oclif 2.0.0 → 2.0.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.
Files changed (106) hide show
  1. package/.oclif.manifest.json +1 -1
  2. package/CHANGELOG.md +100 -11
  3. package/README.md +228 -101
  4. package/bin/dev +19 -0
  5. package/bin/dev.cmd +3 -0
  6. package/bin/run +5 -2
  7. package/lib/aws.d.ts +5 -5
  8. package/lib/aws.js +7 -5
  9. package/lib/command-base.d.ts +2 -2
  10. package/lib/command-base.js +3 -3
  11. package/lib/commands/generate.d.ts +11 -0
  12. package/lib/commands/generate.js +19 -0
  13. package/lib/commands/manifest.d.ts +1 -2
  14. package/lib/commands/manifest.js +4 -7
  15. package/lib/commands/pack/deb.d.ts +3 -3
  16. package/lib/commands/pack/deb.js +11 -12
  17. package/lib/commands/pack/macos.d.ts +4 -3
  18. package/lib/commands/pack/macos.js +19 -13
  19. package/lib/commands/pack/tarballs.d.ts +6 -3
  20. package/lib/commands/pack/tarballs.js +9 -7
  21. package/lib/commands/pack/win.d.ts +4 -3
  22. package/lib/commands/pack/win.js +29 -16
  23. package/lib/commands/promote.d.ts +14 -3
  24. package/lib/commands/promote.js +27 -28
  25. package/lib/commands/readme.d.ts +13 -11
  26. package/lib/commands/readme.js +33 -34
  27. package/lib/commands/upload/deb.d.ts +2 -3
  28. package/lib/commands/upload/deb.js +8 -9
  29. package/lib/commands/upload/macos.d.ts +2 -3
  30. package/lib/commands/upload/macos.js +8 -9
  31. package/lib/commands/upload/tarballs.d.ts +7 -3
  32. package/lib/commands/upload/tarballs.js +23 -20
  33. package/lib/commands/upload/win.d.ts +2 -3
  34. package/lib/commands/upload/win.js +10 -11
  35. package/lib/generators/{app.d.ts → cli.d.ts} +2 -22
  36. package/lib/generators/cli.js +182 -0
  37. package/lib/help-compatibility.d.ts +4 -5
  38. package/lib/help-compatibility.js +1 -0
  39. package/lib/index.d.ts +1 -1
  40. package/lib/index.js +3 -2
  41. package/lib/log.js +3 -2
  42. package/lib/tarballs/bin.d.ts +2 -2
  43. package/lib/tarballs/bin.js +2 -1
  44. package/lib/tarballs/build.js +29 -28
  45. package/lib/tarballs/config.d.ts +6 -7
  46. package/lib/tarballs/config.js +24 -12
  47. package/lib/tarballs/index.js +4 -4
  48. package/lib/tarballs/node.d.ts +7 -4
  49. package/lib/tarballs/node.js +5 -5
  50. package/lib/upload-util.d.ts +3 -3
  51. package/lib/upload-util.js +5 -2
  52. package/lib/util.js +24 -20
  53. package/lib/version-indexes.d.ts +2 -4
  54. package/lib/version-indexes.js +3 -1
  55. package/package.json +27 -27
  56. package/lib/app-command.d.ts +0 -12
  57. package/lib/app-command.js +0 -26
  58. package/lib/commands/base.d.ts +0 -5
  59. package/lib/commands/base.js +0 -11
  60. package/lib/commands/command.d.ts +0 -17
  61. package/lib/commands/command.js +0 -23
  62. package/lib/commands/hook.d.ts +0 -18
  63. package/lib/commands/hook.js +0 -25
  64. package/lib/commands/multi.d.ts +0 -5
  65. package/lib/commands/multi.js +0 -11
  66. package/lib/commands/plugin.d.ts +0 -5
  67. package/lib/commands/plugin.js +0 -11
  68. package/lib/commands/single.d.ts +0 -5
  69. package/lib/commands/single.js +0 -11
  70. package/lib/generators/app.js +0 -459
  71. package/lib/generators/command.d.ts +0 -15
  72. package/lib/generators/command.js +0 -51
  73. package/lib/generators/hook.d.ts +0 -14
  74. package/lib/generators/hook.js +0 -51
  75. package/templates/LICENSE.mit +0 -21
  76. package/templates/README.md.ejs +0 -21
  77. package/templates/appveyor.yml.ejs +0 -33
  78. package/templates/base/src/index.js +0 -1
  79. package/templates/base/src/index.ts +0 -1
  80. package/templates/base/test/index.test.js +0 -8
  81. package/templates/base/test/index.test.ts +0 -9
  82. package/templates/bin/run +0 -5
  83. package/templates/bin/run.cmd +0 -3
  84. package/templates/circle.yml.ejs +0 -65
  85. package/templates/editorconfig +0 -11
  86. package/templates/eslintrc +0 -7
  87. package/templates/eslintrc.typescript +0 -10
  88. package/templates/multi/src/index.js +0 -1
  89. package/templates/multi/src/index.ts +0 -1
  90. package/templates/plugin/bin/run +0 -4
  91. package/templates/plugin/src/index.ts +0 -1
  92. package/templates/scripts/setup_git +0 -12
  93. package/templates/single/bin/run.js +0 -4
  94. package/templates/single/bin/run.ts +0 -13
  95. package/templates/src/command.js.ejs +0 -27
  96. package/templates/src/command.ts.ejs +0 -46
  97. package/templates/src/hook.js.ejs +0 -3
  98. package/templates/src/hook.ts.ejs +0 -7
  99. package/templates/test/command.test.js.ejs +0 -28
  100. package/templates/test/command.test.ts.ejs +0 -29
  101. package/templates/test/hook.test.js.ejs +0 -9
  102. package/templates/test/hook.test.ts.ejs +0 -9
  103. package/templates/test/mocha.opts +0 -4
  104. package/templates/test/tsconfig.json +0 -9
  105. package/templates/travis.yml.ejs +0 -14
  106. package/templates/tsconfig.json +0 -15
package/bin/run CHANGED
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- require('..').run()
4
- .catch(require('@oclif/errors/handle'))
3
+ const oclif = require('@oclif/core')
4
+
5
+ oclif.settings.disableJsonFlag = true
6
+
7
+ oclif.run().then(require('@oclif/core/flush')).catch(require('@oclif/core/handle'))
package/lib/aws.d.ts CHANGED
@@ -11,13 +11,13 @@ export declare namespace upload {
11
11
  }
12
12
  declare const _default: {
13
13
  readonly cloudfront: {
14
- createCloudfrontInvalidation: (options: CloudFront.CreateInvalidationRequest) => Promise<unknown>;
14
+ createCloudfrontInvalidation: (options: CloudFront.Types.CreateInvalidationRequest) => Promise<unknown>;
15
15
  };
16
16
  readonly s3: {
17
- uploadFile: (local: string, options: S3.PutObjectRequest) => Promise<unknown>;
18
- headObject: (options: S3.HeadObjectRequest) => Promise<S3.HeadObjectOutput>;
19
- copyObject: (options: S3.CopyObjectRequest) => Promise<unknown>;
20
- getObject: (options: S3.GetObjectRequest) => Promise<S3.GetObjectOutput>;
17
+ uploadFile: (local: string, options: S3.Types.PutObjectRequest) => Promise<unknown>;
18
+ headObject: (options: S3.Types.HeadObjectRequest) => Promise<S3.HeadObjectOutput>;
19
+ copyObject: (options: S3.Types.CopyObjectRequest) => Promise<unknown>;
20
+ getObject: (options: S3.Types.GetObjectRequest) => Promise<S3.GetObjectOutput>;
21
21
  };
22
22
  };
23
23
  export default _default;
package/lib/aws.js CHANGED
@@ -35,29 +35,31 @@ const aws = {
35
35
  },
36
36
  };
37
37
  exports.default = {
38
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
38
39
  get cloudfront() {
39
40
  return {
40
41
  createCloudfrontInvalidation: (options) => new Promise((resolve, reject) => {
41
- log_1.log('createCloudfrontInvalidation', options.DistributionId, options.InvalidationBatch.Paths.Items);
42
+ (0, log_1.log)('createCloudfrontInvalidation', options.DistributionId, options.InvalidationBatch.Paths.Items);
42
43
  aws.cloudfront.createInvalidation(options, err => {
43
44
  if (err)
44
45
  reject(err);
45
46
  else
46
- resolve();
47
+ resolve(null);
47
48
  });
48
49
  }),
49
50
  };
50
51
  },
52
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
51
53
  get s3() {
52
54
  return {
53
55
  uploadFile: (local, options) => new Promise((resolve, reject) => {
54
- log_1.log('s3:uploadFile', qq.prettifyPaths(local), `s3://${options.Bucket}/${options.Key}`);
56
+ (0, log_1.log)('s3:uploadFile', qq.prettifyPaths(local), `s3://${options.Bucket}/${options.Key}`);
55
57
  options.Body = fs.createReadStream(local);
56
58
  aws.s3.upload(options, err => {
57
59
  if (err)
58
60
  reject(err);
59
61
  else
60
- resolve();
62
+ resolve(null);
61
63
  });
62
64
  }),
63
65
  headObject: (options) => new Promise((resolve, reject) => {
@@ -70,7 +72,7 @@ exports.default = {
70
72
  });
71
73
  }),
72
74
  copyObject: (options) => new Promise((resolve, reject) => {
73
- log_1.log('s3:copyObject', `from s3://${options.CopySource}`, `to s3://${options.Bucket}/${options.Key}`);
75
+ (0, log_1.log)('s3:copyObject', `from s3://${options.CopySource}`, `to s3://${options.Bucket}/${options.Key}`);
74
76
  aws.s3.copyObject(options, function (err, data) {
75
77
  if (err)
76
78
  reject(err);
@@ -1,4 +1,4 @@
1
- import Command from '@oclif/command';
1
+ import { Command } from '@oclif/core';
2
2
  export default abstract class CommandBase extends Command {
3
- protected generate(type: string, generatorOptions?: {}): Promise<void>;
3
+ protected generate(type: string, generatorOptions?: Record<string, unknown>): Promise<void>;
4
4
  }
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const command_1 = require("@oclif/command");
3
+ const core_1 = require("@oclif/core");
4
4
  const yeoman_environment_1 = require("yeoman-environment");
5
- class CommandBase extends command_1.default {
5
+ class CommandBase extends core_1.Command {
6
6
  async generate(type, generatorOptions = {}) {
7
- const env = yeoman_environment_1.createEnv();
7
+ const env = (0, yeoman_environment_1.createEnv)();
8
8
  env.register(require.resolve(`./generators/${type}`), `oclif:${type}`);
9
9
  await new Promise((resolve, reject) => {
10
10
  env.run(`oclif:${type}`, generatorOptions, ((err, results) => {
@@ -0,0 +1,11 @@
1
+ import CommandBase from './../command-base';
2
+ export default class Generate extends CommandBase {
3
+ static description: string;
4
+ static flags: {};
5
+ static args: {
6
+ name: string;
7
+ required: boolean;
8
+ description: string;
9
+ }[];
10
+ run(): Promise<void>;
11
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const command_base_1 = require("./../command-base");
4
+ class Generate extends command_base_1.default {
5
+ async run() {
6
+ const { args } = await this.parse(Generate);
7
+ await super.generate('cli', {
8
+ name: args.name,
9
+ force: true,
10
+ });
11
+ }
12
+ }
13
+ exports.default = Generate;
14
+ Generate.description = `generate a new CLI
15
+ This will clone the template repo 'oclif/hello-world' and update package properties`;
16
+ Generate.flags = {};
17
+ Generate.args = [
18
+ { name: 'name', required: true, description: 'directory name of new project' },
19
+ ];
@@ -1,6 +1,5 @@
1
- import { Command } from '@oclif/command';
1
+ import { Command } from '@oclif/core';
2
2
  export default class Manifest extends Command {
3
- static hidden: boolean;
4
3
  static description: string;
5
4
  static args: {
6
5
  name: string;
@@ -1,25 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const command_1 = require("@oclif/command");
4
- const Config = require("@oclif/config");
3
+ const core_1 = require("@oclif/core");
5
4
  const fs = require("fs-extra");
6
5
  const path = require("path");
7
- class Manifest extends command_1.Command {
6
+ class Manifest extends core_1.Command {
8
7
  async run() {
9
8
  try {
10
9
  fs.unlinkSync('oclif.manifest.json');
11
10
  }
12
11
  catch (_a) { }
13
- const { args } = this.parse(Manifest);
12
+ const { args } = await this.parse(Manifest);
14
13
  const root = path.resolve(args.path);
15
- let plugin = new Config.Plugin({ root, type: 'core', ignoreManifest: true, errorOnManifestCreate: true });
14
+ let plugin = new core_1.Plugin({ root, type: 'core', ignoreManifest: true, errorOnManifestCreate: true });
16
15
  if (!plugin)
17
16
  throw new Error('plugin not found');
18
17
  await plugin.load();
19
18
  if (!plugin.valid) {
20
19
  const p = require.resolve('@oclif/plugin-legacy', { paths: [process.cwd()] });
21
20
  const { PluginLegacy } = require(p);
22
- delete plugin.name;
23
21
  plugin = new PluginLegacy(this.config, plugin);
24
22
  await plugin.load();
25
23
  }
@@ -33,7 +31,6 @@ class Manifest extends command_1.Command {
33
31
  }
34
32
  }
35
33
  exports.default = Manifest;
36
- Manifest.hidden = true;
37
34
  Manifest.description = 'generates plugin manifest json';
38
35
  Manifest.args = [
39
36
  { name: 'path', description: 'path to plugin', default: '.' },
@@ -1,9 +1,9 @@
1
- import { Command, flags } from '@oclif/command';
1
+ import { Command } from '@oclif/core';
2
+ import { Interfaces } from '@oclif/core';
2
3
  export default class PackDeb extends Command {
3
- static hidden: boolean;
4
4
  static description: string;
5
5
  static flags: {
6
- root: flags.IOptionFlag<string>;
6
+ root: Interfaces.OptionFlag<string>;
7
7
  };
8
8
  run(): Promise<void>;
9
9
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const command_1 = require("@oclif/command");
3
+ const core_1 = require("@oclif/core");
4
4
  const _ = require("lodash");
5
5
  const qq = require("qqjs");
6
6
  const Tarballs = require("../../tarballs");
@@ -28,7 +28,7 @@ export ${config.scopedEnvVarKey('UPDATE_INSTRUCTIONS')}="update with \\"sudo apt
28
28
  `,
29
29
  /* eslint-enable no-useless-escape */
30
30
  control: (config, arch) => `Package: ${config.config.bin}
31
- Version: ${upload_util_1.debVersion(config)}
31
+ Version: ${(0, upload_util_1.debVersion)(config)}
32
32
  Section: main
33
33
  Priority: standard
34
34
  Architecture: ${arch}
@@ -41,34 +41,34 @@ APT::FTPArchive::Release {
41
41
  Suite "stable";
42
42
  `,
43
43
  };
44
- class PackDeb extends command_1.Command {
44
+ class PackDeb extends core_1.Command {
45
45
  async run() {
46
46
  if (process.platform !== 'linux')
47
47
  throw new Error('debian packing must be run on linux');
48
- const { flags } = this.parse(PackDeb);
48
+ const { flags } = await this.parse(PackDeb);
49
49
  const buildConfig = await Tarballs.buildConfig(flags.root);
50
- const { config, tmp, targets } = buildConfig;
50
+ const { config } = buildConfig;
51
51
  await Tarballs.build(buildConfig, { platform: 'linux', pack: false });
52
52
  const dist = buildConfig.dist('deb');
53
53
  await qq.emptyDir(dist);
54
54
  const build = async (arch) => {
55
55
  const target = { platform: 'linux', arch };
56
- const versionedDebBase = upload_util_1.templateShortKey('deb', { bin: config.bin, versionShaRevision: upload_util_1.debVersion(buildConfig), arch: upload_util_1.debArch(arch) });
57
- const workspace = qq.join(tmp, 'apt', versionedDebBase.replace('.deb', '.apt'));
56
+ 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) });
57
+ const workspace = qq.join(buildConfig.tmp, 'apt', versionedDebBase.replace('.deb', '.apt'));
58
58
  await qq.rm(workspace);
59
59
  await qq.mkdirp([workspace, 'DEBIAN']);
60
60
  await qq.mkdirp([workspace, 'usr/bin']);
61
61
  await qq.mkdirp([workspace, 'usr/lib']);
62
62
  await qq.mv(buildConfig.workspace(target), [workspace, 'usr/lib', config.dirname]);
63
63
  await qq.write([workspace, 'usr/lib', config.dirname, 'bin', config.bin], scripts.bin(config));
64
- await qq.write([workspace, 'DEBIAN/control'], scripts.control(buildConfig, upload_util_1.debArch(arch)));
64
+ await qq.write([workspace, 'DEBIAN/control'], scripts.control(buildConfig, (0, upload_util_1.debArch)(arch)));
65
65
  await qq.chmod([workspace, 'usr/lib', config.dirname, 'bin', config.bin], 0o755);
66
66
  await qq.x(`ln -s "../lib/${config.dirname}/bin/${config.bin}" "${workspace}/usr/bin/${config.bin}"`);
67
67
  await qq.x(`chown -R root "${workspace}"`);
68
68
  await qq.x(`chgrp -R root "${workspace}"`);
69
69
  await qq.x(`dpkg --build "${workspace}" "${qq.join(dist, versionedDebBase)}"`);
70
70
  };
71
- const arches = _.uniq(targets
71
+ const arches = _.uniq(buildConfig.targets
72
72
  .filter(t => t.platform === 'linux')
73
73
  .map(t => t.arch));
74
74
  // eslint-disable-next-line no-await-in-loop
@@ -78,7 +78,7 @@ class PackDeb extends command_1.Command {
78
78
  await qq.x('gzip -c Packages > Packages.gz', { cwd: dist });
79
79
  await qq.x('bzip2 -k Packages', { cwd: dist });
80
80
  await qq.x('xz -k Packages', { cwd: dist });
81
- const ftparchive = qq.join(tmp, 'apt', 'apt-ftparchive.conf');
81
+ const ftparchive = qq.join(buildConfig.tmp, 'apt', 'apt-ftparchive.conf');
82
82
  await qq.write(ftparchive, scripts.ftparchive(config));
83
83
  await qq.x(`apt-ftparchive -c "${ftparchive}" release . > Release`, { cwd: dist });
84
84
  const gpgKey = config.scopedEnvVar('DEB_KEY');
@@ -89,8 +89,7 @@ class PackDeb extends command_1.Command {
89
89
  }
90
90
  }
91
91
  exports.default = PackDeb;
92
- PackDeb.hidden = true;
93
92
  PackDeb.description = 'pack CLI into debian package';
94
93
  PackDeb.flags = {
95
- root: command_1.flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
94
+ root: core_1.Flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
96
95
  };
@@ -1,9 +1,10 @@
1
- import { Command, flags } from '@oclif/command';
1
+ import { Command } from '@oclif/core';
2
+ import { Interfaces } from '@oclif/core';
2
3
  export default class PackMacos extends Command {
3
- static hidden: boolean;
4
4
  static description: string;
5
5
  static flags: {
6
- root: flags.IOptionFlag<string>;
6
+ root: Interfaces.OptionFlag<string>;
7
+ 'additional-cli': Interfaces.OptionFlag<string | undefined>;
7
8
  };
8
9
  run(): Promise<void>;
9
10
  }
@@ -1,22 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const command_1 = require("@oclif/command");
3
+ const core_1 = require("@oclif/core");
4
4
  const path = require("path");
5
5
  const qq = require("qqjs");
6
6
  const Tarballs = require("../../tarballs");
7
7
  const upload_util_1 = require("../../upload-util");
8
8
  const scripts = {
9
- preinstall: (config) => `#!/usr/bin/env bash
9
+ preinstall: (config, additionalCLI) => `#!/usr/bin/env bash
10
10
  sudo rm -rf /usr/local/lib/${config.dirname}
11
11
  sudo rm -rf /usr/local/${config.bin}
12
12
  sudo rm -rf /usr/local/bin/${config.bin}
13
+ ${additionalCLI ?
14
+ `sudo rm -rf /usr/local/${additionalCLI}
15
+ sudo rm -rf /usr/local/bin/${additionalCLI}` : ''}
13
16
  `,
14
- postinstall: (config) => `#!/usr/bin/env bash
17
+ postinstall: (config, additionalCLI) => `#!/usr/bin/env bash
15
18
  set -x
16
19
  sudo mkdir -p /usr/local/bin
17
20
  sudo ln -sf /usr/local/lib/${config.dirname}/bin/${config.bin} /usr/local/bin/${config.bin}
21
+ ${additionalCLI ? `sudo ln -sf /usr/local/lib/${config.dirname}/bin/${additionalCLI} /usr/local/bin/${additionalCLI}` : ''}
18
22
  `,
19
- uninstall: (config) => {
23
+ uninstall: (config, additionalCLI) => {
20
24
  const packageIdentifier = config.pjson.oclif.macos.identifier;
21
25
  return `#!/usr/bin/env bash
22
26
 
@@ -57,6 +61,7 @@ done
57
61
  echo "Application uninstalling process started"
58
62
  # remove link to shorcut file
59
63
  find "/usr/local/bin/" -name "${config.bin}" | xargs rm
64
+ ${additionalCLI ? `find "/usr/local/bin/" -name "${additionalCLI}" | xargs rm` : ''}
60
65
  if [ $? -eq 0 ]
61
66
  then
62
67
  echo "[1/3] [DONE] Successfully deleted shortcut links"
@@ -87,13 +92,13 @@ exit 0
87
92
  `;
88
93
  },
89
94
  };
90
- class PackMacos extends command_1.Command {
95
+ class PackMacos extends core_1.Command {
91
96
  async run() {
92
97
  if (process.platform !== 'darwin')
93
98
  this.error('must be run from macos');
94
- const { flags } = this.parse(PackMacos);
99
+ const { flags } = await this.parse(PackMacos);
95
100
  const buildConfig = await Tarballs.buildConfig(flags.root);
96
- const { config, tmp, gitSha, version } = buildConfig;
101
+ const { config } = buildConfig;
97
102
  const c = config.pjson.oclif;
98
103
  if (!c.macos)
99
104
  this.error('package.json is missing an oclif.macos config');
@@ -102,15 +107,15 @@ class PackMacos extends command_1.Command {
102
107
  const macos = c.macos;
103
108
  const packageIdentifier = macos.identifier;
104
109
  await Tarballs.build(buildConfig, { platform: 'darwin', pack: false });
105
- const templateKey = upload_util_1.templateShortKey('macos', { bin: config.bin, version: config.version, sha: gitSha });
110
+ const templateKey = (0, upload_util_1.templateShortKey)('macos', { bin: config.bin, version: config.version, sha: buildConfig.gitSha });
106
111
  const dist = buildConfig.dist(`macos/${templateKey}`);
107
112
  await qq.emptyDir(path.dirname(dist));
108
- const scriptsDir = qq.join(tmp, 'macos/scripts');
113
+ const scriptsDir = qq.join(buildConfig.tmp, 'macos/scripts');
109
114
  const rootDir = buildConfig.workspace({ platform: 'darwin', arch: 'x64' });
110
115
  const writeScript = async (script) => {
111
116
  const path = script === 'uninstall' ? [rootDir, 'bin'] : [scriptsDir];
112
117
  path.push(script);
113
- await qq.write(path, scripts[script](config));
118
+ await qq.write(path, scripts[script](config, flags['additional-cli']));
114
119
  await qq.chmod(path, 0o755);
115
120
  };
116
121
  await writeScript('preinstall');
@@ -120,7 +125,7 @@ class PackMacos extends command_1.Command {
120
125
  const args = [
121
126
  '--root', rootDir,
122
127
  '--identifier', packageIdentifier,
123
- '--version', version,
128
+ '--version', config.version,
124
129
  '--install-location', `/usr/local/lib/${config.dirname}`,
125
130
  '--scripts', scriptsDir,
126
131
  ];
@@ -137,8 +142,9 @@ class PackMacos extends command_1.Command {
137
142
  }
138
143
  }
139
144
  exports.default = PackMacos;
140
- PackMacos.hidden = true;
141
145
  PackMacos.description = 'pack CLI into macOS .pkg';
142
146
  PackMacos.flags = {
143
- root: command_1.flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
147
+ root: core_1.Flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
148
+ 'additional-cli': core_1.Flags.string({ description: `an Oclif CLI other than the one listed in config.bin that should be made available to the user
149
+ the CLI should already exist in a directory named after the CLI that is the root of the tarball produced by "oclif pack:tarballs"`, hidden: true }),
144
150
  };
@@ -1,7 +1,10 @@
1
- import { Command, flags } from '@oclif/command';
1
+ import { Command } from '@oclif/core';
2
2
  export default class PackTarballs extends Command {
3
- static hidden: boolean;
4
3
  static description: string;
5
- static flags: flags.Input<any>;
4
+ static flags: {
5
+ root: import("@oclif/core/lib/interfaces").OptionFlag<string>;
6
+ targets: import("@oclif/core/lib/interfaces").OptionFlag<string>;
7
+ xz: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
+ };
6
9
  run(): Promise<void>;
7
10
  }
@@ -1,31 +1,33 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const command_1 = require("@oclif/command");
3
+ const core_1 = require("@oclif/core");
4
4
  const qq = require("qqjs");
5
5
  const Tarballs = require("../../tarballs");
6
- class PackTarballs extends command_1.Command {
6
+ class PackTarballs extends core_1.Command {
7
7
  async run() {
8
8
  const prevCwd = qq.cwd();
9
9
  if (process.platform === 'win32')
10
10
  throw new Error('pack does not function on windows');
11
- const { flags } = this.parse(PackTarballs);
11
+ const { flags } = await this.parse(PackTarballs);
12
12
  const targets = flags.targets.split(',');
13
13
  const buildConfig = await Tarballs.buildConfig(flags.root, { xz: flags.xz, targets: targets });
14
+ if (buildConfig.targets.length === 0) {
15
+ throw new Error('Please specify one or more valid targets.');
16
+ }
14
17
  await Tarballs.build(buildConfig);
15
18
  qq.cd(prevCwd);
16
19
  }
17
20
  }
18
21
  exports.default = PackTarballs;
19
- PackTarballs.hidden = true;
20
22
  PackTarballs.description = `packages oclif CLI into tarballs
21
23
 
22
24
  This can be used to create oclif CLIs that use the system node or that come preloaded with a node binary.
23
25
  `;
24
26
  PackTarballs.flags = {
25
- root: command_1.flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
26
- targets: command_1.flags.string({ char: 't',
27
+ root: core_1.Flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
28
+ targets: core_1.Flags.string({ char: 't',
27
29
  description: 'comma-separated targets to pack (e.g.: linux-arm,win32-x64)',
28
30
  default: Tarballs.TARGETS.join(','),
29
31
  }),
30
- xz: command_1.flags.boolean({ description: 'also build xz', allowNo: true, default: true }),
32
+ xz: core_1.Flags.boolean({ description: 'also build xz', allowNo: true, default: true }),
31
33
  };
@@ -1,9 +1,10 @@
1
- import { Command, flags } from '@oclif/command';
1
+ import { Command } from '@oclif/core';
2
+ import { Interfaces } from '@oclif/core';
2
3
  export default class PackWin extends Command {
3
- static hidden: boolean;
4
4
  static description: string;
5
5
  static flags: {
6
- root: flags.IOptionFlag<string>;
6
+ root: Interfaces.OptionFlag<string>;
7
+ 'additional-cli': Interfaces.OptionFlag<string | undefined>;
7
8
  };
8
9
  run(): Promise<void>;
9
10
  private checkForNSIS;
@@ -1,19 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const command_1 = require("@oclif/command");
3
+ const core_1 = require("@oclif/core");
4
4
  const qq = require("qqjs");
5
5
  const Tarballs = require("../../tarballs");
6
6
  const upload_util_1 = require("../../upload-util");
7
7
  const scripts = {
8
8
  /* eslint-disable no-useless-escape */
9
- cmd: (config) => `@echo off
9
+ // eslint-disable-next-line unicorn/no-useless-undefined
10
+ cmd: (config, additionalCLI = undefined) => `@echo off
10
11
  setlocal enableextensions
11
12
 
12
- set ${config.scopedEnvVarKey('BINPATH')}=%~dp0\\${config.bin}.cmd
13
- if exist "%LOCALAPPDATA%\\${config.dirname}\\client\\bin\\${config.bin}.cmd" (
14
- "%LOCALAPPDATA%\\${config.dirname}\\client\\bin\\${config.bin}.cmd" %*
13
+ set ${additionalCLI ? `${additionalCLI.toUpperCase()}_BINPATH` : config.scopedEnvVarKey('BINPATH')}=%~dp0\\${additionalCLI !== null && additionalCLI !== void 0 ? additionalCLI : config.bin}.cmd
14
+ if exist "%LOCALAPPDATA%\\${config.dirname}\\client\\bin\\${additionalCLI !== null && additionalCLI !== void 0 ? additionalCLI : config.bin}.cmd" (
15
+ "%LOCALAPPDATA%\\${config.dirname}\\client\\bin\\${additionalCLI !== null && additionalCLI !== void 0 ? additionalCLI : config.bin}.cmd" %*
15
16
  ) else (
16
- "%~dp0\\..\\client\\bin\\node.exe" "%~dp0\\..\\client\\bin\\run" %*
17
+ "%~dp0\\..\\client\\bin\\node.exe" "%~dp0\\..\\client\\${additionalCLI ? `${additionalCLI}\\bin\\run` : 'bin\\run'}" %*
17
18
  )
18
19
  `,
19
20
  sh: (config) => `#!/bin/sh
@@ -188,28 +189,33 @@ done:
188
189
  Exch $R1 ; $R1=old$R1, stack=[result,...]
189
190
  FunctionEnd
190
191
  `,
192
+ /* eslint-enable no-useless-escape */
191
193
  };
192
- class PackWin extends command_1.Command {
194
+ class PackWin extends core_1.Command {
193
195
  async run() {
194
196
  await this.checkForNSIS();
195
- const { flags } = this.parse(PackWin);
197
+ const { flags } = await this.parse(PackWin);
196
198
  const buildConfig = await Tarballs.buildConfig(flags.root);
197
- const { config, version, gitSha, targets, tmp } = buildConfig;
199
+ const { config } = buildConfig;
198
200
  await Tarballs.build(buildConfig, { platform: 'win32', pack: false });
199
- const arches = targets.filter(t => t.platform === 'win32').map(t => t.arch);
201
+ const arches = buildConfig.targets.filter(t => t.platform === 'win32').map(t => t.arch);
200
202
  for (const arch of arches) {
201
- const installerBase = qq.join(tmp, `windows-${arch}-installer`);
203
+ const installerBase = qq.join(buildConfig.tmp, `windows-${arch}-installer`);
202
204
  // eslint-disable-next-line no-await-in-loop
203
205
  await qq.write([installerBase, `bin/${config.bin}.cmd`], scripts.cmd(config));
204
206
  // eslint-disable-next-line no-await-in-loop
205
207
  await qq.write([installerBase, `bin/${config.bin}`], scripts.sh(config));
208
+ if (flags['additional-cli']) {
209
+ await qq.write([installerBase, `bin/${flags['additional-cli']}.cmd`], scripts.cmd(config, flags['additional-cli'])); // eslint-disable-line no-await-in-loop
210
+ await qq.write([installerBase, `bin/${flags['additional-cli']}`], scripts.sh({ bin: flags['additional-cli'] })); // eslint-disable-line no-await-in-loop
211
+ }
206
212
  // eslint-disable-next-line no-await-in-loop
207
213
  await qq.write([installerBase, `${config.bin}.nsi`], scripts.nsis(config, arch));
208
214
  // eslint-disable-next-line no-await-in-loop
209
215
  await qq.mv(buildConfig.workspace({ platform: 'win32', arch }), [installerBase, 'client']);
210
216
  // eslint-disable-next-line no-await-in-loop
211
217
  await qq.x(`makensis ${installerBase}/${config.bin}.nsi | grep -v "\\[compress\\]" | grep -v "^File: Descending to"`);
212
- const templateKey = upload_util_1.templateShortKey('win32', { bin: config.bin, version: version, sha: gitSha, arch });
218
+ const templateKey = (0, upload_util_1.templateShortKey)('win32', { bin: config.bin, version: config.version, sha: buildConfig.gitSha, arch });
213
219
  const o = buildConfig.dist(`win32/${templateKey}`);
214
220
  // eslint-disable-next-line no-await-in-loop
215
221
  await qq.mv([installerBase, 'installer.exe'], o);
@@ -218,10 +224,14 @@ class PackWin extends command_1.Command {
218
224
  const buildLocationUnsigned = o.replace(`${arch}.exe`, `${arch}-unsigned.exe`);
219
225
  // eslint-disable-next-line no-await-in-loop
220
226
  await qq.mv(o, buildLocationUnsigned);
227
+ const pass = config.scopedEnvVar('WINDOWS_SIGNING_PASS');
228
+ if (!pass) {
229
+ throw new Error(`${config.scopedEnvVarKey('WINDOWS_SIGNING_PASS')} not set in the environment`);
230
+ }
221
231
  /* eslint-disable array-element-newline */
222
232
  const args = [
223
233
  '-pkcs12', windows.keypath,
224
- '-pass', config.scopedEnvVar('WINDOWS_SIGNING_PASS'),
234
+ '-pass', pass,
225
235
  '-n', windows.name,
226
236
  '-i', windows.homepage || config.pjson.homepage,
227
237
  '-h', 'sha512',
@@ -251,8 +261,11 @@ class PackWin extends command_1.Command {
251
261
  }
252
262
  }
253
263
  exports.default = PackWin;
254
- PackWin.hidden = true;
255
- PackWin.description = 'create windows installer from oclif CLI';
264
+ PackWin.description = `create windows installer from oclif CLI
265
+
266
+ This command requires WINDOWS_SIGNING (prefixed with the name of your executable, e.g. OCLIF_WINDOWS_SIGNING_PASS) to be set in the environment`;
256
267
  PackWin.flags = {
257
- root: command_1.flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
268
+ root: core_1.Flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
269
+ 'additional-cli': core_1.Flags.string({ description: `an Oclif CLI other than the one listed in config.bin that should be made available to the user
270
+ the CLI should already exist in a directory named after the CLI that is the root of the tarball produced by "oclif pack:tarballs"`, hidden: true }),
258
271
  };
@@ -1,7 +1,18 @@
1
- import { Command, flags } from '@oclif/command';
1
+ import { Command } from '@oclif/core';
2
2
  export default class Promote extends Command {
3
- static hidden: boolean;
4
3
  static description: string;
5
- static flags: flags.Input<any>;
4
+ static flags: {
5
+ root: import("@oclif/core/lib/interfaces").OptionFlag<string>;
6
+ version: import("@oclif/core/lib/interfaces").OptionFlag<string>;
7
+ sha: import("@oclif/core/lib/interfaces").OptionFlag<string>;
8
+ channel: import("@oclif/core/lib/interfaces").OptionFlag<string>;
9
+ targets: import("@oclif/core/lib/interfaces").OptionFlag<string>;
10
+ deb: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
11
+ macos: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
12
+ win: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
13
+ 'max-age': import("@oclif/core/lib/interfaces").OptionFlag<string>;
14
+ xz: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
15
+ indexes: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
16
+ };
6
17
  run(): Promise<void>;
7
18
  }