oclif 4.17.19 → 4.17.20

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/bin/dev.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ts-node
2
- // eslint-disable-next-line node/shebang, unicorn/prefer-top-level-await
2
+
3
+ // eslint-disable-next-line unicorn/prefer-top-level-await
3
4
  ;(async () => {
4
5
  const oclif = await import('@oclif/core')
5
6
  await oclif.execute({development: true, dir: __dirname})
@@ -180,6 +180,21 @@ Head to oclif.io/docs/introduction to learn more about building CLIs with oclif.
180
180
  debug(`${moduleType} files %O`, moduleSpecificFiles);
181
181
  await Promise.all([...sharedFiles, ...moduleSpecificFiles].map(async (file) => {
182
182
  switch (file.name) {
183
+ case '.gitignore.ejs': {
184
+ await this.template(file.src, file.destination, { packageManager });
185
+ break;
186
+ }
187
+ case 'onPushToMain.yml.ejs':
188
+ case 'onRelease.yml.ejs':
189
+ case 'test.yml.ejs': {
190
+ await this.template(file.src, file.destination, {
191
+ exec: packageManager === 'yarn' ? packageManager : `${packageManager} exec`,
192
+ install: packageManager === 'yarn' ? packageManager : `${packageManager} install`,
193
+ packageManager,
194
+ run: packageManager === 'yarn' ? packageManager : `${packageManager} run`,
195
+ });
196
+ break;
197
+ }
183
198
  case 'package.json.ejs': {
184
199
  const data = {
185
200
  author,
@@ -195,25 +210,10 @@ Head to oclif.io/docs/introduction to learn more about building CLIs with oclif.
195
210
  await this.template(file.src, file.destination, data);
196
211
  break;
197
212
  }
198
- case '.gitignore.ejs': {
199
- await this.template(file.src, file.destination, { packageManager });
200
- break;
201
- }
202
213
  case 'README.md.ejs': {
203
214
  await this.template(file.src, file.destination, { description, name, repository });
204
215
  break;
205
216
  }
206
- case 'onPushToMain.yml.ejs':
207
- case 'onRelease.yml.ejs':
208
- case 'test.yml.ejs': {
209
- await this.template(file.src, file.destination, {
210
- exec: packageManager === 'yarn' ? packageManager : `${packageManager} exec`,
211
- install: packageManager === 'yarn' ? packageManager : `${packageManager} install`,
212
- packageManager,
213
- run: packageManager === 'yarn' ? packageManager : `${packageManager} run`,
214
- });
215
- break;
216
- }
217
217
  default: {
218
218
  await this.template(file.src, file.destination);
219
219
  }
@@ -32,12 +32,15 @@ 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
+ };
35
38
  Object.defineProperty(exports, "__esModule", { value: true });
36
39
  const core_1 = require("@oclif/core");
37
40
  const fs_extra_1 = require("fs-extra");
38
41
  const node_child_process_1 = require("node:child_process");
39
42
  const os = __importStar(require("node:os"));
40
- const path = __importStar(require("node:path"));
43
+ const node_path_1 = __importDefault(require("node:path"));
41
44
  const node_stream_1 = require("node:stream");
42
45
  const node_util_1 = require("node:util");
43
46
  const semver_1 = require("semver");
@@ -70,7 +73,7 @@ class Manifest extends core_1.Command {
70
73
  }
71
74
  catch { }
72
75
  const { args } = await this.parse(Manifest);
73
- const root = path.resolve(args.path);
76
+ const root = node_path_1.default.resolve(args.path);
74
77
  const packageJson = (0, fs_extra_1.readJSONSync)('package.json');
75
78
  let jitPluginManifests = [];
76
79
  if (flags.jit && packageJson.oclif?.jitPlugins) {
@@ -79,16 +82,16 @@ class Manifest extends core_1.Command {
79
82
  const { default: got } = await import('got');
80
83
  const promises = Object.entries(packageJson.oclif.jitPlugins).map(async ([jitPlugin, version]) => {
81
84
  const pluginDir = jitPlugin.replace('/', '-').replace('@', '');
82
- const fullPath = path.join(tmpDir, pluginDir);
85
+ const fullPath = node_path_1.default.join(tmpDir, pluginDir);
83
86
  if (await fileExists(fullPath))
84
87
  await (0, fs_extra_1.remove)(fullPath);
85
88
  await (0, fs_extra_1.mkdir)(fullPath, { recursive: true });
86
89
  const resolvedVersion = await this.getVersion(jitPlugin, version);
87
90
  const tarballUrl = await this.getTarballUrl(jitPlugin, resolvedVersion);
88
- const tarball = path.join(fullPath, path.basename(tarballUrl));
91
+ const tarball = node_path_1.default.join(fullPath, node_path_1.default.basename(tarballUrl));
89
92
  await pipeline(got.stream(tarballUrl), (0, fs_extra_1.createWriteStream)(tarball));
90
93
  await this.executeCommand(`tar -xzf "${tarball}"`, { cwd: fullPath });
91
- const manifest = (await (0, fs_extra_1.readJSON)(path.join(fullPath, 'package', 'oclif.manifest.json')));
94
+ const manifest = (await (0, fs_extra_1.readJSON)(node_path_1.default.join(fullPath, 'package', 'oclif.manifest.json')));
92
95
  for (const command of Object.values(manifest.commands)) {
93
96
  command.pluginType = 'jit';
94
97
  }
@@ -123,7 +126,7 @@ class Manifest extends core_1.Command {
123
126
  });
124
127
  }
125
128
  const dotfile = plugin.pjson.files.find((f) => f.endsWith('.oclif.manifest.json'));
126
- const file = path.join(plugin.root, `${dotfile ? '.' : ''}oclif.manifest.json`);
129
+ const file = node_path_1.default.join(plugin.root, `${dotfile ? '.' : ''}oclif.manifest.json`);
127
130
  for (const manifest of jitPluginManifests) {
128
131
  plugin.manifest.commands = { ...plugin.manifest.commands, ...manifest.commands };
129
132
  }
@@ -32,12 +32,15 @@ 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
+ };
35
38
  Object.defineProperty(exports, "__esModule", { value: true });
36
39
  const core_1 = require("@oclif/core");
37
40
  const fs = __importStar(require("fs-extra"));
38
41
  const node_child_process_1 = require("node:child_process");
39
42
  const fsPromises = __importStar(require("node:fs/promises"));
40
- const path = __importStar(require("node:path"));
43
+ const node_path_1 = __importDefault(require("node:path"));
41
44
  const node_util_1 = require("node:util");
42
45
  const Tarballs = __importStar(require("../../tarballs"));
43
46
  const upload_util_1 = require("../../upload-util");
@@ -123,29 +126,29 @@ class PackDeb extends core_1.Command {
123
126
  bin: config.bin,
124
127
  versionShaRevision: (0, upload_util_1.debVersion)(buildConfig),
125
128
  });
126
- const workspace = path.join(buildConfig.tmp, 'apt', versionedDebBase.replace('.deb', '.apt'));
129
+ const workspace = node_path_1.default.join(buildConfig.tmp, 'apt', versionedDebBase.replace('.deb', '.apt'));
127
130
  await fs.remove(workspace);
128
131
  await Promise.all([
129
- fsPromises.mkdir(path.join(workspace, 'DEBIAN'), { recursive: true }),
130
- fsPromises.mkdir(path.join(workspace, 'usr', 'bin'), { recursive: true }),
132
+ fsPromises.mkdir(node_path_1.default.join(workspace, 'DEBIAN'), { recursive: true }),
133
+ fsPromises.mkdir(node_path_1.default.join(workspace, 'usr', 'bin'), { recursive: true }),
131
134
  ]);
132
- await fs.copy(buildConfig.workspace(target), path.join(workspace, 'usr', 'lib', config.dirname));
135
+ await fs.copy(buildConfig.workspace(target), node_path_1.default.join(workspace, 'usr', 'lib', config.dirname));
133
136
  await Promise.all([
134
137
  // usr/lib/oclif/bin/oclif (the executable)
135
- fsPromises.writeFile(path.join(workspace, 'usr', 'lib', config.dirname, 'bin', config.bin), scripts.bin(config), { mode: 0o755 }),
136
- fsPromises.writeFile(path.join(workspace, 'DEBIAN', 'control'), scripts.control(buildConfig, (0, upload_util_1.debArch)(arch))),
138
+ fsPromises.writeFile(node_path_1.default.join(workspace, 'usr', 'lib', config.dirname, 'bin', config.bin), scripts.bin(config), { mode: 0o755 }),
139
+ fsPromises.writeFile(node_path_1.default.join(workspace, 'DEBIAN', 'control'), scripts.control(buildConfig, (0, upload_util_1.debArch)(arch))),
137
140
  ]);
138
141
  // symlink usr/bin/oclif points to usr/lib/oclif/bin/oclif
139
- await exec(`ln -s "${path.join('..', 'lib', config.dirname, 'bin', config.bin)}" "${config.bin}"`, {
140
- cwd: path.join(workspace, 'usr', 'bin'),
142
+ await exec(`ln -s "${node_path_1.default.join('..', 'lib', config.dirname, 'bin', config.bin)}" "${config.bin}"`, {
143
+ cwd: node_path_1.default.join(workspace, 'usr', 'bin'),
141
144
  });
142
- config.binAliases?.map((alias) => exec(`ln -sf "${path.join('..', 'lib', config.dirname, 'bin', config.bin)}" "${alias}"`, {
143
- cwd: path.join(workspace, 'usr', 'bin'),
145
+ config.binAliases?.map((alias) => exec(`ln -sf "${node_path_1.default.join('..', 'lib', config.dirname, 'bin', config.bin)}" "${alias}"`, {
146
+ cwd: node_path_1.default.join(workspace, 'usr', 'bin'),
144
147
  }));
145
148
  await exec(`sudo chown -R root "${workspace}"`);
146
149
  await exec(`sudo chgrp -R root "${workspace}"`);
147
150
  const dpkgDeb = flags.compression ? `dpkg-deb --build "-Z${flags.compression}"` : 'dpkg-deb --build';
148
- await exec(`${dpkgDeb} "${workspace}" "${path.join(dist, versionedDebBase)}"`);
151
+ await exec(`${dpkgDeb} "${workspace}" "${node_path_1.default.join(dist, versionedDebBase)}"`);
149
152
  this.log(`finished building debian / ${arch}`);
150
153
  };
151
154
  const arches = (0, util_1.uniq)(buildConfig.targets.filter((t) => t.platform === 'linux').map((t) => t.arch));
@@ -170,8 +173,8 @@ class PackDeb extends core_1.Command {
170
173
  }
171
174
  exports.default = PackDeb;
172
175
  async function packForFTP(buildConfig, config, dist) {
173
- const ftparchive = path.join(buildConfig.tmp, 'apt', 'apt-ftparchive.conf');
174
- await fsPromises.mkdir(path.basename(ftparchive), { recursive: true });
176
+ const ftparchive = node_path_1.default.join(buildConfig.tmp, 'apt', 'apt-ftparchive.conf');
177
+ await fsPromises.mkdir(node_path_1.default.basename(ftparchive), { recursive: true });
175
178
  await fs.writeFile(ftparchive, scripts.ftparchive(config));
176
179
  await exec(`apt-ftparchive -c "${ftparchive}" release . > Release`, { cwd: dist });
177
180
  }
@@ -32,12 +32,15 @@ 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
+ };
35
38
  Object.defineProperty(exports, "__esModule", { value: true });
36
39
  const core_1 = require("@oclif/core");
37
40
  const fs = __importStar(require("fs-extra"));
38
41
  const node_child_process_1 = require("node:child_process");
39
42
  const os = __importStar(require("node:os"));
40
- const path = __importStar(require("node:path"));
43
+ const node_path_1 = __importDefault(require("node:path"));
41
44
  const node_util_1 = require("node:util");
42
45
  const Tarballs = __importStar(require("../../tarballs"));
43
46
  const upload_util_1 = require("../../upload-util");
@@ -205,9 +208,9 @@ the CLI should already exist in a directory named after the CLI that is the root
205
208
  pruneLockfiles: flags['prune-lockfiles'],
206
209
  tarball: flags.tarball,
207
210
  });
208
- const scriptsDir = path.join(buildConfig.tmp, 'macos/scripts');
211
+ const scriptsDir = node_path_1.default.join(buildConfig.tmp, 'macos/scripts');
209
212
  await fs.emptyDir(buildConfig.dist('macos'));
210
- const noBundleConfigurationPath = path.join(buildConfig.tmp, 'macos', 'no-bundle.plist');
213
+ const noBundleConfigurationPath = node_path_1.default.join(buildConfig.tmp, 'macos', 'no-bundle.plist');
211
214
  const build = async (arch) => {
212
215
  const templateKey = (0, upload_util_1.templateShortKey)('macos', {
213
216
  arch,
@@ -218,14 +221,14 @@ the CLI should already exist in a directory named after the CLI that is the root
218
221
  const dist = buildConfig.dist(`macos/${templateKey}`);
219
222
  const rootDir = buildConfig.workspace({ arch, platform: 'darwin' });
220
223
  const writeNoBundleConfiguration = async () => {
221
- await fs.mkdir(path.dirname(noBundleConfigurationPath), { recursive: true });
224
+ await fs.mkdir(node_path_1.default.dirname(noBundleConfigurationPath), { recursive: true });
222
225
  await fs.writeFile(noBundleConfigurationPath, noBundleConfiguration, { mode: 0o755 });
223
226
  };
224
227
  const writeScript = async (script) => {
225
228
  const scriptLocation = script === 'uninstall' ? [rootDir, 'bin'] : [scriptsDir];
226
229
  scriptLocation.push(script);
227
- await fs.mkdir(path.dirname(path.join(...scriptLocation)), { recursive: true });
228
- await fs.writeFile(path.join(...scriptLocation), scripts[script](config, flags['additional-cli']), {
230
+ await fs.mkdir(node_path_1.default.dirname(node_path_1.default.join(...scriptLocation)), { recursive: true });
231
+ await fs.writeFile(node_path_1.default.join(...scriptLocation), scripts[script](config, flags['additional-cli']), {
229
232
  mode: 0o755,
230
233
  });
231
234
  };
@@ -32,13 +32,16 @@ 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
+ };
35
38
  Object.defineProperty(exports, "__esModule", { value: true });
36
39
  const core_1 = require("@oclif/core");
37
40
  const fs_extra_1 = require("fs-extra");
38
41
  const node_child_process_1 = require("node:child_process");
39
42
  const node_fs_1 = require("node:fs");
40
43
  const promises_1 = require("node:fs/promises");
41
- const path = __importStar(require("node:path"));
44
+ const node_path_1 = __importDefault(require("node:path"));
42
45
  const node_util_1 = require("node:util");
43
46
  const Tarballs = __importStar(require("../../tarballs"));
44
47
  const upload_util_1 = require("../../upload-util");
@@ -52,7 +55,7 @@ set ${additionalCLI ? `${additionalCLI.toUpperCase()}_BINPATH` : config.scopedEn
52
55
  if exist "%LOCALAPPDATA%\\${config.dirname}\\client\\bin\\${additionalCLI ?? config.bin}.cmd" (
53
56
  "%LOCALAPPDATA%\\${config.dirname}\\client\\bin\\${additionalCLI ?? config.bin}.cmd" %*
54
57
  ) else (
55
- "%~dp0\\..\\client\\bin\\node.exe" ${`${nodeOptions?.join(' ')} `}"%~dp0\\..\\client\\${additionalCLI ? `${additionalCLI}\\bin\\run` : 'bin\\run'}" %*
58
+ "%~dp0\\..\\client\\bin\\node.exe" ${`${nodeOptions?.join(' ')} `}"%~dp0\\..\\client\\${additionalCLI ? `${additionalCLI}\\bin\\run` : String.raw `bin\run`}" %*
56
59
  )
57
60
  `,
58
61
  nsis: ({ arch, config, customization, defenderOptional, hideDefenderOption, }) => `!include MUI2.nsh
@@ -285,13 +288,13 @@ the CLI should already exist in a directory named after the CLI that is the root
285
288
  tarball: flags.tarball,
286
289
  });
287
290
  await Promise.all(arches.map(async (arch) => {
288
- const installerBase = path.join(buildConfig.tmp, `windows-${arch}-installer`);
291
+ const installerBase = node_path_1.default.join(buildConfig.tmp, `windows-${arch}-installer`);
289
292
  await (0, promises_1.rm)(installerBase, { force: true, recursive: true });
290
- await (0, promises_1.mkdir)(path.join(installerBase, 'bin'), { recursive: true });
293
+ await (0, promises_1.mkdir)(node_path_1.default.join(installerBase, 'bin'), { recursive: true });
291
294
  await Promise.all([
292
- (0, promises_1.writeFile)(path.join(installerBase, 'bin', `${config.bin}.cmd`), scripts.cmd(config, undefined, buildConfig.nodeOptions)),
293
- (0, promises_1.writeFile)(path.join(installerBase, 'bin', `${config.bin}`), scripts.sh(config)),
294
- (0, promises_1.writeFile)(path.join(installerBase, `${config.bin}.nsi`), scripts.nsis({
295
+ (0, promises_1.writeFile)(node_path_1.default.join(installerBase, 'bin', `${config.bin}.cmd`), scripts.cmd(config, undefined, buildConfig.nodeOptions)),
296
+ (0, promises_1.writeFile)(node_path_1.default.join(installerBase, 'bin', `${config.bin}`), scripts.sh(config)),
297
+ (0, promises_1.writeFile)(node_path_1.default.join(installerBase, `${config.bin}.nsi`), scripts.nsis({
295
298
  arch,
296
299
  config,
297
300
  customization: nsisCustomization,
@@ -304,18 +307,18 @@ the CLI should already exist in a directory named after the CLI that is the root
304
307
  // write duplicate files for windows aliases
305
308
  // this avoids mklink which can require admin privileges which not everyone has
306
309
  [
307
- (0, promises_1.writeFile)(path.join(installerBase, 'bin', `${alias}.cmd`), scripts.cmd(config)),
308
- (0, promises_1.writeFile)(path.join(installerBase, 'bin', `${alias}`), scripts.sh(config)),
310
+ (0, promises_1.writeFile)(node_path_1.default.join(installerBase, 'bin', `${alias}.cmd`), scripts.cmd(config)),
311
+ (0, promises_1.writeFile)(node_path_1.default.join(installerBase, 'bin', `${alias}`), scripts.sh(config)),
309
312
  ])
310
313
  : []),
311
314
  ...(flags['additional-cli']
312
315
  ? [
313
- (0, promises_1.writeFile)(path.join(installerBase, 'bin', `${flags['additional-cli']}.cmd`), scripts.cmd(config, flags['additional-cli'])),
314
- (0, promises_1.writeFile)(path.join(installerBase, 'bin', `${flags['additional-cli']}`), scripts.sh({ bin: flags['additional-cli'] })),
316
+ (0, promises_1.writeFile)(node_path_1.default.join(installerBase, 'bin', `${flags['additional-cli']}.cmd`), scripts.cmd(config, flags['additional-cli'])),
317
+ (0, promises_1.writeFile)(node_path_1.default.join(installerBase, 'bin', `${flags['additional-cli']}`), scripts.sh({ bin: flags['additional-cli'] })),
315
318
  ]
316
319
  : []),
317
320
  ]);
318
- await (0, fs_extra_1.move)(buildConfig.workspace({ arch, platform: 'win32' }), path.join(installerBase, 'client'));
321
+ await (0, fs_extra_1.move)(buildConfig.workspace({ arch, platform: 'win32' }), node_path_1.default.join(installerBase, 'client'));
319
322
  await exec(`makensis "${installerBase}/${config.bin}.nsi" | grep -v "\\[compress\\]" | grep -v "^File: Descending to"`);
320
323
  const templateKey = (0, upload_util_1.templateShortKey)('win32', {
321
324
  arch,
@@ -324,7 +327,7 @@ the CLI should already exist in a directory named after the CLI that is the root
324
327
  version: config.version,
325
328
  });
326
329
  const o = buildConfig.dist(`win32/${templateKey}`);
327
- await (0, fs_extra_1.move)(path.join(installerBase, 'installer.exe'), o);
330
+ await (0, fs_extra_1.move)(node_path_1.default.join(installerBase, 'installer.exe'), o);
328
331
  const { windows } = config.pjson.oclif;
329
332
  if (windows && windows.name && windows.keypath) {
330
333
  await signWindows(o, arch, config, windows);
@@ -38,7 +38,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  const client_s3_1 = require("@aws-sdk/client-s3");
40
40
  const core_1 = require("@oclif/core");
41
- const path = __importStar(require("node:path"));
41
+ const node_path_1 = __importDefault(require("node:path"));
42
42
  const aws_1 = __importDefault(require("../aws"));
43
43
  const Tarballs = __importStar(require("../tarballs"));
44
44
  const upload_util_1 = require("../upload-util");
@@ -86,8 +86,8 @@ class Promote extends core_1.Command {
86
86
  CacheControl: indexDefaults.maxAge,
87
87
  MetadataDirective: client_s3_1.MetadataDirective.REPLACE,
88
88
  };
89
- const cloudBucketCommitKey = (shortKey) => path.join(s3Config.bucket, (0, upload_util_1.commitAWSDir)(flags.version, flags.sha, s3Config), shortKey);
90
- const cloudChannelKey = (shortKey) => path.join((0, upload_util_1.channelAWSDir)(flags.channel, s3Config), shortKey);
89
+ const cloudBucketCommitKey = (shortKey) => node_path_1.default.join(s3Config.bucket, (0, upload_util_1.commitAWSDir)(flags.version, flags.sha, s3Config), shortKey);
90
+ const cloudChannelKey = (shortKey) => node_path_1.default.join((0, upload_util_1.channelAWSDir)(flags.channel, s3Config), shortKey);
91
91
  // copy tarballs manifests
92
92
  const promoteManifest = async (target) => {
93
93
  const manifest = (0, upload_util_1.templateShortKey)('manifest', {
@@ -38,7 +38,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  const core_1 = require("@oclif/core");
40
40
  const fs = __importStar(require("fs-extra"));
41
- const path = __importStar(require("node:path"));
41
+ const node_path_1 = __importDefault(require("node:path"));
42
42
  const readme_generator_1 = __importDefault(require("../readme-generator"));
43
43
  class Readme extends core_1.Command {
44
44
  static description = `The readme must have any of the following tags inside of it for it to be replaced or else it will do nothing:
@@ -98,8 +98,8 @@ Customize the code URL prefix by setting oclif.repositoryPrefix in package.json.
98
98
  const { flags } = await this.parse(Readme);
99
99
  this.flags = flags;
100
100
  this.flags['plugin-directory'] ??= process.cwd();
101
- const readmePath = path.resolve(this.flags['plugin-directory'], flags['readme-path']);
102
- const tsConfigPath = path.resolve(this.flags['plugin-directory'], flags['tsconfig-path']);
101
+ const readmePath = node_path_1.default.resolve(this.flags['plugin-directory'], flags['readme-path']);
102
+ const tsConfigPath = node_path_1.default.resolve(this.flags['plugin-directory'], flags['tsconfig-path']);
103
103
  if (await fs.pathExists(tsConfigPath)) {
104
104
  const { default: JSONC } = await import('tiny-jsonc');
105
105
  const tsConfigRaw = await fs.readFile(tsConfigPath, 'utf8');
@@ -38,7 +38,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  const core_1 = require("@oclif/core");
40
40
  const fs = __importStar(require("node:fs"));
41
- const path = __importStar(require("node:path"));
41
+ const node_path_1 = __importDefault(require("node:path"));
42
42
  const aws_1 = __importDefault(require("../../aws"));
43
43
  const log_1 = require("../../log");
44
44
  const Tarballs = __importStar(require("../../tarballs"));
@@ -53,7 +53,7 @@ class UploadDeb extends core_1.Command {
53
53
  const { flags } = await this.parse(UploadDeb);
54
54
  const buildConfig = await Tarballs.buildConfig(flags.root);
55
55
  const { config, s3Config } = buildConfig;
56
- const dist = (f) => buildConfig.dist(path.join('deb', f));
56
+ const dist = (f) => buildConfig.dist(node_path_1.default.join('deb', f));
57
57
  const S3Options = {
58
58
  ACL: s3Config.acl || 'public-read',
59
59
  Bucket: s3Config.bucket,
@@ -27,15 +27,15 @@ export type GetFlagOrPromptOptions = {
27
27
  */
28
28
  type: 'input' | 'select';
29
29
  };
30
- export declare function exec(command: string, opts?: {
30
+ export declare function exec(command: string, opts?: ExecOptions & {
31
31
  silent?: boolean;
32
- } & ExecOptions): Promise<{
32
+ }): Promise<{
33
33
  stderr: string;
34
34
  stdout: string;
35
35
  }>;
36
- export declare function readPJSON(location: string): Promise<({
36
+ export declare function readPJSON(location: string): Promise<(Interfaces.PJSON & {
37
37
  scripts: Record<string, string>;
38
- } & Interfaces.PJSON) | undefined>;
38
+ }) | undefined>;
39
39
  export declare function makeFlags<T extends Record<string, FlaggablePrompt>>(flaggablePrompts: T): FlagsOfPrompts<T>;
40
40
  export declare abstract class GeneratorCommand<T extends typeof Command> extends Command {
41
41
  protected args: Args<T>;
package/lib/generator.js CHANGED
@@ -99,28 +99,28 @@ class GeneratorCommand extends core_1.Command {
99
99
  }
100
100
  };
101
101
  switch (type) {
102
- case 'select': {
102
+ case 'input': {
103
103
  return (maybeFlag() ??
104
104
  (await checkMaybeOtherValue()) ??
105
105
  maybeDefault() ??
106
- // Dynamic import because @inquirer/select is ESM only. Once oclif is ESM, we can make this a normal import
106
+ // Dynamic import because @inquirer/input is ESM only. Once oclif is ESM, we can make this a normal import
107
107
  // so that we can avoid importing on every single question.
108
- (await import('@inquirer/select')).default({
109
- choices: (this.flaggablePrompts[name].options ?? []).map((o) => ({ name: o, value: o })),
108
+ (await import('@inquirer/input')).default({
110
109
  default: defaultValue,
111
110
  message: this.flaggablePrompts[name].message,
111
+ validate: this.flaggablePrompts[name].validate,
112
112
  }));
113
113
  }
114
- case 'input': {
114
+ case 'select': {
115
115
  return (maybeFlag() ??
116
116
  (await checkMaybeOtherValue()) ??
117
117
  maybeDefault() ??
118
- // Dynamic import because @inquirer/input is ESM only. Once oclif is ESM, we can make this a normal import
118
+ // Dynamic import because @inquirer/select is ESM only. Once oclif is ESM, we can make this a normal import
119
119
  // so that we can avoid importing on every single question.
120
- (await import('@inquirer/input')).default({
120
+ (await import('@inquirer/select')).default({
121
+ choices: (this.flaggablePrompts[name].options ?? []).map((o) => ({ name: o, value: o })),
121
122
  default: defaultValue,
122
123
  message: this.flaggablePrompts[name].message,
123
- validate: this.flaggablePrompts[name].validate,
124
124
  }));
125
125
  }
126
126
  default: {
package/lib/log.js CHANGED
@@ -1,46 +1,13 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
3
  exports.debug = void 0;
37
4
  exports.log = log;
38
5
  const core_1 = require("@oclif/core");
39
- const util = __importStar(require("node:util"));
6
+ const node_util_1 = require("node:util");
40
7
  const util_1 = require("./util");
41
8
  exports.debug = require('debug')('oclif');
42
9
  exports.debug.new = (name) => require('debug')(`oclif:${name}`);
43
10
  function log(format, ...args) {
44
11
  args = args.map((arg) => (0, util_1.prettifyPaths)(arg));
45
- exports.debug.enabled ? (0, exports.debug)(format, ...args) : core_1.ux.stdout(`oclif: ${util.format(format, ...args)}`);
12
+ return exports.debug.enabled ? (0, exports.debug)(format, ...args) : core_1.ux.stdout(`oclif: ${(0, node_util_1.format)(format, ...args)}`);
46
13
  }
@@ -227,6 +227,7 @@ USAGE
227
227
  /**
228
228
  * fetches the path to a command
229
229
  */
230
+ // eslint-disable-next-line complexity
230
231
  commandPath(plugin, c) {
231
232
  const strategy = typeof plugin.pjson.oclif?.commands === 'string' ? 'pattern' : plugin.pjson.oclif?.commands?.strategy;
232
233
  // if the strategy is explicit, we can't determine the path so return undefined
@@ -32,11 +32,14 @@ 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
+ };
35
38
  Object.defineProperty(exports, "__esModule", { value: true });
36
39
  exports.writeBinScripts = writeBinScripts;
37
40
  const node_child_process_1 = require("node:child_process");
38
41
  const fs = __importStar(require("node:fs"));
39
- const path = __importStar(require("node:path"));
42
+ const node_path_1 = __importDefault(require("node:path"));
40
43
  const node_util_1 = require("node:util");
41
44
  const exec = (0, node_util_1.promisify)(node_child_process_1.exec);
42
45
  async function writeBinScripts({ baseWorkspace, config, nodeOptions, nodeVersion, }) {
@@ -44,7 +47,7 @@ async function writeBinScripts({ baseWorkspace, config, nodeOptions, nodeVersion
44
47
  const redirectedEnvVar = config.scopedEnvVarKey('REDIRECTED');
45
48
  const clientHomeEnvVar = config.scopedEnvVarKey('OCLIF_CLIENT_HOME');
46
49
  const writeWin32 = async (bin) => {
47
- await fs.promises.writeFile(path.join(baseWorkspace, 'bin', `${bin}.cmd`), `@echo off
50
+ await fs.promises.writeFile(node_path_1.default.join(baseWorkspace, 'bin', `${bin}.cmd`), `@echo off
48
51
  setlocal enableextensions
49
52
 
50
53
  if not "%${redirectedEnvVar}%"=="1" if exist "%LOCALAPPDATA%\\${bin}\\client\\bin\\${bin}.cmd" (
@@ -65,7 +68,7 @@ if exist "%~dp0..\\bin\\node.exe" (
65
68
  `);
66
69
  };
67
70
  const writeUnix = async () => {
68
- const bin = path.join(baseWorkspace, 'bin', config.bin);
71
+ const bin = node_path_1.default.join(baseWorkspace, 'bin', config.bin);
69
72
  await fs.promises.writeFile(bin, `#!/usr/bin/env bash
70
73
  set -e
71
74
  echoerr() { echo "$@" 1>&2; }
@@ -118,6 +121,6 @@ fi
118
121
  writeUnix(),
119
122
  ...(config.binAliases?.map((alias) => process.platform === 'win32'
120
123
  ? writeWin32(alias)
121
- : exec(`ln -sf ${config.bin} ${alias}`, { cwd: path.join(baseWorkspace, 'bin') })) ?? []),
124
+ : exec(`ln -sf ${config.bin} ${alias}`, { cwd: node_path_1.default.join(baseWorkspace, 'bin') })) ?? []),
122
125
  ]);
123
126
  }
@@ -1,37 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
36
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
4
  };
@@ -43,7 +10,7 @@ const fs_extra_1 = require("fs-extra");
43
10
  const node_child_process_1 = require("node:child_process");
44
11
  const node_fs_1 = require("node:fs");
45
12
  const promises_1 = require("node:fs/promises");
46
- const path = __importStar(require("node:path"));
13
+ const node_path_1 = __importDefault(require("node:path"));
47
14
  const node_util_1 = require("node:util");
48
15
  const semver_1 = require("semver");
49
16
  const log_1 = require("../log");
@@ -53,21 +20,24 @@ const bin_1 = require("./bin");
53
20
  const node_1 = require("./node");
54
21
  const exec = (0, node_util_1.promisify)(node_child_process_1.exec);
55
22
  const pack = async (from, to) => {
56
- const cwd = path.dirname(from);
57
- await (0, promises_1.mkdir)(path.dirname(to), { recursive: true });
58
- (0, log_1.log)(`packing tarball from ${(0, util_1.prettifyPaths)(path.dirname(from))} to ${(0, util_1.prettifyPaths)(to)}`);
59
- to.endsWith('gz')
60
- ? await exec(`tar czf ${to} ${path.basename(from)}${process.platform === 'win32' ? ' --force-local' : ''}`, { cwd })
61
- : await exec(`tar cfJ ${to} ${path.basename(from)}${process.platform === 'win32' ? ' --force-local' : ''}`, { cwd });
23
+ const cwd = node_path_1.default.dirname(from);
24
+ await (0, promises_1.mkdir)(node_path_1.default.dirname(to), { recursive: true });
25
+ (0, log_1.log)(`packing tarball from ${(0, util_1.prettifyPaths)(node_path_1.default.dirname(from))} to ${(0, util_1.prettifyPaths)(to)}`);
26
+ if (to.endsWith('gz')) {
27
+ return exec(`tar czf ${to} ${node_path_1.default.basename(from)}${process.platform === 'win32' ? ' --force-local' : ''}`, {
28
+ cwd,
29
+ });
30
+ }
31
+ await exec(`tar cfJ ${to} ${node_path_1.default.basename(from)}${process.platform === 'win32' ? ' --force-local' : ''}`, { cwd });
62
32
  };
63
33
  const isYarnProject = (yarnRootPath) => {
64
34
  const yarnLockFileName = 'yarn.lock';
65
- const rootYarnLockFilePath = path.join(yarnRootPath, yarnLockFileName);
35
+ const rootYarnLockFilePath = node_path_1.default.join(yarnRootPath, yarnLockFileName);
66
36
  return (0, node_fs_1.existsSync)(rootYarnLockFilePath);
67
37
  };
68
38
  const copyYarnDirectory = async (relativePath, yarnRootPath, workspacePath) => {
69
- const rootYarnDirectoryPath = path.join(yarnRootPath, relativePath);
70
- const workspaceYarnDirectoryPath = path.join(workspacePath, relativePath);
39
+ const rootYarnDirectoryPath = node_path_1.default.join(yarnRootPath, relativePath);
40
+ const workspaceYarnDirectoryPath = node_path_1.default.join(workspacePath, relativePath);
71
41
  if ((0, node_fs_1.existsSync)(rootYarnDirectoryPath)) {
72
42
  // create the directory if it does not exist
73
43
  if (!(0, node_fs_1.existsSync)(workspaceYarnDirectoryPath)) {
@@ -80,15 +50,15 @@ const copyYarnDirectory = async (relativePath, yarnRootPath, workspacePath) => {
80
50
  const copyCoreYarnFiles = async (yarnRootPath, workspacePath) => {
81
51
  // copy yarn dependencies lock file
82
52
  const yarnLockFileName = 'yarn.lock';
83
- const rootYarnLockFilePath = path.join(yarnRootPath, yarnLockFileName);
84
- const workspaceYarnLockFilePath = path.join(workspacePath, yarnLockFileName);
53
+ const rootYarnLockFilePath = node_path_1.default.join(yarnRootPath, yarnLockFileName);
54
+ const workspaceYarnLockFilePath = node_path_1.default.join(workspacePath, yarnLockFileName);
85
55
  if ((0, node_fs_1.existsSync)(rootYarnLockFilePath)) {
86
56
  await (0, fs_extra_1.copy)(rootYarnLockFilePath, workspaceYarnLockFilePath);
87
57
  }
88
58
  // copy yarn configuration file
89
59
  const yarnConfigFileName = '.yarnrc.yml';
90
- const rootYarnConfigFilePath = path.join(yarnRootPath, yarnConfigFileName);
91
- const workspaceYarnConfigFilePath = path.join(workspacePath, yarnConfigFileName);
60
+ const rootYarnConfigFilePath = node_path_1.default.join(yarnRootPath, yarnConfigFileName);
61
+ const workspaceYarnConfigFilePath = node_path_1.default.join(workspacePath, yarnConfigFileName);
92
62
  if ((0, node_fs_1.existsSync)(rootYarnConfigFilePath)) {
93
63
  await (0, fs_extra_1.copy)(rootYarnConfigFilePath, workspaceYarnConfigFilePath);
94
64
  }
@@ -137,26 +107,26 @@ const isLockFile = (f) => f.endsWith('package-lock.json') ||
137
107
  /** recursively remove all lockfiles from tarball after installing dependencies */
138
108
  const removeLockfiles = async (c) => {
139
109
  const files = await (0, promises_1.readdir)(c.workspace(), { recursive: true });
140
- const lockfiles = files.filter((f) => isLockFile(f)).map((f) => path.join(c.workspace(), f));
110
+ const lockfiles = files.filter((f) => isLockFile(f)).map((f) => node_path_1.default.join(c.workspace(), f));
141
111
  (0, log_1.log)(`removing ${lockfiles.length} lockfiles`);
142
112
  await Promise.all(lockfiles.map((f) => (0, fs_extra_1.remove)(f)));
143
113
  };
144
114
  /** runs the pretarball script from the cli being packed */
145
115
  const pretarball = async (c) => {
146
- const pjson = await (0, fs_extra_1.readJSON)(path.join(c.workspace(), 'package.json'));
116
+ const pjson = await (0, fs_extra_1.readJSON)(node_path_1.default.join(c.workspace(), 'package.json'));
147
117
  if (!pjson.scripts.pretarball)
148
118
  return;
149
119
  const yarnRoot = (0, find_yarn_workspace_root_1.default)(c.root) || c.root;
150
120
  let script = 'npm run pretarball';
151
- if ((0, node_fs_1.existsSync)(path.join(yarnRoot, 'yarn.lock')))
121
+ if ((0, node_fs_1.existsSync)(node_path_1.default.join(yarnRoot, 'yarn.lock')))
152
122
  script = 'yarn run pretarball';
153
- else if ((0, node_fs_1.existsSync)(path.join(c.root, 'pnpm-lock.yaml')))
123
+ else if ((0, node_fs_1.existsSync)(node_path_1.default.join(c.root, 'pnpm-lock.yaml')))
154
124
  script = 'pnpm run pretarball';
155
125
  (0, log_1.log)(`running pretarball via ${script} in ${c.workspace()}`);
156
126
  await exec(script, { cwd: c.workspace() });
157
127
  };
158
128
  const updatePJSON = async (c) => {
159
- const pjsonPath = path.join(c.workspace(), 'package.json');
129
+ const pjsonPath = node_path_1.default.join(c.workspace(), 'package.json');
160
130
  const pjson = await (0, fs_extra_1.readJSON)(pjsonPath);
161
131
  pjson.version = c.config.version;
162
132
  pjson.oclif.update = pjson.oclif.update ?? {};
@@ -188,35 +158,35 @@ const addDependencies = async (c) => {
188
158
  }
189
159
  }
190
160
  }
191
- else if ((0, node_fs_1.existsSync)(path.join(c.root, 'pnpm-lock.yaml'))) {
192
- await (0, fs_extra_1.copy)(path.join(c.root, 'pnpm-lock.yaml'), path.join(c.workspace(), 'pnpm-lock.yaml'));
161
+ else if ((0, node_fs_1.existsSync)(node_path_1.default.join(c.root, 'pnpm-lock.yaml'))) {
162
+ await (0, fs_extra_1.copy)(node_path_1.default.join(c.root, 'pnpm-lock.yaml'), node_path_1.default.join(c.workspace(), 'pnpm-lock.yaml'));
193
163
  await exec('pnpm install --production', { cwd: c.workspace() });
194
164
  }
195
165
  else {
196
- const lockpath = (0, node_fs_1.existsSync)(path.join(c.root, 'package-lock.json'))
197
- ? path.join(c.root, 'package-lock.json')
198
- : path.join(c.root, 'npm-shrinkwrap.json');
199
- await (0, fs_extra_1.copy)(lockpath, path.join(c.workspace(), path.basename(lockpath)));
166
+ const lockpath = (0, node_fs_1.existsSync)(node_path_1.default.join(c.root, 'package-lock.json'))
167
+ ? node_path_1.default.join(c.root, 'package-lock.json')
168
+ : node_path_1.default.join(c.root, 'npm-shrinkwrap.json');
169
+ await (0, fs_extra_1.copy)(lockpath, node_path_1.default.join(c.workspace(), node_path_1.default.basename(lockpath)));
200
170
  await exec('npm install --production', { cwd: c.workspace() });
201
171
  }
202
172
  };
203
173
  const packCLI = async (c) => {
204
174
  const { stdout } = await exec('npm pack --unsafe-perm', { cwd: c.root });
205
- return path.join(c.root, stdout.trim().split('\n').pop());
175
+ return node_path_1.default.join(c.root, stdout.trim().split('\n').pop());
206
176
  };
207
177
  const extractCLI = async (tarball, c) => {
208
178
  const workspace = c.workspace();
209
179
  await (0, fs_extra_1.emptyDir)(workspace);
210
- const tarballNewLocation = path.join(workspace, path.basename(tarball));
180
+ const tarballNewLocation = node_path_1.default.join(workspace, node_path_1.default.basename(tarball));
211
181
  await (0, fs_extra_1.move)(tarball, tarballNewLocation);
212
182
  const tarCommand = `tar -xzf "${tarballNewLocation}"${process.platform === 'win32' ? ' --force-local' : ''}`;
213
183
  await exec(tarCommand, { cwd: workspace });
214
- const files = await (0, promises_1.readdir)(path.join(workspace, 'package'), { withFileTypes: true });
215
- await Promise.all(files.map((i) => (0, fs_extra_1.move)(path.join(workspace, 'package', i.name), path.join(workspace, i.name))));
184
+ const files = await (0, promises_1.readdir)(node_path_1.default.join(workspace, 'package'), { withFileTypes: true });
185
+ await Promise.all(files.map((i) => (0, fs_extra_1.move)(node_path_1.default.join(workspace, 'package', i.name), node_path_1.default.join(workspace, i.name))));
216
186
  await Promise.all([
217
- (0, promises_1.rm)(path.join(workspace, 'package'), { recursive: true }),
218
- (0, promises_1.rm)(path.join(workspace, path.basename(tarball)), { recursive: true }),
219
- (0, fs_extra_1.remove)(path.join(workspace, 'bin', 'run.cmd')),
187
+ (0, promises_1.rm)(node_path_1.default.join(workspace, 'package'), { recursive: true }),
188
+ (0, promises_1.rm)(node_path_1.default.join(workspace, node_path_1.default.basename(tarball)), { recursive: true }),
189
+ (0, fs_extra_1.remove)(node_path_1.default.join(workspace, 'bin', 'run.cmd')),
220
190
  ]);
221
191
  };
222
192
  const buildTarget = async (target, c, options) => {
@@ -230,7 +200,7 @@ const buildTarget = async (target, c, options) => {
230
200
  const { gitSha: sha } = c;
231
201
  const templateShortKeyCommonOptions = { arch, bin, platform, sha, version };
232
202
  const [gzLocalKey, xzLocalKey] = ['.tar.gz', '.tar.xz'].map((ext) => (0, upload_util_1.templateShortKey)('versioned', { ...templateShortKeyCommonOptions, ext }));
233
- const base = path.basename(gzLocalKey);
203
+ const base = node_path_1.default.basename(gzLocalKey);
234
204
  (0, log_1.log)(`building target ${base}`);
235
205
  (0, log_1.log)('copying workspace', c.workspace(), workspace);
236
206
  await (0, fs_extra_1.emptyDir)(workspace);
@@ -238,9 +208,9 @@ const buildTarget = async (target, c, options) => {
238
208
  await (0, node_1.fetchNodeBinary)({
239
209
  arch,
240
210
  nodeVersion: c.nodeVersion,
241
- output: path.join(workspace, 'bin', 'node'),
211
+ output: node_path_1.default.join(workspace, 'bin', 'node'),
242
212
  platform,
243
- tmp: path.join(c.config.root, 'tmp'),
213
+ tmp: node_path_1.default.join(c.config.root, 'tmp'),
244
214
  });
245
215
  if (options.pack === false)
246
216
  return;
@@ -1,17 +1,17 @@
1
1
  import { ObjectCannedACL } from '@aws-sdk/client-s3';
2
2
  import { Interfaces } from '@oclif/core';
3
3
  export declare const TARGETS: string[];
4
- export type S3Config = {
4
+ export type S3Config = BuildConfig['updateConfig']['s3'] & {
5
5
  acl?: ObjectCannedACL;
6
6
  } & {
7
7
  folder?: string;
8
8
  indexVersionLimit?: number;
9
- } & BuildConfig['updateConfig']['s3'];
10
- export type UpdateConfig = {
11
- s3?: {
9
+ };
10
+ export type UpdateConfig = Interfaces.OclifConfiguration['update'] & {
11
+ s3?: Interfaces.S3 & {
12
12
  acl?: ObjectCannedACL;
13
- } & Interfaces.S3;
14
- } & Interfaces.OclifConfiguration['update'];
13
+ };
14
+ };
15
15
  export type BuildConfig = {
16
16
  config: Interfaces.Config;
17
17
  dist(input: string): string;
@@ -32,6 +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
+ };
35
38
  Object.defineProperty(exports, "__esModule", { value: true });
36
39
  exports.TARGETS = void 0;
37
40
  exports.gitSha = gitSha;
@@ -39,7 +42,7 @@ exports.buildConfig = buildConfig;
39
42
  const core_1 = require("@oclif/core");
40
43
  const node_child_process_1 = require("node:child_process");
41
44
  const promises_1 = require("node:fs/promises");
42
- const path = __importStar(require("node:path"));
45
+ const node_path_1 = __importDefault(require("node:path"));
43
46
  const node_util_1 = require("node:util");
44
47
  const semver = __importStar(require("semver"));
45
48
  const upload_util_1 = require("../upload-util");
@@ -61,12 +64,12 @@ async function gitSha(cwd, options = {}) {
61
64
  return stdout.trim();
62
65
  }
63
66
  async function Tmp(config) {
64
- const tmp = path.join(config.root, 'tmp');
67
+ const tmp = node_path_1.default.join(config.root, 'tmp');
65
68
  await (0, promises_1.mkdir)(tmp, { recursive: true });
66
69
  return tmp;
67
70
  }
68
71
  async function buildConfig(root, options = {}) {
69
- const config = await core_1.Config.load({ devPlugins: false, root: path.resolve(root), userPlugins: false });
72
+ const config = await core_1.Config.load({ devPlugins: false, root: node_path_1.default.resolve(root), userPlugins: false });
70
73
  root = config.root;
71
74
  const _gitSha = await gitSha(root, { short: true });
72
75
  // eslint-disable-next-line new-cap
@@ -93,7 +96,7 @@ async function buildConfig(root, options = {}) {
93
96
  };
94
97
  return {
95
98
  config,
96
- dist: (...args) => path.join(config.root, 'dist', ...args),
99
+ dist: (...args) => node_path_1.default.join(config.root, 'dist', ...args),
97
100
  gitSha: _gitSha,
98
101
  nodeOptions,
99
102
  nodeVersion,
@@ -103,10 +106,10 @@ async function buildConfig(root, options = {}) {
103
106
  tmp,
104
107
  updateConfig,
105
108
  workspace(target) {
106
- const base = path.join(config.root, 'tmp');
109
+ const base = node_path_1.default.join(config.root, 'tmp');
107
110
  if (target && target.platform)
108
- return path.join(base, [target.platform, target.arch].join('-'), (0, upload_util_1.templateShortKey)('baseDir', { bin: config.bin }));
109
- return path.join(base, (0, upload_util_1.templateShortKey)('baseDir', { bin: config.bin }));
111
+ return node_path_1.default.join(base, [target.platform, target.arch].join('-'), (0, upload_util_1.templateShortKey)('baseDir', { bin: config.bin }));
112
+ return node_path_1.default.join(base, (0, upload_util_1.templateShortKey)('baseDir', { bin: config.bin }));
110
113
  },
111
114
  xz: options?.xz ?? updateConfig?.s3?.xz ?? true,
112
115
  };
@@ -1,37 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
36
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
4
  };
@@ -42,7 +9,7 @@ const fs_extra_1 = require("fs-extra");
42
9
  const node_child_process_1 = require("node:child_process");
43
10
  const node_fs_1 = require("node:fs");
44
11
  const promises_1 = require("node:fs/promises");
45
- const path = __importStar(require("node:path"));
12
+ const node_path_1 = __importDefault(require("node:path"));
46
13
  const promises_2 = require("node:stream/promises");
47
14
  const node_util_1 = require("node:util");
48
15
  const log_1 = require("../log");
@@ -53,44 +20,44 @@ async function fetchNodeBinary({ arch, nodeVersion, output, platform, tmp }) {
53
20
  if (arch === 'arm')
54
21
  arch = 'armv7l';
55
22
  let nodeBase = `node-v${nodeVersion}-${platform}-${arch}`;
56
- let tarball = path.join(tmp, 'node', `${nodeBase}.tar.xz`);
23
+ let tarball = node_path_1.default.join(tmp, 'node', `${nodeBase}.tar.xz`);
57
24
  let url = `https://nodejs.org/dist/v${nodeVersion}/${nodeBase}.tar.xz`;
58
25
  if (platform === 'win32') {
59
26
  await (0, util_1.checkFor7Zip)();
60
27
  nodeBase = `node-v${nodeVersion}-win-${arch}`;
61
- tarball = path.join(tmp, 'node', `${nodeBase}.7z`);
28
+ tarball = node_path_1.default.join(tmp, 'node', `${nodeBase}.7z`);
62
29
  url = `https://nodejs.org/dist/v${nodeVersion}/${nodeBase}.7z`;
63
30
  output += '.exe';
64
31
  }
65
- let cache = path.join(tmp, 'cache', `node-v${nodeVersion}-${platform}-${arch}`);
32
+ let cache = node_path_1.default.join(tmp, 'cache', `node-v${nodeVersion}-${platform}-${arch}`);
66
33
  if (platform === 'win32')
67
34
  cache += '.exe';
68
35
  const download = async () => {
69
36
  (0, log_1.log)(`downloading ${nodeBase} (${url})`);
70
- await Promise.all([(0, fs_extra_1.ensureDir)(path.join(tmp, 'cache', nodeVersion)), (0, fs_extra_1.ensureDir)(path.join(tmp, 'node'))]);
71
- const shasums = path.join(tmp, 'cache', nodeVersion, 'SHASUMS256.txt.asc');
37
+ await Promise.all([(0, fs_extra_1.ensureDir)(node_path_1.default.join(tmp, 'cache', nodeVersion)), (0, fs_extra_1.ensureDir)(node_path_1.default.join(tmp, 'node'))]);
38
+ const shasums = node_path_1.default.join(tmp, 'cache', nodeVersion, 'SHASUMS256.txt.asc');
72
39
  const { default: got } = await import('got');
73
40
  if (!(0, node_fs_1.existsSync)(shasums)) {
74
41
  await (0, promises_2.pipeline)(got.stream(`https://nodejs.org/dist/v${nodeVersion}/SHASUMS256.txt.asc`), (0, node_fs_1.createWriteStream)(shasums));
75
42
  }
76
- const basedir = path.dirname(tarball);
43
+ const basedir = node_path_1.default.dirname(tarball);
77
44
  await (0, promises_1.mkdir)(basedir, { recursive: true });
78
45
  await (0, promises_2.pipeline)(got.stream(url), (0, node_fs_1.createWriteStream)(tarball));
79
46
  if (platform !== 'win32')
80
- await exec(`grep "${path.basename(tarball)}" "${shasums}" | shasum -a 256 -c -`, { cwd: basedir });
47
+ await exec(`grep "${node_path_1.default.basename(tarball)}" "${shasums}" | shasum -a 256 -c -`, { cwd: basedir });
81
48
  };
82
49
  const extract = async () => {
83
50
  (0, log_1.log)(`extracting ${nodeBase}`);
84
- const nodeTmp = path.join(tmp, 'node');
51
+ const nodeTmp = node_path_1.default.join(tmp, 'node');
85
52
  await (0, promises_1.mkdir)(nodeTmp, { recursive: true });
86
- await (0, promises_1.mkdir)(path.dirname(cache), { recursive: true });
53
+ await (0, promises_1.mkdir)(node_path_1.default.dirname(cache), { recursive: true });
87
54
  if (platform === 'win32') {
88
55
  await exec(`7z x -bd -y "${tarball}"`, { cwd: nodeTmp });
89
- await (0, fs_extra_1.move)(path.join(nodeTmp, nodeBase, 'node.exe'), path.join(cache, 'node.exe'));
56
+ await (0, fs_extra_1.move)(node_path_1.default.join(nodeTmp, nodeBase, 'node.exe'), node_path_1.default.join(cache, 'node.exe'));
90
57
  }
91
58
  else {
92
59
  await exec(`tar -C "${tmp}/node" -xJf "${tarball}"`);
93
- await (0, fs_extra_1.move)(path.join(nodeTmp, nodeBase, 'bin', 'node'), path.join(cache, 'node'));
60
+ await (0, fs_extra_1.move)(node_path_1.default.join(nodeTmp, nodeBase, 'bin', 'node'), node_path_1.default.join(cache, 'node'));
94
61
  }
95
62
  };
96
63
  if (!(0, node_fs_1.existsSync)(cache)) {
@@ -105,7 +72,7 @@ async function fetchNodeBinary({ arch, nodeVersion, output, platform, tmp }) {
105
72
  });
106
73
  await extract();
107
74
  }
108
- await (0, fs_extra_1.copy)(path.join(cache, getFilename(platform)), output);
75
+ await (0, fs_extra_1.copy)(node_path_1.default.join(cache, getFilename(platform)), output);
109
76
  return output;
110
77
  }
111
78
  const getFilename = (platform) => (platform === 'win32' ? 'node.exe' : 'node');
@@ -2,14 +2,14 @@ import { Interfaces } from '@oclif/core';
2
2
  import { BuildConfig as TarballConfig } from './tarballs/config';
3
3
  export declare function commitAWSDir(version: string, sha: string, s3Config: TarballConfig['s3Config']): string;
4
4
  export declare function channelAWSDir(channel: string, s3Config: TarballConfig['s3Config']): string;
5
- type TemplateOptions = {
5
+ type TemplateOptions = Interfaces.Config.s3Key.Options | {
6
6
  arch?: DebArch | Interfaces.ArchTypes;
7
7
  bin?: string;
8
8
  ext?: '.tar.gz' | '.tar.xz';
9
9
  sha?: string;
10
10
  version?: string;
11
11
  versionShaRevision?: string;
12
- } | Interfaces.Config.s3Key.Options;
12
+ };
13
13
  export declare function templateShortKey(type: 'deb' | 'macos' | 'win32' | keyof Interfaces.S3Templates, options?: TemplateOptions): string;
14
14
  export type DebArch = 'amd64' | 'arm64' | 'armel' | 'i386';
15
15
  export declare function debArch(arch: Interfaces.ArchTypes): DebArch;
package/lib/util.js CHANGED
@@ -116,7 +116,7 @@ const sortVersionsObjectByKeysDesc = (input) => {
116
116
  return result;
117
117
  };
118
118
  exports.sortVersionsObjectByKeysDesc = sortVersionsObjectByKeysDesc;
119
- const homeRegexp = new RegExp(`\\B${os.homedir().replace('/', '\\/')}`, 'g');
119
+ const homeRegexp = new RegExp(`\\B${os.homedir().replace('/', String.raw `\/`)}`, 'g');
120
120
  const curRegexp = new RegExp(`\\B${process.cwd()}`, 'g');
121
121
  const prettifyPaths = (input) => (input ?? '').toString().replace(curRegexp, '.').replace(homeRegexp, '~');
122
122
  exports.prettifyPaths = prettifyPaths;
@@ -39,7 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.appendToIndex = void 0;
40
40
  const client_s3_1 = require("@aws-sdk/client-s3");
41
41
  const fs = __importStar(require("fs-extra"));
42
- const path = __importStar(require("node:path"));
42
+ const node_path_1 = __importDefault(require("node:path"));
43
43
  const aws_1 = __importDefault(require("./aws"));
44
44
  const log_1 = require("./log");
45
45
  const debug = log_1.debug.new('version-indexes');
@@ -81,7 +81,7 @@ const appendToIndex = async (input) => {
81
81
  // json-friendly filenames like sfdx-linux-x64-tar-gz
82
82
  const jsonFileName = `${filename.replaceAll('.', '-')}.json`;
83
83
  // folder is optional, but honored if present
84
- const key = path.join(s3Config.folder ?? '', 'versions', jsonFileName);
84
+ const key = node_path_1.default.join(s3Config.folder ?? '', 'versions', jsonFileName);
85
85
  // retrieve existing index file
86
86
  let existing = {};
87
87
  try {
@@ -1131,5 +1131,5 @@
1131
1131
  ]
1132
1132
  }
1133
1133
  },
1134
- "version": "4.17.19"
1134
+ "version": "4.17.20"
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.19",
4
+ "version": "4.17.20",
5
5
  "author": "Salesforce",
6
6
  "bin": {
7
7
  "oclif": "bin/run.js"
@@ -35,6 +35,7 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@commitlint/config-conventional": "^19",
38
+ "@eslint/compat": "^1.2.5",
38
39
  "@oclif/plugin-legacy": "^2.0.19",
39
40
  "@oclif/prettier-config": "^0.2.1",
40
41
  "@oclif/test": "^4",
@@ -53,11 +54,10 @@
53
54
  "@types/validate-npm-package-name": "^4.0.2",
54
55
  "chai": "^4.5.0",
55
56
  "commitlint": "^19",
56
- "eslint": "^8.57.1",
57
- "eslint-config-oclif": "^5.2.2",
58
- "eslint-config-oclif-typescript": "^3.1.13",
59
- "eslint-config-prettier": "^9.0.0",
60
- "eslint-plugin-perfectionist": "^2.11.0",
57
+ "eslint": "^9",
58
+ "eslint-config-oclif": "^6",
59
+ "eslint-config-prettier": "^10",
60
+ "eslint-plugin-perfectionist": "^4",
61
61
  "husky": "^9.1.7",
62
62
  "lint-staged": "^15",
63
63
  "mocha": "^10.8.2",
@@ -74,9 +74,9 @@
74
74
  },
75
75
  "files": [
76
76
  "oclif.manifest.json",
77
- "/bin",
78
- "/lib",
79
- "/templates"
77
+ "./bin",
78
+ "./lib",
79
+ "./templates"
80
80
  ],
81
81
  "homepage": "https://github.com/oclif/oclif",
82
82
  "keywords": [
@@ -129,7 +129,7 @@
129
129
  "commitlint": "commitlint",
130
130
  "compile": "tsc",
131
131
  "format": "prettier --write \"+(src|test)/**/*.+(ts|js|json)\"",
132
- "lint": "eslint . --ext .ts",
132
+ "lint": "eslint",
133
133
  "postpack": "shx rm oclif.manifest.json",
134
134
  "posttest": "yarn run lint",
135
135
  "prepack": "yarn build && bin/run.js manifest",
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node_modules/.bin/ts-node
2
- // eslint-disable-next-line node/shebang, unicorn/prefer-top-level-await
2
+
3
+ // eslint-disable-next-line unicorn/prefer-top-level-await
3
4
  ;(async () => {
4
5
  const oclif = await import('@oclif/core')
5
6
  await oclif.execute({development: true, dir: __dirname})
@@ -0,0 +1,19 @@
1
+ import {includeIgnoreFile} from '@eslint/compat'
2
+ import oclif from 'eslint-config-oclif'
3
+ import prettier from 'eslint-config-prettier'
4
+ import path from 'node:path'
5
+ import {fileURLToPath} from 'node:url'
6
+
7
+ const gitignorePath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '.gitignore')
8
+
9
+ export default [
10
+ includeIgnoreFile(gitignorePath),
11
+ ...oclif,
12
+ prettier,
13
+ {
14
+ rules: {
15
+ // Turn off to support Node 18. You can remove this rule if you don't need to support Node 18.
16
+ 'unicorn/prefer-module': 'off',
17
+ }
18
+ }
19
+ ]
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env -S node --loader ts-node/esm --disable-warning=ExperimentalWarning
2
2
 
3
- // eslint-disable-next-line n/shebang
4
3
  import {execute} from '@oclif/core'
5
4
 
6
5
  await execute({development: true, dir: import.meta.url})
@@ -0,0 +1,9 @@
1
+ import {includeIgnoreFile} from '@eslint/compat'
2
+ import oclif from 'eslint-config-oclif'
3
+ import prettier from 'eslint-config-prettier'
4
+ import path from 'node:path'
5
+ import {fileURLToPath} from 'node:url'
6
+
7
+ const gitignorePath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '.gitignore')
8
+
9
+ export default [includeIgnoreFile(gitignorePath), ...oclif, prettier]
@@ -13,16 +13,16 @@
13
13
  "@oclif/plugin-plugins": "^5"
14
14
  },
15
15
  "devDependencies": {
16
+ "@eslint/compat": "^1",
16
17
  "@oclif/prettier-config": "^0.2.1",
17
18
  "@oclif/test": "^4",
18
19
  "@types/chai": "^4",
19
20
  "@types/mocha": "^10",
20
21
  "@types/node": "^18",
21
22
  "chai": "^4",
22
- "eslint": "^8",
23
- "eslint-config-oclif": "^5",
24
- "eslint-config-oclif-typescript": "^3",
25
- "eslint-config-prettier": "^9",
23
+ "eslint": "^9",
24
+ "eslint-config-oclif": "^6",
25
+ "eslint-config-prettier": "^10",
26
26
  "mocha": "^10",
27
27
  "oclif": "^4",
28
28
  "shx": "^0.3.3",
@@ -33,9 +33,9 @@
33
33
  "node": ">=18.0.0"
34
34
  },
35
35
  "files": [
36
- "/bin",
37
- "/dist",
38
- "/oclif.manifest.json"
36
+ "./bin",
37
+ "./dist",
38
+ "./oclif.manifest.json"
39
39
  ],
40
40
  "homepage": "https://github.com/<%- owner %>/<%- repository %>",
41
41
  "keywords": [
@@ -62,7 +62,7 @@
62
62
  "repository": "<%- owner %>/<%- repository %>",
63
63
  "scripts": {
64
64
  "build": "shx rm -rf dist && tsc -b",
65
- "lint": "eslint . --ext .ts",
65
+ "lint": "eslint",
66
66
  "postpack": "shx rm -f oclif.manifest.json",
67
67
  "posttest": "<%- pkgManagerScript %> lint",
68
68
  "prepack": "oclif manifest && oclif readme",
@@ -4,15 +4,12 @@ export default class Hello extends Command {
4
4
  static args = {
5
5
  person: Args.string({description: 'Person to say hello to', required: true}),
6
6
  }
7
-
8
7
  static description = 'Say hello'
9
-
10
8
  static examples = [
11
9
  `<%%= config.bin %> <%%= command.id %> friend --from oclif
12
10
  hello friend from oclif! (./src/commands/hello/index.ts)
13
11
  `,
14
12
  ]
15
-
16
13
  static flags = {
17
14
  from: Flags.string({char: 'f', description: 'Who is saying hello', required: true}),
18
15
  }
@@ -2,15 +2,12 @@ import {Command} from '@oclif/core'
2
2
 
3
3
  export default class World extends Command {
4
4
  static args = {}
5
-
6
5
  static description = 'Say hello world'
7
-
8
6
  static examples = [
9
7
  `<%%= config.bin %> <%%= command.id %>
10
8
  hello world! (./src/commands/hello/world.ts)
11
9
  `,
12
10
  ]
13
-
14
11
  static flags = {}
15
12
 
16
13
  async run(): Promise<void> {
@@ -4,13 +4,10 @@ export default class <%- className %> extends Command {
4
4
  static override args = {
5
5
  file: Args.string({description: 'file to read'}),
6
6
  }
7
-
8
7
  static override description = 'describe the command here'
9
-
10
8
  static override examples = [
11
9
  '<%%= config.bin %> <%%= command.id %>',
12
10
  ]
13
-
14
11
  static override flags = {
15
12
  // flag with no value (-f, --force)
16
13
  force: Flags.boolean({char: 'f'}),
@@ -1 +0,0 @@
1
- /dist
@@ -1,3 +0,0 @@
1
- {
2
- "extends": ["oclif", "oclif-typescript", "prettier"]
3
- }