oclif 3.7.2 → 3.8.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,5 +1,5 @@
1
1
  {
2
- "version": "3.7.2",
2
+ "version": "3.8.0",
3
3
  "commands": {
4
4
  "generate": {
5
5
  "id": "generate",
package/README.md CHANGED
@@ -6,7 +6,6 @@ oclif: Node.JS Open CLI Framework
6
6
  =================================
7
7
 
8
8
  [![Version](https://img.shields.io/npm/v/oclif.svg)](https://npmjs.org/package/oclif)
9
- [![CircleCI](https://circleci.com/gh/oclif/oclif/tree/main.svg?style=shield)](https://circleci.com/gh/oclif/oclif/tree/main)
10
9
  [![Downloads/week](https://img.shields.io/npm/dw/@oclif/command.svg)](https://npmjs.org/package/@oclif/core)
11
10
  [![License](https://img.shields.io/npm/l/oclif.svg)](https://github.com/oclif/oclif/blob/main/package.json)
12
11
 
@@ -54,7 +54,7 @@ class Manifest extends core_1.Command {
54
54
  let plugin = new core_1.Plugin({ root, type: 'core', ignoreManifest: true, errorOnManifestCreate: true });
55
55
  if (!plugin)
56
56
  throw new Error('plugin not found');
57
- await plugin.load();
57
+ await plugin.load(true);
58
58
  if (!plugin.valid) {
59
59
  const p = require.resolve('@oclif/plugin-legacy', { paths: [process.cwd()] });
60
60
  const { PluginLegacy } = require(p);
@@ -1,5 +1,4 @@
1
- import { Command } from '@oclif/core';
2
- import { Interfaces } from '@oclif/core';
1
+ import { Command, Interfaces } from '@oclif/core';
3
2
  export default class PackDeb extends Command {
4
3
  static description: string;
5
4
  static flags: {
@@ -31,14 +31,18 @@ export ${config.scopedEnvVarKey('UPDATE_INSTRUCTIONS')}="update with \\"sudo apt
31
31
  \$DIR/node \$DIR/run "\$@"
32
32
  `,
33
33
  /* eslint-enable no-useless-escape */
34
- control: (config, arch) => `Package: ${config.config.bin}
34
+ control: (config, arch) => {
35
+ var _a;
36
+ return `Package: ${config.config.bin}
35
37
  Version: ${(0, upload_util_1.debVersion)(config)}
36
38
  Section: main
37
39
  Priority: standard
38
40
  Architecture: ${arch}
39
41
  Maintainer: ${config.config.scopedEnvVar('AUTHOR') || config.config.pjson.author}
40
42
  Description: ${config.config.pjson.description}
41
- `,
43
+ Aliases: ${(_a = config.config.binAliases) === null || _a === void 0 ? void 0 : _a.join(', ')}
44
+ `;
45
+ },
42
46
  ftparchive: (config) => `
43
47
  APT::FTPArchive::Release {
44
48
  Origin "${config.scopedEnvVar('AUTHOR') || config.pjson.author}";
@@ -56,6 +60,7 @@ class PackDeb extends core_1.Command {
56
60
  const dist = buildConfig.dist('deb');
57
61
  await fs.emptyDir(dist);
58
62
  const build = async (arch) => {
63
+ var _a;
59
64
  this.log(`building debian / ${arch}`);
60
65
  const target = { platform: 'linux', arch };
61
66
  const versionedDebBase = (0, upload_util_1.templateShortKey)('deb', { bin: config.bin, versionShaRevision: (0, upload_util_1.debVersion)(buildConfig), arch: (0, upload_util_1.debArch)(arch) });
@@ -73,6 +78,7 @@ class PackDeb extends core_1.Command {
73
78
  ]);
74
79
  // symlink usr/bin/oclif points to usr/lib/oclif/bin/oclif
75
80
  await exec(`ln -s "${path.join('..', 'lib', config.dirname, 'bin', config.bin)}" "${config.bin}"`, { cwd: path.join(workspace, 'usr', 'bin') });
81
+ (_a = config.binAliases) === null || _a === void 0 ? void 0 : _a.map(alias => exec(`ln -sf "${path.join('..', 'lib', config.dirname, 'bin', config.bin)}" "${alias}"`, { cwd: path.join(workspace, 'usr', 'bin') }));
76
82
  await exec(`sudo chown -R root "${workspace}"`);
77
83
  await exec(`sudo chgrp -R root "${workspace}"`);
78
84
  await exec(`dpkg --build "${workspace}" "${path.join(dist, versionedDebBase)}"`);
@@ -1,5 +1,4 @@
1
- import { Command } from '@oclif/core';
2
- import { Interfaces } from '@oclif/core';
1
+ import { Command, Interfaces } from '@oclif/core';
3
2
  export default class PackWin extends Command {
4
3
  static description: string;
5
4
  static flags: {
@@ -213,7 +213,11 @@ class PackWin extends core_1.Command {
213
213
  fs.writeFile(path.join(installerBase, 'bin', `${config.bin}.cmd`), scripts.cmd(config)),
214
214
  fs.writeFile(path.join(installerBase, 'bin', `${config.bin}`), scripts.sh(config)),
215
215
  fs.writeFile(path.join(installerBase, `${config.bin}.nsi`), scripts.nsis(config, arch)),
216
- ].concat(flags['additional-cli'] ? [
216
+ ].concat(config.binAliases ? config.binAliases.flatMap(alias =>
217
+ // write duplicate files for windows aliases
218
+ // this avoids mklink which can require admin privileges which not everyone has
219
+ [fs.writeFile(path.join(installerBase, 'bin', `${alias}.cmd`), scripts.cmd(config)), fs.writeFile(path.join(installerBase, 'bin', `${alias}`), scripts.sh(config))]) : [])
220
+ .concat(flags['additional-cli'] ? [
217
221
  fs.writeFile(path.join(installerBase, 'bin', `${flags['additional-cli']}.cmd`), scripts.cmd(config, flags['additional-cli'])),
218
222
  fs.writeFile(path.join(installerBase, 'bin', `${flags['additional-cli']}`), scripts.sh({ bin: flags['additional-cli'] })),
219
223
  ] : []));
@@ -3,13 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.writeBinScripts = void 0;
4
4
  const fs = require("fs");
5
5
  const path = require("path");
6
+ const node_child_process_1 = require("node:child_process");
7
+ const node_util_1 = require("node:util");
8
+ const exec = (0, node_util_1.promisify)(node_child_process_1.exec);
6
9
  async function writeBinScripts({ config, baseWorkspace, nodeVersion }) {
10
+ var _a, _b;
7
11
  const binPathEnvVar = config.scopedEnvVarKey('BINPATH');
8
12
  const redirectedEnvVar = config.scopedEnvVarKey('REDIRECTED');
9
13
  const clientHomeEnvVar = config.scopedEnvVarKey('OCLIF_CLIENT_HOME');
10
- const writeWin32 = async () => {
11
- const { bin } = config;
12
- await fs.promises.writeFile(path.join(baseWorkspace, 'bin', `${config.bin}.cmd`), `@echo off
14
+ const writeWin32 = async (bin) => {
15
+ await fs.promises.writeFile(path.join(baseWorkspace, 'bin', `${bin}.cmd`), `@echo off
13
16
  setlocal enableextensions
14
17
 
15
18
  if not "%${redirectedEnvVar}%"=="1" if exist "%LOCALAPPDATA%\\${bin}\\client\\bin\\${bin}.cmd" (
@@ -27,12 +30,6 @@ if exist "%~dp0..\\bin\\node.exe" (
27
30
  node "%~dp0..\\bin\\run" %*
28
31
  )
29
32
  `);
30
- // await qq.write([output, 'bin', config.bin], `#!/bin/sh
31
- // basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
32
- // "$basedir/../client/bin/${config.bin}.cmd" "$@"
33
- // ret=$?
34
- // exit $ret
35
- // `)
36
33
  };
37
34
  const writeUnix = async () => {
38
35
  const bin = path.join(baseWorkspace, 'bin', config.bin);
@@ -83,6 +80,12 @@ else
83
80
  fi
84
81
  `, { mode: 0o755 });
85
82
  };
86
- await Promise.all([writeWin32(), writeUnix()]);
83
+ await Promise.all([
84
+ writeWin32(config.bin),
85
+ writeUnix(),
86
+ ...(_b = (_a = config.binAliases) === null || _a === void 0 ? void 0 : _a.map(alias => process.platform === 'win32' ?
87
+ writeWin32(alias) :
88
+ exec(`ln -sf ${config.bin} ${alias}`, { cwd: path.join(baseWorkspace, 'bin') }))) !== null && _b !== void 0 ? _b : [],
89
+ ]);
87
90
  }
88
91
  exports.writeBinScripts = writeBinScripts;
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "oclif",
3
3
  "description": "oclif: create your own CLI",
4
- "version": "3.7.2",
4
+ "version": "3.8.0",
5
5
  "author": "Salesforce",
6
6
  "bin": {
7
- "oclif": "bin/run"
7
+ "oclif": "bin/run",
8
+ "oclif2": "bin/run"
8
9
  },
9
10
  "bugs": "https://github.com/oclif/oclif/issues",
10
11
  "dependencies": {
11
- "@oclif/core": "^2.7.1",
12
+ "@oclif/core": "^2.8.0",
12
13
  "@oclif/plugin-help": "^5.1.19",
13
14
  "@oclif/plugin-not-found": "^2.3.7",
14
15
  "@oclif/plugin-warn-if-update-available": "^2.0.14",
@@ -91,6 +92,9 @@
91
92
  "@oclif/plugin-not-found"
92
93
  ],
93
94
  "bin": "oclif",
95
+ "binAliases": [
96
+ "oclif2"
97
+ ],
94
98
  "dirname": "oclif",
95
99
  "topicSeparator": " ",
96
100
  "macos": {