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
@@ -2,19 +2,12 @@ import * as Generator from 'yeoman-generator';
2
2
  declare class App extends Generator {
3
3
  options: {
4
4
  defaults?: boolean;
5
- mocha: boolean;
6
- circleci: boolean;
7
- appveyor: boolean;
8
- typescript: boolean;
9
- eslint: boolean;
10
5
  yarn: boolean;
11
- travisci: boolean;
12
6
  };
13
7
  args: {
14
8
  [k: string]: string;
15
9
  };
16
- type: 'single' | 'multi' | 'plugin' | 'base';
17
- path: string;
10
+ name: string;
18
11
  pjson: any;
19
12
  githubUser: string | undefined;
20
13
  answers: {
@@ -39,15 +32,7 @@ declare class App extends Generator {
39
32
  travisci: boolean;
40
33
  };
41
34
  };
42
- mocha: boolean;
43
- circleci: boolean;
44
- appveyor: boolean;
45
- ts: boolean;
46
- eslint: boolean;
47
35
  yarn: boolean;
48
- travisci: boolean;
49
- get _ext(): "ts" | "js";
50
- get _bin(): any;
51
36
  repository?: string;
52
37
  constructor(args: any, opts: any);
53
38
  prompting(): Promise<void>;
@@ -55,10 +40,5 @@ declare class App extends Generator {
55
40
  install(): Promise<void>;
56
41
  end(): void;
57
42
  private _gitignore;
58
- private _eslintignore;
59
- private _writeBase;
60
- private _writePlugin;
61
- private _writeSingle;
62
- private _writeMulti;
63
43
  }
64
44
  export = App;
@@ -0,0 +1,183 @@
1
+ "use strict";
2
+ const child_process_1 = require("child_process");
3
+ const fs = require("fs");
4
+ const _ = require("lodash");
5
+ const path = require("path");
6
+ const Generator = require("yeoman-generator");
7
+ const yosay = require("yosay");
8
+ const sortPjson = require('sort-pjson');
9
+ const fixpack = require('@oclif/fixpack');
10
+ const debug = require('debug')('generator-oclif');
11
+ const { version } = require('../../package.json');
12
+ const isWindows = process.platform === 'win32';
13
+ let hasYarn = false;
14
+ try {
15
+ (0, child_process_1.execSync)('yarn -v', { stdio: 'ignore' });
16
+ hasYarn = true;
17
+ }
18
+ catch (_a) { }
19
+ class App extends Generator {
20
+ constructor(args, opts) {
21
+ super(args, opts);
22
+ this.name = opts.name;
23
+ this.options = {
24
+ defaults: opts.defaults,
25
+ yarn: hasYarn,
26
+ };
27
+ }
28
+ // eslint-disable-next-line complexity
29
+ async prompting() {
30
+ const msg = 'Time to build an oclif CLI!';
31
+ this.log(yosay(`${msg} Version: ${version}`));
32
+ (0, child_process_1.execSync)(`git clone https://github.com/oclif/hello-world.git ${path.resolve(this.name)}`);
33
+ fs.rmdirSync(`${path.resolve(this.name, '.git')}`);
34
+ this.destinationRoot(path.resolve(this.name));
35
+ process.chdir(this.destinationRoot());
36
+ this.githubUser = await this.user.github.username().catch(debug);
37
+ this.pjson = Object.assign({ scripts: {}, engines: {}, devDependencies: {}, dependencies: {}, oclif: {} }, this.fs.readJSON('package.json', {}));
38
+ let repository = this.destinationRoot().split(path.sep).slice(-2).join('/');
39
+ if (this.githubUser)
40
+ repository = `${this.githubUser}/${repository.split('/')[1]}`;
41
+ const defaults = Object.assign(Object.assign({ name: this.determineAppname().replace(/ /g, '-'), version: '0.0.0', license: 'MIT', author: this.githubUser ? `${this.user.git.name()} @${this.githubUser}` : this.user.git.name(), dependencies: {}, repository }, this.pjson), { engines: Object.assign({ node: '>=8.0.0' }, this.pjson.engines), options: this.options });
42
+ this.repository = defaults.repository;
43
+ if (this.repository && this.repository.url) {
44
+ this.repository = this.repository.url;
45
+ }
46
+ if (this.options.defaults) {
47
+ this.answers = defaults;
48
+ }
49
+ else {
50
+ this.answers = await this.prompt([
51
+ {
52
+ type: 'input',
53
+ name: 'name',
54
+ message: 'npm package name',
55
+ default: defaults.name,
56
+ },
57
+ {
58
+ type: 'input',
59
+ name: 'bin',
60
+ message: 'command bin name the CLI will export',
61
+ default: (answers) => answers.name,
62
+ },
63
+ {
64
+ type: 'input',
65
+ name: 'description',
66
+ message: 'description',
67
+ default: defaults.description,
68
+ },
69
+ {
70
+ type: 'input',
71
+ name: 'author',
72
+ message: 'author',
73
+ default: defaults.author,
74
+ },
75
+ {
76
+ type: 'input',
77
+ name: 'version',
78
+ message: 'version',
79
+ default: defaults.version,
80
+ when: !this.pjson.version,
81
+ },
82
+ {
83
+ type: 'input',
84
+ name: 'license',
85
+ message: 'license',
86
+ default: defaults.license,
87
+ },
88
+ {
89
+ type: 'input',
90
+ name: 'github.user',
91
+ message: 'Who is the GitHub owner of repository (https://github.com/OWNER/repo)',
92
+ default: repository.split('/').slice(0, -1).pop(),
93
+ },
94
+ {
95
+ type: 'input',
96
+ name: 'github.repo',
97
+ message: 'What is the GitHub name of repository (https://github.com/owner/REPO)',
98
+ default: (answers) => (this.pjson.repository || answers.name || this.pjson.name).split('/').pop(),
99
+ },
100
+ {
101
+ type: 'list',
102
+ name: 'pkg',
103
+ message: 'Select a package manager',
104
+ choices: [
105
+ { name: 'npm', value: 'npm' },
106
+ { name: 'yarn', value: 'yarn' },
107
+ ],
108
+ default: () => this.options.yarn || hasYarn ? 1 : 0,
109
+ },
110
+ ]);
111
+ }
112
+ debug(this.answers);
113
+ if (!this.options.defaults) {
114
+ this.options = Object.assign(Object.assign({}, this.answers.ci), { yarn: this.answers.pkg === 'yarn' });
115
+ }
116
+ this.yarn = this.options.yarn;
117
+ this.pjson.name = this.answers.name || defaults.name;
118
+ this.pjson.description = this.answers.description || defaults.description;
119
+ this.pjson.version = this.answers.version || defaults.version;
120
+ this.pjson.engines.node = defaults.engines.node;
121
+ this.pjson.author = this.answers.author || defaults.author;
122
+ this.pjson.files = this.answers.files || defaults.files || '/lib';
123
+ this.pjson.license = this.answers.license || defaults.license;
124
+ // eslint-disable-next-line no-multi-assign
125
+ this.repository = this.pjson.repository = this.answers.github ? `${this.answers.github.user}/${this.answers.github.repo}` : defaults.repository;
126
+ this.pjson.homepage = `https://github.com/${this.repository}`;
127
+ this.pjson.bugs = `https://github.com/${this.repository}/issues`;
128
+ this.pjson.oclif.bin = this.answers.bin;
129
+ this.pjson.bin = {};
130
+ this.pjson.bin[this.pjson.oclif.bin] = './bin/run';
131
+ }
132
+ writing() {
133
+ if (this.pjson.oclif && Array.isArray(this.pjson.oclif.plugins)) {
134
+ this.pjson.oclif.plugins.sort();
135
+ }
136
+ if (this.fs.exists(this.destinationPath('./package.json'))) {
137
+ fixpack(this.destinationPath('./package.json'), require('@oclif/fixpack/config.json'));
138
+ }
139
+ if (_.isEmpty(this.pjson.oclif))
140
+ delete this.pjson.oclif;
141
+ this.pjson.files = _.uniq((this.pjson.files || []).sort());
142
+ this.fs.writeJSON(this.destinationPath('./package.json'), sortPjson(this.pjson));
143
+ this.fs.write(this.destinationPath('.gitignore'), this._gitignore());
144
+ }
145
+ install() {
146
+ const dependencies = [];
147
+ const devDependencies = [];
148
+ if (isWindows)
149
+ devDependencies.push('rimraf');
150
+ const yarnOpts = {};
151
+ if (process.env.YARN_MUTEX)
152
+ yarnOpts.mutex = process.env.YARN_MUTEX;
153
+ const install = (deps, opts) => this.yarn ? this.yarnInstall(deps, opts) : this.npmInstall(deps, opts);
154
+ const dev = this.yarn ? { dev: true } : { 'save-dev': true };
155
+ const save = this.yarn ? {} : { save: true };
156
+ return Promise.all([
157
+ install(devDependencies, Object.assign(Object.assign(Object.assign({}, yarnOpts), dev), { ignoreScripts: true })),
158
+ install(dependencies, Object.assign(Object.assign({}, yarnOpts), save)),
159
+ ]).then(() => { });
160
+ }
161
+ end() {
162
+ this.spawnCommandSync(path.join('.', 'node_modules/.bin/oclif'), ['readme']);
163
+ console.log(`\nCreated ${this.pjson.name} in ${this.destinationRoot()}`);
164
+ }
165
+ _gitignore() {
166
+ const existing = this.fs.exists(this.destinationPath('.gitignore')) ? this.fs.read(this.destinationPath('.gitignore')).split('\n') : [];
167
+ return _([
168
+ '*-debug.log',
169
+ '*-error.log',
170
+ 'node_modules',
171
+ '/tmp',
172
+ '/dist',
173
+ this.yarn ? '/package-lock.json' : '/yarn.lock',
174
+ '/lib',
175
+ ])
176
+ .concat(existing)
177
+ .compact()
178
+ .uniq()
179
+ .sort()
180
+ .join('\n') + '\n';
181
+ }
182
+ }
183
+ module.exports = App;
@@ -1,12 +1,11 @@
1
- import { HelpBase } from '@oclif/plugin-help';
2
- import { Command } from '@oclif/config';
1
+ import { Interfaces, HelpBase } from '@oclif/core';
3
2
  interface MaybeCompatibleHelp extends HelpBase {
4
- formatCommand?: (command: Command) => string;
5
- command?: (command: Command) => string;
3
+ formatCommand?: (command: Interfaces.Command) => string;
4
+ command?: (command: Interfaces.Command) => string;
6
5
  }
7
6
  export declare class HelpCompatibilityWrapper {
8
7
  inner: MaybeCompatibleHelp;
9
8
  constructor(inner: MaybeCompatibleHelp);
10
- formatCommand(command: Command): string;
9
+ formatCommand(command: Interfaces.Command): string;
11
10
  }
12
11
  export {};
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HelpCompatibilityWrapper = void 0;
3
4
  class IncompatibleHelpError extends Error {
4
5
  constructor() {
5
6
  super(...arguments);
package/lib/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { run } from '@oclif/command';
1
+ export { run } from '@oclif/core';
2
2
  export { IManifest } from './tarballs';
package/lib/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var command_1 = require("@oclif/command");
4
- exports.run = command_1.run;
3
+ exports.run = void 0;
4
+ var core_1 = require("@oclif/core");
5
+ Object.defineProperty(exports, "run", { enumerable: true, get: function () { return core_1.run; } });
package/lib/log.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.log = exports.debug = void 0;
3
4
  const cli_ux_1 = require("cli-ux");
4
5
  const qq = require("qqjs");
5
6
  const util = require("util");
@@ -7,6 +8,6 @@ exports.debug = require('debug')('oclif');
7
8
  exports.debug.new = (name) => require('debug')(`oclif:${name}`);
8
9
  function log(format, ...args) {
9
10
  args = args.map(qq.prettifyPaths);
10
- exports.debug.enabled ? exports.debug(format, ...args) : cli_ux_1.default.log(`oclif: ${util.format(format, ...args)}`);
11
+ exports.debug.enabled ? (0, exports.debug)(format, ...args) : cli_ux_1.default.log(`oclif: ${util.format(format, ...args)}`);
11
12
  }
12
13
  exports.log = log;
@@ -1,6 +1,6 @@
1
- import * as Config from '@oclif/config';
1
+ import { Interfaces } from '@oclif/core';
2
2
  export declare function writeBinScripts({ config, baseWorkspace, nodeVersion }: {
3
- config: Config.IConfig;
3
+ config: Interfaces.Config;
4
4
  baseWorkspace: string;
5
5
  nodeVersion: string;
6
6
  }): Promise<void>;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.writeBinScripts = void 0;
3
4
  const qq = require("qqjs");
4
5
  async function writeBinScripts({ config, baseWorkspace, nodeVersion }) {
5
6
  const binPathEnvVar = config.scopedEnvVarKey('BINPATH');
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.build = void 0;
3
4
  const findYarnWorkspaceRoot = require("find-yarn-workspace-root");
4
5
  const path = require("path");
5
6
  const qq = require("qqjs");
@@ -11,7 +12,7 @@ const pack = async (from, to) => {
11
12
  const prevCwd = qq.cwd();
12
13
  qq.cd(path.dirname(from));
13
14
  await qq.mkdirp(path.dirname(to));
14
- log_1.log(`packing tarball from ${qq.prettifyPaths(from)} to ${qq.prettifyPaths(to)}`);
15
+ (0, log_1.log)(`packing tarball from ${qq.prettifyPaths(from)} to ${qq.prettifyPaths(to)}`);
15
16
  await (to.endsWith('gz') ?
16
17
  qq.x('tar', ['czf', to, path.basename(from)]) :
17
18
  qq.x(`tar c ${path.basename(from)} | xz > ${to}`));
@@ -75,14 +76,14 @@ async function build(c, options = {}) {
75
76
  };
76
77
  const buildTarget = async (target) => {
77
78
  const workspace = c.workspace(target);
78
- const gzLocalKey = upload_util_1.templateShortKey('versioned', '.tar.gz', {
79
+ const gzLocalKey = (0, upload_util_1.templateShortKey)('versioned', '.tar.gz', {
79
80
  arch: target.arch,
80
81
  bin: c.config.bin,
81
82
  platform: target.platform,
82
83
  sha: c.gitSha,
83
84
  version: config.version,
84
85
  });
85
- const xzLocalKey = upload_util_1.templateShortKey('versioned', '.tar.xz', {
86
+ const xzLocalKey = (0, upload_util_1.templateShortKey)('versioned', '.tar.xz', {
86
87
  arch: target.arch,
87
88
  bin: c.config.bin,
88
89
  platform: target.platform,
@@ -90,11 +91,11 @@ async function build(c, options = {}) {
90
91
  version: config.version,
91
92
  });
92
93
  const base = path.basename(gzLocalKey);
93
- log_1.log(`building target ${base}`);
94
- log_1.log('copying workspace', c.workspace(), workspace);
94
+ (0, log_1.log)(`building target ${base}`);
95
+ (0, log_1.log)('copying workspace', c.workspace(), workspace);
95
96
  await qq.rm(workspace);
96
97
  await qq.cp(c.workspace(), workspace);
97
- await node_1.fetchNodeBinary({
98
+ await (0, node_1.fetchNodeBinary)({
98
99
  nodeVersion: c.nodeVersion,
99
100
  output: path.join(workspace, 'bin', 'node'),
100
101
  platform: target.platform,
@@ -109,13 +110,13 @@ async function build(c, options = {}) {
109
110
  if (!c.updateConfig.s3.host)
110
111
  return;
111
112
  const rollout = (typeof c.updateConfig.autoupdate === 'object' && c.updateConfig.autoupdate.rollout);
112
- const gzCloudKey = `${upload_util_1.commitAWSDir(c.version, c.gitSha, c.updateConfig.s3)}/${gzLocalKey}`;
113
- const xzCloudKey = `${upload_util_1.commitAWSDir(c.version, c.gitSha, c.updateConfig.s3)}/${xzLocalKey}`;
113
+ const gzCloudKey = `${(0, upload_util_1.commitAWSDir)(c.version, c.gitSha, c.updateConfig.s3)}/${gzLocalKey}`;
114
+ const xzCloudKey = `${(0, upload_util_1.commitAWSDir)(c.version, c.gitSha, c.updateConfig.s3)}/${xzLocalKey}`;
114
115
  const manifest = {
115
116
  rollout: rollout === false ? undefined : rollout,
116
117
  version: c.version,
117
118
  sha: c.gitSha,
118
- baseDir: upload_util_1.templateShortKey('baseDir', target, { bin: c.config.bin }),
119
+ baseDir: (0, upload_util_1.templateShortKey)('baseDir', target, { bin: c.config.bin }),
119
120
  gz: config.s3Url(gzCloudKey),
120
121
  xz: xz ? config.s3Url(xzCloudKey) : undefined,
121
122
  sha256gz: await qq.hash('sha256', c.dist(gzLocalKey)),
@@ -125,7 +126,7 @@ async function build(c, options = {}) {
125
126
  recommended: c.nodeVersion,
126
127
  },
127
128
  };
128
- const manifestFilepath = c.dist(upload_util_1.templateShortKey('manifest', {
129
+ const manifestFilepath = c.dist((0, upload_util_1.templateShortKey)('manifest', {
129
130
  arch: target.arch,
130
131
  bin: c.config.bin,
131
132
  platform: target.platform,
@@ -134,11 +135,11 @@ async function build(c, options = {}) {
134
135
  }));
135
136
  await qq.writeJSON(manifestFilepath, manifest);
136
137
  };
137
- log_1.log(`gathering workspace for ${config.bin} to ${c.workspace()}`);
138
+ (0, log_1.log)(`gathering workspace for ${config.bin} to ${c.workspace()}`);
138
139
  await extractCLI(await packCLI());
139
140
  await updatePJSON();
140
141
  await addDependencies();
141
- await bin_1.writeBinScripts({ config, baseWorkspace: c.workspace(), nodeVersion: c.nodeVersion });
142
+ await (0, bin_1.writeBinScripts)({ config, baseWorkspace: c.workspace(), nodeVersion: c.nodeVersion });
142
143
  await pretarball();
143
144
  for (const target of c.targets) {
144
145
  if (!options.platform || options.platform === target.platform) {
@@ -1,9 +1,9 @@
1
- import * as Config from '@oclif/config';
1
+ import { Interfaces } from '@oclif/core';
2
2
  export declare const TARGETS: string[];
3
3
  export interface BuildConfig {
4
4
  root: string;
5
5
  gitSha: string;
6
- config: Config.IConfig;
6
+ config: Interfaces.Config;
7
7
  nodeVersion: string;
8
8
  version: string;
9
9
  tmp: string;
@@ -14,12 +14,12 @@ export interface BuildConfig {
14
14
  };
15
15
  xz: boolean;
16
16
  targets: {
17
- platform: Config.PlatformTypes;
18
- arch: Config.ArchTypes;
17
+ platform: Interfaces.PlatformTypes;
18
+ arch: Interfaces.ArchTypes;
19
19
  }[];
20
20
  workspace(target?: {
21
- platform: Config.PlatformTypes;
22
- arch: Config.ArchTypes;
21
+ platform: Interfaces.PlatformTypes;
22
+ arch: Interfaces.ArchTypes;
23
23
  }): string;
24
24
  dist(input: string): string;
25
25
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const Config = require("@oclif/config");
3
+ exports.buildConfig = exports.gitSha = exports.TARGETS = void 0;
4
+ const core_1 = require("@oclif/core");
4
5
  const path = require("path");
5
6
  const qq = require("qqjs");
6
7
  const util_1 = require("../util");
@@ -23,7 +24,7 @@ async function Tmp(config) {
23
24
  return tmp;
24
25
  }
25
26
  async function buildConfig(root, options = {}) {
26
- const config = await Config.load({ root: path.resolve(root), devPlugins: false, userPlugins: false });
27
+ const config = await core_1.Config.load({ root: path.resolve(root), devPlugins: false, userPlugins: false });
27
28
  root = config.root;
28
29
  const _gitSha = await gitSha(root, { short: true });
29
30
  const version = config.version.includes('-') ? `${config.version}.${_gitSha}` : config.version;
@@ -45,10 +46,10 @@ async function buildConfig(root, options = {}) {
45
46
  workspace(target) {
46
47
  const base = qq.join(config.root, 'tmp');
47
48
  if (target && target.platform)
48
- return qq.join(base, [target.platform, target.arch].join('-'), upload_util_1.templateShortKey('baseDir', { bin: config.bin }));
49
- return qq.join(base, upload_util_1.templateShortKey('baseDir', { bin: config.bin }));
49
+ return qq.join(base, [target.platform, target.arch].join('-'), (0, upload_util_1.templateShortKey)('baseDir', { bin: config.bin }));
50
+ return qq.join(base, (0, upload_util_1.templateShortKey)('baseDir', { bin: config.bin }));
50
51
  },
51
- targets: util_1.compact(options.targets || updateConfig.node.targets || exports.TARGETS).map(t => {
52
+ targets: (0, util_1.compact)(options.targets || updateConfig.node.targets || exports.TARGETS).map(t => {
52
53
  const [platform, arch] = t.split('-');
53
54
  return { platform, arch };
54
55
  }),
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./bin"), exports);
5
- tslib_1.__exportStar(require("./build"), exports);
6
- tslib_1.__exportStar(require("./config"), exports);
7
- tslib_1.__exportStar(require("./node"), exports);
4
+ (0, tslib_1.__exportStar)(require("./bin"), exports);
5
+ (0, tslib_1.__exportStar)(require("./build"), exports);
6
+ (0, tslib_1.__exportStar)(require("./config"), exports);
7
+ (0, tslib_1.__exportStar)(require("./node"), exports);
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const errors_1 = require("@oclif/errors");
3
+ exports.fetchNodeBinary = void 0;
4
+ const core_1 = require("@oclif/core");
4
5
  const path = require("path");
5
6
  const qq = require("qqjs");
6
7
  const log_1 = require("../log");
@@ -10,7 +11,7 @@ async function checkFor7Zip() {
10
11
  }
11
12
  catch (error) {
12
13
  if (error.code === 127)
13
- errors_1.error('install 7-zip to package windows tarball');
14
+ core_1.Errors.error('install 7-zip to package windows tarball');
14
15
  else
15
16
  throw error;
16
17
  }
@@ -33,7 +34,7 @@ async function fetchNodeBinary({ nodeVersion, output, platform, arch, tmp }) {
33
34
  if (platform === 'win32')
34
35
  cache += '.exe';
35
36
  const download = async () => {
36
- log_1.log(`downloading ${nodeBase}`);
37
+ (0, log_1.log)(`downloading ${nodeBase}`);
37
38
  const shasums = path.join(tmp, 'cache', nodeVersion, 'SHASUMS256.txt.asc');
38
39
  if (!await qq.exists(shasums)) {
39
40
  await qq.download(`https://nodejs.org/dist/v${nodeVersion}/SHASUMS256.txt.asc`, shasums);
@@ -44,7 +45,7 @@ async function fetchNodeBinary({ nodeVersion, output, platform, arch, tmp }) {
44
45
  await qq.x(`grep ${path.basename(tarball)} ${shasums} | shasum -a 256 -c -`, { cwd: basedir });
45
46
  };
46
47
  const extract = async () => {
47
- log_1.log(`extracting ${nodeBase}`);
48
+ (0, log_1.log)(`extracting ${nodeBase}`);
48
49
  const nodeTmp = path.join(tmp, 'node');
49
50
  await qq.rm([nodeTmp, nodeBase]);
50
51
  await qq.mkdirp(nodeTmp);
@@ -1,7 +1,7 @@
1
- import * as Config from '@oclif/config';
1
+ import { Interfaces } from '@oclif/core';
2
2
  import { BuildConfig as TarballConfig } from './tarballs/config';
3
3
  export declare function commitAWSDir(version: string, sha: string, s3Config: TarballConfig['s3Config']): string;
4
4
  export declare function channelAWSDir(channel: string, s3Config: TarballConfig['s3Config']): string;
5
- export declare function templateShortKey(type: keyof Config.PJSON.S3.Templates | 'macos' | 'win32' | 'deb', ext?: '.tar.gz' | '.tar.xz' | Config.IConfig.s3Key.Options, options?: Config.IConfig.s3Key.Options): string;
6
- export declare function debArch(arch: Config.ArchTypes): "amd64" | "i386" | "armel";
5
+ export declare function templateShortKey(type: keyof Interfaces.PJSON.S3.Templates | 'macos' | 'win32' | 'deb', ext?: '.tar.gz' | '.tar.xz' | Interfaces.Config.s3Key.Options, options?: Interfaces.Config.s3Key.Options): string;
6
+ export declare function debArch(arch: Interfaces.ArchTypes): "amd64" | "i386" | "armel";
7
7
  export declare function debVersion(buildConfig: TarballConfig): string;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.debVersion = exports.debArch = exports.templateShortKey = exports.channelAWSDir = exports.commitAWSDir = void 0;
3
4
  const path = require("path");
4
5
  function commitAWSDir(version, sha, s3Config) {
5
6
  let s3SubDir = s3Config.folder || '';
package/lib/util.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sortVersionsObjectByKeysDesc = exports.template = exports.sortBy = exports.compact = exports.uniqBy = exports.castArray = void 0;
3
4
  const _ = require("lodash");
4
5
  function castArray(input) {
5
6
  if (input === undefined)
@@ -39,8 +40,9 @@ function sortBy(arr, fn) {
39
40
  return arr.sort((a, b) => compare(fn(a), fn(b)));
40
41
  }
41
42
  exports.sortBy = sortBy;
42
- exports.template = (context) => (t) => _.template(t || '')(context);
43
- exports.sortVersionsObjectByKeysDesc = (input) => {
43
+ const template = (context) => (t) => _.template(t || '')(context);
44
+ exports.template = template;
45
+ const sortVersionsObjectByKeysDesc = (input) => {
44
46
  const keys = Reflect.ownKeys(input).sort((a, b) => {
45
47
  const splitA = a.split('.').map(part => parseInt(part, 10));
46
48
  const splitB = b.split('.').map(part => parseInt(part, 10));
@@ -67,3 +69,4 @@ exports.sortVersionsObjectByKeysDesc = (input) => {
67
69
  });
68
70
  return result;
69
71
  };
72
+ exports.sortVersionsObjectByKeysDesc = sortVersionsObjectByKeysDesc;
@@ -1,10 +1,8 @@
1
+ import { BuildConfig } from './tarballs';
1
2
  export declare const appendToIndex: (input: {
2
3
  version: string;
3
4
  originalUrl: string;
4
5
  filename: string;
5
6
  maxAge: string;
6
- s3Config: import("@oclif/config").PJSON.S3 & {
7
- folder?: string | undefined;
8
- indexVersionLimit?: number | undefined;
9
- };
7
+ s3Config: BuildConfig['s3Config'];
10
8
  }) => Promise<void>;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.appendToIndex = void 0;
3
4
  const fs = require("fs-extra");
4
5
  const path = require("path");
5
6
  const aws_1 = require("./aws");
@@ -33,7 +34,7 @@ const sortVersionsObjectByKeysDesc = (input, keyLimit) => {
33
34
  return result;
34
35
  };
35
36
  // appends to an existing file (or writes a new one) with the versions in descending order, with an optional limit from the pjson file
36
- exports.appendToIndex = async (input) => {
37
+ const appendToIndex = async (input) => {
37
38
  var _a;
38
39
  const { version, originalUrl, filename, maxAge, s3Config } = input;
39
40
  // these checks are both nice for users AND helpful for TS
@@ -67,3 +68,4 @@ exports.appendToIndex = async (input) => {
67
68
  // cleans up local fs
68
69
  await fs.remove(jsonFileName);
69
70
  };
71
+ exports.appendToIndex = appendToIndex;
package/package.json CHANGED
@@ -1,16 +1,14 @@
1
1
  {
2
2
  "name": "oclif",
3
3
  "description": "oclif: create your own CLI",
4
- "version": "1.18.2-dev.2",
4
+ "version": "2.0.0-dev.0",
5
5
  "author": "Jeff Dickey @jdxcode",
6
6
  "bin": {
7
7
  "oclif": "bin/run"
8
8
  },
9
9
  "bugs": "https://github.com/oclif/oclif/issues",
10
10
  "dependencies": {
11
- "@oclif/command": "^1.6",
12
- "@oclif/config": "^1.12.6",
13
- "@oclif/errors": "^1.2.2",
11
+ "@oclif/core": "^1.0.0",
14
12
  "@oclif/fixpack": "^2.3.0",
15
13
  "@oclif/plugin-help": "^3",
16
14
  "@oclif/plugin-not-found": "^1.2.2",
@@ -63,7 +61,7 @@
63
61
  "shx": "^0.3.3",
64
62
  "tmp": "^0.2.1",
65
63
  "ts-node": "^9.0.0",
66
- "typescript": "3.8.3"
64
+ "typescript": "4.4.3"
67
65
  },
68
66
  "engines": {
69
67
  "node": ">=12.0.0"
@@ -124,8 +122,8 @@
124
122
  "lint": "nps lint",
125
123
  "postpack": "shx rm .oclif.manifest.json",
126
124
  "posttest": "yarn run lint",
127
- "prepack": "shx rm -rf lib && tsc && oclif-dev manifest",
128
- "version": "oclif-dev readme && git add README.md",
125
+ "prepack": "shx rm -rf lib && tsc && bin/dev manifest .",
126
+ "version": "bin/dev readme && git add README.md",
129
127
  "test": "nps test"
130
128
  },
131
129
  "publishConfig": {
@@ -1,16 +0,0 @@
1
- import { flags } from '@oclif/command';
2
- import Base from './command-base';
3
- export default abstract class AppCommand extends Base {
4
- static flags: {
5
- defaults: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
6
- options: flags.IOptionFlag<string | undefined>;
7
- force: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
8
- };
9
- static args: {
10
- name: string;
11
- required: boolean;
12
- description: string;
13
- }[];
14
- abstract type: string;
15
- run(): Promise<void>;
16
- }