oclif 4.17.45 → 4.18.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.
@@ -1,10 +1,7 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  const core_1 = require("@oclif/core");
7
- const chalk_1 = __importDefault(require("chalk"));
4
+ const ansis_1 = require("ansis");
8
5
  const change_case_1 = require("change-case");
9
6
  const node_path_1 = require("node:path");
10
7
  const generator_1 = require("../../generator");
@@ -22,7 +19,7 @@ class GenerateCommand extends generator_1.GeneratorCommand {
22
19
  if (!packageJSON)
23
20
  throw new core_1.Errors.CLIError('not in a project directory');
24
21
  const topicSeparator = packageJSON.oclif?.topicSeparator ?? ':';
25
- this.log(`Adding ${chalk_1.default.dim(this.args.name.replaceAll(':', topicSeparator))} to ${packageJSON.name}!`);
22
+ this.log(`Adding ${(0, ansis_1.dim)(this.args.name.replaceAll(':', topicSeparator))} to ${packageJSON.name}!`);
26
23
  const cmdPath = this.args.name.split(':').join('/');
27
24
  const destination = (0, node_path_1.join)(process.cwd(), this.flags['commands-dir'], `${cmdPath}.ts`);
28
25
  let bin = packageJSON.oclif?.bin ?? packageJSON.oclif?.dirname ?? packageJSON.name;
@@ -32,12 +32,9 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
35
  Object.defineProperty(exports, "__esModule", { value: true });
39
36
  const core_1 = require("@oclif/core");
40
- const chalk_1 = __importDefault(require("chalk"));
37
+ const ansis_1 = require("ansis");
41
38
  const fs = __importStar(require("fs-extra"));
42
39
  const promises_1 = require("node:fs/promises");
43
40
  const node_path_1 = require("node:path");
@@ -61,7 +58,7 @@ class GenerateHook extends generator_1.GeneratorCommand {
61
58
  const packageJSON = await (0, generator_1.readPJSON)(process.cwd());
62
59
  if (!packageJSON)
63
60
  throw new core_1.Errors.CLIError('not in a project directory');
64
- this.log(`Adding a ${chalk_1.default.dim(this.flags.event)} hook to ${packageJSON.name}!`);
61
+ this.log(`Adding a ${(0, ansis_1.dim)(this.flags.event)} hook to ${packageJSON.name}!`);
65
62
  const source = (0, node_path_1.join)(this.templatesDir, 'src', 'hook.ts.ejs');
66
63
  const dest = (0, node_path_1.join)(process.cwd(), 'src', 'hooks', this.flags.event, `${this.args.name}.ts`);
67
64
  await this.template(source, dest, { event: this.flags.event });
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const core_1 = require("@oclif/core");
7
- const chalk_1 = __importDefault(require("chalk"));
7
+ const ansis_1 = require("ansis");
8
8
  const node_fs_1 = require("node:fs");
9
9
  const promises_1 = require("node:fs/promises");
10
10
  const node_path_1 = require("node:path");
@@ -133,7 +133,7 @@ Head to oclif.io/docs/introduction to learn more about building CLIs with oclif.
133
133
  static summary = 'Generate a new CLI';
134
134
  async run() {
135
135
  const location = this.flags['output-dir'] ? (0, node_path_1.join)(this.flags['output-dir'], this.args.name) : (0, node_path_1.resolve)(this.args.name);
136
- this.log(`Generating ${this.args.name} in ${chalk_1.default.green(location)}`);
136
+ this.log(`Generating ${this.args.name} in ${(0, ansis_1.green)(location)}`);
137
137
  if ((0, node_fs_1.existsSync)(location)) {
138
138
  throw new core_1.Errors.CLIError(`The directory ${location} already exists.`);
139
139
  }
@@ -220,7 +220,7 @@ Head to oclif.io/docs/introduction to learn more about building CLIs with oclif.
220
220
  }
221
221
  }));
222
222
  if (this.flags['dry-run']) {
223
- this.log(`\n[DRY RUN] Created ${chalk_1.default.green(name)}`);
223
+ this.log(`\n[DRY RUN] Created ${(0, ansis_1.green)(name)}`);
224
224
  }
225
225
  else {
226
226
  if (process.platform !== 'win32') {
@@ -240,7 +240,7 @@ Head to oclif.io/docs/introduction to learn more about building CLIs with oclif.
240
240
  env: { ...process.env, NODE_ENV: 'production' },
241
241
  silent: false,
242
242
  });
243
- this.log(`\nCreated ${chalk_1.default.green(name)}`);
243
+ this.log(`\nCreated ${(0, ansis_1.green)(name)}`);
244
244
  }
245
245
  }
246
246
  }
@@ -1,10 +1,7 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  const core_1 = require("@oclif/core");
7
- const chalk_1 = __importDefault(require("chalk"));
4
+ const ansis_1 = require("ansis");
8
5
  const promises_1 = require("node:fs/promises");
9
6
  const node_path_1 = require("node:path");
10
7
  const generator_1 = require("../generator");
@@ -72,7 +69,7 @@ class Generate extends generator_1.GeneratorCommand {
72
69
  async run() {
73
70
  const outputDir = this.flags['output-dir'] ?? process.cwd();
74
71
  const location = (0, node_path_1.resolve)(outputDir);
75
- this.log(`Initializing oclif in ${chalk_1.default.green(location)}`);
72
+ this.log(`Initializing oclif in ${(0, ansis_1.green)(location)}`);
76
73
  const packageJSON = (await (0, generator_1.readPJSON)(location));
77
74
  if (!packageJSON) {
78
75
  throw new core_1.Errors.CLIError(`Could not find a package.json file in ${location}`);
@@ -112,8 +109,8 @@ class Generate extends generator_1.GeneratorCommand {
112
109
  name: 'package-manager',
113
110
  type: 'select',
114
111
  });
115
- this.log(`Using module type ${chalk_1.default.green(moduleType)}`);
116
- this.log(`Using package manager ${chalk_1.default.green(packageManager)}`);
112
+ this.log(`Using module type ${(0, ansis_1.green)(moduleType)}`);
113
+ this.log(`Using package manager ${(0, ansis_1.green)(packageManager)}`);
117
114
  const projectBinPath = (0, node_path_1.join)(location, 'bin');
118
115
  const templateBinPath = (0, node_path_1.join)(this.templatesDir, 'cli', moduleType.toLowerCase(), 'bin');
119
116
  await this.template((0, node_path_1.join)(templateBinPath, 'dev.cmd.ejs'), (0, node_path_1.join)(projectBinPath, 'dev.cmd'));
@@ -162,7 +159,7 @@ class Generate extends generator_1.GeneratorCommand {
162
159
  silent: false,
163
160
  });
164
161
  }
165
- this.log(`\nCreated CLI ${chalk_1.default.green(bin)}`);
162
+ this.log(`\nCreated CLI ${(0, ansis_1.green)(bin)}`);
166
163
  }
167
164
  }
168
165
  exports.default = Generate;
package/lib/generator.js CHANGED
@@ -8,7 +8,7 @@ exports.exec = exec;
8
8
  exports.readPJSON = readPJSON;
9
9
  exports.makeFlags = makeFlags;
10
10
  const core_1 = require("@oclif/core");
11
- const chalk_1 = __importDefault(require("chalk"));
11
+ const ansis_1 = __importDefault(require("ansis"));
12
12
  const ejs_1 = require("ejs");
13
13
  const fs_extra_1 = require("fs-extra");
14
14
  const node_child_process_1 = require("node:child_process");
@@ -21,7 +21,7 @@ async function exec(command, opts) {
21
21
  const silent = opts ? opts.silent : true;
22
22
  return new Promise((resolve, reject) => {
23
23
  if (!silent)
24
- core_1.ux.stdout(chalk_1.default.dim(command));
24
+ core_1.ux.stdout(ansis_1.default.dim(command));
25
25
  const p = (0, node_child_process_1.exec)(command, opts ?? {}, (err, stdout, stderr) => {
26
26
  if (err)
27
27
  return reject(err);
@@ -79,13 +79,13 @@ class GeneratorCommand extends core_1.Command {
79
79
  throw new Error(`No flaggable prompt defined for ${name}`);
80
80
  const maybeFlag = () => {
81
81
  if (this.flags[name]) {
82
- this.log(`${chalk_1.default.green('?')} ${chalk_1.default.bold(this.flaggablePrompts[name].message)} ${chalk_1.default.cyan(this.flags[name])}`);
82
+ this.log(`${ansis_1.default.green('?')} ${ansis_1.default.bold(this.flaggablePrompts[name].message)} ${ansis_1.default.cyan(this.flags[name])}`);
83
83
  return this.flags[name];
84
84
  }
85
85
  };
86
86
  const maybeDefault = () => {
87
87
  if (this.flags.yes) {
88
- this.log(`${chalk_1.default.green('?')} ${chalk_1.default.bold(this.flaggablePrompts[name].message)} ${chalk_1.default.cyan(defaultValue)}`);
88
+ this.log(`${ansis_1.default.green('?')} ${ansis_1.default.bold(this.flaggablePrompts[name].message)} ${ansis_1.default.cyan(defaultValue)}`);
89
89
  return defaultValue;
90
90
  }
91
91
  };
@@ -94,7 +94,7 @@ class GeneratorCommand extends core_1.Command {
94
94
  return;
95
95
  const otherValue = await maybeOtherValue();
96
96
  if (otherValue) {
97
- this.log(`${chalk_1.default.green('?')} ${chalk_1.default.bold(this.flaggablePrompts[name].message)} ${chalk_1.default.cyan(otherValue)}`);
97
+ this.log(`${ansis_1.default.green('?')} ${ansis_1.default.bold(this.flaggablePrompts[name].message)} ${ansis_1.default.cyan(otherValue)}`);
98
98
  return otherValue;
99
99
  }
100
100
  };
@@ -170,11 +170,11 @@ class GeneratorCommand extends core_1.Command {
170
170
  verb = 'Overwriting';
171
171
  }
172
172
  else {
173
- this.log(`${chalk_1.default.yellow('Skipping')} ${relativePath}`);
173
+ this.log(`${ansis_1.default.yellow('Skipping')} ${relativePath}`);
174
174
  return;
175
175
  }
176
176
  }
177
- this.log(`${chalk_1.default.yellow(verb)} ${relativePath}`);
177
+ this.log(`${ansis_1.default.yellow(verb)} ${relativePath}`);
178
178
  if (!this.flags['dry-run']) {
179
179
  await (0, fs_extra_1.outputFile)(destination, rendered);
180
180
  }
@@ -1131,5 +1131,5 @@
1131
1131
  ]
1132
1132
  }
1133
1133
  },
1134
- "version": "4.17.45"
1134
+ "version": "4.18.0"
1135
1135
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "oclif",
3
3
  "description": "oclif: create your own CLI",
4
- "version": "4.17.45",
4
+ "version": "4.18.0",
5
5
  "author": "Salesforce",
6
6
  "bin": {
7
7
  "oclif": "bin/run.js"
@@ -9,7 +9,7 @@
9
9
  "bugs": "https://github.com/oclif/oclif/issues",
10
10
  "dependencies": {
11
11
  "@aws-sdk/client-cloudfront": "^3.787.0",
12
- "@aws-sdk/client-s3": "^3.782.0",
12
+ "@aws-sdk/client-s3": "^3.787.0",
13
13
  "@inquirer/confirm": "^3.1.22",
14
14
  "@inquirer/input": "^2.2.4",
15
15
  "@inquirer/select": "^2.5.0",
@@ -17,8 +17,8 @@
17
17
  "@oclif/plugin-help": "^6.2.27",
18
18
  "@oclif/plugin-not-found": "^3.2.48",
19
19
  "@oclif/plugin-warn-if-update-available": "^3.1.38",
20
+ "ansis": "^3.16.0",
20
21
  "async-retry": "^1.3.3",
21
- "chalk": "^4",
22
22
  "change-case": "^4",
23
23
  "debug": "^4.4.0",
24
24
  "ejs": "^3.1.10",