Skip to content

Commit

Permalink
feat(js): skipPackageJson in js lib generator (nrwl#19821)
Browse files Browse the repository at this point in the history
  • Loading branch information
mandarini authored Oct 26, 2023
1 parent 2ea9f18 commit 7942ea3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
6 changes: 6 additions & 0 deletions docs/generated/packages/js/generators/library.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
5 changes: 3 additions & 2 deletions packages/js/src/generators/library/library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }));
Expand Down Expand Up @@ -708,7 +710,6 @@ function addProjectDependencies(
}

// Vite is being installed in the next step if bundler is vite

// noop
return () => {};
}
Expand Down
6 changes: 6 additions & 0 deletions packages/js/src/generators/library/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
1 change: 1 addition & 0 deletions packages/js/src/utils/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface LibraryGeneratorSchema {
skipFormat?: boolean;
tags?: string;
skipTsConfig?: boolean;
skipPackageJson?: boolean;
includeBabelRc?: boolean;
unitTestRunner?: 'jest' | 'vitest' | 'none';
linter?: Linter;
Expand Down

0 comments on commit 7942ea3

Please sign in to comment.