Skip to content

Commit

Permalink
Move @typespec/compiler from dependencies to peerDependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
sarangan12 committed Jul 11, 2024
1 parent b7c7097 commit 8678f03
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/compiler/src/init/scaffold.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,10 @@ async function writePackageJson(host: CompilerHost, config: ScaffoldingConfig) {
return;
}
const dependencies: Record<string, string> = {};
const peerDependencies: Record<string, string> = {};

if (!config.template.skipCompilerPackage) {
dependencies["@typespec/compiler"] = "latest";
peerDependencies["@typespec/compiler"] = "latest";
}

for (const library of config.libraries) {
Expand All @@ -119,6 +120,7 @@ async function writePackageJson(host: CompilerHost, config: ScaffoldingConfig) {
version: "0.1.0",
type: "module",
dependencies,
peerDependencies,
private: true,
};

Expand Down
5 changes: 4 additions & 1 deletion packages/compiler/test/init/init-template.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,14 @@ describe("compiler: init: templates", () => {
});

deepStrictEqual(JSON.parse(getOutputFile("package.json")!).dependencies, {
"@typespec/compiler": "latest",
foo: "~1.2.3",
bar: "latest",
});

deepStrictEqual(JSON.parse(getOutputFile("package.json")!).peerDependencies, {
"@typespec/compiler": "latest",
});

strictEqual(getOutputFile("main.tsp")!, 'import "foo";\nimport "bar";\n');
});
});
Expand Down

0 comments on commit 8678f03

Please sign in to comment.