From 8395c6c4823490f9e68ce6253991ff1d97227be6 Mon Sep 17 00:00:00 2001 From: Katerina Skroumpelou Date: Tue, 24 Oct 2023 15:45:11 +0300 Subject: [PATCH] feat(js): skipPackageJson in js lib generator closed #18069 --- docs/generated/packages/js/generators/library.json | 6 ++++++ packages/js/src/generators/library/library.ts | 5 +++-- packages/js/src/generators/library/schema.json | 6 ++++++ packages/js/src/utils/schema.d.ts | 1 + 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/docs/generated/packages/js/generators/library.json b/docs/generated/packages/js/generators/library.json index b1b59e5e376ac..524e1af8fafdb 100644 --- a/docs/generated/packages/js/generators/library.json +++ b/docs/generated/packages/js/generators/library.json @@ -48,6 +48,12 @@ "default": false, "x-priority": "internal" }, + "skipPackageJson": { + "description": "Do not add dependencies to `package.json`.", + "type": "boolean", + "default": false, + "x-priority": "internal" + }, "skipTsConfig": { "type": "boolean", "description": "Do not update tsconfig.json for development experience.", diff --git a/packages/js/src/generators/library/library.ts b/packages/js/src/generators/library/library.ts index 89dcea84710d6..a2c11ce221fa6 100644 --- a/packages/js/src/generators/library/library.ts +++ b/packages/js/src/generators/library/library.ts @@ -74,7 +74,9 @@ export async function libraryGeneratorInternal( addProject(tree, options); - tasks.push(addProjectDependencies(tree, options)); + if (!options.skipPackageJson) { + tasks.push(addProjectDependencies(tree, options)); + } if (options.publishable) { tasks.push(await setupVerdaccio(tree, { ...options, skipFormat: true })); @@ -706,7 +708,6 @@ function addProjectDependencies( } // Vite is being installed in the next step if bundler is vite - // noop return () => {}; } diff --git a/packages/js/src/generators/library/schema.json b/packages/js/src/generators/library/schema.json index 3122e75d68eb1..205b636d69ce1 100644 --- a/packages/js/src/generators/library/schema.json +++ b/packages/js/src/generators/library/schema.json @@ -48,6 +48,12 @@ "default": false, "x-priority": "internal" }, + "skipPackageJson": { + "description": "Do not add dependencies to `package.json`.", + "type": "boolean", + "default": false, + "x-priority": "internal" + }, "skipTsConfig": { "type": "boolean", "description": "Do not update tsconfig.json for development experience.", diff --git a/packages/js/src/utils/schema.d.ts b/packages/js/src/utils/schema.d.ts index c6ef695061f56..7a5b2d81aef10 100644 --- a/packages/js/src/utils/schema.d.ts +++ b/packages/js/src/utils/schema.d.ts @@ -14,6 +14,7 @@ export interface LibraryGeneratorSchema { skipFormat?: boolean; tags?: string; skipTsConfig?: boolean; + skipPackageJson?: boolean; includeBabelRc?: boolean; unitTestRunner?: 'jest' | 'vitest' | 'none'; linter?: Linter;