From 58bffe31ae559236006ffd8ac6905b707355d9f2 Mon Sep 17 00:00:00 2001 From: Tolga Paksoy Date: Thu, 11 Apr 2024 13:43:29 +0200 Subject: [PATCH] feat(gcp-functions): allow keeping optional peerDeps and devDeps --- packages/gcp-functions/src/executors/build/build.impl.ts | 2 ++ packages/gcp-functions/src/executors/build/schema.json | 5 +++++ packages/gcp-functions/src/utils/generate-package-json.ts | 5 +++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/gcp-functions/src/executors/build/build.impl.ts b/packages/gcp-functions/src/executors/build/build.impl.ts index b7df7511..48d5e15c 100644 --- a/packages/gcp-functions/src/executors/build/build.impl.ts +++ b/packages/gcp-functions/src/executors/build/build.impl.ts @@ -8,6 +8,7 @@ import { generatePackageJson } from '../../utils/generate-package-json' export interface RawOptions extends WebpackExecutorOptions { generateLockFile?: boolean + omitOptionalDependencies?: boolean } export async function buildExecutor( @@ -34,6 +35,7 @@ export async function buildExecutor( context, options, value.outfile, + rawOptions.omitOptionalDependencies, rawOptions.generateLockFile ) } diff --git a/packages/gcp-functions/src/executors/build/schema.json b/packages/gcp-functions/src/executors/build/schema.json index f02ac094..09456693 100644 --- a/packages/gcp-functions/src/executors/build/schema.json +++ b/packages/gcp-functions/src/executors/build/schema.json @@ -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)" diff --git a/packages/gcp-functions/src/utils/generate-package-json.ts b/packages/gcp-functions/src/utils/generate-package-json.ts index bb6ca54f..0b5fc71d 100644 --- a/packages/gcp-functions/src/utils/generate-package-json.ts +++ b/packages/gcp-functions/src/utils/generate-package-json.ts @@ -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] @@ -27,7 +28,7 @@ export const generatePackageJson = ( readCachedProjectGraph(), { root: context.root, - isProduction: true + isProduction: omitOptionalDependencies } )