oclif 3.17.1 → 4.0.0-beta.1

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,5 +1,5 @@
1
1
  {
2
- "version": "3.17.1",
2
+ "version": "4.0.0-beta.1",
3
3
  "commands": {
4
4
  "generate": {
5
5
  "id": "generate",
package/README.md CHANGED
@@ -53,7 +53,7 @@ $ heroku info --app=<tab><tab> # will complete with all the Heroku apps a user h
53
53
 
54
54
  # 📌 Requirements
55
55
 
56
- Currently, Node 12+ is supported. We support the [LTS versions](https://nodejs.org/en/about/releases) of Node. You can add the [node](https://www.npmjs.com/package/node) package to your CLI to ensure users are running a specific version of Node.
56
+ Currently, Node 18+ is supported. We support the [LTS versions](https://nodejs.org/en/about/releases) of Node. You can add the [node](https://www.npmjs.com/package/node) package to your CLI to ensure users are running a specific version of Node.
57
57
 
58
58
  # 📌 Migrating from V1
59
59
 
package/bin/dev CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  const oclif = require('@oclif/core')
4
4
 
5
- const path = require('path')
5
+ const path = require('node:path')
6
6
  const project = path.join(__dirname, '..', 'tsconfig.json')
7
7
 
8
8
  // In dev mode -> use ts-node and dev plugins
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
4
  const fs = require("fs-extra");
5
- const path = require("path");
6
- const os = require("os");
5
+ const path = require("node:path");
6
+ const os = require("node:os");
7
7
  const semver = require("semver");
8
8
  const shelljs_1 = require("shelljs");
9
9
  const got_1 = require("got");
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
4
  const fs = require("fs-extra");
5
5
  const _ = require("lodash");
6
- const path = require("path");
6
+ const path = require("node:path");
7
7
  const Tarballs = require("../../tarballs");
8
8
  const upload_util_1 = require("../../upload-util");
9
- const child_process_1 = require("child_process");
9
+ const node_child_process_1 = require("node:child_process");
10
10
  const node_util_1 = require("node:util");
11
- const exec = (0, node_util_1.promisify)(child_process_1.exec);
11
+ const exec = (0, node_util_1.promisify)(node_child_process_1.exec);
12
12
  const scripts = {
13
13
  /* eslint-disable no-useless-escape */
14
14
  bin: (config) => `#!/usr/bin/env bash
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const path = require("path");
3
+ const path = require("node:path");
4
4
  const _ = require("lodash");
5
5
  const fs = require("fs-extra");
6
6
  const core_1 = require("@oclif/core");
7
7
  const Tarballs = require("../../tarballs");
8
8
  const upload_util_1 = require("../../upload-util");
9
- const child_process_1 = require("child_process");
9
+ const node_child_process_1 = require("node:child_process");
10
10
  const node_util_1 = require("node:util");
11
- const os = require("os");
12
- const exec = (0, node_util_1.promisify)(child_process_1.exec);
11
+ const os = require("node:os");
12
+ const exec = (0, node_util_1.promisify)(node_child_process_1.exec);
13
13
  const noBundleConfiguration = `<?xml version="1.0" encoding="UTF-8"?>
14
14
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
15
15
  <plist version="1.0">
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
- const path = require("path");
4
+ const path = require("node:path");
5
5
  const fs = require("fs-extra");
6
6
  const Tarballs = require("../../tarballs");
7
7
  const upload_util_1 = require("../../upload-util");
8
- const child_process_1 = require("child_process");
8
+ const node_child_process_1 = require("node:child_process");
9
9
  const node_util_1 = require("node:util");
10
- const exec = (0, node_util_1.promisify)(child_process_1.exec);
10
+ const exec = (0, node_util_1.promisify)(node_child_process_1.exec);
11
11
  const scripts = {
12
12
  /* eslint-disable no-useless-escape */
13
13
  // eslint-disable-next-line unicorn/no-useless-undefined
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const path = require("path");
3
+ const path = require("node:path");
4
4
  const _ = require("lodash");
5
5
  const core_1 = require("@oclif/core");
6
6
  const semver_1 = require("semver");
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- // tslint:disable no-implicit-dependencies
4
3
  const core_1 = require("@oclif/core");
5
4
  const fs = require("fs-extra");
6
5
  const _ = require("lodash");
7
- const path = require("path");
8
- const url_1 = require("url");
6
+ const path = require("node:path");
7
+ const node_url_1 = require("node:url");
9
8
  const util_1 = require("../util");
10
9
  const help_compatibility_1 = require("../help-compatibility");
11
10
  const normalize = require('normalize-package-data');
@@ -13,9 +12,16 @@ const columns = Number.parseInt(process.env.COLUMNS, 10) || 120;
13
12
  const slugify = new (require('github-slugger'))();
14
13
  class Readme extends core_1.Command {
15
14
  async run() {
15
+ var _a, _b;
16
16
  this.flags = (await this.parse(Readme)).flags;
17
17
  const cwd = process.cwd();
18
18
  const readmePath = path.resolve(cwd, 'README.md');
19
+ const tsConfigPath = path.resolve(cwd, 'tsconfig.json');
20
+ const tsConfig = await fs.readJSON(tsConfigPath).catch(() => ({}));
21
+ const outDir = (_b = (_a = tsConfig.compilerOptions) === null || _a === void 0 ? void 0 : _a.outDir) !== null && _b !== void 0 ? _b : 'lib';
22
+ if (!await fs.pathExists(outDir)) {
23
+ this.warn(`No compiled source found at ${outDir}. Some commands may be missing.`);
24
+ }
19
25
  const config = await core_1.Config.load({ root: cwd, devPlugins: false, userPlugins: false });
20
26
  try {
21
27
  const p = require.resolve('@oclif/plugin-legacy', { paths: [cwd] });
@@ -23,7 +29,7 @@ class Readme extends core_1.Command {
23
29
  await plugin.load();
24
30
  config.plugins.push(plugin);
25
31
  }
26
- catch (_a) { }
32
+ catch (_c) { }
27
33
  await config.runHook('init', { id: 'readme', argv: this.argv });
28
34
  this.HelpClass = await (0, core_1.loadHelpClass)(config);
29
35
  let readme = await fs.readFile(readmePath, 'utf8');
@@ -167,7 +173,7 @@ USAGE
167
173
  const repo = pjson.repository && pjson.repository.url;
168
174
  if (!repo)
169
175
  return;
170
- const url = new url_1.URL(repo);
176
+ const url = new node_url_1.URL(repo);
171
177
  if (!['github.com', 'gitlab.com'].includes(url.hostname) && !pjson.oclif.repositoryPrefix && !this.flags['repository-prefix'])
172
178
  return;
173
179
  return `https://${url.hostname}${url.pathname.replace(/\.git$/, '')}`;
@@ -177,21 +183,24 @@ USAGE
177
183
  * fetches the path to a command
178
184
  */
179
185
  commandPath(plugin, c) {
186
+ var _a, _b;
180
187
  const commandsDir = plugin.pjson.oclif.commands;
181
188
  if (!commandsDir)
182
189
  return;
190
+ const hasTypescript = ((_a = plugin.pjson.devDependencies) === null || _a === void 0 ? void 0 : _a.typescript) || ((_b = plugin.pjson.dependencies) === null || _b === void 0 ? void 0 : _b.typescript);
183
191
  let p = path.join(plugin.root, commandsDir, ...c.id.split(':'));
184
- const libRegex = new RegExp('^lib' + (path.sep === '\\' ? '\\\\' : path.sep));
192
+ const outDir = path.dirname(commandsDir.replace(`.${path.sep}`, ''));
193
+ const outDirRegex = new RegExp('^' + outDir + (path.sep === '\\' ? '\\\\' : path.sep));
185
194
  if (fs.pathExistsSync(path.join(p, 'index.js'))) {
186
195
  p = path.join(p, 'index.js');
187
196
  }
188
197
  else if (fs.pathExistsSync(p + '.js')) {
189
198
  p += '.js';
190
199
  }
191
- else if (plugin.pjson.devDependencies && plugin.pjson.devDependencies.typescript) {
200
+ else if (hasTypescript) {
192
201
  // check if non-compiled scripts are available
193
202
  const base = p.replace(plugin.root + path.sep, '');
194
- p = path.join(plugin.root, base.replace(libRegex, 'src' + path.sep));
203
+ p = path.join(plugin.root, base.replace(outDirRegex, 'src' + path.sep));
195
204
  if (fs.pathExistsSync(path.join(p, 'index.ts'))) {
196
205
  p = path.join(p, 'index.ts');
197
206
  }
@@ -204,9 +213,8 @@ USAGE
204
213
  else
205
214
  return;
206
215
  p = p.replace(plugin.root + path.sep, '');
207
- if (plugin.pjson.devDependencies && plugin.pjson.devDependencies.typescript) {
208
- p = p.replace(libRegex, 'src' + path.sep);
209
- p = p.replace(/\.js$/, '.ts');
216
+ if (hasTypescript) {
217
+ p = p.replace(outDirRegex, 'src' + path.sep).replace(/\.js$/, '.ts');
210
218
  }
211
219
  p = p.replace(/\\/g, '/'); // Replace windows '\' by '/'
212
220
  return p;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
- const fs = require("fs");
5
- const path = require("path");
4
+ const fs = require("node:fs");
5
+ const path = require("node:path");
6
6
  const aws_1 = require("../../aws");
7
7
  const log_1 = require("../../log");
8
8
  const Tarballs = require("../../tarballs");
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const _ = require("lodash");
4
- const fs = require("fs");
4
+ const fs = require("node:fs");
5
5
  const core_1 = require("@oclif/core");
6
6
  const aws_1 = require("../../aws");
7
7
  const log_1 = require("../../log");
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
- const fs = require("fs");
4
+ const fs = require("node:fs");
5
5
  const aws_1 = require("../../aws");
6
6
  const log_1 = require("../../log");
7
7
  const Tarballs = require("../../tarballs");
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
- const fs = require("fs");
4
+ const fs = require("node:fs");
5
5
  const aws_1 = require("../../aws");
6
6
  const log_1 = require("../../log");
7
7
  const Tarballs = require("../../tarballs");
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const child_process_1 = require("child_process");
4
- const fs = require("fs");
3
+ const node_child_process_1 = require("node:child_process");
4
+ const fs = require("node:fs");
5
5
  const _ = require("lodash");
6
- const path = require("path");
6
+ const path = require("node:path");
7
7
  const Generator = require("yeoman-generator");
8
8
  const debug = require('debug')('generator-oclif');
9
9
  const { version } = require('../../package.json');
10
10
  let hasYarn = false;
11
11
  try {
12
- (0, child_process_1.execSync)('yarn -v', { stdio: 'ignore' });
12
+ (0, node_child_process_1.execSync)('yarn -v', { stdio: 'ignore' });
13
13
  hasYarn = true;
14
14
  }
15
15
  catch (_a) { }
@@ -40,7 +40,7 @@ class CLI extends Generator {
40
40
  },
41
41
  ]) : 'cjs';
42
42
  const repo = moduleType === 'esm' ? 'hello-world-esm' : 'hello-world';
43
- (0, child_process_1.execSync)(`git clone https://github.com/oclif/${repo}.git "${path.resolve(this.name)}" --depth=1`);
43
+ (0, node_child_process_1.execSync)(`git clone https://github.com/oclif/${repo}.git "${path.resolve(this.name)}" --depth=1`);
44
44
  fs.rmSync(`${path.resolve(this.name, '.git')}`, { recursive: true });
45
45
  this.destinationRoot(path.resolve(this.name));
46
46
  this.env.cwd = this.destinationPath();
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const _ = require("lodash");
4
- const path = require("path");
4
+ const path = require("node:path");
5
5
  const Generator = require("yeoman-generator");
6
6
  const { version } = require('../../package.json');
7
7
  class Command extends Generator {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const _ = require("lodash");
4
- const path = require("path");
4
+ const path = require("node:path");
5
5
  const Generator = require("yeoman-generator");
6
6
  const { version } = require('../../package.json');
7
7
  class Hook extends Generator {
package/lib/log.js CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.log = exports.debug = void 0;
4
4
  const core_1 = require("@oclif/core");
5
- const util = require("util");
5
+ const util = require("node:util");
6
6
  const util_1 = require("./util");
7
7
  exports.debug = require('debug')('oclif');
8
8
  exports.debug.new = (name) => require('debug')(`oclif:${name}`);
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.writeBinScripts = void 0;
4
- const fs = require("fs");
5
- const path = require("path");
4
+ const fs = require("node:fs");
5
+ const path = require("node:path");
6
6
  const node_child_process_1 = require("node:child_process");
7
7
  const node_util_1 = require("node:util");
8
8
  const exec = (0, node_util_1.promisify)(node_child_process_1.exec);
@@ -3,15 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.build = void 0;
4
4
  const findYarnWorkspaceRoot = require("find-yarn-workspace-root");
5
5
  const log_1 = require("../log");
6
- const path = require("path");
6
+ const path = require("node:path");
7
7
  const fs = require("fs-extra");
8
8
  const bin_1 = require("./bin");
9
9
  const node_1 = require("./node");
10
10
  const upload_util_1 = require("../upload-util");
11
11
  const util_1 = require("../util");
12
- const child_process_1 = require("child_process");
12
+ const node_child_process_1 = require("node:child_process");
13
13
  const node_util_1 = require("node:util");
14
- const exec = (0, node_util_1.promisify)(child_process_1.exec);
14
+ const exec = (0, node_util_1.promisify)(node_child_process_1.exec);
15
15
  const pack = async (from, to) => {
16
16
  const cwd = path.dirname(from);
17
17
  await fs.promises.mkdir(path.dirname(to), { recursive: true });
@@ -2,14 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildConfig = exports.gitSha = exports.TARGETS = void 0;
4
4
  const core_1 = require("@oclif/core");
5
- const path = require("path");
5
+ const path = require("node:path");
6
6
  const semver = require("semver");
7
7
  const fs = require("fs-extra");
8
8
  const util_1 = require("../util");
9
9
  const upload_util_1 = require("../upload-util");
10
- const child_process_1 = require("child_process");
10
+ const node_child_process_1 = require("node:child_process");
11
11
  const node_util_1 = require("node:util");
12
- const exec = (0, node_util_1.promisify)(child_process_1.exec);
12
+ const exec = (0, node_util_1.promisify)(node_child_process_1.exec);
13
13
  exports.TARGETS = [
14
14
  'linux-x64',
15
15
  'linux-arm',
@@ -1,17 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fetchNodeBinary = void 0;
4
- const path = require("path");
4
+ const path = require("node:path");
5
5
  const fs = require("fs-extra");
6
- const stream_1 = require("stream");
6
+ const promises_1 = require("node:stream/promises");
7
7
  const log_1 = require("../log");
8
- const child_process_1 = require("child_process");
8
+ const node_child_process_1 = require("node:child_process");
9
9
  const util_1 = require("util");
10
10
  const got_1 = require("got");
11
11
  const retry = require("async-retry");
12
12
  const util_2 = require("../util");
13
- const pipeline = (0, util_1.promisify)(stream_1.pipeline);
14
- const exec = (0, util_1.promisify)(child_process_1.exec);
13
+ const exec = (0, util_1.promisify)(node_child_process_1.exec);
15
14
  const RETRY_TIMEOUT_MS = 1000;
16
15
  async function fetchNodeBinary({ nodeVersion, output, platform, arch, tmp }) {
17
16
  if (arch === 'arm')
@@ -37,11 +36,11 @@ async function fetchNodeBinary({ nodeVersion, output, platform, arch, tmp }) {
37
36
  ]);
38
37
  const shasums = path.join(tmp, 'cache', nodeVersion, 'SHASUMS256.txt.asc');
39
38
  if (!fs.existsSync(shasums)) {
40
- await pipeline(got_1.default.stream(`https://nodejs.org/dist/v${nodeVersion}/SHASUMS256.txt.asc`), fs.createWriteStream(shasums));
39
+ await (0, promises_1.pipeline)(got_1.default.stream(`https://nodejs.org/dist/v${nodeVersion}/SHASUMS256.txt.asc`), fs.createWriteStream(shasums));
41
40
  }
42
41
  const basedir = path.dirname(tarball);
43
42
  await fs.promises.mkdir(basedir, { recursive: true });
44
- await pipeline(got_1.default.stream(url), fs.createWriteStream(tarball));
43
+ await (0, promises_1.pipeline)(got_1.default.stream(url), fs.createWriteStream(tarball));
45
44
  if (platform !== 'win32')
46
45
  await exec(`grep "${path.basename(tarball)}" "${shasums}" | shasum -a 256 -c -`, { cwd: basedir });
47
46
  };
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.debVersion = exports.debArch = exports.templateShortKey = exports.channelAWSDir = exports.commitAWSDir = void 0;
4
- const path = require("path");
4
+ const path = require("node:path");
5
5
  function commitAWSDir(version, sha, s3Config) {
6
6
  let s3SubDir = s3Config.folder || '';
7
7
  if (s3SubDir !== '' && s3SubDir.slice(-1) !== '/')
package/lib/util.js CHANGED
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.checkFor7Zip = exports.hash = exports.prettifyPaths = exports.sortVersionsObjectByKeysDesc = exports.template = exports.sortBy = exports.compact = exports.uniqBy = exports.castArray = void 0;
4
4
  const core_1 = require("@oclif/core");
5
5
  const _ = require("lodash");
6
- const os = require("os");
7
- const crypto = require("crypto");
6
+ const os = require("node:os");
7
+ const crypto = require("node:crypto");
8
8
  const log_1 = require("./log");
9
9
  const fs = require("fs-extra");
10
- const child_process_1 = require("child_process");
10
+ const node_child_process_1 = require("node:child_process");
11
11
  const util_1 = require("util");
12
- const exec = (0, util_1.promisify)(child_process_1.exec);
12
+ const exec = (0, util_1.promisify)(node_child_process_1.exec);
13
13
  function castArray(input) {
14
14
  if (input === undefined)
15
15
  return [];
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.appendToIndex = void 0;
4
4
  const fs = require("fs-extra");
5
- const path = require("path");
5
+ const path = require("node:path");
6
6
  const aws_1 = require("./aws");
7
7
  const log_1 = require("./log");
8
8
  const debug = log_1.debug.new('version-indexes');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "oclif",
3
3
  "description": "oclif: create your own CLI",
4
- "version": "3.17.1",
4
+ "version": "4.0.0-beta.1",
5
5
  "author": "Salesforce",
6
6
  "bin": {
7
7
  "oclif": "bin/run"
@@ -38,7 +38,7 @@
38
38
  "@types/lodash": "^4.14.191",
39
39
  "@types/lodash.template": "^4.5.0",
40
40
  "@types/mocha": "^8.2.3",
41
- "@types/node": "^14.18.34",
41
+ "@types/node": "^18",
42
42
  "@types/semver": "^7.3.13",
43
43
  "@types/shelljs": "^0.8.11",
44
44
  "@types/yeoman-generator": "^5.2.11",
@@ -64,7 +64,7 @@
64
64
  "colors": "1.4.0"
65
65
  },
66
66
  "engines": {
67
- "node": ">=12.0.0"
67
+ "node": ">=18.0.0"
68
68
  },
69
69
  "files": [
70
70
  ".oclif.manifest.json",
@@ -97,7 +97,7 @@
97
97
  "debounce": 60
98
98
  },
99
99
  "node": {
100
- "version": "16.13.2"
100
+ "version": "18.17.1"
101
101
  },
102
102
  "s3": {
103
103
  "bucket": "dfc-data-production",