Skip to content

Commit

Permalink
feat(gcp-functions): allow keeping optional peerDeps and devDeps
Browse files Browse the repository at this point in the history
  • Loading branch information
tolgap committed Apr 11, 2024
1 parent 4a64d35 commit 58bffe3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/gcp-functions/src/executors/build/build.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { generatePackageJson } from '../../utils/generate-package-json'

export interface RawOptions extends WebpackExecutorOptions {
generateLockFile?: boolean
omitOptionalDependencies?: boolean
}

export async function buildExecutor(
Expand All @@ -34,6 +35,7 @@ export async function buildExecutor(
context,
options,
value.outfile,
rawOptions.omitOptionalDependencies,
rawOptions.generateLockFile
)
}
Expand Down
5 changes: 5 additions & 0 deletions packages/gcp-functions/src/executors/build/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@
"default": false,
"x-deprecated": "The recommended method to detect circular dependencies in project code is to use a either a lint rule or other external tooling."
},
"omitOptionalDependencies": {
"type": "boolean",
"description": "If omitOptionalDependencies flag is set, it will remove devDependencies and optional peerDependencies",
"default": true
},
"maxWorkers": {
"type": "number",
"description": "Number of workers to use for type checking. (defaults to # of CPUS - 2)"
Expand Down
5 changes: 3 additions & 2 deletions packages/gcp-functions/src/utils/generate-package-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export const generatePackageJson = (
context: ExecutorContext,
options: WebpackExecutorOptions,
outFile: string,
generateLockFile?: boolean
omitOptionalDependencies = true,
generateLockFile?: boolean,
) => {
const { root } = context.workspace.projects[context.projectName]

Expand All @@ -27,7 +28,7 @@ export const generatePackageJson = (
readCachedProjectGraph(),
{
root: context.root,
isProduction: true
isProduction: omitOptionalDependencies
}
)

Expand Down

0 comments on commit 58bffe3

Please sign in to comment.