Skip to content

Commit

Permalink
feat: add json schema for lerna.json (#3229)
Browse files Browse the repository at this point in the history
  • Loading branch information
fahslaj committed Jul 7, 2022
1 parent 0e976bf commit 5075eae
Show file tree
Hide file tree
Showing 7 changed files with 1,848 additions and 1 deletion.
5 changes: 5 additions & 0 deletions commands/init/__tests__/init-command.test.js
Expand Up @@ -66,6 +66,7 @@ describe("InitCommand", () => {
await lernaInit(testDir)("--exact");

expect(await fs.readJSON(path.join(testDir, "lerna.json"))).toMatchObject({
$schema: "node_modules/lerna/schemas/lerna-schema.json",
command: {
init: {
exact: true,
Expand All @@ -91,6 +92,7 @@ describe("InitCommand", () => {
]);

expect(lernaJson).toMatchObject({
$schema: "node_modules/lerna/schemas/lerna-schema.json",
packages: ["packages/*"],
version: "0.0.0",
});
Expand Down Expand Up @@ -190,6 +192,7 @@ describe("InitCommand", () => {
await lernaInit(testDir)();

expect(await fs.readJSON(lernaJsonPath)).toEqual({
$schema: "node_modules/lerna/schemas/lerna-schema.json",
packages: ["packages/*"],
useNx: false,
version: "1.2.3",
Expand Down Expand Up @@ -223,6 +226,7 @@ describe("InitCommand", () => {
hoist: true,
},
},
$schema: "node_modules/lerna/schemas/lerna-schema.json",
version: "1.2.3",
});
await fs.outputJSON(pkgJsonPath, {
Expand All @@ -242,6 +246,7 @@ describe("InitCommand", () => {
exact: true,
},
},
$schema: "node_modules/lerna/schemas/lerna-schema.json",
packages: ["packages/*"],
useNx: false,
version: "1.2.3",
Expand Down
1 change: 1 addition & 0 deletions commands/init/index.js
Expand Up @@ -128,6 +128,7 @@ class InitCommand extends Command {
}

Object.assign(config, {
$schema: "node_modules/lerna/schemas/lerna-schema.json",
packages: this.project.packageConfigs,
useNx: false,
version,
Expand Down
3 changes: 2 additions & 1 deletion core/lerna/package.json
Expand Up @@ -18,7 +18,8 @@
},
"files": [
"index.js",
"cli.js"
"cli.js",
"schemas/lerna-schema.json"
],
"engines": {
"node": "^14.15.0 || >=16.0.0"
Expand Down

0 comments on commit 5075eae

Please sign in to comment.