From b1a264b7489fbae4f7bdaee02b2b106b523050ba Mon Sep 17 00:00:00 2001 From: Momo Kornher Date: Mon, 23 Dec 2024 14:25:58 +0100 Subject: [PATCH] chore(cdk-build-tools): allow packing of private packages for local testing --- tools/@aws-cdk/cdk-build-tools/bin/cdk-package.ts | 6 ++++-- tools/@aws-cdk/cdk-build-tools/lib/package-info.ts | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/@aws-cdk/cdk-build-tools/bin/cdk-package.ts b/tools/@aws-cdk/cdk-build-tools/bin/cdk-package.ts index bc48546f91787..66ae1264f4265 100644 --- a/tools/@aws-cdk/cdk-build-tools/bin/cdk-package.ts +++ b/tools/@aws-cdk/cdk-build-tools/bin/cdk-package.ts @@ -24,6 +24,7 @@ async function main() { }) .option('pre-only', { type: 'boolean', default: false, desc: 'run pre package steps only' }) .option('post-only', { type: 'boolean', default: false, desc: 'run post package steps only' }) + .option('private', { type: 'boolean', default: false, desc: 'Also package private packages for local usage' }) .argv; if (args['pre-only'] && args['post-only']) { @@ -43,8 +44,9 @@ async function main() { const outdir = 'dist'; // if this is a private module, don't package - if (isPrivate()) { - process.stdout.write('No packaging for private modules.\n'); + const packPrivate = args.private || options.private; + if (isPrivate() && !packPrivate) { + process.stdout.write('No packaging for private modules.\nUse --private to force packing private packages for local testing.\n'); return; } diff --git a/tools/@aws-cdk/cdk-build-tools/lib/package-info.ts b/tools/@aws-cdk/cdk-build-tools/lib/package-info.ts index 9657930be27d7..6687cfb497f67 100644 --- a/tools/@aws-cdk/cdk-build-tools/lib/package-info.ts +++ b/tools/@aws-cdk/cdk-build-tools/lib/package-info.ts @@ -205,6 +205,12 @@ export interface CDKPackageOptions { * Should this package be bundled. (and if so, how) */ bundle?: Omit; + + /** + * Also package private packages for local usage. + * @default false + */ + private?: boolean; } /**