@guardian/cdk 50.12.2 → 50.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bin/index.js +11 -3
- package/lib/bin/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
package/lib/bin/index.js
CHANGED
|
@@ -71,11 +71,19 @@ parseCommandLineArguments()
|
|
|
71
71
|
return (0, aws_cdk_version_1.awsCdkVersionCommand)();
|
|
72
72
|
}
|
|
73
73
|
case Commands.AccountReadiness: {
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
// TODO remove casting as yargs should be able to infer the type of the options
|
|
75
|
+
const profile = argv.profile;
|
|
76
|
+
const region = argv.region;
|
|
77
|
+
return (0, account_readiness_1.accountReadinessCommand)({ credentialProvider: (0, aws_credential_provider_1.awsCredentialProviderChain)(profile), region: region });
|
|
76
78
|
}
|
|
77
79
|
case Commands.New: {
|
|
78
|
-
|
|
80
|
+
// TODO remove casting as yargs should be able to infer the type of the options
|
|
81
|
+
const init = argv.init;
|
|
82
|
+
const app = argv.app;
|
|
83
|
+
const stack = argv.stack;
|
|
84
|
+
const yamlTemplateLocation = argv["yaml-template-location"];
|
|
85
|
+
const stage = argv.stage;
|
|
86
|
+
const packageManager = argv["package-manager"];
|
|
79
87
|
const stages = stage.map((_) => _.toUpperCase());
|
|
80
88
|
return (0, new_project_1.newCdkProject)({
|
|
81
89
|
init,
|
package/lib/bin/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bin/index.ts"],"names":[],"mappings":";;;;;;AAEA,kDAA0B;AAC1B,4CAA2C;AAE3C,uEAAuE;AACvE,oEAAuE;AACvE,gEAAkE;AAElE,wDAAuD;AAEvD,MAAM,QAAQ,GAAG;IACf,aAAa,EAAE,iBAAiB;IAChC,gBAAgB,EAAE,mBAAmB;IACrC,GAAG,EAAE,KAAK;CACX,C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CAAC,CAAC;KACxD;AACH,CAAC,CAAC;KACD,IAAI,CAAC,CAAC,eAAe,EAAE,EAAE;IACxB,IAAI,OAAO,eAAe,KAAK,QAAQ,EAAE;QACvC,OAAO,CAAC,QAAQ,GAAG,eAAe,CAAC;KACpC;SAAM,IAAI,OAAO,eAAe,KAAK,QAAQ,EAAE;QAC9C,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;KAC9B;SAAM;QACL,MAAM,uBAAuB,GAAG,EAAE,eAAe,EAAE,EAAE,OAAO,EAAE,uBAAW,CAAC,OAAO,EAAE,EAAE,GAAG,eAAe,EAAE,CAAC;QAC1G,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC,CAAC;KACtD;AACH,CAAC,CAAC;KACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACb,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\n\nimport yargs from \"yargs\";\nimport { LibraryInfo } from \"../constants\";\nimport type { CliCommandResponse } from \"../types/cli\";\nimport { awsCredentialProviderChain } from \"./aws-credential-provider\";\nimport { accountReadinessCommand } from \"./commands/account-readiness\";\nimport { awsCdkVersionCommand } from \"./commands/aws-cdk-version\";\nimport type { PackageManager } from \"./commands/new-project\";\nimport { newCdkProject } from \"./commands/new-project\";\n\nconst Commands = {\n AwsCdkVersion: \"aws-cdk-version\",\n AccountReadiness: \"account-readiness\",\n New: \"new\",\n};\n\nconst parseCommandLineArguments = () => {\n /*\n The type of `yargs.argv` is `T | Promise<T>`.\n To avoid creating custom type guards, use `Promise.resolve` which takes `T | PromiseLike<T>` and returns `Promise<T>`.\n That is, use `Promise.resolve` to provide a single type.\n See https://github.com/DefinitelyTyped/DefinitelyTyped/blob/7b2f0d45985538a40df96244481bfc6cd309c250/types/yargs/index.d.ts#L74\n */\n return Promise.resolve(\n yargs\n .usage(\"$0 COMMAND [args]\")\n .command(Commands.AwsCdkVersion, \"Print the version of AWS CDK libraries being used\")\n .command(Commands.AccountReadiness, \"Perform checks on an AWS account to see if it is GuCDK ready\", (yargs) =>\n yargs\n .option(\"profile\", { type: \"string\", description: \"AWS profile\" })\n .option(\"region\", { type: \"string\", description: \"AWS region\", default: \"eu-west-1\" }),\n )\n .command(\n Commands.New,\n \"Creates a new CDK project within a `cdk` directory at the root of the repository\",\n (yargs) =>\n yargs\n .option(\"init\", {\n type: \"boolean\",\n description: \"Create the cdk directory before building the app and stack files (defaults to true)\",\n default: true,\n })\n .option(\"app\", {\n type: \"string\",\n description: \"The name of your application e.g. Amigo\",\n demandOption: true,\n })\n .option(\"stack\", {\n type: \"string\",\n description:\n \"The Guardian stack being used (as defined in your riff-raff.yaml). This will be applied as a tag to all of your resources.\",\n demandOption: true,\n })\n .option(\"yaml-template-location\", {\n type: \"string\",\n description: \"Path to the YAML CloudFormation template\",\n })\n .option(\"stage\", {\n description:\n \"The stage(s) for your stack. Can be specified multiple times, e.g. --stage CODE --stage PROD\",\n type: \"array\",\n demandOption: true,\n })\n .option(\"package-manager\", {\n description:\n \"The Node package manager to use. Match this to the repository (package-lock.json = npm, yarn.lock = yarn). If the repository has neither file, and there is no strong convention in your team, we recommend npm.\",\n choices: [\"npm\", \"yarn\"],\n demandOption: true,\n }),\n )\n .version(\n `${LibraryInfo.VERSION} (using aws-cdk-lib ${LibraryInfo.AWS_CDK_VERSION}, constructs ${LibraryInfo.CONSTRUCTS_VERSION})`,\n )\n .demandCommand(1, \"\") // just print help\n .help()\n .alias(\"h\", \"help\").argv,\n );\n};\n\nparseCommandLineArguments()\n .then((argv): CliCommandResponse => {\n const command = argv._[0];\n switch (command) {\n case Commands.AwsCdkVersion: {\n return awsCdkVersionCommand();\n }\n case Commands.AccountReadiness: {\n // TODO remove casting as yargs should be able to infer the type of the options\n const profile = argv.profile as string;\n const region = argv.region as string;\n return accountReadinessCommand({ credentialProvider: awsCredentialProviderChain(profile), region: region });\n }\n case Commands.New: {\n // TODO remove casting as yargs should be able to infer the type of the options\n const init = argv.init as boolean;\n const app = argv.app as string;\n const stack = argv.stack as string;\n const yamlTemplateLocation = argv[\"yaml-template-location\"] as string | undefined;\n const stage = argv.stage as string[];\n const packageManager = argv[\"package-manager\"] as string;\n\n const stages = stage.map((_) => _.toUpperCase());\n return newCdkProject({\n init,\n app,\n stack,\n yamlTemplateLocation,\n stages,\n packageManager: packageManager as PackageManager,\n });\n }\n default:\n throw new Error(`Unknown command: ${command ?? \"\"}`);\n }\n })\n .then((commandResponse) => {\n if (typeof commandResponse === \"number\") {\n process.exitCode = commandResponse;\n } else if (typeof commandResponse === \"string\") {\n console.log(commandResponse);\n } else {\n const responseWithVersionInfo = { \"@guardian/cdk\": { version: LibraryInfo.VERSION }, ...commandResponse };\n console.log(JSON.stringify(responseWithVersionInfo));\n }\n })\n .catch((err) => {\n console.error(err);\n process.exitCode = 1;\n });\n"]}
|