Skip to content

Commit 8678f03

Browse files
committed
Move @typespec/compiler from dependencies to peerDependencies
1 parent b7c7097 commit 8678f03

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

packages/compiler/src/init/scaffold.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,10 @@ async function writePackageJson(host: CompilerHost, config: ScaffoldingConfig) {
105105
return;
106106
}
107107
const dependencies: Record<string, string> = {};
108+
const peerDependencies: Record<string, string> = {};
108109

109110
if (!config.template.skipCompilerPackage) {
110-
dependencies["@typespec/compiler"] = "latest";
111+
peerDependencies["@typespec/compiler"] = "latest";
111112
}
112113

113114
for (const library of config.libraries) {
@@ -119,6 +120,7 @@ async function writePackageJson(host: CompilerHost, config: ScaffoldingConfig) {
119120
version: "0.1.0",
120121
type: "module",
121122
dependencies,
123+
peerDependencies,
122124
private: true,
123125
};
124126

packages/compiler/test/init/init-template.test.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,14 @@ describe("compiler: init: templates", () => {
4545
});
4646

4747
deepStrictEqual(JSON.parse(getOutputFile("package.json")!).dependencies, {
48-
"@typespec/compiler": "latest",
4948
foo: "~1.2.3",
5049
bar: "latest",
5150
});
5251

52+
deepStrictEqual(JSON.parse(getOutputFile("package.json")!).peerDependencies, {
53+
"@typespec/compiler": "latest",
54+
});
55+
5356
strictEqual(getOutputFile("main.tsp")!, 'import "foo";\nimport "bar";\n');
5457
});
5558
});

0 commit comments

Comments
 (0)