oclif 1.18.2-dev.2 → 1.18.2
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.
- package/.oclif.manifest.json +1 -1
- package/CHANGELOG.md +23 -8
- package/README.md +6 -6
- package/lib/app-command.d.ts +1 -5
- package/lib/command-base.d.ts +1 -1
- package/lib/commands/command.d.ts +2 -4
- package/lib/commands/hook.d.ts +1 -5
- package/lib/commands/pack/deb.js +4 -4
- package/lib/commands/pack/macos.d.ts +0 -1
- package/lib/commands/pack/macos.js +8 -15
- package/lib/commands/pack/tarballs.d.ts +1 -5
- package/lib/commands/pack/win.d.ts +0 -1
- package/lib/commands/pack/win.js +11 -17
- package/lib/commands/promote.d.ts +1 -13
- package/lib/commands/readme.d.ts +1 -4
- package/lib/commands/readme.js +8 -8
- package/lib/commands/upload/deb.js +3 -3
- package/lib/commands/upload/macos.js +4 -4
- package/lib/commands/upload/tarballs.d.ts +1 -5
- package/lib/commands/upload/tarballs.js +8 -10
- package/lib/commands/upload/win.js +6 -6
- package/lib/generators/app.js +104 -115
- package/lib/log.js +1 -1
- package/lib/tarballs/bin.js +1 -1
- package/lib/tarballs/build.js +20 -20
- package/lib/util.js +22 -22
- package/lib/version-indexes.js +4 -4
- package/package.json +21 -22
- package/templates/eslintrc +5 -1
- package/templates/eslintrc.typescript +4 -6
- package/templates/tsconfig.json +2 -1
|
@@ -10,14 +10,14 @@ class UploadWin extends command_1.Command {
|
|
|
10
10
|
async run() {
|
|
11
11
|
const { flags } = this.parse(UploadWin);
|
|
12
12
|
const buildConfig = await Tarballs.buildConfig(flags.root);
|
|
13
|
-
const { s3Config, version, config, dist } = buildConfig;
|
|
13
|
+
const { s3Config, version, config, dist, targets, gitSha } = buildConfig;
|
|
14
14
|
const S3Options = {
|
|
15
15
|
Bucket: s3Config.bucket,
|
|
16
16
|
ACL: s3Config.acl || 'public-read',
|
|
17
17
|
};
|
|
18
|
-
const archs =
|
|
18
|
+
const archs = 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:
|
|
20
|
+
const templateKey = upload_util_1.templateShortKey('win32', { bin: config.bin, version: version, sha: 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,
|
|
28
|
+
const cloudKeyBase = upload_util_1.commitAWSDir(config.pjson.version, gitSha, s3Config);
|
|
29
29
|
const uploadWin = async (arch) => {
|
|
30
|
-
const templateKey = upload_util_1.templateShortKey('win32', { bin: config.bin, version:
|
|
30
|
+
const templateKey = upload_util_1.templateShortKey('win32', { bin: config.bin, version: version, sha: gitSha, arch });
|
|
31
31
|
const localExe = dist(`win32/${templateKey}`);
|
|
32
32
|
const cloudKey = `${cloudKeyBase}/${templateKey}`;
|
|
33
33
|
if (await qq.exists(localExe))
|
|
@@ -35,7 +35,7 @@ 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}-${
|
|
38
|
+
log_1.log(`done uploading windows executables for v${version}-${gitSha}`);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
exports.default = UploadWin;
|
package/lib/generators/app.js
CHANGED
|
@@ -77,113 +77,108 @@ class App extends Generator {
|
|
|
77
77
|
let repository = this.destinationRoot().split(path.sep).slice(-2).join('/');
|
|
78
78
|
if (this.githubUser)
|
|
79
79
|
repository = `${this.githubUser}/${repository.split('/')[1]}`;
|
|
80
|
-
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: '>=
|
|
80
|
+
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: '>=12.0.0' }, this.pjson.engines), options: this.options });
|
|
81
81
|
this.repository = defaults.repository;
|
|
82
82
|
if (this.repository && this.repository.url) {
|
|
83
83
|
this.repository = this.repository.url;
|
|
84
84
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
name: '
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
name: '
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
],
|
|
183
|
-
filter: ((arr) => _.keyBy(arr)),
|
|
184
|
-
},
|
|
185
|
-
]);
|
|
186
|
-
}
|
|
85
|
+
this.answers = this.options.defaults ? defaults : await this.prompt([
|
|
86
|
+
{
|
|
87
|
+
type: 'input',
|
|
88
|
+
name: 'name',
|
|
89
|
+
message: 'npm package name',
|
|
90
|
+
default: defaults.name,
|
|
91
|
+
when: !this.pjson.name,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
type: 'input',
|
|
95
|
+
name: 'bin',
|
|
96
|
+
message: 'command bin name the CLI will export',
|
|
97
|
+
default: (answers) => (answers.name || this._bin).split('/').pop(),
|
|
98
|
+
when: ['single', 'multi'].includes(this.type) && !this.pjson.oclif.bin,
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
type: 'input',
|
|
102
|
+
name: 'description',
|
|
103
|
+
message: 'description',
|
|
104
|
+
default: defaults.description,
|
|
105
|
+
when: !this.pjson.description,
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
type: 'input',
|
|
109
|
+
name: 'author',
|
|
110
|
+
message: 'author',
|
|
111
|
+
default: defaults.author,
|
|
112
|
+
when: !this.pjson.author,
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
type: 'input',
|
|
116
|
+
name: 'version',
|
|
117
|
+
message: 'version',
|
|
118
|
+
default: defaults.version,
|
|
119
|
+
when: !this.pjson.version,
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
type: 'input',
|
|
123
|
+
name: 'license',
|
|
124
|
+
message: 'license',
|
|
125
|
+
default: defaults.license,
|
|
126
|
+
when: !this.pjson.license,
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
type: 'input',
|
|
130
|
+
name: 'github.user',
|
|
131
|
+
message: 'Who is the GitHub owner of repository (https://github.com/OWNER/repo)',
|
|
132
|
+
default: repository.split('/').slice(0, -1).pop(),
|
|
133
|
+
when: !this.pjson.repository,
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
type: 'input',
|
|
137
|
+
name: 'github.repo',
|
|
138
|
+
message: 'What is the GitHub name of repository (https://github.com/owner/REPO)',
|
|
139
|
+
default: (answers) => (this.pjson.repository || answers.name || this.pjson.name).split('/').pop(),
|
|
140
|
+
when: !this.pjson.repository,
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
type: 'list',
|
|
144
|
+
name: 'pkg',
|
|
145
|
+
message: 'Select a package manager',
|
|
146
|
+
choices: [
|
|
147
|
+
{ name: 'npm', value: 'npm' },
|
|
148
|
+
{ name: 'yarn', value: 'yarn' },
|
|
149
|
+
],
|
|
150
|
+
default: () => this.options.yarn || hasYarn ? 1 : 0,
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
type: 'confirm',
|
|
154
|
+
name: 'typescript',
|
|
155
|
+
message: 'TypeScript',
|
|
156
|
+
default: () => true,
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
type: 'confirm',
|
|
160
|
+
name: 'eslint',
|
|
161
|
+
message: 'Use eslint (linter for JavaScript and Typescript)',
|
|
162
|
+
default: () => true,
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
type: 'confirm',
|
|
166
|
+
name: 'mocha',
|
|
167
|
+
message: 'Use mocha (testing framework)',
|
|
168
|
+
default: () => true,
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
type: 'checkbox',
|
|
172
|
+
name: 'ci',
|
|
173
|
+
message: 'Add CI service config',
|
|
174
|
+
choices: [
|
|
175
|
+
{ name: 'circleci (continuous integration/delivery service)', value: 'circleci' },
|
|
176
|
+
{ name: 'appveyor (continuous integration/delivery service)', value: 'appveyor' },
|
|
177
|
+
{ name: 'travisci (continuous integration/delivery service)', value: 'travisci' },
|
|
178
|
+
],
|
|
179
|
+
filter: ((arr) => _.keyBy(arr)),
|
|
180
|
+
},
|
|
181
|
+
]);
|
|
187
182
|
debug(this.answers);
|
|
188
183
|
if (!this.options.defaults) {
|
|
189
184
|
this.options = Object.assign(Object.assign({}, this.answers.ci), { mocha: this.answers.mocha, eslint: this.answers.eslint, typescript: this.answers.typescript, yarn: this.answers.pkg === 'yarn' });
|
|
@@ -207,12 +202,7 @@ class App extends Generator {
|
|
|
207
202
|
if (this.eslint) {
|
|
208
203
|
this.pjson.scripts.posttest = 'eslint .';
|
|
209
204
|
}
|
|
210
|
-
|
|
211
|
-
this.pjson.scripts.test = `nyc ${this.ts ? '--extension .ts ' : ''}mocha --forbid-only "test/**/*.test.${this._ext}"`;
|
|
212
|
-
}
|
|
213
|
-
else {
|
|
214
|
-
this.pjson.scripts.test = 'echo NO TESTS';
|
|
215
|
-
}
|
|
205
|
+
this.pjson.scripts.test = this.mocha ? `nyc ${this.ts ? '--extension .ts ' : ''}mocha --forbid-only "test/**/*.test.${this._ext}"` : 'echo NO TESTS';
|
|
216
206
|
if (this.ts) {
|
|
217
207
|
this.pjson.scripts.prepack = nps.series(`${rmrf} lib`, 'tsc -b');
|
|
218
208
|
if (this.eslint) {
|
|
@@ -223,8 +213,7 @@ class App extends Generator {
|
|
|
223
213
|
this.pjson.scripts.prepack = nps.series(this.pjson.scripts.prepack, 'oclif-dev manifest', 'oclif-dev readme');
|
|
224
214
|
this.pjson.scripts.postpack = `${rmf} oclif.manifest.json`;
|
|
225
215
|
this.pjson.scripts.version = nps.series('oclif-dev readme', 'git add README.md');
|
|
226
|
-
this.pjson.files.push('/oclif.manifest.json');
|
|
227
|
-
this.pjson.files.push('/npm-shrinkwrap.json');
|
|
216
|
+
this.pjson.files.push('/oclif.manifest.json', '/npm-shrinkwrap.json');
|
|
228
217
|
}
|
|
229
218
|
else if (this.type === 'single') {
|
|
230
219
|
this.pjson.scripts.prepack = nps.series(this.pjson.scripts.prepack, 'oclif-dev readme');
|
|
@@ -362,8 +351,7 @@ class App extends Generator {
|
|
|
362
351
|
}
|
|
363
352
|
}
|
|
364
353
|
if (this.eslint) {
|
|
365
|
-
devDependencies.push('eslint@^7.
|
|
366
|
-
'eslint-config-oclif@^3.1');
|
|
354
|
+
devDependencies.push('eslint@^7.32.0', 'eslint-config-oclif@^3.1.2');
|
|
367
355
|
if (this.ts) {
|
|
368
356
|
devDependencies.push('eslint-config-oclif-typescript@^0.2.0');
|
|
369
357
|
}
|
|
@@ -373,6 +361,7 @@ class App extends Generator {
|
|
|
373
361
|
const yarnOpts = {};
|
|
374
362
|
if (process.env.YARN_MUTEX)
|
|
375
363
|
yarnOpts.mutex = process.env.YARN_MUTEX;
|
|
364
|
+
// eslint-disable-next-line @typescript-eslint/ban-types,unicorn/consistent-function-scoping
|
|
376
365
|
const install = (deps, opts) => this.yarn ? this.yarnInstall(deps, opts) : this.npmInstall(deps, opts);
|
|
377
366
|
const dev = this.yarn ? { dev: true } : { 'save-dev': true };
|
|
378
367
|
const save = this.yarn ? {} : { save: true };
|
|
@@ -402,8 +391,8 @@ class App extends Generator {
|
|
|
402
391
|
'/.nyc_output',
|
|
403
392
|
this.yarn ? '/package-lock.json' : '/yarn.lock',
|
|
404
393
|
this.ts && '/lib',
|
|
394
|
+
...existing,
|
|
405
395
|
])
|
|
406
|
-
.concat(existing)
|
|
407
396
|
.compact()
|
|
408
397
|
.uniq()
|
|
409
398
|
.sort()
|
|
@@ -413,8 +402,8 @@ class App extends Generator {
|
|
|
413
402
|
const existing = this.fs.exists(this.destinationPath('.eslintignore')) ? this.fs.read(this.destinationPath('.eslintignore')).split('\n') : [];
|
|
414
403
|
return _([
|
|
415
404
|
this.ts && '/lib',
|
|
405
|
+
...existing,
|
|
416
406
|
])
|
|
417
|
-
.concat(existing)
|
|
418
407
|
.compact()
|
|
419
408
|
.uniq()
|
|
420
409
|
.sort()
|
package/lib/log.js
CHANGED
|
@@ -6,7 +6,7 @@ const util = require("util");
|
|
|
6
6
|
exports.debug = require('debug')('oclif');
|
|
7
7
|
exports.debug.new = (name) => require('debug')(`oclif:${name}`);
|
|
8
8
|
function log(format, ...args) {
|
|
9
|
-
args = args.map(qq.prettifyPaths);
|
|
9
|
+
args = args.map(arg => qq.prettifyPaths(arg));
|
|
10
10
|
exports.debug.enabled ? exports.debug(format, ...args) : cli_ux_1.default.log(`oclif: ${util.format(format, ...args)}`);
|
|
11
11
|
}
|
|
12
12
|
exports.log = log;
|
package/lib/tarballs/bin.js
CHANGED
|
@@ -7,7 +7,7 @@ async function writeBinScripts({ config, baseWorkspace, nodeVersion }) {
|
|
|
7
7
|
const clientHomeEnvVar = config.scopedEnvVarKey('OCLIF_CLIENT_HOME');
|
|
8
8
|
const writeWin32 = async () => {
|
|
9
9
|
const { bin } = config;
|
|
10
|
-
await qq.write([baseWorkspace, 'bin', `${
|
|
10
|
+
await qq.write([baseWorkspace, 'bin', `${bin}.cmd`], `@echo off
|
|
11
11
|
setlocal enableextensions
|
|
12
12
|
|
|
13
13
|
if not "%${redirectedEnvVar}%"=="1" if exist "%LOCALAPPDATA%\\${bin}\\client\\bin\\${bin}.cmd" (
|
package/lib/tarballs/build.js
CHANGED
|
@@ -18,7 +18,7 @@ const pack = async (from, to) => {
|
|
|
18
18
|
qq.cd(prevCwd);
|
|
19
19
|
};
|
|
20
20
|
async function build(c, options = {}) {
|
|
21
|
-
const { xz, config } = c;
|
|
21
|
+
const { xz, config, version, s3Config, gitSha, nodeVersion, targets, updateConfig } = c;
|
|
22
22
|
const prevCwd = qq.cwd();
|
|
23
23
|
const packCLI = async () => {
|
|
24
24
|
const stdout = await qq.x.stdout('npm', ['pack', '--unsafe-perm'], { cwd: c.root });
|
|
@@ -39,10 +39,10 @@ async function build(c, options = {}) {
|
|
|
39
39
|
const updatePJSON = async () => {
|
|
40
40
|
qq.cd(c.workspace());
|
|
41
41
|
const pjson = await qq.readJSON('package.json');
|
|
42
|
-
pjson.version =
|
|
42
|
+
pjson.version = version;
|
|
43
43
|
pjson.oclif.update = pjson.oclif.update || {};
|
|
44
44
|
pjson.oclif.update.s3 = pjson.oclif.update.s3 || {};
|
|
45
|
-
pjson.oclif.update.s3.bucket =
|
|
45
|
+
pjson.oclif.update.s3.bucket = s3Config.bucket;
|
|
46
46
|
await qq.writeJSON('package.json', pjson);
|
|
47
47
|
};
|
|
48
48
|
const addDependencies = async () => {
|
|
@@ -77,16 +77,16 @@ async function build(c, options = {}) {
|
|
|
77
77
|
const workspace = c.workspace(target);
|
|
78
78
|
const gzLocalKey = upload_util_1.templateShortKey('versioned', '.tar.gz', {
|
|
79
79
|
arch: target.arch,
|
|
80
|
-
bin:
|
|
80
|
+
bin: config.bin,
|
|
81
81
|
platform: target.platform,
|
|
82
|
-
sha:
|
|
82
|
+
sha: gitSha,
|
|
83
83
|
version: config.version,
|
|
84
84
|
});
|
|
85
85
|
const xzLocalKey = upload_util_1.templateShortKey('versioned', '.tar.xz', {
|
|
86
86
|
arch: target.arch,
|
|
87
|
-
bin:
|
|
87
|
+
bin: config.bin,
|
|
88
88
|
platform: target.platform,
|
|
89
|
-
sha:
|
|
89
|
+
sha: gitSha,
|
|
90
90
|
version: config.version,
|
|
91
91
|
});
|
|
92
92
|
const base = path.basename(gzLocalKey);
|
|
@@ -95,7 +95,7 @@ async function build(c, options = {}) {
|
|
|
95
95
|
await qq.rm(workspace);
|
|
96
96
|
await qq.cp(c.workspace(), workspace);
|
|
97
97
|
await node_1.fetchNodeBinary({
|
|
98
|
-
nodeVersion:
|
|
98
|
+
nodeVersion: nodeVersion,
|
|
99
99
|
output: path.join(workspace, 'bin', 'node'),
|
|
100
100
|
platform: target.platform,
|
|
101
101
|
arch: target.arch,
|
|
@@ -106,30 +106,30 @@ async function build(c, options = {}) {
|
|
|
106
106
|
await pack(workspace, c.dist(gzLocalKey));
|
|
107
107
|
if (xz)
|
|
108
108
|
await pack(workspace, c.dist(xzLocalKey));
|
|
109
|
-
if (!
|
|
109
|
+
if (!updateConfig.s3.host)
|
|
110
110
|
return;
|
|
111
|
-
const rollout = (typeof
|
|
112
|
-
const gzCloudKey = `${upload_util_1.commitAWSDir(
|
|
113
|
-
const xzCloudKey = `${upload_util_1.commitAWSDir(
|
|
111
|
+
const rollout = (typeof updateConfig.autoupdate === 'object' && updateConfig.autoupdate.rollout);
|
|
112
|
+
const gzCloudKey = `${upload_util_1.commitAWSDir(version, gitSha, updateConfig.s3)}/${gzLocalKey}`;
|
|
113
|
+
const xzCloudKey = `${upload_util_1.commitAWSDir(version, gitSha, updateConfig.s3)}/${xzLocalKey}`;
|
|
114
114
|
const manifest = {
|
|
115
115
|
rollout: rollout === false ? undefined : rollout,
|
|
116
|
-
version:
|
|
117
|
-
sha:
|
|
118
|
-
baseDir: upload_util_1.templateShortKey('baseDir', target, { bin:
|
|
116
|
+
version: version,
|
|
117
|
+
sha: gitSha,
|
|
118
|
+
baseDir: upload_util_1.templateShortKey('baseDir', target, { bin: config.bin }),
|
|
119
119
|
gz: config.s3Url(gzCloudKey),
|
|
120
120
|
xz: xz ? config.s3Url(xzCloudKey) : undefined,
|
|
121
121
|
sha256gz: await qq.hash('sha256', c.dist(gzLocalKey)),
|
|
122
122
|
sha256xz: xz ? await qq.hash('sha256', c.dist(xzLocalKey)) : undefined,
|
|
123
123
|
node: {
|
|
124
124
|
compatible: config.pjson.engines.node,
|
|
125
|
-
recommended:
|
|
125
|
+
recommended: nodeVersion,
|
|
126
126
|
},
|
|
127
127
|
};
|
|
128
128
|
const manifestFilepath = c.dist(upload_util_1.templateShortKey('manifest', {
|
|
129
129
|
arch: target.arch,
|
|
130
|
-
bin:
|
|
130
|
+
bin: config.bin,
|
|
131
131
|
platform: target.platform,
|
|
132
|
-
sha:
|
|
132
|
+
sha: gitSha,
|
|
133
133
|
version: config.version,
|
|
134
134
|
}));
|
|
135
135
|
await qq.writeJSON(manifestFilepath, manifest);
|
|
@@ -138,9 +138,9 @@ async function build(c, options = {}) {
|
|
|
138
138
|
await extractCLI(await packCLI());
|
|
139
139
|
await updatePJSON();
|
|
140
140
|
await addDependencies();
|
|
141
|
-
await bin_1.writeBinScripts({ config, baseWorkspace: c.workspace(), nodeVersion:
|
|
141
|
+
await bin_1.writeBinScripts({ config, baseWorkspace: c.workspace(), nodeVersion: nodeVersion });
|
|
142
142
|
await pretarball();
|
|
143
|
-
for (const target of
|
|
143
|
+
for (const target of targets) {
|
|
144
144
|
if (!options.platform || options.platform === target.platform) {
|
|
145
145
|
// eslint-disable-next-line no-await-in-loop
|
|
146
146
|
await buildTarget(target);
|
package/lib/util.js
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const _ = require("lodash");
|
|
4
|
+
function compare(a, b) {
|
|
5
|
+
a = a === undefined ? 0 : a;
|
|
6
|
+
b = b === undefined ? 0 : b;
|
|
7
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
8
|
+
if (a.length === 0 && b.length === 0)
|
|
9
|
+
return 0;
|
|
10
|
+
const diff = compare(a[0], b[0]);
|
|
11
|
+
if (diff !== 0)
|
|
12
|
+
return diff;
|
|
13
|
+
return compare(a.slice(1), b.slice(1));
|
|
14
|
+
}
|
|
15
|
+
if (a < b)
|
|
16
|
+
return -1;
|
|
17
|
+
if (a > b)
|
|
18
|
+
return 1;
|
|
19
|
+
return 0;
|
|
20
|
+
}
|
|
4
21
|
function castArray(input) {
|
|
5
22
|
if (input === undefined)
|
|
6
23
|
return [];
|
|
@@ -10,7 +27,7 @@ exports.castArray = castArray;
|
|
|
10
27
|
function uniqBy(arr, fn) {
|
|
11
28
|
return arr.filter((a, i) => {
|
|
12
29
|
const aVal = fn(a);
|
|
13
|
-
return !arr.
|
|
30
|
+
return !arr.some((b, j) => j > i && fn(b) === aVal);
|
|
14
31
|
});
|
|
15
32
|
}
|
|
16
33
|
exports.uniqBy = uniqBy;
|
|
@@ -19,31 +36,14 @@ function compact(a) {
|
|
|
19
36
|
}
|
|
20
37
|
exports.compact = compact;
|
|
21
38
|
function sortBy(arr, fn) {
|
|
22
|
-
function compare(a, b) {
|
|
23
|
-
a = a === undefined ? 0 : a;
|
|
24
|
-
b = b === undefined ? 0 : b;
|
|
25
|
-
if (Array.isArray(a) && Array.isArray(b)) {
|
|
26
|
-
if (a.length === 0 && b.length === 0)
|
|
27
|
-
return 0;
|
|
28
|
-
const diff = compare(a[0], b[0]);
|
|
29
|
-
if (diff !== 0)
|
|
30
|
-
return diff;
|
|
31
|
-
return compare(a.slice(1), b.slice(1));
|
|
32
|
-
}
|
|
33
|
-
if (a < b)
|
|
34
|
-
return -1;
|
|
35
|
-
if (a > b)
|
|
36
|
-
return 1;
|
|
37
|
-
return 0;
|
|
38
|
-
}
|
|
39
39
|
return arr.sort((a, b) => compare(fn(a), fn(b)));
|
|
40
40
|
}
|
|
41
41
|
exports.sortBy = sortBy;
|
|
42
42
|
exports.template = (context) => (t) => _.template(t || '')(context);
|
|
43
43
|
exports.sortVersionsObjectByKeysDesc = (input) => {
|
|
44
44
|
const keys = Reflect.ownKeys(input).sort((a, b) => {
|
|
45
|
-
const splitA = a.split('.').map(part => parseInt(part, 10));
|
|
46
|
-
const splitB = b.split('.').map(part => parseInt(part, 10));
|
|
45
|
+
const splitA = a.split('.').map(part => Number.parseInt(part, 10));
|
|
46
|
+
const splitB = b.split('.').map(part => Number.parseInt(part, 10));
|
|
47
47
|
// sort by major
|
|
48
48
|
if (splitA[0] < splitB[0])
|
|
49
49
|
return 1;
|
|
@@ -62,8 +62,8 @@ exports.sortVersionsObjectByKeysDesc = (input) => {
|
|
|
62
62
|
return 0;
|
|
63
63
|
});
|
|
64
64
|
const result = {};
|
|
65
|
-
|
|
65
|
+
for (const key of keys) {
|
|
66
66
|
result[key] = input[key];
|
|
67
|
-
}
|
|
67
|
+
}
|
|
68
68
|
return result;
|
|
69
69
|
};
|
package/lib/version-indexes.js
CHANGED
|
@@ -7,8 +7,8 @@ const log_1 = require("./log");
|
|
|
7
7
|
const debug = log_1.debug.new('version-indexes');
|
|
8
8
|
const sortVersionsObjectByKeysDesc = (input, keyLimit) => {
|
|
9
9
|
const keys = Reflect.ownKeys(input).sort((a, b) => {
|
|
10
|
-
const splitA = a.split('.').map(part => parseInt(part, 10));
|
|
11
|
-
const splitB = b.split('.').map(part => parseInt(part, 10));
|
|
10
|
+
const splitA = a.split('.').map(part => Number.parseInt(part, 10));
|
|
11
|
+
const splitB = b.split('.').map(part => Number.parseInt(part, 10));
|
|
12
12
|
// sort by major
|
|
13
13
|
if (splitA[0] < splitB[0])
|
|
14
14
|
return 1;
|
|
@@ -27,9 +27,9 @@ const sortVersionsObjectByKeysDesc = (input, keyLimit) => {
|
|
|
27
27
|
return 0;
|
|
28
28
|
}).slice(0, keyLimit); // undefined keyLimit returns the entire array
|
|
29
29
|
const result = {};
|
|
30
|
-
|
|
30
|
+
for (const key of keys) {
|
|
31
31
|
result[key] = input[key];
|
|
32
|
-
}
|
|
32
|
+
}
|
|
33
33
|
return result;
|
|
34
34
|
};
|
|
35
35
|
// appends to an existing file (or writes a new one) with the versions in descending order, with an optional limit from the pjson file
|
package/package.json
CHANGED
|
@@ -1,60 +1,59 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oclif",
|
|
3
3
|
"description": "oclif: create your own CLI",
|
|
4
|
-
"version": "1.18.2
|
|
4
|
+
"version": "1.18.2",
|
|
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.
|
|
13
|
-
"@oclif/errors": "^1.
|
|
11
|
+
"@oclif/command": "^1.8.6",
|
|
12
|
+
"@oclif/config": "^1.17.1",
|
|
13
|
+
"@oclif/errors": "^1.3.5",
|
|
14
14
|
"@oclif/fixpack": "^2.3.0",
|
|
15
|
-
"@oclif/plugin-help": "^3",
|
|
15
|
+
"@oclif/plugin-help": "^3.2.9",
|
|
16
16
|
"@oclif/plugin-not-found": "^1.2.2",
|
|
17
|
-
"@oclif/plugin-warn-if-update-available": "^1.
|
|
18
|
-
"cli-ux": "^5.
|
|
17
|
+
"@oclif/plugin-warn-if-update-available": "^1.7.3",
|
|
18
|
+
"cli-ux": "^5.6.4",
|
|
19
19
|
"debug": "^4.1.1",
|
|
20
20
|
"find-yarn-workspace-root": "^2.0.0",
|
|
21
21
|
"fs-extra": "^8.1",
|
|
22
22
|
"github-slugger": "^1.2.1",
|
|
23
|
-
"lodash": "^4.17.
|
|
23
|
+
"lodash": "^4.17.21",
|
|
24
24
|
"normalize-package-data": "^3.0.0",
|
|
25
25
|
"nps-utils": "^1.7.0",
|
|
26
26
|
"qqjs": "^0.3.10",
|
|
27
27
|
"sort-pjson": "^1.0.3",
|
|
28
28
|
"tslib": "^2.0.0",
|
|
29
|
-
"yeoman-environment": "^2.3
|
|
30
|
-
"yeoman-generator": "3",
|
|
29
|
+
"yeoman-environment": "^2.10.3",
|
|
30
|
+
"yeoman-generator": "3.2.0",
|
|
31
31
|
"yosay": "^2.0.2"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@oclif/dev-cli": "^1.
|
|
35
|
-
"@oclif/plugin-legacy": "^1.
|
|
36
|
-
"@oclif/test": "^1.2.
|
|
34
|
+
"@oclif/dev-cli": "^1.26.5",
|
|
35
|
+
"@oclif/plugin-legacy": "^1.2.2",
|
|
36
|
+
"@oclif/test": "^1.2.8",
|
|
37
37
|
"@types/chai": "^4.1.7",
|
|
38
38
|
"@types/execa": "^0.9.0",
|
|
39
39
|
"@types/fs-extra": "^9.0",
|
|
40
40
|
"@types/lodash": "^4.14.121",
|
|
41
|
-
"@types/lodash.template": "^4.4.6",
|
|
42
41
|
"@types/mocha": "^8.0.0",
|
|
43
42
|
"@types/node": "^14.0.14",
|
|
44
43
|
"@types/read-pkg": "^5.1.0",
|
|
45
44
|
"@types/shelljs": "^0.8.3",
|
|
46
45
|
"@types/supports-color": "^7.2.0",
|
|
47
46
|
"@types/write-json-file": "^3.2.1",
|
|
48
|
-
"@types/yeoman-environment": "^2.10.
|
|
47
|
+
"@types/yeoman-environment": "^2.10.5",
|
|
49
48
|
"@types/yosay": "^0.0.29",
|
|
50
49
|
"aws-sdk": "^2.443.0",
|
|
51
50
|
"chai": "^4.2.0",
|
|
52
51
|
"conventional-changelog-cli": "^2.0.17",
|
|
53
|
-
"eslint": "^7.3.
|
|
54
|
-
"eslint-config-oclif": "^
|
|
55
|
-
"eslint-config-oclif-typescript": "^0.2
|
|
52
|
+
"eslint": "^7.3.2",
|
|
53
|
+
"eslint-config-oclif": "^4.0.0",
|
|
54
|
+
"eslint-config-oclif-typescript": "^1.0.2",
|
|
56
55
|
"execa": "^0.10.0",
|
|
57
|
-
"fancy-test": "^1.4.
|
|
56
|
+
"fancy-test": "^1.4.10",
|
|
58
57
|
"globby": "^11.0.1",
|
|
59
58
|
"mocha": "^8.2.1",
|
|
60
59
|
"npm-run-path": "^4.0.1",
|
|
@@ -117,14 +116,14 @@
|
|
|
117
116
|
},
|
|
118
117
|
"repository": "oclif/oclif",
|
|
119
118
|
"scripts": {
|
|
120
|
-
"build": "
|
|
119
|
+
"build": "rm -rf lib && tsc",
|
|
121
120
|
"devcli:lint": "eslint . --ext .ts --config .eslintrc",
|
|
122
121
|
"devcli:test": "mocha --forbid-only \"test/*.test.ts\"",
|
|
123
122
|
"devcli": "yarn build --noEmit && yarn run devcli:test && yarn run devcli:lint",
|
|
124
123
|
"lint": "nps lint",
|
|
125
|
-
"postpack": "
|
|
124
|
+
"postpack": "rm .oclif.manifest.json",
|
|
126
125
|
"posttest": "yarn run lint",
|
|
127
|
-
"prepack": "
|
|
126
|
+
"prepack": "rm -rf lib && tsc && oclif-dev manifest",
|
|
128
127
|
"version": "oclif-dev readme && git add README.md",
|
|
129
128
|
"test": "nps test"
|
|
130
129
|
},
|