oclif 1.18.2-dev.2 → 2.0.0-dev.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 +71 -10
  3. package/README.md +223 -96
  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 +5 -5
  9. package/lib/command-base.d.ts +1 -1
  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 +7 -8
  17. package/lib/commands/pack/macos.d.ts +4 -4
  18. package/lib/commands/pack/macos.js +16 -17
  19. package/lib/commands/pack/tarballs.d.ts +4 -5
  20. package/lib/commands/pack/tarballs.js +6 -7
  21. package/lib/commands/pack/win.d.ts +4 -4
  22. package/lib/commands/pack/win.js +26 -20
  23. package/lib/commands/promote.d.ts +12 -13
  24. package/lib/commands/promote.js +27 -28
  25. package/lib/commands/readme.d.ts +11 -12
  26. package/lib/commands/readme.js +27 -28
  27. package/lib/commands/upload/deb.d.ts +2 -3
  28. package/lib/commands/upload/deb.js +7 -8
  29. package/lib/commands/upload/macos.d.ts +2 -3
  30. package/lib/commands/upload/macos.js +7 -8
  31. package/lib/commands/upload/tarballs.d.ts +5 -5
  32. package/lib/commands/upload/tarballs.js +15 -18
  33. package/lib/commands/upload/win.d.ts +2 -3
  34. package/lib/commands/upload/win.js +8 -9
  35. package/lib/generators/{app.d.ts → cli.d.ts} +1 -21
  36. package/lib/generators/cli.js +183 -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 +2 -1
  42. package/lib/tarballs/bin.d.ts +2 -2
  43. package/lib/tarballs/bin.js +1 -0
  44. package/lib/tarballs/build.js +13 -12
  45. package/lib/tarballs/config.d.ts +6 -6
  46. package/lib/tarballs/config.js +6 -5
  47. package/lib/tarballs/index.js +4 -4
  48. package/lib/tarballs/node.js +5 -4
  49. package/lib/upload-util.d.ts +3 -3
  50. package/lib/upload-util.js +1 -0
  51. package/lib/util.js +5 -2
  52. package/lib/version-indexes.d.ts +2 -4
  53. package/lib/version-indexes.js +3 -1
  54. package/package.json +5 -7
  55. package/lib/app-command.d.ts +0 -16
  56. package/lib/app-command.js +0 -26
  57. package/lib/commands/base.d.ts +0 -5
  58. package/lib/commands/base.js +0 -11
  59. package/lib/commands/command.d.ts +0 -19
  60. package/lib/commands/command.js +0 -23
  61. package/lib/commands/hook.d.ts +0 -22
  62. package/lib/commands/hook.js +0 -25
  63. package/lib/commands/multi.d.ts +0 -5
  64. package/lib/commands/multi.js +0 -11
  65. package/lib/commands/plugin.d.ts +0 -5
  66. package/lib/commands/plugin.js +0 -11
  67. package/lib/commands/single.d.ts +0 -5
  68. package/lib/commands/single.js +0 -11
  69. package/lib/generators/app.js +0 -470
  70. package/lib/generators/command.d.ts +0 -15
  71. package/lib/generators/command.js +0 -51
  72. package/lib/generators/hook.d.ts +0 -14
  73. package/lib/generators/hook.js +0 -51
  74. package/templates/LICENSE.mit +0 -21
  75. package/templates/README.md.ejs +0 -21
  76. package/templates/appveyor.yml.ejs +0 -33
  77. package/templates/base/src/index.js +0 -1
  78. package/templates/base/src/index.ts +0 -1
  79. package/templates/base/test/index.test.js +0 -8
  80. package/templates/base/test/index.test.ts +0 -9
  81. package/templates/bin/run +0 -5
  82. package/templates/bin/run.cmd +0 -3
  83. package/templates/circle.yml.ejs +0 -65
  84. package/templates/editorconfig +0 -11
  85. package/templates/eslintrc +0 -3
  86. package/templates/eslintrc.typescript +0 -12
  87. package/templates/multi/src/index.js +0 -1
  88. package/templates/multi/src/index.ts +0 -1
  89. package/templates/plugin/bin/run +0 -4
  90. package/templates/plugin/src/index.ts +0 -1
  91. package/templates/scripts/setup_git +0 -12
  92. package/templates/single/bin/run.js +0 -4
  93. package/templates/single/bin/run.ts +0 -13
  94. package/templates/src/command.js.ejs +0 -27
  95. package/templates/src/command.ts.ejs +0 -46
  96. package/templates/src/hook.js.ejs +0 -3
  97. package/templates/src/hook.ts.ejs +0 -7
  98. package/templates/test/command.test.js.ejs +0 -28
  99. package/templates/test/command.test.ts.ejs +0 -29
  100. package/templates/test/hook.test.js.ejs +0 -9
  101. package/templates/test/hook.test.ts.ejs +0 -9
  102. package/templates/test/mocha.opts +0 -4
  103. package/templates/test/tsconfig.json +0 -9
  104. package/templates/travis.yml.ejs +0 -14
  105. package/templates/tsconfig.json +0 -14
@@ -1,15 +1,15 @@
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 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 command_1.Command {
10
+ class Promote extends core_1.Command {
11
11
  async run() {
12
- const { flags } = this.parse(Promote);
12
+ const { flags } = await 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 command_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, upload_util_1.commitAWSDir(flags.version, flags.sha, s3Config), shortKey);
25
- const cloudChannelKey = (shortKey) => path.join(upload_util_1.channelAWSDir(flags.channel, s3Config), shortKey);
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);
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 = upload_util_1.templateShortKey('manifest', {
30
+ const manifest = (0, 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 command_1.Command {
46
46
  CacheControl: maxAge,
47
47
  MetadataDirective: 'REPLACE',
48
48
  });
49
- const versionedTarGzName = upload_util_1.templateShortKey('versioned', '.tar.gz', {
49
+ const versionedTarGzName = (0, 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 command_1.Command {
67
67
  });
68
68
  // eslint-disable-next-line no-await-in-loop
69
69
  if (flags.indexes)
70
- await version_indexes_1.appendToIndex(Object.assign(Object.assign({}, indexDefaults), { originalUrl: versionedTarGzKey, filename: unversionedTarGzName }));
70
+ await (0, version_indexes_1.appendToIndex)(Object.assign(Object.assign({}, indexDefaults), { originalUrl: versionedTarGzKey, filename: unversionedTarGzName }));
71
71
  if (flags.xz) {
72
- const versionedTarXzName = upload_util_1.templateShortKey('versioned', '.tar.xz', {
72
+ const versionedTarXzName = (0, 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 command_1.Command {
90
90
  });
91
91
  // eslint-disable-next-line no-await-in-loop
92
92
  if (flags.indexes)
93
- await version_indexes_1.appendToIndex(Object.assign(Object.assign({}, indexDefaults), { originalUrl: versionedTarXzKey, filename: unversionedTarXzName }));
93
+ await (0, 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 = upload_util_1.templateShortKey('macos', { bin: config.bin, version: flags.version, sha: flags.sha });
99
+ const darwinPkg = (0, 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 command_1.Command {
109
109
  MetadataDirective: 'REPLACE',
110
110
  });
111
111
  if (flags.indexes)
112
- await version_indexes_1.appendToIndex(Object.assign(Object.assign({}, indexDefaults), { originalUrl: darwinCopySource, filename: unversionedPkg }));
112
+ await (0, 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 = upload_util_1.templateShortKey('win32', { bin: config.bin, version: flags.version, sha: flags.sha, arch });
119
+ const winPkg = (0, 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 command_1.Command {
130
130
  });
131
131
  // eslint-disable-next-line no-await-in-loop
132
132
  if (flags.indexes)
133
- await version_indexes_1.appendToIndex(Object.assign(Object.assign({}, indexDefaults), { originalUrl: winCopySource, filename: unversionedExe }));
133
+ await (0, 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
- 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' }),
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' }),
141
141
  'Packages.gz',
142
142
  'Packages.xz',
143
143
  'Packages.bz2',
@@ -163,22 +163,21 @@ class Promote extends command_1.Command {
163
163
  }
164
164
  }
165
165
  exports.default = Promote;
166
- Promote.hidden = true;
167
166
  Promote.description = 'promote CLI builds to a S3 release channel';
168
167
  Promote.flags = {
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({
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({
174
173
  char: 't',
175
174
  description: 'comma-separated targets to promote (e.g.: linux-arm,win32-x64)',
176
175
  default: Tarballs.TARGETS.join(','),
177
176
  }),
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' }),
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' }),
184
183
  };
@@ -1,21 +1,20 @@
1
- import { Command, flags } from '@oclif/command';
2
- import * as Config from '@oclif/config';
1
+ import { Command, Interfaces } from '@oclif/core';
3
2
  export default class Readme extends Command {
4
- static hidden: boolean;
5
3
  static description: string;
6
4
  static flags: {
7
- dir: flags.IOptionFlag<string>;
8
- multi: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
5
+ dir: Interfaces.OptionFlag<string>;
6
+ multi: Interfaces.BooleanFlag<boolean>;
9
7
  };
8
+ private HelpClass;
10
9
  run(): Promise<void>;
11
10
  replaceTag(readme: string, tag: string, body: string): string;
12
- toc(__: Config.IConfig, readme: string): string;
13
- usage(config: Config.IConfig): string;
14
- multiCommands(config: Config.IConfig, commands: Config.Command[], dir: string): string;
15
- createTopicFile(file: string, config: Config.IConfig, topic: Config.Topic, commands: Config.Command[]): void;
16
- commands(config: Config.IConfig, commands: Config.Command[]): string;
17
- renderCommand(config: Config.IConfig, c: Config.Command): string;
18
- commandCode(config: Config.IConfig, c: Config.Command): string | undefined;
11
+ toc(__: Interfaces.Config, readme: string): string;
12
+ usage(config: Interfaces.Config): string;
13
+ multiCommands(config: Interfaces.Config, commands: Interfaces.Command[], dir: string): string;
14
+ createTopicFile(file: string, config: Interfaces.Config, topic: Interfaces.Topic, commands: Interfaces.Command[]): void;
15
+ commands(config: Interfaces.Config, commands: Interfaces.Command[]): string;
16
+ renderCommand(config: Interfaces.Config, c: Interfaces.Command): string;
17
+ commandCode(config: Interfaces.Config, c: Interfaces.Command): string | undefined;
19
18
  private repo;
20
19
  /**
21
20
  * fetches the path to a command
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  // tslint:disable no-implicit-dependencies
4
- const command_1 = require("@oclif/command");
5
- const Config = require("@oclif/config");
6
- const plugin_help_1 = require("@oclif/plugin-help");
4
+ const core_1 = require("@oclif/core");
7
5
  const fs = require("fs-extra");
8
6
  const _ = require("lodash");
9
7
  const path = require("path");
@@ -13,27 +11,28 @@ const help_compatibility_1 = require("../help-compatibility");
13
11
  const normalize = require('normalize-package-data');
14
12
  const columns = parseInt(process.env.COLUMNS, 10) || 120;
15
13
  const slugify = new (require('github-slugger'))();
16
- class Readme extends command_1.Command {
14
+ class Readme extends core_1.Command {
17
15
  async run() {
18
- const { flags } = this.parse(Readme);
16
+ const { flags } = await this.parse(Readme);
19
17
  const cwd = process.cwd();
20
18
  const readmePath = path.resolve(cwd, 'README.md');
21
- const config = await Config.load({ root: cwd, devPlugins: false, userPlugins: false });
19
+ const config = await core_1.Config.load({ root: cwd, devPlugins: false, userPlugins: false });
22
20
  try {
23
21
  const p = require.resolve('@oclif/plugin-legacy', { paths: [cwd] });
24
- const plugin = new Config.Plugin({ root: p, type: 'core' });
22
+ const plugin = new core_1.Plugin({ root: p, type: 'core' });
25
23
  await plugin.load();
26
24
  config.plugins.push(plugin);
27
25
  }
28
26
  catch (_a) { }
29
27
  await config.runHook('init', { id: 'readme', argv: this.argv });
28
+ this.HelpClass = await (0, core_1.loadHelpClass)(config);
30
29
  let readme = await fs.readFile(readmePath, 'utf8');
31
30
  let commands = config.commands;
32
31
  commands = commands.filter(c => !c.hidden);
33
32
  commands = commands.filter(c => c.pluginType === 'core');
34
33
  this.debug('commands:', commands.map(c => c.id).length);
35
- commands = util_1.uniqBy(commands, c => c.id);
36
- commands = util_1.sortBy(commands, c => c.id);
34
+ commands = (0, util_1.uniqBy)(commands, c => c.id);
35
+ commands = (0, util_1.sortBy)(commands, c => c.id);
37
36
  readme = this.replaceTag(readme, 'usage', this.usage(config));
38
37
  readme = this.replaceTag(readme, 'commands', flags.multi ? this.multiCommands(config, commands, flags.dir) : this.commands(config, commands));
39
38
  readme = this.replaceTag(readme, 'toc', this.toc(config, readme));
@@ -57,12 +56,15 @@ class Readme extends command_1.Command {
57
56
  .join('\n');
58
57
  }
59
58
  usage(config) {
59
+ var _a;
60
+ const versionFlags = ['--version', ...((_a = config.pjson.oclif.additionalVersionFlags) !== null && _a !== void 0 ? _a : []).sort()];
61
+ const versionFlagsString = `(${versionFlags.join('|')})`;
60
62
  return [
61
63
  `\`\`\`sh-session
62
64
  $ npm install -g ${config.name}
63
65
  $ ${config.bin} COMMAND
64
66
  running command...
65
- $ ${config.bin} (-v|--version|version)
67
+ $ ${config.bin} ${versionFlagsString}
66
68
  ${config.name}/${process.env.OCLIF_NEXT_VERSION || config.version} ${process.platform}-${process.arch} node-v${process.versions.node}
67
69
  $ ${config.bin} --help [COMMAND]
68
70
  USAGE
@@ -75,17 +77,17 @@ USAGE
75
77
  let topics = config.topics;
76
78
  topics = topics.filter(t => !t.hidden && !t.name.includes(':'));
77
79
  topics = topics.filter(t => commands.find(c => c.id.startsWith(t.name)));
78
- topics = util_1.sortBy(topics, t => t.name);
79
- topics = util_1.uniqBy(topics, t => t.name);
80
+ topics = (0, util_1.sortBy)(topics, t => t.name);
81
+ topics = (0, util_1.uniqBy)(topics, t => t.name);
80
82
  for (const topic of topics) {
81
83
  this.createTopicFile(path.join('.', dir, topic.name.replace(/:/g, '/') + '.md'), config, topic, commands.filter(c => c.id === topic.name || c.id.startsWith(topic.name + ':')));
82
84
  }
83
85
  return [
84
86
  '# Command Topics\n',
85
87
  ...topics.map(t => {
86
- return util_1.compact([
88
+ return (0, util_1.compact)([
87
89
  `* [\`${config.bin} ${t.name}\`](${dir}/${t.name.replace(/:/g, '/')}.md)`,
88
- util_1.template({ config })(t.description || '').trim().split('\n')[0],
90
+ (0, util_1.template)({ config })(t.description || '').trim().split('\n')[0],
89
91
  ]).join(' - ');
90
92
  }),
91
93
  ].join('\n').trim() + '\n';
@@ -96,7 +98,7 @@ USAGE
96
98
  bin,
97
99
  '='.repeat(bin.length),
98
100
  '',
99
- util_1.template({ config })(topic.description || '').trim(),
101
+ (0, util_1.template)({ config })(topic.description || '').trim(),
100
102
  '',
101
103
  this.commands(config, commands),
102
104
  ].join('\n').trim() + '\n';
@@ -114,13 +116,12 @@ USAGE
114
116
  }
115
117
  renderCommand(config, c) {
116
118
  this.debug('rendering command', c.id);
117
- const title = util_1.template({ config, command: c })(c.description || '').trim().split('\n')[0];
118
- const HelpClass = plugin_help_1.getHelpClass(config);
119
- const help = new HelpClass(config, { stripAnsi: true, maxWidth: columns });
119
+ const title = (0, util_1.template)({ config, command: c })(c.summary || c.description || '').trim().split('\n')[0];
120
+ const help = new this.HelpClass(config, { stripAnsi: true, maxWidth: columns });
120
121
  const wrapper = new help_compatibility_1.HelpCompatibilityWrapper(help);
121
122
  const header = () => `## \`${config.bin} ${this.commandUsage(config, c)}\``;
122
123
  try {
123
- return util_1.compact([
124
+ return (0, util_1.compact)([
124
125
  header(),
125
126
  title,
126
127
  '```\n' + wrapper.formatCommand(c).trim() + '\n```',
@@ -210,20 +211,18 @@ USAGE
210
211
  return `${name}`;
211
212
  return `[${name}]`;
212
213
  };
214
+ const id = config.topicSeparator ? command.id.replace(/:/g, config.topicSeparator) : command.id;
213
215
  const defaultUsage = () => {
214
- // const flags = Object.entries(command.flags)
215
- // .filter(([, v]) => !v.hidden)
216
- return util_1.compact([
217
- command.id,
216
+ return (0, util_1.compact)([
217
+ id,
218
218
  command.args.filter(a => !a.hidden).map(a => arg(a)).join(' '),
219
219
  ]).join(' ');
220
220
  };
221
- const usages = util_1.castArray(command.usage);
222
- return util_1.template({ config, command })(usages.length === 0 ? defaultUsage() : usages[0]);
221
+ const usages = (0, util_1.castArray)(command.usage);
222
+ return (0, util_1.template)({ config, command })(usages.length === 0 ? defaultUsage() : usages[0]);
223
223
  }
224
224
  }
225
225
  exports.default = Readme;
226
- Readme.hidden = true;
227
226
  Readme.description = `adds commands to README.md in current directory
228
227
  The readme must have any of the following tags inside of it for it to be replaced or else it will do nothing:
229
228
  # Usage
@@ -234,6 +233,6 @@ The readme must have any of the following tags inside of it for it to be replace
234
233
  Customize the code URL prefix by setting oclif.repositoryPrefix in package.json.
235
234
  `;
236
235
  Readme.flags = {
237
- dir: command_1.flags.string({ description: 'output directory for multi docs', default: 'docs', required: true }),
238
- multi: command_1.flags.boolean({ description: 'create a different markdown page for each topic' }),
236
+ dir: core_1.Flags.string({ description: 'output directory for multi docs', default: 'docs', required: true }),
237
+ multi: core_1.Flags.boolean({ description: 'create a different markdown page for each topic' }),
239
238
  };
@@ -1,9 +1,8 @@
1
- import { Command, flags } from '@oclif/command';
1
+ import { Command } from '@oclif/core';
2
2
  export default class UploadDeb extends Command {
3
- static hidden: boolean;
4
3
  static description: string;
5
4
  static flags: {
6
- root: flags.IOptionFlag<string>;
5
+ root: import("@oclif/core/lib/interfaces").OptionFlag<string>;
7
6
  };
8
7
  run(): Promise<void>;
9
8
  }
@@ -1,14 +1,14 @@
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 aws_1 = require("../../aws");
6
6
  const log_1 = require("../../log");
7
7
  const Tarballs = require("../../tarballs");
8
8
  const upload_util_1 = require("../../upload-util");
9
- class UploadDeb extends command_1.Command {
9
+ class UploadDeb extends core_1.Command {
10
10
  async run() {
11
- const { flags } = this.parse(UploadDeb);
11
+ const { flags } = await this.parse(UploadDeb);
12
12
  const buildConfig = await Tarballs.buildConfig(flags.root);
13
13
  const { s3Config, config } = buildConfig;
14
14
  const dist = (f) => buildConfig.dist(qq.join('deb', f));
@@ -20,13 +20,13 @@ class UploadDeb extends command_1.Command {
20
20
  this.error('Cannot find debian artifacts', {
21
21
  suggestions: ['Run "oclif-dev pack:deb" before uploading'],
22
22
  });
23
- const cloudKeyBase = upload_util_1.commitAWSDir(config.pjson.version, buildConfig.gitSha, s3Config);
23
+ const cloudKeyBase = (0, upload_util_1.commitAWSDir)(config.pjson.version, buildConfig.gitSha, s3Config);
24
24
  const upload = (file) => {
25
25
  const cloudKey = `${cloudKeyBase}/apt/${file}`;
26
26
  return aws_1.default.s3.uploadFile(dist(file), Object.assign(Object.assign({}, S3Options), { CacheControl: 'max-age=86400', Key: cloudKey }));
27
27
  };
28
28
  const uploadDeb = async (arch) => {
29
- const deb = upload_util_1.templateShortKey('deb', { bin: config.bin, versionShaRevision: upload_util_1.debVersion(buildConfig), arch: arch });
29
+ const deb = (0, upload_util_1.templateShortKey)('deb', { bin: config.bin, versionShaRevision: (0, upload_util_1.debVersion)(buildConfig), arch: arch });
30
30
  if (await qq.exists(dist(deb)))
31
31
  await upload(deb);
32
32
  };
@@ -40,12 +40,11 @@ class UploadDeb extends command_1.Command {
40
40
  await upload('InRelease');
41
41
  if (await qq.exists(dist('Release.gpg')))
42
42
  await upload('Release.gpg');
43
- log_1.log(`done uploading deb artifacts for v${config.version}-${buildConfig.gitSha}`);
43
+ (0, log_1.log)(`done uploading deb artifacts for v${config.version}-${buildConfig.gitSha}`);
44
44
  }
45
45
  }
46
46
  exports.default = UploadDeb;
47
- UploadDeb.hidden = true;
48
47
  UploadDeb.description = 'upload deb package built with pack:deb';
49
48
  UploadDeb.flags = {
50
- root: command_1.flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
49
+ root: core_1.Flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
51
50
  };
@@ -1,9 +1,8 @@
1
- import { Command, flags } from '@oclif/command';
1
+ import { Command } from '@oclif/core';
2
2
  export default class UploadMacos extends Command {
3
- static hidden: boolean;
4
3
  static description: string;
5
4
  static flags: {
6
- root: flags.IOptionFlag<string>;
5
+ root: import("@oclif/core/lib/interfaces").OptionFlag<string>;
7
6
  };
8
7
  run(): Promise<void>;
9
8
  }
@@ -1,22 +1,22 @@
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 aws_1 = require("../../aws");
6
6
  const log_1 = require("../../log");
7
7
  const Tarballs = require("../../tarballs");
8
8
  const upload_util_1 = require("../../upload-util");
9
- class UploadMacos extends command_1.Command {
9
+ class UploadMacos extends core_1.Command {
10
10
  async run() {
11
- const { flags } = this.parse(UploadMacos);
11
+ const { flags } = await this.parse(UploadMacos);
12
12
  const buildConfig = await Tarballs.buildConfig(flags.root);
13
13
  const { s3Config, version, config, dist } = buildConfig;
14
14
  const S3Options = {
15
15
  Bucket: s3Config.bucket,
16
16
  ACL: s3Config.acl || 'public-read',
17
17
  };
18
- const cloudKeyBase = upload_util_1.commitAWSDir(version, buildConfig.gitSha, s3Config);
19
- const templateKey = upload_util_1.templateShortKey('macos', { bin: config.bin, version, sha: buildConfig.gitSha });
18
+ const cloudKeyBase = (0, upload_util_1.commitAWSDir)(version, buildConfig.gitSha, s3Config);
19
+ const templateKey = (0, upload_util_1.templateShortKey)('macos', { bin: config.bin, version, sha: buildConfig.gitSha });
20
20
  const cloudKey = `${cloudKeyBase}/${templateKey}`;
21
21
  const localPkg = dist(`macos/${templateKey}`);
22
22
  if (await qq.exists(localPkg))
@@ -25,12 +25,11 @@ class UploadMacos extends command_1.Command {
25
25
  this.error('Cannot find macOS pkg', {
26
26
  suggestions: ['Run "oclif-dev pack:macos" before uploading'],
27
27
  });
28
- log_1.log(`done uploading macos pkg for v${version}-${buildConfig.gitSha}`);
28
+ (0, log_1.log)(`done uploading macos pkg for v${version}-${buildConfig.gitSha}`);
29
29
  }
30
30
  }
31
31
  exports.default = UploadMacos;
32
- UploadMacos.hidden = true;
33
32
  UploadMacos.description = 'upload macos installers built with pack:macos';
34
33
  UploadMacos.flags = {
35
- root: command_1.flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
34
+ root: core_1.Flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
36
35
  };
@@ -1,11 +1,11 @@
1
- import { Command, flags } from '@oclif/command';
1
+ import { Command } from '@oclif/core';
2
+ import { Interfaces } from '@oclif/core';
2
3
  export default class UploadTarballs extends Command {
3
- static hidden: boolean;
4
4
  static description: string;
5
5
  static flags: {
6
- root: flags.IOptionFlag<string>;
7
- targets: flags.IOptionFlag<string>;
8
- xz: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
6
+ root: Interfaces.OptionFlag<string>;
7
+ targets: Interfaces.OptionFlag<string>;
8
+ xz: Interfaces.BooleanFlag<boolean>;
9
9
  };
10
10
  run(): Promise<void>;
11
11
  }
@@ -1,14 +1,14 @@
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 aws_1 = require("../../aws");
6
6
  const log_1 = require("../../log");
7
7
  const Tarballs = require("../../tarballs");
8
8
  const upload_util_1 = require("../../upload-util");
9
- class UploadTarballs extends command_1.Command {
9
+ class UploadTarballs extends core_1.Command {
10
10
  async run() {
11
- const { flags } = this.parse(UploadTarballs);
11
+ const { flags } = await this.parse(UploadTarballs);
12
12
  if (process.platform === 'win32')
13
13
  throw new Error('upload does not function on windows');
14
14
  const targets = flags.targets.split(',');
@@ -16,14 +16,12 @@ class UploadTarballs extends command_1.Command {
16
16
  const { s3Config, dist, version, config, xz } = buildConfig;
17
17
  // fail early if targets are not built
18
18
  for (const target of buildConfig.targets) {
19
- log_1.log(`Looking for ${config.bin}-v${config.version}-${buildConfig.gitSha}-${target.platform}-${target.arch}.tar.gz ...`);
20
- const tarball = dist(upload_util_1.templateShortKey('versioned', Object.assign({ ext: '.tar.gz', bin: config.bin, version: config.version, sha: buildConfig.gitSha }, target)));
19
+ const tarball = dist((0, upload_util_1.templateShortKey)('versioned', Object.assign({ ext: '.tar.gz', bin: config.bin, version: config.version, sha: buildConfig.gitSha }, target)));
21
20
  // eslint-disable-next-line no-await-in-loop
22
21
  if (!await qq.exists(tarball))
23
22
  this.error(`Cannot find a tarball ${tarball} for ${target.platform}-${target.arch}`, {
24
- suggestions: [`Run "oclif-dev pack --target ${target.platform}-${target.arch}" before uploading`],
23
+ suggestions: [`Run "oclif pack --target ${target.platform}-${target.arch}" before uploading`],
25
24
  });
26
- log_1.log('Found it.');
27
25
  }
28
26
  const S3Options = {
29
27
  Bucket: s3Config.bucket,
@@ -32,50 +30,49 @@ class UploadTarballs extends command_1.Command {
32
30
  const uploadTarball = async (options) => {
33
31
  const TarballS3Options = Object.assign(Object.assign({}, S3Options), { CacheControl: 'max-age=604800' });
34
32
  const releaseTarballs = async (ext) => {
35
- const localKey = upload_util_1.templateShortKey('versioned', ext, {
33
+ const localKey = (0, upload_util_1.templateShortKey)('versioned', ext, {
36
34
  arch: options === null || options === void 0 ? void 0 : options.arch,
37
35
  bin: config.bin,
38
36
  platform: options === null || options === void 0 ? void 0 : options.platform,
39
37
  sha: buildConfig.gitSha,
40
- version,
38
+ version: config.version,
41
39
  });
42
- const cloudKey = `${upload_util_1.commitAWSDir(version, buildConfig.gitSha, s3Config)}/${localKey}`;
40
+ const cloudKey = `${(0, upload_util_1.commitAWSDir)(version, buildConfig.gitSha, s3Config)}/${localKey}`;
43
41
  await aws_1.default.s3.uploadFile(dist(localKey), Object.assign(Object.assign({}, TarballS3Options), { ContentType: 'application/gzip', Key: cloudKey }));
44
42
  };
45
43
  await releaseTarballs('.tar.gz');
46
44
  if (xz)
47
45
  await releaseTarballs('.tar.xz');
48
46
  const ManifestS3Options = Object.assign(Object.assign({}, S3Options), { CacheControl: 'max-age=86400', ContentType: 'application/json' });
49
- const manifest = upload_util_1.templateShortKey('manifest', {
47
+ const manifest = (0, upload_util_1.templateShortKey)('manifest', {
50
48
  arch: options === null || options === void 0 ? void 0 : options.arch,
51
49
  bin: config.bin,
52
50
  platform: options === null || options === void 0 ? void 0 : options.platform,
53
51
  sha: buildConfig.gitSha,
54
52
  version: config.version,
55
53
  });
56
- const cloudKey = `${upload_util_1.commitAWSDir(version, buildConfig.gitSha, s3Config)}/${manifest}`;
54
+ const cloudKey = `${(0, upload_util_1.commitAWSDir)(version, buildConfig.gitSha, s3Config)}/${manifest}`;
57
55
  await aws_1.default.s3.uploadFile(dist(manifest), Object.assign(Object.assign({}, ManifestS3Options), { Key: cloudKey }));
58
56
  };
59
57
  if (targets.length > 0)
60
- log_1.log('uploading targets');
58
+ (0, log_1.log)('uploading targets');
61
59
  // eslint-disable-next-line no-await-in-loop
62
60
  for (const target of buildConfig.targets)
63
61
  await uploadTarball(target);
64
- log_1.log(`done uploading tarballs & manifests for v${config.version}-${buildConfig.gitSha}`);
62
+ (0, log_1.log)(`done uploading tarballs & manifests for v${config.version}-${buildConfig.gitSha}`);
65
63
  }
66
64
  }
67
65
  exports.default = UploadTarballs;
68
- UploadTarballs.hidden = true;
69
66
  UploadTarballs.description = `upload an oclif CLI to S3
70
67
 
71
68
  "aws-sdk" will need to be installed as a devDependency to upload.
72
69
  `;
73
70
  UploadTarballs.flags = {
74
- root: command_1.flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
75
- targets: command_1.flags.string({
71
+ root: core_1.Flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
72
+ targets: core_1.Flags.string({
76
73
  char: 't',
77
74
  description: 'comma-separated targets to upload (e.g.: linux-arm,win32-x64)',
78
75
  default: Tarballs.TARGETS.join(','),
79
76
  }),
80
- xz: command_1.flags.boolean({ description: 'also upload xz', allowNo: true, default: true }),
77
+ xz: core_1.Flags.boolean({ description: 'also upload xz', allowNo: true, default: true }),
81
78
  };
@@ -1,9 +1,8 @@
1
- import { Command, flags } from '@oclif/command';
1
+ import { Command } from '@oclif/core';
2
2
  export default class UploadWin extends Command {
3
- static hidden: boolean;
4
3
  static description: string;
5
4
  static flags: {
6
- root: flags.IOptionFlag<string>;
5
+ root: import("@oclif/core/lib/interfaces").OptionFlag<string>;
7
6
  };
8
7
  run(): Promise<void>;
9
8
  }
@@ -1,14 +1,14 @@
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 aws_1 = require("../../aws");
6
6
  const log_1 = require("../../log");
7
7
  const Tarballs = require("../../tarballs");
8
8
  const upload_util_1 = require("../../upload-util");
9
- class UploadWin extends command_1.Command {
9
+ class UploadWin extends core_1.Command {
10
10
  async run() {
11
- const { flags } = this.parse(UploadWin);
11
+ const { flags } = await this.parse(UploadWin);
12
12
  const buildConfig = await Tarballs.buildConfig(flags.root);
13
13
  const { s3Config, version, config, dist } = buildConfig;
14
14
  const S3Options = {
@@ -17,7 +17,7 @@ class UploadWin extends command_1.Command {
17
17
  };
18
18
  const archs = buildConfig.targets.filter(t => t.platform === 'win32').map(t => t.arch);
19
19
  for (const arch of archs) {
20
- const templateKey = upload_util_1.templateShortKey('win32', { bin: config.bin, version: buildConfig.version, sha: buildConfig.gitSha, arch });
20
+ const templateKey = (0, upload_util_1.templateShortKey)('win32', { bin: config.bin, version: buildConfig.version, sha: buildConfig.gitSha, arch });
21
21
  const localKey = dist(`win32/${templateKey}`);
22
22
  // eslint-disable-next-line no-await-in-loop
23
23
  if (!await qq.exists(localKey))
@@ -25,9 +25,9 @@ class UploadWin extends command_1.Command {
25
25
  suggestions: ['Run "oclif-dev pack:win" before uploading'],
26
26
  });
27
27
  }
28
- const cloudKeyBase = upload_util_1.commitAWSDir(config.pjson.version, buildConfig.gitSha, s3Config);
28
+ const cloudKeyBase = (0, upload_util_1.commitAWSDir)(config.pjson.version, buildConfig.gitSha, s3Config);
29
29
  const uploadWin = async (arch) => {
30
- const templateKey = upload_util_1.templateShortKey('win32', { bin: config.bin, version: buildConfig.version, sha: buildConfig.gitSha, arch });
30
+ const templateKey = (0, upload_util_1.templateShortKey)('win32', { bin: config.bin, version: buildConfig.version, sha: buildConfig.gitSha, arch });
31
31
  const localExe = dist(`win32/${templateKey}`);
32
32
  const cloudKey = `${cloudKeyBase}/${templateKey}`;
33
33
  if (await qq.exists(localExe))
@@ -35,12 +35,11 @@ class UploadWin extends command_1.Command {
35
35
  };
36
36
  await uploadWin('x64');
37
37
  await uploadWin('x86');
38
- log_1.log(`done uploading windows executables for v${version}-${buildConfig.gitSha}`);
38
+ (0, log_1.log)(`done uploading windows executables for v${version}-${buildConfig.gitSha}`);
39
39
  }
40
40
  }
41
41
  exports.default = UploadWin;
42
- UploadWin.hidden = true;
43
42
  UploadWin.description = 'upload windows installers built with pack:win';
44
43
  UploadWin.flags = {
45
- root: command_1.flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
44
+ root: core_1.Flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
46
45
  };