oclif 2.0.0-main.6 → 2.0.0-master.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.
Files changed (105) hide show
  1. package/.oclif.manifest.json +1 -1
  2. package/CHANGELOG.md +5 -52
  3. package/README.md +57 -217
  4. package/bin/run +2 -5
  5. package/lib/app-command.d.ts +12 -0
  6. package/lib/app-command.js +26 -0
  7. package/lib/aws.d.ts +5 -5
  8. package/lib/aws.js +5 -5
  9. package/lib/command-base.d.ts +2 -2
  10. package/lib/command-base.js +3 -3
  11. package/lib/commands/base.d.ts +5 -0
  12. package/lib/commands/base.js +11 -0
  13. package/lib/commands/command.d.ts +17 -0
  14. package/lib/commands/command.js +23 -0
  15. package/lib/commands/hook.d.ts +18 -0
  16. package/lib/commands/hook.js +25 -0
  17. package/lib/commands/manifest.d.ts +2 -1
  18. package/lib/commands/manifest.js +7 -4
  19. package/lib/commands/multi.d.ts +5 -0
  20. package/lib/commands/multi.js +11 -0
  21. package/lib/commands/pack/deb.d.ts +3 -3
  22. package/lib/commands/pack/deb.js +12 -11
  23. package/lib/commands/pack/macos.d.ts +3 -3
  24. package/lib/commands/pack/macos.js +9 -8
  25. package/lib/commands/pack/tarballs.d.ts +3 -6
  26. package/lib/commands/pack/tarballs.js +7 -6
  27. package/lib/commands/pack/win.d.ts +3 -3
  28. package/lib/commands/pack/win.js +11 -17
  29. package/lib/commands/plugin.d.ts +5 -0
  30. package/lib/commands/plugin.js +11 -0
  31. package/lib/commands/promote.d.ts +3 -14
  32. package/lib/commands/promote.js +28 -27
  33. package/lib/commands/readme.d.ts +11 -13
  34. package/lib/commands/readme.js +36 -35
  35. package/lib/commands/single.d.ts +5 -0
  36. package/lib/commands/single.js +11 -0
  37. package/lib/commands/upload/deb.d.ts +3 -2
  38. package/lib/commands/upload/deb.js +9 -8
  39. package/lib/commands/upload/macos.d.ts +3 -2
  40. package/lib/commands/upload/macos.js +9 -8
  41. package/lib/commands/upload/tarballs.d.ts +3 -7
  42. package/lib/commands/upload/tarballs.js +17 -16
  43. package/lib/commands/upload/win.d.ts +3 -2
  44. package/lib/commands/upload/win.js +11 -10
  45. package/lib/generators/{cli.d.ts → app.d.ts} +21 -1
  46. package/lib/generators/app.js +459 -0
  47. package/lib/generators/command.d.ts +15 -0
  48. package/lib/generators/command.js +51 -0
  49. package/lib/generators/hook.d.ts +14 -0
  50. package/lib/generators/hook.js +51 -0
  51. package/lib/help-compatibility.d.ts +5 -4
  52. package/lib/help-compatibility.js +0 -1
  53. package/lib/index.d.ts +1 -1
  54. package/lib/index.js +2 -3
  55. package/lib/log.js +2 -3
  56. package/lib/tarballs/bin.d.ts +2 -2
  57. package/lib/tarballs/bin.js +1 -2
  58. package/lib/tarballs/build.js +28 -29
  59. package/lib/tarballs/config.d.ts +6 -6
  60. package/lib/tarballs/config.js +5 -6
  61. package/lib/tarballs/index.js +4 -4
  62. package/lib/tarballs/node.js +4 -5
  63. package/lib/upload-util.d.ts +3 -3
  64. package/lib/upload-util.js +0 -1
  65. package/lib/util.js +24 -27
  66. package/lib/version-indexes.d.ts +4 -2
  67. package/lib/version-indexes.js +5 -7
  68. package/package.json +22 -20
  69. package/templates/LICENSE.mit +21 -0
  70. package/templates/README.md.ejs +21 -0
  71. package/templates/appveyor.yml.ejs +33 -0
  72. package/templates/base/src/index.js +1 -0
  73. package/templates/base/src/index.ts +1 -0
  74. package/templates/base/test/index.test.js +8 -0
  75. package/templates/base/test/index.test.ts +9 -0
  76. package/templates/bin/run +5 -0
  77. package/templates/bin/run.cmd +3 -0
  78. package/templates/circle.yml.ejs +65 -0
  79. package/templates/editorconfig +11 -0
  80. package/templates/eslintrc +7 -0
  81. package/templates/eslintrc.typescript +10 -0
  82. package/templates/multi/src/index.js +1 -0
  83. package/templates/multi/src/index.ts +1 -0
  84. package/templates/plugin/bin/run +4 -0
  85. package/templates/plugin/src/index.ts +1 -0
  86. package/templates/scripts/setup_git +12 -0
  87. package/templates/single/bin/run.js +4 -0
  88. package/templates/single/bin/run.ts +13 -0
  89. package/templates/src/command.js.ejs +27 -0
  90. package/templates/src/command.ts.ejs +46 -0
  91. package/templates/src/hook.js.ejs +3 -0
  92. package/templates/src/hook.ts.ejs +7 -0
  93. package/templates/test/command.test.js.ejs +28 -0
  94. package/templates/test/command.test.ts.ejs +29 -0
  95. package/templates/test/hook.test.js.ejs +9 -0
  96. package/templates/test/hook.test.ts.ejs +9 -0
  97. package/templates/test/mocha.opts +4 -0
  98. package/templates/test/tsconfig.json +9 -0
  99. package/templates/travis.yml.ejs +14 -0
  100. package/templates/tsconfig.json +15 -0
  101. package/bin/dev +0 -19
  102. package/bin/dev.cmd +0 -3
  103. package/lib/commands/generate.d.ts +0 -11
  104. package/lib/commands/generate.js +0 -19
  105. package/lib/generators/cli.js +0 -183
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const command_1 = require("@oclif/command");
4
+ const command_base_1 = require("../command-base");
5
+ class AppCommand extends command_base_1.default {
6
+ async run() {
7
+ const { flags, args } = this.parse(AppCommand);
8
+ await super.generate('command', {
9
+ name: args.name,
10
+ defaults: flags.defaults,
11
+ force: flags.force,
12
+ });
13
+ }
14
+ }
15
+ exports.default = AppCommand;
16
+ AppCommand.description = 'add a command to an existing CLI or plugin';
17
+ AppCommand.flags = {
18
+ defaults: command_1.flags.boolean({ description: 'use defaults for every setting' }),
19
+ force: command_1.flags.boolean({ description: 'overwrite existing files' }),
20
+ };
21
+ AppCommand.args = [
22
+ { name: 'name', description: 'name of command', required: true },
23
+ ];
@@ -0,0 +1,18 @@
1
+ import { flags } from '@oclif/command';
2
+ import Base from '../command-base';
3
+ export interface Options {
4
+ name: string;
5
+ defaults?: boolean;
6
+ force?: boolean;
7
+ event: string;
8
+ }
9
+ export default abstract class HookCommand extends Base {
10
+ static description: string;
11
+ static flags: flags.Input<any>;
12
+ static args: {
13
+ name: string;
14
+ description: string;
15
+ required: boolean;
16
+ }[];
17
+ run(): Promise<void>;
18
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const command_1 = require("@oclif/command");
4
+ const command_base_1 = require("../command-base");
5
+ class HookCommand extends command_base_1.default {
6
+ async run() {
7
+ const { flags, args } = this.parse(HookCommand);
8
+ await super.generate('hook', {
9
+ name: args.name,
10
+ event: flags.event,
11
+ defaults: flags.defaults,
12
+ force: flags.force,
13
+ });
14
+ }
15
+ }
16
+ exports.default = HookCommand;
17
+ HookCommand.description = 'add a hook to an existing CLI or plugin';
18
+ HookCommand.flags = {
19
+ defaults: command_1.flags.boolean({ description: 'use defaults for every setting' }),
20
+ force: command_1.flags.boolean({ description: 'overwrite existing files' }),
21
+ event: command_1.flags.string({ description: 'event to run hook on', default: 'init' }),
22
+ };
23
+ HookCommand.args = [
24
+ { name: 'name', description: 'name of hook (snake_case)', required: true },
25
+ ];
@@ -1,5 +1,6 @@
1
- import { Command } from '@oclif/core';
1
+ import { Command } from '@oclif/command';
2
2
  export default class Manifest extends Command {
3
+ static hidden: boolean;
3
4
  static description: string;
4
5
  static args: {
5
6
  name: string;
@@ -1,23 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@oclif/core");
3
+ const command_1 = require("@oclif/command");
4
+ const Config = require("@oclif/config");
4
5
  const fs = require("fs-extra");
5
6
  const path = require("path");
6
- class Manifest extends core_1.Command {
7
+ class Manifest extends command_1.Command {
7
8
  async run() {
8
9
  try {
9
10
  fs.unlinkSync('oclif.manifest.json');
10
11
  }
11
12
  catch (_a) { }
12
- const { args } = await this.parse(Manifest);
13
+ const { args } = this.parse(Manifest);
13
14
  const root = path.resolve(args.path);
14
- let plugin = new core_1.Plugin({ root, type: 'core', ignoreManifest: true, errorOnManifestCreate: true });
15
+ let plugin = new Config.Plugin({ root, type: 'core', ignoreManifest: true, errorOnManifestCreate: true });
15
16
  if (!plugin)
16
17
  throw new Error('plugin not found');
17
18
  await plugin.load();
18
19
  if (!plugin.valid) {
19
20
  const p = require.resolve('@oclif/plugin-legacy', { paths: [process.cwd()] });
20
21
  const { PluginLegacy } = require(p);
22
+ delete plugin.name;
21
23
  plugin = new PluginLegacy(this.config, plugin);
22
24
  await plugin.load();
23
25
  }
@@ -31,6 +33,7 @@ class Manifest extends core_1.Command {
31
33
  }
32
34
  }
33
35
  exports.default = Manifest;
36
+ Manifest.hidden = true;
34
37
  Manifest.description = 'generates plugin manifest json';
35
38
  Manifest.args = [
36
39
  { name: 'path', description: 'path to plugin', default: '.' },
@@ -0,0 +1,5 @@
1
+ import AppCommand from '../app-command';
2
+ export default class extends AppCommand {
3
+ static description: string;
4
+ type: string;
5
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const app_command_1 = require("../app-command");
4
+ class default_1 extends app_command_1.default {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.type = 'multi';
8
+ }
9
+ }
10
+ exports.default = default_1;
11
+ default_1.description = 'generate a new multi-command CLI';
@@ -1,9 +1,9 @@
1
- import { Command } from '@oclif/core';
2
- import { Interfaces } from '@oclif/core';
1
+ import { Command, flags } from '@oclif/command';
3
2
  export default class PackDeb extends Command {
3
+ static hidden: boolean;
4
4
  static description: string;
5
5
  static flags: {
6
- root: Interfaces.OptionFlag<string>;
6
+ root: flags.IOptionFlag<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 core_1 = require("@oclif/core");
3
+ const command_1 = require("@oclif/command");
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: ${(0, upload_util_1.debVersion)(config)}
31
+ Version: ${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 core_1.Command {
44
+ class PackDeb extends command_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 } = await this.parse(PackDeb);
48
+ const { flags } = this.parse(PackDeb);
49
49
  const buildConfig = await Tarballs.buildConfig(flags.root);
50
- const { config } = buildConfig;
50
+ const { config, tmp, targets } = 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 = (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'));
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'));
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, (0, upload_util_1.debArch)(arch)));
64
+ await qq.write([workspace, 'DEBIAN/control'], scripts.control(buildConfig, 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(buildConfig.targets
71
+ const arches = _.uniq(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 core_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(buildConfig.tmp, 'apt', 'apt-ftparchive.conf');
81
+ const ftparchive = qq.join(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,7 +89,8 @@ class PackDeb extends core_1.Command {
89
89
  }
90
90
  }
91
91
  exports.default = PackDeb;
92
+ PackDeb.hidden = true;
92
93
  PackDeb.description = 'pack CLI into debian package';
93
94
  PackDeb.flags = {
94
- root: core_1.Flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
95
+ root: command_1.flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
95
96
  };
@@ -1,9 +1,9 @@
1
- import { Command } from '@oclif/core';
2
- import { Interfaces } from '@oclif/core';
1
+ import { Command, flags } from '@oclif/command';
3
2
  export default class PackMacos extends Command {
3
+ static hidden: boolean;
4
4
  static description: string;
5
5
  static flags: {
6
- root: Interfaces.OptionFlag<string>;
6
+ root: flags.IOptionFlag<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 core_1 = require("@oclif/core");
3
+ const command_1 = require("@oclif/command");
4
4
  const path = require("path");
5
5
  const qq = require("qqjs");
6
6
  const Tarballs = require("../../tarballs");
@@ -87,13 +87,13 @@ exit 0
87
87
  `;
88
88
  },
89
89
  };
90
- class PackMacos extends core_1.Command {
90
+ class PackMacos extends command_1.Command {
91
91
  async run() {
92
92
  if (process.platform !== 'darwin')
93
93
  this.error('must be run from macos');
94
- const { flags } = await this.parse(PackMacos);
94
+ const { flags } = this.parse(PackMacos);
95
95
  const buildConfig = await Tarballs.buildConfig(flags.root);
96
- const { config } = buildConfig;
96
+ const { config, tmp, gitSha, version } = buildConfig;
97
97
  const c = config.pjson.oclif;
98
98
  if (!c.macos)
99
99
  this.error('package.json is missing an oclif.macos config');
@@ -102,10 +102,10 @@ class PackMacos extends core_1.Command {
102
102
  const macos = c.macos;
103
103
  const packageIdentifier = macos.identifier;
104
104
  await Tarballs.build(buildConfig, { platform: 'darwin', pack: false });
105
- const templateKey = (0, upload_util_1.templateShortKey)('macos', { bin: config.bin, version: config.version, sha: buildConfig.gitSha });
105
+ const templateKey = upload_util_1.templateShortKey('macos', { bin: config.bin, version: config.version, sha: gitSha });
106
106
  const dist = buildConfig.dist(`macos/${templateKey}`);
107
107
  await qq.emptyDir(path.dirname(dist));
108
- const scriptsDir = qq.join(buildConfig.tmp, 'macos/scripts');
108
+ const scriptsDir = qq.join(tmp, 'macos/scripts');
109
109
  const rootDir = buildConfig.workspace({ platform: 'darwin', arch: 'x64' });
110
110
  const writeScript = async (script) => {
111
111
  const path = script === 'uninstall' ? [rootDir, 'bin'] : [scriptsDir];
@@ -120,7 +120,7 @@ class PackMacos extends core_1.Command {
120
120
  const args = [
121
121
  '--root', rootDir,
122
122
  '--identifier', packageIdentifier,
123
- '--version', buildConfig.version,
123
+ '--version', version,
124
124
  '--install-location', `/usr/local/lib/${config.dirname}`,
125
125
  '--scripts', scriptsDir,
126
126
  ];
@@ -137,7 +137,8 @@ class PackMacos extends core_1.Command {
137
137
  }
138
138
  }
139
139
  exports.default = PackMacos;
140
+ PackMacos.hidden = true;
140
141
  PackMacos.description = 'pack CLI into macOS .pkg';
141
142
  PackMacos.flags = {
142
- root: core_1.Flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
143
+ root: command_1.flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
143
144
  };
@@ -1,10 +1,7 @@
1
- import { Command } from '@oclif/core';
1
+ import { Command, flags } from '@oclif/command';
2
2
  export default class PackTarballs extends Command {
3
+ static hidden: boolean;
3
4
  static description: string;
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
- };
5
+ static flags: flags.Input<any>;
9
6
  run(): Promise<void>;
10
7
  }
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@oclif/core");
3
+ const command_1 = require("@oclif/command");
4
4
  const qq = require("qqjs");
5
5
  const Tarballs = require("../../tarballs");
6
- class PackTarballs extends core_1.Command {
6
+ class PackTarballs extends command_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 } = await this.parse(PackTarballs);
11
+ const { flags } = 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
14
  await Tarballs.build(buildConfig);
@@ -16,15 +16,16 @@ class PackTarballs extends core_1.Command {
16
16
  }
17
17
  }
18
18
  exports.default = PackTarballs;
19
+ PackTarballs.hidden = true;
19
20
  PackTarballs.description = `packages oclif CLI into tarballs
20
21
 
21
22
  This can be used to create oclif CLIs that use the system node or that come preloaded with a node binary.
22
23
  `;
23
24
  PackTarballs.flags = {
24
- root: core_1.Flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
25
- targets: core_1.Flags.string({ char: 't',
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',
26
27
  description: 'comma-separated targets to pack (e.g.: linux-arm,win32-x64)',
27
28
  default: Tarballs.TARGETS.join(','),
28
29
  }),
29
- xz: core_1.Flags.boolean({ description: 'also build xz', allowNo: true, default: true }),
30
+ xz: command_1.flags.boolean({ description: 'also build xz', allowNo: true, default: true }),
30
31
  };
@@ -1,9 +1,9 @@
1
- import { Command } from '@oclif/core';
2
- import { Interfaces } from '@oclif/core';
1
+ import { Command, flags } from '@oclif/command';
3
2
  export default class PackWin extends Command {
3
+ static hidden: boolean;
4
4
  static description: string;
5
5
  static flags: {
6
- root: Interfaces.OptionFlag<string>;
6
+ root: flags.IOptionFlag<string>;
7
7
  };
8
8
  run(): Promise<void>;
9
9
  private checkForNSIS;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@oclif/core");
3
+ const command_1 = require("@oclif/command");
4
4
  const qq = require("qqjs");
5
5
  const Tarballs = require("../../tarballs");
6
6
  const upload_util_1 = require("../../upload-util");
@@ -188,18 +188,17 @@ done:
188
188
  Exch $R1 ; $R1=old$R1, stack=[result,...]
189
189
  FunctionEnd
190
190
  `,
191
- /* eslint-enable no-useless-escape */
192
191
  };
193
- class PackWin extends core_1.Command {
192
+ class PackWin extends command_1.Command {
194
193
  async run() {
195
194
  await this.checkForNSIS();
196
- const { flags } = await this.parse(PackWin);
195
+ const { flags } = this.parse(PackWin);
197
196
  const buildConfig = await Tarballs.buildConfig(flags.root);
198
- const { config } = buildConfig;
197
+ const { config, version, gitSha, targets, tmp } = buildConfig;
199
198
  await Tarballs.build(buildConfig, { platform: 'win32', pack: false });
200
- const arches = buildConfig.targets.filter(t => t.platform === 'win32').map(t => t.arch);
199
+ const arches = targets.filter(t => t.platform === 'win32').map(t => t.arch);
201
200
  for (const arch of arches) {
202
- const installerBase = qq.join(buildConfig.tmp, `windows-${arch}-installer`);
201
+ const installerBase = qq.join(tmp, `windows-${arch}-installer`);
203
202
  // eslint-disable-next-line no-await-in-loop
204
203
  await qq.write([installerBase, `bin/${config.bin}.cmd`], scripts.cmd(config));
205
204
  // eslint-disable-next-line no-await-in-loop
@@ -210,7 +209,7 @@ class PackWin extends core_1.Command {
210
209
  await qq.mv(buildConfig.workspace({ platform: 'win32', arch }), [installerBase, 'client']);
211
210
  // eslint-disable-next-line no-await-in-loop
212
211
  await qq.x(`makensis ${installerBase}/${config.bin}.nsi | grep -v "\\[compress\\]" | grep -v "^File: Descending to"`);
213
- const templateKey = (0, upload_util_1.templateShortKey)('win32', { bin: config.bin, version: buildConfig.version, sha: buildConfig.gitSha, arch });
212
+ const templateKey = upload_util_1.templateShortKey('win32', { bin: config.bin, version: version, sha: gitSha, arch });
214
213
  const o = buildConfig.dist(`win32/${templateKey}`);
215
214
  // eslint-disable-next-line no-await-in-loop
216
215
  await qq.mv([installerBase, 'installer.exe'], o);
@@ -219,14 +218,10 @@ class PackWin extends core_1.Command {
219
218
  const buildLocationUnsigned = o.replace(`${arch}.exe`, `${arch}-unsigned.exe`);
220
219
  // eslint-disable-next-line no-await-in-loop
221
220
  await qq.mv(o, buildLocationUnsigned);
222
- const pass = config.scopedEnvVar('WINDOWS_SIGNING_PASS');
223
- if (!pass) {
224
- throw new Error(`${config.scopedEnvVarKey('WINDOWS_SIGNING_PASS')} not set in the environment`);
225
- }
226
221
  /* eslint-disable array-element-newline */
227
222
  const args = [
228
223
  '-pkcs12', windows.keypath,
229
- '-pass', pass,
224
+ '-pass', config.scopedEnvVar('WINDOWS_SIGNING_PASS'),
230
225
  '-n', windows.name,
231
226
  '-i', windows.homepage || config.pjson.homepage,
232
227
  '-h', 'sha512',
@@ -256,9 +251,8 @@ class PackWin extends core_1.Command {
256
251
  }
257
252
  }
258
253
  exports.default = PackWin;
259
- PackWin.description = `create windows installer from oclif CLI
260
-
261
- This command requires WINDOWS_SIGNING (prefixed with the name of your executable, e.g. OCLIF_WINDOWS_SIGNING_PASS) to be set in the environment`;
254
+ PackWin.hidden = true;
255
+ PackWin.description = 'create windows installer from oclif CLI';
262
256
  PackWin.flags = {
263
- root: core_1.Flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
257
+ root: command_1.flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
264
258
  };
@@ -0,0 +1,5 @@
1
+ import AppCommand from '../app-command';
2
+ export default class extends AppCommand {
3
+ static description: string;
4
+ type: string;
5
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const app_command_1 = require("../app-command");
4
+ class default_1 extends app_command_1.default {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.type = 'plugin';
8
+ }
9
+ }
10
+ exports.default = default_1;
11
+ default_1.description = 'create a new CLI plugin';
@@ -1,18 +1,7 @@
1
- import { Command } from '@oclif/core';
1
+ import { Command, flags } from '@oclif/command';
2
2
  export default class Promote extends Command {
3
+ static hidden: boolean;
3
4
  static description: string;
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
- };
5
+ static flags: flags.Input<any>;
17
6
  run(): Promise<void>;
18
7
  }
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@oclif/core");
3
+ const command_1 = require("@oclif/command");
4
4
  const cli_ux_1 = require("cli-ux");
5
5
  const path = require("path");
6
6
  const aws_1 = require("../aws");
7
7
  const Tarballs = require("../tarballs");
8
8
  const upload_util_1 = require("../upload-util");
9
9
  const version_indexes_1 = require("../version-indexes");
10
- class Promote extends core_1.Command {
10
+ class Promote extends command_1.Command {
11
11
  async run() {
12
- const { flags } = await this.parse(Promote);
12
+ const { flags } = this.parse(Promote);
13
13
  const maxAge = `max-age=${flags['max-age']}`;
14
14
  const targets = flags.targets.split(',');
15
15
  const buildConfig = await Tarballs.buildConfig(flags.root, { targets });
@@ -21,13 +21,13 @@ class Promote extends core_1.Command {
21
21
  };
22
22
  if (!s3Config.bucket)
23
23
  this.error('Cannot determine S3 bucket for promotion');
24
- const cloudBucketCommitKey = (shortKey) => path.join(s3Config.bucket, (0, upload_util_1.commitAWSDir)(flags.version, flags.sha, s3Config), shortKey);
25
- const cloudChannelKey = (shortKey) => path.join((0, upload_util_1.channelAWSDir)(flags.channel, s3Config), shortKey);
24
+ const cloudBucketCommitKey = (shortKey) => path.join(s3Config.bucket, upload_util_1.commitAWSDir(flags.version, flags.sha, s3Config), shortKey);
25
+ const cloudChannelKey = (shortKey) => path.join(upload_util_1.channelAWSDir(flags.channel, s3Config), shortKey);
26
26
  // copy tarballs manifests
27
27
  if (buildConfig.targets.length > 0)
28
28
  this.log(`Promoting buildmanifests & unversioned tarballs to ${flags.channel}`);
29
29
  for (const target of buildConfig.targets) {
30
- const manifest = (0, upload_util_1.templateShortKey)('manifest', {
30
+ const manifest = upload_util_1.templateShortKey('manifest', {
31
31
  arch: target.arch,
32
32
  bin: config.bin,
33
33
  platform: target.platform,
@@ -46,7 +46,7 @@ class Promote extends core_1.Command {
46
46
  CacheControl: maxAge,
47
47
  MetadataDirective: 'REPLACE',
48
48
  });
49
- const versionedTarGzName = (0, upload_util_1.templateShortKey)('versioned', '.tar.gz', {
49
+ const versionedTarGzName = upload_util_1.templateShortKey('versioned', '.tar.gz', {
50
50
  arch: target.arch,
51
51
  bin: config.bin,
52
52
  platform: target.platform,
@@ -67,9 +67,9 @@ class Promote extends core_1.Command {
67
67
  });
68
68
  // eslint-disable-next-line no-await-in-loop
69
69
  if (flags.indexes)
70
- await (0, version_indexes_1.appendToIndex)(Object.assign(Object.assign({}, indexDefaults), { originalUrl: versionedTarGzKey, filename: unversionedTarGzName }));
70
+ await version_indexes_1.appendToIndex(Object.assign(Object.assign({}, indexDefaults), { originalUrl: versionedTarGzKey, filename: unversionedTarGzName }));
71
71
  if (flags.xz) {
72
- const versionedTarXzName = (0, upload_util_1.templateShortKey)('versioned', '.tar.xz', {
72
+ const versionedTarXzName = upload_util_1.templateShortKey('versioned', '.tar.xz', {
73
73
  arch: target.arch,
74
74
  bin: config.bin,
75
75
  platform: target.platform,
@@ -90,13 +90,13 @@ class Promote extends core_1.Command {
90
90
  });
91
91
  // eslint-disable-next-line no-await-in-loop
92
92
  if (flags.indexes)
93
- await (0, version_indexes_1.appendToIndex)(Object.assign(Object.assign({}, indexDefaults), { originalUrl: versionedTarXzKey, filename: unversionedTarXzName }));
93
+ await version_indexes_1.appendToIndex(Object.assign(Object.assign({}, indexDefaults), { originalUrl: versionedTarXzKey, filename: unversionedTarXzName }));
94
94
  }
95
95
  }
96
96
  // copy darwin pkg
97
97
  if (flags.macos) {
98
98
  this.log(`Promoting macos pkg to ${flags.channel}`);
99
- const darwinPkg = (0, upload_util_1.templateShortKey)('macos', { bin: config.bin, version: flags.version, sha: flags.sha });
99
+ const darwinPkg = upload_util_1.templateShortKey('macos', { bin: config.bin, version: flags.version, sha: flags.sha });
100
100
  const darwinCopySource = cloudBucketCommitKey(darwinPkg);
101
101
  // strip version & sha so scripts can point to a static channel pkg
102
102
  const unversionedPkg = darwinPkg.replace(`-v${flags.version}-${flags.sha}`, '');
@@ -109,14 +109,14 @@ class Promote extends core_1.Command {
109
109
  MetadataDirective: 'REPLACE',
110
110
  });
111
111
  if (flags.indexes)
112
- await (0, version_indexes_1.appendToIndex)(Object.assign(Object.assign({}, indexDefaults), { originalUrl: darwinCopySource, filename: unversionedPkg }));
112
+ await version_indexes_1.appendToIndex(Object.assign(Object.assign({}, indexDefaults), { originalUrl: darwinCopySource, filename: unversionedPkg }));
113
113
  }
114
114
  // copy win exe
115
115
  if (flags.win) {
116
116
  this.log(`Promoting windows exe to ${flags.channel}`);
117
117
  const archs = buildConfig.targets.filter(t => t.platform === 'win32').map(t => t.arch);
118
118
  for (const arch of archs) {
119
- const winPkg = (0, upload_util_1.templateShortKey)('win32', { bin: config.bin, version: flags.version, sha: flags.sha, arch });
119
+ const winPkg = upload_util_1.templateShortKey('win32', { bin: config.bin, version: flags.version, sha: flags.sha, arch });
120
120
  const winCopySource = cloudBucketCommitKey(winPkg);
121
121
  // strip version & sha so scripts can point to a static channel exe
122
122
  const unversionedExe = winPkg.replace(`-v${flags.version}-${flags.sha}`, '');
@@ -130,14 +130,14 @@ class Promote extends core_1.Command {
130
130
  });
131
131
  // eslint-disable-next-line no-await-in-loop
132
132
  if (flags.indexes)
133
- await (0, version_indexes_1.appendToIndex)(Object.assign(Object.assign({}, indexDefaults), { originalUrl: winCopySource, filename: unversionedExe }));
133
+ await version_indexes_1.appendToIndex(Object.assign(Object.assign({}, indexDefaults), { originalUrl: winCopySource, filename: unversionedExe }));
134
134
  cli_ux_1.cli.action.stop('successfully');
135
135
  }
136
136
  }
137
137
  // copy debian artifacts
138
138
  const debArtifacts = [
139
- (0, upload_util_1.templateShortKey)('deb', { bin: config.bin, versionShaRevision: (0, upload_util_1.debVersion)(buildConfig), arch: 'amd64' }),
140
- (0, upload_util_1.templateShortKey)('deb', { bin: config.bin, versionShaRevision: (0, upload_util_1.debVersion)(buildConfig), arch: 'i386' }),
139
+ upload_util_1.templateShortKey('deb', { bin: config.bin, versionShaRevision: upload_util_1.debVersion(buildConfig), arch: 'amd64' }),
140
+ upload_util_1.templateShortKey('deb', { bin: config.bin, versionShaRevision: upload_util_1.debVersion(buildConfig), arch: 'i386' }),
141
141
  'Packages.gz',
142
142
  'Packages.xz',
143
143
  'Packages.bz2',
@@ -163,21 +163,22 @@ class Promote extends core_1.Command {
163
163
  }
164
164
  }
165
165
  exports.default = Promote;
166
+ Promote.hidden = true;
166
167
  Promote.description = 'promote CLI builds to a S3 release channel';
167
168
  Promote.flags = {
168
- root: core_1.Flags.string({ char: 'r', description: 'path to the oclif CLI project root', default: '.', required: true }),
169
- version: core_1.Flags.string({ description: 'semantic version of the CLI to promote', required: true }),
170
- sha: core_1.Flags.string({ description: '7-digit short git commit SHA of the CLI to promote', required: true }),
171
- channel: core_1.Flags.string({ description: 'which channel to promote to', required: true, default: 'stable' }),
172
- targets: core_1.Flags.string({
169
+ root: command_1.flags.string({ char: 'r', description: 'path to the oclif CLI project root', default: '.', required: true }),
170
+ version: command_1.flags.string({ description: 'semantic version of the CLI to promote', required: true }),
171
+ sha: command_1.flags.string({ description: '7-digit short git commit SHA of the CLI to promote', required: true }),
172
+ channel: command_1.flags.string({ description: 'which channel to promote to', required: true, default: 'stable' }),
173
+ targets: command_1.flags.string({
173
174
  char: 't',
174
175
  description: 'comma-separated targets to promote (e.g.: linux-arm,win32-x64)',
175
176
  default: Tarballs.TARGETS.join(','),
176
177
  }),
177
- deb: core_1.Flags.boolean({ char: 'd', description: 'promote debian artifacts' }),
178
- macos: core_1.Flags.boolean({ char: 'm', description: 'promote macOS pkg' }),
179
- win: core_1.Flags.boolean({ char: 'w', description: 'promote Windows exe' }),
180
- 'max-age': core_1.Flags.string({ char: 'a', description: 'cache control max-age in seconds', default: '86400' }),
181
- xz: core_1.Flags.boolean({ description: 'also upload xz', allowNo: true, default: true }),
182
- indexes: core_1.Flags.boolean({ description: 'append the promoted urls into the index files' }),
178
+ deb: command_1.flags.boolean({ char: 'd', description: 'promote debian artifacts' }),
179
+ macos: command_1.flags.boolean({ char: 'm', description: 'promote macOS pkg' }),
180
+ win: command_1.flags.boolean({ char: 'w', description: 'promote Windows exe' }),
181
+ 'max-age': command_1.flags.string({ char: 'a', description: 'cache control max-age in seconds', default: '86400' }),
182
+ xz: command_1.flags.boolean({ description: 'also upload xz', allowNo: true, default: true }),
183
+ indexes: command_1.flags.boolean({ description: 'append the promoted urls into the index files' }),
183
184
  };