@datadog/datadog-ci-base 4.3.0 → 5.0.0

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.
Files changed (41) hide show
  1. package/dist/cli.d.ts +1 -0
  2. package/dist/cli.js +21 -19
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/dsyms/cli.d.ts +2 -0
  5. package/dist/commands/dsyms/cli.js +10 -0
  6. package/dist/commands/dsyms/cli.js.map +1 -0
  7. package/dist/commands/dsyms/interfaces.d.ts +17 -0
  8. package/dist/commands/dsyms/interfaces.js +34 -0
  9. package/dist/commands/dsyms/interfaces.js.map +1 -0
  10. package/dist/commands/dsyms/renderer.d.ts +11 -0
  11. package/dist/commands/dsyms/renderer.js +93 -0
  12. package/dist/commands/dsyms/renderer.js.map +1 -0
  13. package/dist/commands/dsyms/upload.d.ts +51 -0
  14. package/dist/commands/dsyms/upload.js +338 -0
  15. package/dist/commands/dsyms/upload.js.map +1 -0
  16. package/dist/commands/dsyms/utils.d.ts +15 -0
  17. package/dist/commands/dsyms/utils.js +74 -0
  18. package/dist/commands/dsyms/utils.js.map +1 -0
  19. package/dist/commands/lambda/flare.js +24 -8
  20. package/dist/commands/lambda/flare.js.map +1 -1
  21. package/dist/commands/lambda/instrument.js +83 -26
  22. package/dist/commands/lambda/instrument.js.map +1 -1
  23. package/dist/commands/lambda/uninstrument.js +24 -8
  24. package/dist/commands/lambda/uninstrument.js.map +1 -1
  25. package/dist/commands/plugin/check.js +8 -0
  26. package/dist/commands/plugin/check.js.map +1 -1
  27. package/dist/commands/plugin/install.js +9 -1
  28. package/dist/commands/plugin/install.js.map +1 -1
  29. package/dist/commands/plugin/list.d.ts +1 -0
  30. package/dist/commands/plugin/list.js +20 -13
  31. package/dist/commands/plugin/list.js.map +1 -1
  32. package/dist/helpers/plugin.d.ts +24 -0
  33. package/dist/helpers/plugin.js +193 -58
  34. package/dist/helpers/plugin.js.map +1 -1
  35. package/dist/helpers/serverless/lambda-layer-versions.d.ts +8 -0
  36. package/dist/helpers/serverless/lambda-layer-versions.js +13 -0
  37. package/dist/helpers/serverless/lambda-layer-versions.js.map +1 -0
  38. package/package.json +14 -16
  39. package/dist/commands/git-metadata/index.d.ts +0 -1
  40. package/dist/commands/git-metadata/index.js +0 -18
  41. package/dist/commands/git-metadata/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"instrument.js","sourceRoot":"","sources":["../../../src/commands/lambda/instrument.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAyC;AAEzC,iDAAyD;AAEzD,6BAAiC;AAEjC,MAAa,uBAAwB,SAAQ,eAAW;IAAxD;;QAQY,qBAAgB,GAAG,kBAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAA;QACxD,kBAAa,GAAG,kBAAM,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;QACjD,yBAAoB,GAAG,kBAAM,CAAC,MAAM,CAAC,iDAAiD,CAAC,CAAA;QACvF,eAAU,GAAG,kBAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;QACtC,WAAM,GAAG,kBAAM,CAAC,OAAO,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAA;QACpD,gBAAW,GAAG,kBAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QACpC,qBAAgB,GAAG,kBAAM,CAAC,MAAM,CAAC,2CAA2C,CAAC,CAAA;QAC7E,cAAS,GAAG,kBAAM,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAA;QACrD,uBAAkB,GAAG,kBAAM,CAAC,MAAM,CAAC,8CAA8C,CAAC,CAAA;QAClF,cAAS,GAAG,kBAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA;QACxC,cAAS,GAAG,kBAAM,CAAC,KAAK,CAAC,eAAe,EAAE,EAAE,CAAC,CAAA;QAC7C,gBAAW,GAAG,kBAAM,CAAC,OAAO,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAA;QAC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AAE,KAAK,CAAC,CAAA;QAC9D,eAAU,GAAG,kBAAM,CAAC,OAAO,CAAC,eAAe,EAAE,KAAK,EAAE;YAC5D,WAAW,EAAE,4JAA4J;SAC1K,CAAC,CAAA;IAKJ,CAAC;IAHc,OAAO;;YAClB,OAAO,IAAA,6BAAoB,EAAC,IAAI,CAAC,CAAA;QACnC,CAAC;KAAA;;AA7FH,0DA8FC;AA7Fe,6BAAK,GAAG,CAAC,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,AAA7B,CAA6B;AAElC,6BAAK,GAAG,mBAAO,CAAC,KAAK,CAAC;IAClC,QAAQ,EAAE,YAAY;IACtB,WAAW,EAAE,4CAA4C;CAC1D,CAAC,AAHiB,CAGjB"}
@@ -16,14 +16,30 @@ const __1 = require("../..");
16
16
  class LambdaUninstrumentCommand extends __1.BaseCommand {
17
17
  constructor() {
18
18
  super(...arguments);
19
- this.configPath = clipanion_1.Option.String('--config');
20
- this.dryRun = clipanion_1.Option.Boolean('-d,--dry,--dry-run', false);
21
- this.forwarder = clipanion_1.Option.String('--forwarder');
22
- this.functions = clipanion_1.Option.Array('-f,--function', []);
23
- this.interactive = clipanion_1.Option.Boolean('-i,--interactive', false);
24
- this.profile = clipanion_1.Option.String('--profile');
25
- this.regExPattern = clipanion_1.Option.String('--functions-regex,--functionsRegex');
26
- this.region = clipanion_1.Option.String('-r,--region');
19
+ this.configPath = clipanion_1.Option.String('--config', {
20
+ description: 'Path to the configuration file',
21
+ });
22
+ this.dryRun = clipanion_1.Option.Boolean('-d,--dry,--dry-run', false, {
23
+ description: 'Preview changes running command would apply',
24
+ });
25
+ this.forwarder = clipanion_1.Option.String('--forwarder', {
26
+ description: `The ARN of the datadog forwarder (https://docs.datadoghq.com/logs/guide/forwarder/) to remove from this function`,
27
+ });
28
+ this.functions = clipanion_1.Option.Array('-f,--function', [], {
29
+ description: `The ARN of the Lambda function to be uninstrumented, or the name of the Lambda function (--region must be defined)`,
30
+ });
31
+ this.interactive = clipanion_1.Option.Boolean('-i,--interactive', false, {
32
+ description: `Allows the user to interactively choose how their function gets uninstrumented. There is no need to provide any other flags if you choose to use interactive mode since you will be prompted for the information instead`,
33
+ });
34
+ this.profile = clipanion_1.Option.String('--profile', {
35
+ description: `Specify the AWS named profile credentials to use to uninstrument. Learn more about AWS named profiles here: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html#using-profiles`,
36
+ });
37
+ this.regExPattern = clipanion_1.Option.String('--functions-regex,--functionsRegex', {
38
+ description: 'A regex pattern to match with the Lambda function name to be uninstrumented',
39
+ });
40
+ this.region = clipanion_1.Option.String('-r,--region', {
41
+ description: 'Default region to use, when --function is specified by the function name instead of the ARN',
42
+ });
27
43
  /**
28
44
  * Arguments that are not really in use, but to
29
45
  * make uninstrumentation easier for the user.
@@ -1 +1 @@
1
- {"version":3,"file":"uninstrument.js","sourceRoot":"","sources":["../../../src/commands/lambda/uninstrument.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAyC;AAEzC,iDAAyD;AAEzD,6BAAiC;AAEjC,MAAa,yBAA0B,SAAQ,eAAW;IAA1D;;QAQY,eAAU,GAAG,kBAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;QACtC,WAAM,GAAG,kBAAM,CAAC,OAAO,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAA;QACpD,cAAS,GAAG,kBAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA;QACxC,cAAS,GAAG,kBAAM,CAAC,KAAK,CAAC,eAAe,EAAE,EAAE,CAAC,CAAA;QAC7C,gBAAW,GAAG,kBAAM,CAAC,OAAO,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAA;QACvD,YAAO,GAAG,kBAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;QACpC,iBAAY,GAAG,kBAAM,CAAC,MAAM,CAAC,oCAAoC,CAAC,CAAA;QAClE,WAAM,GAAG,kBAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA;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AAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAA;QACrE,qBAAgB,GAAG,kBAAM,CAAC,MAAM,CAAC,2CAA2C,EAAE,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAA;QAC7F,oBAAe,GAAG,kBAAM,CAAC,MAAM,CAAC,uCAAuC,EAAE,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAA;QACxF,uBAAkB,GAAG,kBAAM,CAAC,MAAM,CAAC,8CAA8C,EAAE,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAA;QAClG,yBAAoB,GAAG,kBAAM,CAAC,MAAM,CAAC,iDAAiD,EAAE,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAA;QAEvG,SAAI,GAAG,kBAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;QACtC,oBAAe,GAAG,kBAAM,CAAC,OAAO,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAA;IAK1E,CAAC;IAHc,OAAO;;YAClB,OAAO,IAAA,6BAAoB,EAAC,IAAI,CAAC,CAAA;QACnC,CAAC;KAAA;;AAxDH,8DAyDC;AAxDe,+BAAK,GAAG,CAAC,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,AAA/B,CAA+B;AAEpC,+BAAK,GAAG,mBAAO,CAAC,KAAK,CAAC;IAClC,QAAQ,EAAE,YAAY;IACtB,WAAW,EAAE,6CAA6C;CAC3D,CAAC,AAHiB,CAGjB"}
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.PluginCheckCommand = void 0;
13
13
  const clipanion_1 = require("clipanion");
14
+ const message_box_1 = require("../../helpers/message-box");
14
15
  const plugin_1 = require("../../helpers/plugin");
15
16
  const __1 = require("../..");
16
17
  class PluginCheckCommand extends __1.BaseCommand {
@@ -22,6 +23,13 @@ class PluginCheckCommand extends __1.BaseCommand {
22
23
  }
23
24
  execute() {
24
25
  return __awaiter(this, void 0, void 0, function* () {
26
+ const packageName = (0, plugin_1.scopeToPackageName)(this.packageOrScope);
27
+ if (this.context.builtinPlugins.includes(packageName)) {
28
+ console.log();
29
+ (0, message_box_1.messageBox)('Built-in plugin 🔌', 'green', [`The plugin ${packageName} is built-in!`]);
30
+ console.log();
31
+ return 0;
32
+ }
25
33
  const succeeded = yield (0, plugin_1.checkPlugin)(this.packageOrScope, this.command);
26
34
  return succeeded ? 0 : 1;
27
35
  });
@@ -1 +1 @@
1
- {"version":3,"file":"check.js","sourceRoot":"","sources":["../../../src/commands/plugin/check.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAyC;AAEzC,iDAAgD;AAEhD,6BAAiC;AAEjC,MAAa,kBAAmB,SAAQ,eAAW;IAAnD;;QAaE,aAAa;QACN,mBAAc,GAAG,kBAAM,CAAC,MAAM,EAAE,CAAA;QAChC,YAAO,GAAG,kBAAM,CAAC,MAAM,CAAC,EAAC,QAAQ,EAAE,KAAK,EAAC,CAAC,CAAA;IAOnD,CAAC;IALc,OAAO;;YAClB,MAAM,SAAS,GAAG,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;YAEtE,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QAC1B,CAAC;KAAA;;AArBH,gDAsBC;AArBe,wBAAK,GAAG,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,AAAxB,CAAwB;AAE7B,wBAAK,GAAG,mBAAO,CAAC,KAAK,CAAC;IAClC,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,sDAAsD;IACnE,QAAQ,EAAE;QACR,CAAC,8CAA8C,EAAE,+DAA+D,CAAC;QACjH,CAAC,uCAAuC,EAAE,oCAAoC,CAAC;QAC/E,CAAC,+DAA+D,EAAE,8CAA8C,CAAC;KAClH;CACF,CAAC,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C,+DAA+D,EAAE,8CAA8C,CAAC;KAClH;CACF,CAAC,AARiB,CAQjB"}
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.PluginInstallCommand = void 0;
13
13
  const clipanion_1 = require("clipanion");
14
+ const message_box_1 = require("../../helpers/message-box");
14
15
  const plugin_1 = require("../../helpers/plugin");
15
16
  const __1 = require("../..");
16
17
  class PluginInstallCommand extends __1.BaseCommand {
@@ -21,7 +22,14 @@ class PluginInstallCommand extends __1.BaseCommand {
21
22
  }
22
23
  execute() {
23
24
  return __awaiter(this, void 0, void 0, function* () {
24
- const succeeded = yield (0, plugin_1.installPlugin)(this.packageOrScope);
25
+ const packageName = (0, plugin_1.scopeToPackageName)(this.packageOrScope);
26
+ if (this.context.builtinPlugins.includes(packageName)) {
27
+ console.log();
28
+ (0, message_box_1.messageBox)('Built-in plugin 🔌', 'green', [`The plugin ${packageName} is already built-in!`]);
29
+ console.log();
30
+ return 0;
31
+ }
32
+ const succeeded = yield (0, plugin_1.installPlugin)(packageName);
25
33
  return succeeded ? 0 : 1;
26
34
  });
27
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"install.js","sourceRoot":"","sources":["../../../src/commands/plugin/install.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAyC;AAEzC,iDAAkD;AAElD,6BAAiC;AAEjC,MAAa,oBAAqB,SAAQ,eAAW;IAArD;;QAeE,aAAa;QACN,mBAAc,GAAG,kBAAM,CAAC,MAAM,EAAE,CAAA;IAOzC,CAAC;IALc,OAAO;;YAClB,MAAM,SAAS,GAAG,MAAM,IAAA,sBAAa,EAAC,IAAI,CAAC,cAAc,CAAC,CAAA;YAE1D,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QAC1B,CAAC;KAAA;;AAtBH,oDAuBC;AAtBe,0BAAK,GAAG,CAAC,CA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AS;IACnB,WAAW,EAAE,8BAA8B;IAC3C,QAAQ,EAAE;QACR;YACE,gDAAgD;YAChD,iEAAiE;SAClE;QACD,CAAC,yCAAyC,EAAE,sCAAsC,CAAC;KACpF;CACF,CAAC,AAViB,CAUjB"}
@@ -3,6 +3,7 @@ export declare class PluginListCommand extends BaseCommand {
3
3
  static paths: string[][];
4
4
  static usage: import("clipanion").Usage;
5
5
  json: boolean | undefined;
6
+ all: boolean | undefined;
6
7
  private logger;
7
8
  execute(): Promise<number>;
8
9
  }
@@ -23,6 +23,7 @@ class PluginListCommand extends __1.BaseCommand {
23
23
  super(...arguments);
24
24
  // Positional
25
25
  this.json = clipanion_1.Option.Boolean('--json', { required: false });
26
+ this.all = clipanion_1.Option.Boolean('-a,--all', { required: false });
26
27
  this.logger = new logger_1.Logger((s) => {
27
28
  this.context.stdout.write(s);
28
29
  }, logger_1.LogLevel.INFO);
@@ -31,21 +32,26 @@ class PluginListCommand extends __1.BaseCommand {
31
32
  return __awaiter(this, void 0, void 0, function* () {
32
33
  const allPlugins = (0, plugin_1.listAllPlugins)();
33
34
  const builtinPlugins = new Set(this.context.builtinPlugins);
34
- const installablePlugins = allPlugins.filter((plugin) => !builtinPlugins.has(plugin));
35
+ const installablePlugins = allPlugins.filter((name) => !builtinPlugins.has(name));
36
+ const plugins = this.all
37
+ ? [
38
+ ...installablePlugins.map((name) => ({ name, isBuiltin: false })),
39
+ ...Array.from(builtinPlugins).map((name) => ({ name, isBuiltin: true })),
40
+ ]
41
+ : installablePlugins.map((name) => ({ name, isBuiltin: false }));
35
42
  if (this.json) {
36
- this.logger.info(JSON.stringify(installablePlugins.map((plugin) => ({
37
- name: plugin,
38
- scope: getScope(plugin),
43
+ this.logger.info(JSON.stringify(plugins.map(({ name, isBuiltin }) => ({
44
+ name,
45
+ scope: getScope(name),
46
+ isBuiltin,
39
47
  }))));
40
48
  return 0;
41
49
  }
42
- if (installablePlugins.length === 0) {
43
- this.logger.info('All plugins are currently built-in. We will start splitting them in next major release.');
44
- return 0;
45
- }
46
50
  this.logger.info(`The following plugins are available:\n`);
47
- this.logger.info(installablePlugins
48
- .map((plugin) => ` - ${chalk_1.default.bold.magenta(plugin)} (install with ${chalk_1.default.bold.cyan(`datadog-ci plugin install ${getScope(plugin)}`)})`)
51
+ this.logger.info(plugins
52
+ .map(({ name, isBuiltin }) => isBuiltin
53
+ ? ` - ${chalk_1.default.bold('(built-in)')} ${chalk_1.default.magenta(name)}`
54
+ : ` - ${chalk_1.default.bold.magenta(name)} (install with ${chalk_1.default.bold.cyan(`datadog-ci plugin install ${getScope(name)}`)})`)
49
55
  .join('\n'));
50
56
  return 0;
51
57
  });
@@ -58,10 +64,11 @@ PluginListCommand.usage = clipanion_1.Command.Usage({
58
64
  description: 'List the available plugins.',
59
65
  details: `
60
66
  This command lists the plugins that can be installed with the \`datadog-ci plugin install\` command.
61
-
62
- All other plugins are **built-in** and are not listed here.
63
67
  `,
64
- examples: [['List the available plugins', 'datadog-ci plugin list']],
68
+ examples: [
69
+ ['List the available plugins', 'datadog-ci plugin list'],
70
+ ['List all plugins, including built-in plugins', 'datadog-ci plugin list --all'],
71
+ ],
65
72
  });
66
73
  const getScope = (plugin) => plugin.replace('@datadog/datadog-ci-plugin-', '');
67
74
  //# sourceMappingURL=list.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/plugin/list.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAAyB;AACzB,yCAAyC;AAEzC,iDAAqD;AACrD,iDAAmD;AAEnD,6BAAiC;AAEjC,MAAa,iBAAkB,SAAQ,eAAW;IAAlD;;QAcE,aAAa;QACN,SAAI,GAAG,kBAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAC,QAAQ,EAAE,KAAK,EAAC,CAAC,CAAA;QAEjD,WAAM,GAAW,IAAI,eAAM,CAAC,CAAC,CAAS,EAAE,EAAE;YAChD,IAAI,CAAC,OAAO,CAAC,MAAM,CAA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AAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,eAAK,CAAC,IAAI,CAAC,IAAI,CAAC,6BAA6B,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CACtH;iBACA,IAAI,CAAC,IAAI,CAAC,CACd,CAAA;YAED,OAAO,CAAC,CAAA;QACV,CAAC;KAAA;;AA7DH,8CA8DC;AA7De,uBAAK,GAAG,CAAC,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,AAAvB,CAAuB;AAE5B,uBAAK,GAAG,mBAAO,CAAC,KAAK,CAAC;IAClC,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,6BAA6B;IAC1C,OAAO,EAAE;;KAER;IACD,QAAQ,EAAE;QACR,CAAC,4BAA4B,EAAE,wBAAwB,CAAC;QACxD,CAAC,8CAA8C,EAAE,8BAA8B,CAAC;KACjF;CACF,CAAC,AAViB,CAUjB;AAmDJ,MAAM,QAAQ,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,6BAA6B,EAAE,EAAE,CAAC,CAAA"}
@@ -10,4 +10,28 @@ export type PluginSubModule = {
10
10
  export declare const executePluginCommand: <T extends Command<import("clipanion").BaseContext>>(instance: T) => Promise<number | void>;
11
11
  export declare const listAllPlugins: () => string[];
12
12
  export declare const checkPlugin: (scope: string, command?: string) => Promise<boolean>;
13
+ /**
14
+ * Installs a plugin and the base package as `devDependencies` in the current project with the right package manager.
15
+ */
13
16
  export declare const installPlugin: (packageOrScope: string) => Promise<boolean>;
17
+ interface InstallPackageOptions {
18
+ silent: boolean;
19
+ dev: boolean;
20
+ }
21
+ interface InstallPackageOutput {
22
+ exitCode: number;
23
+ stdout: string;
24
+ stderr: string;
25
+ }
26
+ type InstallPackageFn = (names: string[], options: InstallPackageOptions) => Promise<InstallPackageOutput>;
27
+ export declare const importInstallPkg: () => Promise<{
28
+ installPackage: InstallPackageFn;
29
+ }>;
30
+ export declare const scopeToPackageName: (scope: string) => string;
31
+ /**
32
+ * Find where NPX just installed the package.
33
+ *
34
+ * https://github.com/geelen/npx-import/blob/8a1e17ca4f88981b11be5090e20871f8704166b8/src/index.ts#L221-L250
35
+ */
36
+ export declare const getTempPath: (stdout: string, isWindows: boolean) => string;
37
+ export {};
@@ -12,11 +12,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.installPlugin = exports.checkPlugin = exports.listAllPlugins = exports.executePluginCommand = void 0;
15
+ exports.getTempPath = exports.scopeToPackageName = exports.importInstallPkg = exports.installPlugin = exports.checkPlugin = exports.listAllPlugins = exports.executePluginCommand = void 0;
16
+ const node_child_process_1 = require("node:child_process");
17
+ const node_path_1 = __importDefault(require("node:path"));
16
18
  const node_util_1 = require("node:util");
17
19
  const chalk_1 = __importDefault(require("chalk"));
18
20
  const debug_1 = __importDefault(require("debug"));
19
21
  const package_json_1 = require("@datadog/datadog-ci-base/package.json");
22
+ const version_1 = require("../version");
20
23
  const is_standalone_binary_1 = require("./is-standalone-binary");
21
24
  const message_box_1 = require("./message-box");
22
25
  // Use `DEBUG=plugins` to enable debug logs
@@ -31,7 +34,16 @@ const executePluginCommand = (instance) => __awaiter(void 0, void 0, void 0, fun
31
34
  return pluginCommand.execute();
32
35
  }
33
36
  catch (error) {
34
- handleErrorGeneric(error, scope, command);
37
+ debug('Error in executePluginCommand:', error);
38
+ if (isModuleNotFoundError(error)) {
39
+ console.log();
40
+ showPluginNotInstalledMessageBox(scope, command);
41
+ showInstallPluginInstructions(scope);
42
+ console.log();
43
+ }
44
+ else {
45
+ console.log(chalk_1.default.bold.red('Unexpected error when executing the plugin command:\n'), error);
46
+ }
35
47
  console.log([
36
48
  `To troubleshoot, run:`,
37
49
  ` ${chalk_1.default.bold.cyan(`datadog-ci plugin check`)} ${chalk_1.default.magenta(scope)}`,
@@ -49,7 +61,7 @@ const listAllPlugins = () => {
49
61
  };
50
62
  exports.listAllPlugins = listAllPlugins;
51
63
  const checkPlugin = (scope, command) => __awaiter(void 0, void 0, void 0, function* () {
52
- if (!(scopeToPackageName(scope) in package_json_1.peerDependencies)) {
64
+ if (!isValidScope(scope)) {
53
65
  console.log([
54
66
  '',
55
67
  chalk_1.default.bold.red("This plugin is not listed as a possible peer dependency. Make sure you didn't make a typo."),
@@ -78,24 +90,46 @@ const checkPlugin = (scope, command) => __awaiter(void 0, void 0, void 0, functi
78
90
  ].join('\n'));
79
91
  }
80
92
  catch (error) {
81
- handleErrorGeneric(error, scope, command);
82
- if (isModuleNotFoundError(error)) {
83
- console.log(chalk_1.default.bold.red('Original Node.js error:\n'), error);
93
+ debug('Error in checkPlugin:', error);
94
+ if (isPnpModuleNotFoundError(error) && error.pnpCode === 'MISSING_PEER_DEPENDENCY') {
95
+ // This error is verbose and gives a lot of information about the PnP error, so we log it as is.
96
+ console.log(error);
97
+ console.log();
98
+ showPnpPeerDependencyErrorMessageBox(scope);
99
+ showInstallPluginInstructions(scope);
100
+ console.log();
101
+ }
102
+ else if (isModuleNotFoundError(error)) {
103
+ console.log();
104
+ showPluginNotInstalledMessageBox(scope, command);
105
+ showInstallPluginInstructions(scope);
106
+ console.log();
107
+ }
108
+ else {
109
+ console.log(chalk_1.default.bold.red('Unexpected error when checking the plugin:\n'), error);
84
110
  }
85
111
  return false;
86
112
  }
87
113
  return true;
88
114
  });
89
115
  exports.checkPlugin = checkPlugin;
116
+ /**
117
+ * Installs a plugin and the base package as `devDependencies` in the current project with the right package manager.
118
+ */
90
119
  const installPlugin = (packageOrScope) => __awaiter(void 0, void 0, void 0, function* () {
91
- const pluginName = scopeToPackageName(packageOrScope);
92
- const version = package_json_1.peerDependencies[pluginName];
93
- const basePackage = `@datadog/datadog-ci-base@${version}`;
94
- const pluginPackage = `${pluginName}@${version}`;
120
+ if (!isValidScope(packageOrScope)) {
121
+ console.log([
122
+ '',
123
+ chalk_1.default.bold.red("This plugin is not listed as a possible peer dependency. Make sure you didn't make a typo."),
124
+ '',
125
+ ].join('\n'));
126
+ return false;
127
+ }
128
+ const { basePackage, pluginPackage } = getPackagesToInstall(packageOrScope);
95
129
  // We need to install the base package as well in order to satisfy the plugin's peerDependencies.
96
- const { installPackage } = yield import('@antfu/install-pkg');
130
+ const { installPackage } = yield (0, exports.importInstallPkg)();
97
131
  const output = yield installPackage([basePackage, pluginPackage], {
98
- silent: true,
132
+ silent: !debug.enabled,
99
133
  dev: true,
100
134
  });
101
135
  if (output.exitCode === 0) {
@@ -112,6 +146,44 @@ const installPlugin = (packageOrScope) => __awaiter(void 0, void 0, void 0, func
112
146
  }
113
147
  });
114
148
  exports.installPlugin = installPlugin;
149
+ // Wrapper function to be mocked in tests
150
+ const importInstallPkg = () => __awaiter(void 0, void 0, void 0, function* () {
151
+ return import('@antfu/install-pkg');
152
+ });
153
+ exports.importInstallPkg = importInstallPkg;
154
+ const temporarilyInstallPluginWithNpx = (scope) => __awaiter(void 0, void 0, void 0, function* () {
155
+ const isWindows = process.platform === 'win32';
156
+ const { basePackage, pluginPackage } = getPackagesToInstall(scope);
157
+ const emitPath = isWindows ? 'set PATH' : 'printenv PATH';
158
+ const cmd = `npx -y -p ${basePackage} -p ${pluginPackage} ${emitPath}`;
159
+ debug('Using npx to install the missing plugin:', cmd);
160
+ const output = yield new Promise((resolve, reject) => {
161
+ (0, node_child_process_1.exec)(cmd, (error, stdout) => {
162
+ if (error) {
163
+ reject(error);
164
+ }
165
+ else {
166
+ resolve(stdout);
167
+ }
168
+ });
169
+ });
170
+ debug('Output:', output);
171
+ const tempPath = (0, exports.getTempPath)(output, isWindows);
172
+ // The path should end with `node_modules/.bin`
173
+ const nodeModulesPath = node_path_1.default.resolve(tempPath, '..');
174
+ if (!nodeModulesPath.endsWith('node_modules')) {
175
+ throw new Error(`Found NPX temporary path of '${tempPath}' but expected to be able to find a 'node_modules' directory by looking in '..'.`);
176
+ }
177
+ console.log();
178
+ (0, message_box_1.messageBox)('Installed plugin 🔌', 'green', [
179
+ `Successfully installed ${chalk_1.default.bold(pluginPackage)} into ${chalk_1.default.dim(nodeModulesPath)}`,
180
+ '',
181
+ `To skip this step in the future, run ${chalk_1.default.bold.cyan('datadog-ci plugin install')} ${chalk_1.default.magenta(scope)} in your project.`,
182
+ ]);
183
+ console.log();
184
+ // Make the plugin resolvable.
185
+ patchModulePaths(nodeModulesPath);
186
+ });
115
187
  const handlePluginAutoInstall = (scope) => __awaiter(void 0, void 0, void 0, function* () {
116
188
  if (!!process.env['DISABLE_PLUGIN_AUTO_INSTALL']) {
117
189
  debug('Found DISABLE_PLUGIN_AUTO_INSTALL env variable, skipping auto-install');
@@ -122,41 +194,46 @@ const handlePluginAutoInstall = (scope) => __awaiter(void 0, void 0, void 0, fun
122
194
  debug('Auto-install check: plugin is installed, skipping installation');
123
195
  }
124
196
  catch (error) {
197
+ debug('Error in handlePluginAutoInstall:', error);
125
198
  if (!isModuleNotFoundError(error)) {
199
+ // Re-throw unexpected errors.
200
+ throw error;
201
+ }
202
+ if (isPnpModuleNotFoundError(error) && error.pnpCode === 'MISSING_PEER_DEPENDENCY') {
203
+ // Re-throw PnP errors.
204
+ console.log(chalk_1.default.red(`The plugin auto-install feature is not supported with Yarn Plug'n'Play (PnP).`));
126
205
  throw error;
127
206
  }
128
- const pluginName = scopeToPackageName(scope);
207
+ const pluginName = (0, exports.scopeToPackageName)(scope);
129
208
  console.log(chalk_1.default.red(`Could not find ${chalk_1.default.bold(pluginName)}. Installing...`));
130
- yield (0, exports.installPlugin)(pluginName);
209
+ yield temporarilyInstallPluginWithNpx(pluginName);
131
210
  }
132
211
  });
133
- const handleSimulateMissingPlugin = () => {
134
- if (!!process.env['SIMULATE_MISSING_PLUGIN']) {
135
- const error = new Error('Simulated "Module not found" error');
136
- error.code = 'MODULE_NOT_FOUND';
137
- throw error;
138
- }
139
- };
140
212
  const importPluginSubmodule = (scope, command) => __awaiter(void 0, void 0, void 0, function* () {
213
+ if (!isValidScope(scope)) {
214
+ throw new Error(`Invalid scope: ${scope}`);
215
+ }
141
216
  if (yield (0, is_standalone_binary_1.isStandaloneBinary)()) {
142
217
  debug(`Loading plugin injected in the standalone binary`);
143
218
  // @ts-expect-error - All plugins are injected in the standalone binary with esbuild.
144
219
  return __INJECTED_PLUGIN_SUBMODULES__[scope][command];
145
220
  }
221
+ // Add current working directory's `node_modules` to the module resolution paths
222
+ // in case the command is running in NPX.
223
+ patchModulePaths();
146
224
  yield handlePluginAutoInstall(scope);
147
- // Only handle `SIMULATE_MISSING_PLUGIN` when used in combination with `DISABLE_PLUGIN_AUTO_INSTALL`.
148
- if (process.env['DISABLE_PLUGIN_AUTO_INSTALL']) {
149
- handleSimulateMissingPlugin();
150
- }
151
- const submodulePath = `@datadog/datadog-ci-plugin-${scope}/commands/${command}`;
225
+ const submoduleName = `@datadog/datadog-ci-plugin-${scope}/commands/${command}`;
226
+ debug('Resolving submodule:', submoduleName);
227
+ let resolvedPath = submoduleName;
152
228
  try {
153
- const resolvedPath = require.resolve(submodulePath);
154
- debug(`The ${submodulePath} submodule resolves to ${resolvedPath}`);
229
+ resolvedPath = require.resolve(submoduleName);
230
+ debug(`Resolved to: ${resolvedPath}`);
155
231
  }
156
232
  catch (error) {
157
- debug(`Could not require.resolve() the ${submodulePath} submodule: ${error}`);
233
+ debug(`Could not require.resolve() the ${submoduleName} submodule: ${error}`);
158
234
  }
159
- return (yield import(`@datadog/datadog-ci-plugin-${scope}/commands/${command}`));
235
+ debug('Importing submodule:', resolvedPath);
236
+ return (yield import(resolvedPath));
160
237
  });
161
238
  const scopeToPackageName = (scope) => {
162
239
  if (scope.match(/^@datadog\/datadog-ci-plugin-[a-z-]+$/)) {
@@ -164,8 +241,29 @@ const scopeToPackageName = (scope) => {
164
241
  }
165
242
  return `@datadog/datadog-ci-plugin-${scope}`;
166
243
  };
244
+ exports.scopeToPackageName = scopeToPackageName;
245
+ const patchModulePaths = (preferredPath) => {
246
+ const workingDirNodeModules = node_path_1.default.join(process.cwd(), 'node_modules');
247
+ process.env['NODE_PATH'] = [process.env['NODE_PATH'], workingDirNodeModules, preferredPath]
248
+ .filter(Boolean)
249
+ .join(node_path_1.default.delimiter);
250
+ require('module').Module._initPaths();
251
+ debug('Module resolution paths set to:', process.env['NODE_PATH']);
252
+ };
253
+ const isValidScope = (scope) => {
254
+ return (0, exports.scopeToPackageName)(scope) in package_json_1.peerDependencies;
255
+ };
256
+ const getPackagesToInstall = (scope) => {
257
+ const pluginName = (0, exports.scopeToPackageName)(scope);
258
+ // Useful for testing with different versions than the current CLI version.
259
+ // This supports any format that the current package manager supports.
260
+ const baseVersionOverride = process.env['PLUGIN_AUTO_INSTALL_BASE_VERSION_OVERRIDE'];
261
+ const pluginVersionOverride = process.env['PLUGIN_AUTO_INSTALL_PLUGIN_VERSION_OVERRIDE'];
262
+ const basePackage = `@datadog/datadog-ci-base@${baseVersionOverride !== null && baseVersionOverride !== void 0 ? baseVersionOverride : version_1.cliVersion}`;
263
+ const pluginPackage = `${pluginName}@${pluginVersionOverride !== null && pluginVersionOverride !== void 0 ? pluginVersionOverride : version_1.cliVersion}`;
264
+ return { basePackage, pluginPackage };
265
+ };
167
266
  const importPlugin = (scope, command) => __awaiter(void 0, void 0, void 0, function* () {
168
- handleSimulateMissingPlugin();
169
267
  if (scope.match(/^@datadog\/datadog-ci-plugin-[a-z-]+$/)) {
170
268
  // Use `require()` instead of `await import()` to avoid a `ERR_IMPORT_ATTRIBUTE_MISSING` error.
171
269
  return extractPackageJson(require(`${scope}/package.json`));
@@ -189,38 +287,75 @@ const extractPackageJson = (content) => {
189
287
  const { name, version } = content;
190
288
  return { name, version };
191
289
  };
192
- const handleErrorGeneric = (error, scope, command) => {
193
- debug('Original error:', error);
194
- console.log();
195
- if (isModuleNotFoundError(error)) {
196
- const packageName = `@datadog/datadog-ci-plugin-${scope}`;
197
- if (command) {
198
- (0, message_box_1.messageBox)('Plugin not installed 🔌', 'red', [
199
- `The ${chalk_1.default.cyan(`datadog-ci ${scope} ${command}`)} command could not be found.`,
200
- `To use this command, please install ${chalk_1.default.bold.magenta(packageName)} alongside datadog-ci.`,
201
- ]);
202
- }
203
- else {
204
- (0, message_box_1.messageBox)('Plugin not installed 🔌', 'red', [
205
- `The ${chalk_1.default.bold.magenta(packageName)} package could not be found.`,
206
- `To use the any command in this plugin, please install it alongside datadog-ci.`,
207
- ]);
208
- }
209
- console.log([
210
- '',
211
- `You can install the plugin using:`,
212
- ` ${chalk_1.default.bold.cyan('datadog-ci plugin install')} ${chalk_1.default.magenta(scope)}`,
213
- `or`,
214
- ` ${chalk_1.default.bold.cyan('datadog-ci plugin install')} ${chalk_1.default.magenta(packageName)}`,
215
- '',
216
- ].join('\n'));
217
- return;
290
+ const showPluginNotInstalledMessageBox = (scope, command) => {
291
+ const packageName = `@datadog/datadog-ci-plugin-${scope}`;
292
+ if (command) {
293
+ (0, message_box_1.messageBox)('Plugin not installed 🔌', 'red', [
294
+ `The ${chalk_1.default.cyan(`datadog-ci ${scope} ${command}`)} command could not be found.`,
295
+ `To use this command, please install ${chalk_1.default.bold.magenta(packageName)} alongside datadog-ci.`,
296
+ ]);
297
+ }
298
+ else {
299
+ (0, message_box_1.messageBox)('Plugin not installed 🔌', 'red', [
300
+ `The ${chalk_1.default.bold.magenta(packageName)} package could not be found.`,
301
+ `To use the any command in this plugin, please install it alongside datadog-ci.`,
302
+ ]);
218
303
  }
219
- console.log();
304
+ };
305
+ const showPnpPeerDependencyErrorMessageBox = (scope) => {
306
+ const packageName = `@datadog/datadog-ci-plugin-${scope}`;
307
+ (0, message_box_1.messageBox)("Yarn Plug'n'Play (PnP) error 🔌", 'red', [
308
+ `Yarn Plug'n'Play (PnP) detected that ${chalk_1.default.bold.magenta(packageName)} was not installed alongside datadog-ci.`,
309
+ ]);
310
+ };
311
+ const showInstallPluginInstructions = (scope) => {
312
+ const packageName = `@datadog/datadog-ci-plugin-${scope}`;
313
+ console.log([
314
+ '',
315
+ `You can install the plugin using:`,
316
+ ` ${chalk_1.default.bold.cyan('datadog-ci plugin install')} ${chalk_1.default.magenta(scope)}`,
317
+ `or`,
318
+ ` ${chalk_1.default.bold.cyan('datadog-ci plugin install')} ${chalk_1.default.magenta(packageName)}`,
319
+ '',
320
+ ].join('\n'));
220
321
  };
221
322
  const isModuleNotFoundError = (error) => {
222
323
  var _a;
223
324
  return (error instanceof Error &&
224
325
  ['MODULE_NOT_FOUND', 'ERR_MODULE_NOT_FOUND'].includes((_a = error.code) !== null && _a !== void 0 ? _a : ''));
225
326
  };
327
+ const isPnpModuleNotFoundError = (error) => {
328
+ return isModuleNotFoundError(error) && error.pnpCode !== undefined;
329
+ };
330
+ const NPX_PATH_REGEX = /\.npm\/_npx\//;
331
+ const NPX_PATH_WIN_REGEX = /\\npm[-\\]+cache\\_npx\\/;
332
+ /**
333
+ * Find where NPX just installed the package.
334
+ *
335
+ * https://github.com/geelen/npx-import/blob/8a1e17ca4f88981b11be5090e20871f8704166b8/src/index.ts#L221-L250
336
+ */
337
+ const getTempPath = (stdout, isWindows) => {
338
+ if (isWindows) {
339
+ const paths = stdout
340
+ .replace(/^PATH=/i, '')
341
+ .replace(/\\r\\n/g, ';')
342
+ .split(';');
343
+ const tempPath = paths.find((p) => NPX_PATH_WIN_REGEX.exec(p));
344
+ if (!tempPath) {
345
+ const list = paths.map((p) => ` - ${p}`).join('\n');
346
+ throw new Error(`Failed to find temporary install directory. Looking for paths matching '\\npm-cache\\_npx\\' in:\n${list}`);
347
+ }
348
+ return tempPath;
349
+ }
350
+ else {
351
+ const paths = stdout.split(':');
352
+ const tempPath = paths.find((p) => NPX_PATH_REGEX.exec(p));
353
+ if (!tempPath) {
354
+ const list = paths.map((p) => ` - ${p}`).join('\n');
355
+ throw new Error(`Failed to find temporary install directory. Looking for paths matching '/.npm/_npx/' in:\n${list}`);
356
+ }
357
+ return tempPath;
358
+ }
359
+ };
360
+ exports.getTempPath = getTempPath;
226
361
  //# sourceMappingURL=plugin.js.map