oclif 1.18.0 → 1.18.2-dev.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 +39 -0
- package/README.md +5 -5
- package/lib/commands/pack/macos.d.ts +1 -0
- package/lib/commands/pack/macos.js +11 -4
- package/lib/commands/pack/win.d.ts +1 -0
- package/lib/commands/pack/win.js +13 -7
- package/lib/commands/promote.js +9 -38
- package/lib/commands/upload/tarballs.js +4 -2
- package/lib/generators/app.d.ts +0 -3
- package/lib/generators/app.js +3 -5
- package/lib/tarballs/build.js +11 -6
- package/lib/tarballs/config.d.ts +1 -0
- package/lib/version-indexes.d.ts +10 -0
- package/lib/version-indexes.js +69 -0
- package/package.json +6 -5
- package/templates/README.md.ejs +0 -3
- package/templates/appveyor.yml.ejs +1 -5
- package/templates/circle.yml.ejs +0 -7
- package/templates/eslintrc.typescript +7 -1
- package/templates/travis.yml.ejs +0 -6
package/.oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"1.18.
|
|
1
|
+
{"version":"1.18.2-dev.2","commands":{"base":{"id":"base","pluginName":"oclif","pluginType":"core","hidden":true,"aliases":[],"flags":{"defaults":{"name":"defaults","type":"boolean","description":"use defaults for every setting","allowNo":false},"options":{"name":"options","type":"option","description":"(yarn|typescript|eslint|mocha)"},"force":{"name":"force","type":"boolean","description":"overwrite existing files","allowNo":false}},"args":[{"name":"path","description":"path to project, defaults to current directory","required":false}]},"command":{"id":"command","description":"add a command to an existing CLI or plugin","pluginName":"oclif","pluginType":"core","aliases":[],"flags":{"defaults":{"name":"defaults","type":"boolean","description":"use defaults for every setting","allowNo":false},"force":{"name":"force","type":"boolean","description":"overwrite existing files","allowNo":false}},"args":[{"name":"name","description":"name of command","required":true}]},"hook":{"id":"hook","description":"add a hook to an existing CLI or plugin","pluginName":"oclif","pluginType":"core","aliases":[],"flags":{"defaults":{"name":"defaults","type":"boolean","description":"use defaults for every setting","allowNo":false},"force":{"name":"force","type":"boolean","description":"overwrite existing files","allowNo":false},"event":{"name":"event","type":"option","description":"event to run hook on","default":"init"}},"args":[{"name":"name","description":"name of hook (snake_case)","required":true}]},"manifest":{"id":"manifest","description":"generates plugin manifest json","pluginName":"oclif","pluginType":"core","hidden":true,"aliases":[],"flags":{},"args":[{"name":"path","description":"path to plugin","default":"."}]},"multi":{"id":"multi","description":"generate a new multi-command CLI","pluginName":"oclif","pluginType":"core","aliases":[],"flags":{"defaults":{"name":"defaults","type":"boolean","description":"use defaults for every setting","allowNo":false},"options":{"name":"options","type":"option","description":"(yarn|typescript|eslint|mocha)"},"force":{"name":"force","type":"boolean","description":"overwrite existing files","allowNo":false}},"args":[{"name":"path","description":"path to project, defaults to current directory","required":false}]},"plugin":{"id":"plugin","description":"create a new CLI plugin","pluginName":"oclif","pluginType":"core","aliases":[],"flags":{"defaults":{"name":"defaults","type":"boolean","description":"use defaults for every setting","allowNo":false},"options":{"name":"options","type":"option","description":"(yarn|typescript|eslint|mocha)"},"force":{"name":"force","type":"boolean","description":"overwrite existing files","allowNo":false}},"args":[{"name":"path","description":"path to project, defaults to current directory","required":false}]},"promote":{"id":"promote","description":"promote CLI builds to a S3 release channel","pluginName":"oclif","pluginType":"core","hidden":true,"aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to the oclif CLI project root","required":true,"default":"."},"version":{"name":"version","type":"option","description":"semantic version of the CLI to promote","required":true},"sha":{"name":"sha","type":"option","description":"7-digit short git commit SHA of the CLI to promote","required":true},"channel":{"name":"channel","type":"option","description":"which channel to promote to","required":true,"default":"stable"},"targets":{"name":"targets","type":"option","char":"t","description":"comma-separated targets to promote (e.g.: linux-arm,win32-x64)","default":"linux-x64,linux-arm,win32-x64,win32-x86,darwin-x64"},"deb":{"name":"deb","type":"boolean","char":"d","description":"promote debian artifacts","allowNo":false},"macos":{"name":"macos","type":"boolean","char":"m","description":"promote macOS pkg","allowNo":false},"win":{"name":"win","type":"boolean","char":"w","description":"promote Windows exe","allowNo":false},"max-age":{"name":"max-age","type":"option","char":"a","description":"cache control max-age in seconds","default":"86400"},"xz":{"name":"xz","type":"boolean","description":"also upload xz","allowNo":true},"indexes":{"name":"indexes","type":"boolean","description":"append the promoted urls into the index files","allowNo":false}},"args":[]},"readme":{"id":"readme","description":"adds commands to README.md in current directory\nThe readme must have any of the following tags inside of it for it to be replaced or else it will do nothing:\n# Usage\n<!-- usage -->\n# Commands\n<!-- commands -->\n\nCustomize the code URL prefix by setting oclif.repositoryPrefix in package.json.\n","pluginName":"oclif","pluginType":"core","hidden":true,"aliases":[],"flags":{"dir":{"name":"dir","type":"option","description":"output directory for multi docs","required":true,"default":"docs"},"multi":{"name":"multi","type":"boolean","description":"create a different markdown page for each topic","allowNo":false}},"args":[]},"single":{"id":"single","description":"generate a new single-command CLI","pluginName":"oclif","pluginType":"core","aliases":[],"flags":{"defaults":{"name":"defaults","type":"boolean","description":"use defaults for every setting","allowNo":false},"options":{"name":"options","type":"option","description":"(yarn|typescript|eslint|mocha)"},"force":{"name":"force","type":"boolean","description":"overwrite existing files","allowNo":false}},"args":[{"name":"path","description":"path to project, defaults to current directory","required":false}]},"pack:deb":{"id":"pack:deb","description":"pack CLI into debian package","pluginName":"oclif","pluginType":"core","hidden":true,"aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"default":"."}},"args":[]},"pack:macos":{"id":"pack:macos","description":"pack CLI into macOS .pkg","pluginName":"oclif","pluginType":"core","hidden":true,"aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"default":"."},"additional-executable":{"name":"additional-executable","type":"option","description":"an executable other than the one listed in config.bin that should be made available to the user\nthe executable should already exist in the tarball produced by \"oclif pack:tarballs\""}},"args":[]},"pack:tarballs":{"id":"pack:tarballs","description":"packages oclif CLI into tarballs\n\nThis can be used to create oclif CLIs that use the system node or that come preloaded with a node binary.\n","pluginName":"oclif","pluginType":"core","hidden":true,"aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"default":"."},"targets":{"name":"targets","type":"option","char":"t","description":"comma-separated targets to pack (e.g.: linux-arm,win32-x64)","default":"linux-x64,linux-arm,win32-x64,win32-x86,darwin-x64"},"xz":{"name":"xz","type":"boolean","description":"also build xz","allowNo":true}},"args":[]},"pack:win":{"id":"pack:win","description":"create windows installer from oclif CLI","pluginName":"oclif","pluginType":"core","hidden":true,"aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"default":"."},"additional-executable":{"name":"additional-executable","type":"option","description":"an executable other than the one listed in config.bin that should be made available to the user\nthe executable should already exist in the tarball produced by \"oclif pack:tarballs\""}},"args":[]},"upload:deb":{"id":"upload:deb","description":"upload deb package built with pack:deb","pluginName":"oclif","pluginType":"core","hidden":true,"aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"default":"."}},"args":[]},"upload:macos":{"id":"upload:macos","description":"upload macos installers built with pack:macos","pluginName":"oclif","pluginType":"core","hidden":true,"aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"default":"."}},"args":[]},"upload:tarballs":{"id":"upload:tarballs","description":"upload an oclif CLI to S3\n\n\"aws-sdk\" will need to be installed as a devDependency to upload.\n","pluginName":"oclif","pluginType":"core","hidden":true,"aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"default":"."},"targets":{"name":"targets","type":"option","char":"t","description":"comma-separated targets to upload (e.g.: linux-arm,win32-x64)","default":"linux-x64,linux-arm,win32-x64,win32-x86,darwin-x64"},"xz":{"name":"xz","type":"boolean","description":"also upload xz","allowNo":true}},"args":[]},"upload:win":{"id":"upload:win","description":"upload windows installers built with pack:win","pluginName":"oclif","pluginType":"core","hidden":true,"aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"default":"."}},"args":[]}}}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,42 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
|
+
|
|
5
|
+
### [1.18.2-dev.2](https://github.com/oclif/oclif/compare/v1.18.1...v1.18.2-dev.2) (2021-10-28)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### ⚠ BREAKING CHANGES
|
|
9
|
+
|
|
10
|
+
* require node 12+ (#676)
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* add additional executable to mac installer ([015d10a](https://github.com/oclif/oclif/commit/015d10ac904fe25bc699e5381d643067fba489da))
|
|
15
|
+
* add additional executable to win installer ([cfd831e](https://github.com/oclif/oclif/commit/cfd831e4c03ab70dff0fcd330a84f0f3905153c3))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* build and find tarballs using the same version ([44c4177](https://github.com/oclif/oclif/commit/44c41774c262c85eebd1a0eb8afce07edfd5ef8c))
|
|
21
|
+
* lint ([110e659](https://github.com/oclif/oclif/commit/110e6597c3fe41a1453c0034b166b23419324b71))
|
|
22
|
+
* release new dev version ([cb63e9c](https://github.com/oclif/oclif/commit/cb63e9c508dbbf7dea0ed44a3bd082be7fbc122b))
|
|
23
|
+
* tests ([7a68684](https://github.com/oclif/oclif/commit/7a68684cd25ba4b770d16904fc22eb266c0c4b1f))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### build
|
|
27
|
+
|
|
28
|
+
* require node 12+ ([#676](https://github.com/oclif/oclif/issues/676)) ([f4b648c](https://github.com/oclif/oclif/commit/f4b648c244c8806c999ad2e636c446414b14c5a5))
|
|
29
|
+
|
|
30
|
+
### [1.18.1](https://github.com/oclif/oclif/compare/v1.18.0...v1.18.1) (2021-07-01)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
|
|
35
|
+
* add setup_git script ([35d0920](https://github.com/oclif/oclif/commit/35d0920eae2958d7e9ae394523f06b1f034396ad))
|
|
36
|
+
* move pretarball step ([#617](https://github.com/oclif/oclif/issues/617)) ([cd74340](https://github.com/oclif/oclif/commit/cd743408e5a8fd3e4f7e6effd6ec91adbe1121d4))
|
|
37
|
+
* update config.yml ([97b630c](https://github.com/oclif/oclif/commit/97b630c2d1ac36b1975057fbc18caa420f828981))
|
|
38
|
+
* update release job ([eb05cd5](https://github.com/oclif/oclif/commit/eb05cd5511dfac27617e916aa0415cdb5647f11e))
|
|
39
|
+
|
|
1
40
|
# [1.17.0](https://github.com/oclif/oclif/compare/v1.16.2...v1.17.0) (2021-03-15)
|
|
2
41
|
|
|
3
42
|
|
package/README.md
CHANGED
|
@@ -146,7 +146,7 @@ OPTIONS
|
|
|
146
146
|
--force overwrite existing files
|
|
147
147
|
```
|
|
148
148
|
|
|
149
|
-
_See code: [src/commands/command.ts](https://github.com/oclif/oclif/blob/v1.18.
|
|
149
|
+
_See code: [src/commands/command.ts](https://github.com/oclif/oclif/blob/v1.18.2-dev.2/src/commands/command.ts)_
|
|
150
150
|
|
|
151
151
|
## `oclif help [COMMAND]`
|
|
152
152
|
|
|
@@ -182,7 +182,7 @@ OPTIONS
|
|
|
182
182
|
--force overwrite existing files
|
|
183
183
|
```
|
|
184
184
|
|
|
185
|
-
_See code: [src/commands/hook.ts](https://github.com/oclif/oclif/blob/v1.18.
|
|
185
|
+
_See code: [src/commands/hook.ts](https://github.com/oclif/oclif/blob/v1.18.2-dev.2/src/commands/hook.ts)_
|
|
186
186
|
|
|
187
187
|
## `oclif multi [PATH]`
|
|
188
188
|
|
|
@@ -201,7 +201,7 @@ OPTIONS
|
|
|
201
201
|
--options=options (yarn|typescript|eslint|mocha)
|
|
202
202
|
```
|
|
203
203
|
|
|
204
|
-
_See code: [src/commands/multi.ts](https://github.com/oclif/oclif/blob/v1.18.
|
|
204
|
+
_See code: [src/commands/multi.ts](https://github.com/oclif/oclif/blob/v1.18.2-dev.2/src/commands/multi.ts)_
|
|
205
205
|
|
|
206
206
|
## `oclif plugin [PATH]`
|
|
207
207
|
|
|
@@ -220,7 +220,7 @@ OPTIONS
|
|
|
220
220
|
--options=options (yarn|typescript|eslint|mocha)
|
|
221
221
|
```
|
|
222
222
|
|
|
223
|
-
_See code: [src/commands/plugin.ts](https://github.com/oclif/oclif/blob/v1.18.
|
|
223
|
+
_See code: [src/commands/plugin.ts](https://github.com/oclif/oclif/blob/v1.18.2-dev.2/src/commands/plugin.ts)_
|
|
224
224
|
|
|
225
225
|
## `oclif single [PATH]`
|
|
226
226
|
|
|
@@ -239,7 +239,7 @@ OPTIONS
|
|
|
239
239
|
--options=options (yarn|typescript|eslint|mocha)
|
|
240
240
|
```
|
|
241
241
|
|
|
242
|
-
_See code: [src/commands/single.ts](https://github.com/oclif/oclif/blob/v1.18.
|
|
242
|
+
_See code: [src/commands/single.ts](https://github.com/oclif/oclif/blob/v1.18.2-dev.2/src/commands/single.ts)_
|
|
243
243
|
<!-- commandsstop -->
|
|
244
244
|
|
|
245
245
|
# 🏭 Related Repositories
|
|
@@ -6,17 +6,21 @@ const qq = require("qqjs");
|
|
|
6
6
|
const Tarballs = require("../../tarballs");
|
|
7
7
|
const upload_util_1 = require("../../upload-util");
|
|
8
8
|
const scripts = {
|
|
9
|
-
preinstall: (config) => `#!/usr/bin/env bash
|
|
9
|
+
preinstall: (config, additionalExecutable) => `#!/usr/bin/env bash
|
|
10
10
|
sudo rm -rf /usr/local/lib/${config.dirname}
|
|
11
11
|
sudo rm -rf /usr/local/${config.bin}
|
|
12
12
|
sudo rm -rf /usr/local/bin/${config.bin}
|
|
13
|
+
${additionalExecutable ?
|
|
14
|
+
`sudo rm -rf /usr/local/${additionalExecutable}
|
|
15
|
+
sudo rm -rf /usr/local/bin/${additionalExecutable}` : ''}
|
|
13
16
|
`,
|
|
14
|
-
postinstall: (config) => `#!/usr/bin/env bash
|
|
17
|
+
postinstall: (config, additionalExecutable) => `#!/usr/bin/env bash
|
|
15
18
|
set -x
|
|
16
19
|
sudo mkdir -p /usr/local/bin
|
|
17
20
|
sudo ln -sf /usr/local/lib/${config.dirname}/bin/${config.bin} /usr/local/bin/${config.bin}
|
|
21
|
+
${additionalExecutable ? `sudo ln -sf /usr/local/lib/${config.dirname}/bin/${additionalExecutable} /usr/local/bin/${additionalExecutable}` : ''}
|
|
18
22
|
`,
|
|
19
|
-
uninstall: (config) => {
|
|
23
|
+
uninstall: (config, additionalExecutable) => {
|
|
20
24
|
const packageIdentifier = config.pjson.oclif.macos.identifier;
|
|
21
25
|
return `#!/usr/bin/env bash
|
|
22
26
|
|
|
@@ -57,6 +61,7 @@ done
|
|
|
57
61
|
echo "Application uninstalling process started"
|
|
58
62
|
# remove link to shorcut file
|
|
59
63
|
find "/usr/local/bin/" -name "${config.bin}" | xargs rm
|
|
64
|
+
${additionalExecutable ? `find "/usr/local/bin/" -name "${additionalExecutable}" | xargs rm` : ''}
|
|
60
65
|
if [ $? -eq 0 ]
|
|
61
66
|
then
|
|
62
67
|
echo "[1/3] [DONE] Successfully deleted shortcut links"
|
|
@@ -110,7 +115,7 @@ class PackMacos extends command_1.Command {
|
|
|
110
115
|
const writeScript = async (script) => {
|
|
111
116
|
const path = script === 'uninstall' ? [rootDir, 'bin'] : [scriptsDir];
|
|
112
117
|
path.push(script);
|
|
113
|
-
await qq.write(path, scripts[script](config));
|
|
118
|
+
await qq.write(path, scripts[script](config, flags['additional-executable']));
|
|
114
119
|
await qq.chmod(path, 0o755);
|
|
115
120
|
};
|
|
116
121
|
await writeScript('preinstall');
|
|
@@ -141,4 +146,6 @@ PackMacos.hidden = true;
|
|
|
141
146
|
PackMacos.description = 'pack CLI into macOS .pkg';
|
|
142
147
|
PackMacos.flags = {
|
|
143
148
|
root: command_1.flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
|
|
149
|
+
'additional-executable': command_1.flags.string({ description: `an executable other than the one listed in config.bin that should be made available to the user
|
|
150
|
+
the executable should already exist in the tarball produced by "oclif pack:tarballs"` }),
|
|
144
151
|
};
|
package/lib/commands/pack/win.js
CHANGED
|
@@ -6,20 +6,20 @@ const Tarballs = require("../../tarballs");
|
|
|
6
6
|
const upload_util_1 = require("../../upload-util");
|
|
7
7
|
const scripts = {
|
|
8
8
|
/* eslint-disable no-useless-escape */
|
|
9
|
-
cmd: (config) => `@echo off
|
|
9
|
+
cmd: (config, additionalExecutable = '') => `@echo off
|
|
10
10
|
setlocal enableextensions
|
|
11
11
|
|
|
12
|
-
set ${config.scopedEnvVarKey('BINPATH')}=%~dp0\\${config.bin}.cmd
|
|
13
|
-
if exist "%LOCALAPPDATA%\\${config.dirname}\\client\\bin\\${config.bin}.cmd" (
|
|
14
|
-
"%LOCALAPPDATA%\\${config.dirname}\\client\\bin\\${config.bin}.cmd" %*
|
|
12
|
+
set ${config.scopedEnvVarKey('BINPATH')}=%~dp0\\${additionalExecutable ? additionalExecutable : config.bin}.cmd
|
|
13
|
+
if exist "%LOCALAPPDATA%\\${config.dirname}\\client\\bin\\${additionalExecutable ? additionalExecutable : config.bin}.cmd" (
|
|
14
|
+
"%LOCALAPPDATA%\\${config.dirname}\\client\\bin\\${additionalExecutable ? additionalExecutable : config.bin}.cmd" %*
|
|
15
15
|
) else (
|
|
16
|
-
"%~dp0\\..\\client\\bin\\node.exe" "%~dp0\\..\\client\\bin
|
|
16
|
+
"%~dp0\\..\\client\\bin\\node.exe" "%~dp0\\..\\client\\bin\\${additionalExecutable ? additionalExecutable : 'run'}" %*
|
|
17
17
|
)
|
|
18
18
|
`,
|
|
19
|
-
sh: (config) => `#!/bin/sh
|
|
19
|
+
sh: (config, additionalExecutable = '') => `#!/bin/sh
|
|
20
20
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")
|
|
21
21
|
|
|
22
|
-
"$basedir/../client/bin/${config.bin}.cmd" "$@"
|
|
22
|
+
"$basedir/../client/bin/${additionalExecutable ? additionalExecutable : config.bin}.cmd" "$@"
|
|
23
23
|
ret=$?
|
|
24
24
|
exit $ret
|
|
25
25
|
`,
|
|
@@ -203,6 +203,10 @@ class PackWin extends command_1.Command {
|
|
|
203
203
|
await qq.write([installerBase, `bin/${config.bin}.cmd`], scripts.cmd(config));
|
|
204
204
|
// eslint-disable-next-line no-await-in-loop
|
|
205
205
|
await qq.write([installerBase, `bin/${config.bin}`], scripts.sh(config));
|
|
206
|
+
if (flags['additional-executable']) {
|
|
207
|
+
await qq.write([installerBase, `bin/${flags['additional-executable']}.cmd`], scripts.cmd(config, flags['additional-executable'])); // eslint-disable-line no-await-in-loop
|
|
208
|
+
await qq.write([installerBase, `bin/${flags['additional-executable']}`], scripts.sh(config, flags['additional-executable'])); // eslint-disable-line no-await-in-loop
|
|
209
|
+
}
|
|
206
210
|
// eslint-disable-next-line no-await-in-loop
|
|
207
211
|
await qq.write([installerBase, `${config.bin}.nsi`], scripts.nsis(config, arch));
|
|
208
212
|
// eslint-disable-next-line no-await-in-loop
|
|
@@ -255,4 +259,6 @@ PackWin.hidden = true;
|
|
|
255
259
|
PackWin.description = 'create windows installer from oclif CLI';
|
|
256
260
|
PackWin.flags = {
|
|
257
261
|
root: command_1.flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
|
|
262
|
+
'additional-executable': command_1.flags.string({ description: `an executable other than the one listed in config.bin that should be made available to the user
|
|
263
|
+
the executable should already exist in the tarball produced by "oclif pack:tarballs"` }),
|
|
258
264
|
};
|
package/lib/commands/promote.js
CHANGED
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const command_1 = require("@oclif/command");
|
|
4
4
|
const cli_ux_1 = require("cli-ux");
|
|
5
|
-
const fs = require("fs-extra");
|
|
6
5
|
const path = require("path");
|
|
7
6
|
const aws_1 = require("../aws");
|
|
8
7
|
const Tarballs = require("../tarballs");
|
|
9
8
|
const upload_util_1 = require("../upload-util");
|
|
10
|
-
const
|
|
9
|
+
const version_indexes_1 = require("../version-indexes");
|
|
11
10
|
class Promote extends command_1.Command {
|
|
12
11
|
async run() {
|
|
13
12
|
const { flags } = this.parse(Promote);
|
|
@@ -15,38 +14,10 @@ class Promote extends command_1.Command {
|
|
|
15
14
|
const targets = flags.targets.split(',');
|
|
16
15
|
const buildConfig = await Tarballs.buildConfig(flags.root, { targets });
|
|
17
16
|
const { s3Config, config } = buildConfig;
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
throw new Error('[package.json].oclif.s3.bucket is required for indexes');
|
|
23
|
-
if (!s3Config.host)
|
|
24
|
-
throw new Error('[package.json].oclif.s3.host is required for indexes');
|
|
25
|
-
// json-friendly filenames like sfdx-linux-x64-tar-gz
|
|
26
|
-
const jsonFileName = `${input.filename.replace(/\./g, '-')}.json`;
|
|
27
|
-
const key = path.join(s3Config.folder, 'versions', jsonFileName);
|
|
28
|
-
// retrieve existing index file
|
|
29
|
-
let existing = {};
|
|
30
|
-
try {
|
|
31
|
-
existing = JSON.parse((_a = (await aws_1.default.s3.getObject({
|
|
32
|
-
Bucket: s3Config.bucket,
|
|
33
|
-
Key: key,
|
|
34
|
-
})).Body) === null || _a === void 0 ? void 0 : _a.toString());
|
|
35
|
-
this.log('appending to existing index file');
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
this.error(`error on ${key}`, error);
|
|
39
|
-
}
|
|
40
|
-
// appends new version from this promotion if not already present (idempotent)
|
|
41
|
-
await fs.writeJSON(jsonFileName, util_1.sortVersionsObjectByKeysDesc(Object.assign(Object.assign({}, existing), { [flags.version]: input.originalUrl.replace(s3Config.bucket, s3Config.host) })), { spaces: 2 });
|
|
42
|
-
// put the file back in the same place
|
|
43
|
-
await aws_1.default.s3.uploadFile(jsonFileName, {
|
|
44
|
-
Bucket: s3Config.bucket,
|
|
45
|
-
Key: key,
|
|
46
|
-
CacheControl: maxAge,
|
|
47
|
-
});
|
|
48
|
-
// cleans up local fs
|
|
49
|
-
await fs.remove(jsonFileName);
|
|
17
|
+
const indexDefaults = {
|
|
18
|
+
version: flags.version,
|
|
19
|
+
s3Config,
|
|
20
|
+
maxAge,
|
|
50
21
|
};
|
|
51
22
|
if (!s3Config.bucket)
|
|
52
23
|
this.error('Cannot determine S3 bucket for promotion');
|
|
@@ -96,7 +67,7 @@ class Promote extends command_1.Command {
|
|
|
96
67
|
});
|
|
97
68
|
// eslint-disable-next-line no-await-in-loop
|
|
98
69
|
if (flags.indexes)
|
|
99
|
-
await appendToIndex({ originalUrl: versionedTarGzKey, filename: unversionedTarGzName });
|
|
70
|
+
await version_indexes_1.appendToIndex(Object.assign(Object.assign({}, indexDefaults), { originalUrl: versionedTarGzKey, filename: unversionedTarGzName }));
|
|
100
71
|
if (flags.xz) {
|
|
101
72
|
const versionedTarXzName = upload_util_1.templateShortKey('versioned', '.tar.xz', {
|
|
102
73
|
arch: target.arch,
|
|
@@ -119,7 +90,7 @@ class Promote extends command_1.Command {
|
|
|
119
90
|
});
|
|
120
91
|
// eslint-disable-next-line no-await-in-loop
|
|
121
92
|
if (flags.indexes)
|
|
122
|
-
await appendToIndex({ originalUrl: versionedTarXzKey, filename: unversionedTarXzName });
|
|
93
|
+
await version_indexes_1.appendToIndex(Object.assign(Object.assign({}, indexDefaults), { originalUrl: versionedTarXzKey, filename: unversionedTarXzName }));
|
|
123
94
|
}
|
|
124
95
|
}
|
|
125
96
|
// copy darwin pkg
|
|
@@ -138,7 +109,7 @@ class Promote extends command_1.Command {
|
|
|
138
109
|
MetadataDirective: 'REPLACE',
|
|
139
110
|
});
|
|
140
111
|
if (flags.indexes)
|
|
141
|
-
await appendToIndex({ originalUrl: darwinCopySource, filename: unversionedPkg });
|
|
112
|
+
await version_indexes_1.appendToIndex(Object.assign(Object.assign({}, indexDefaults), { originalUrl: darwinCopySource, filename: unversionedPkg }));
|
|
142
113
|
}
|
|
143
114
|
// copy win exe
|
|
144
115
|
if (flags.win) {
|
|
@@ -159,7 +130,7 @@ class Promote extends command_1.Command {
|
|
|
159
130
|
});
|
|
160
131
|
// eslint-disable-next-line no-await-in-loop
|
|
161
132
|
if (flags.indexes)
|
|
162
|
-
await appendToIndex({ originalUrl: winCopySource, filename: unversionedExe });
|
|
133
|
+
await version_indexes_1.appendToIndex(Object.assign(Object.assign({}, indexDefaults), { originalUrl: winCopySource, filename: unversionedExe }));
|
|
163
134
|
cli_ux_1.cli.action.stop('successfully');
|
|
164
135
|
}
|
|
165
136
|
}
|
|
@@ -16,12 +16,14 @@ 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
|
-
|
|
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)));
|
|
20
21
|
// eslint-disable-next-line no-await-in-loop
|
|
21
22
|
if (!await qq.exists(tarball))
|
|
22
|
-
this.error(`Cannot find a tarball for ${target.platform}-${target.arch}`, {
|
|
23
|
+
this.error(`Cannot find a tarball ${tarball} for ${target.platform}-${target.arch}`, {
|
|
23
24
|
suggestions: [`Run "oclif-dev pack --target ${target.platform}-${target.arch}" before uploading`],
|
|
24
25
|
});
|
|
26
|
+
log_1.log('Found it.');
|
|
25
27
|
}
|
|
26
28
|
const S3Options = {
|
|
27
29
|
Bucket: s3Config.bucket,
|
package/lib/generators/app.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ declare class App extends Generator {
|
|
|
5
5
|
mocha: boolean;
|
|
6
6
|
circleci: boolean;
|
|
7
7
|
appveyor: boolean;
|
|
8
|
-
codecov: boolean;
|
|
9
8
|
typescript: boolean;
|
|
10
9
|
eslint: boolean;
|
|
11
10
|
yarn: boolean;
|
|
@@ -37,14 +36,12 @@ declare class App extends Generator {
|
|
|
37
36
|
ci: {
|
|
38
37
|
circleci: boolean;
|
|
39
38
|
appveyor: boolean;
|
|
40
|
-
codecov: boolean;
|
|
41
39
|
travisci: boolean;
|
|
42
40
|
};
|
|
43
41
|
};
|
|
44
42
|
mocha: boolean;
|
|
45
43
|
circleci: boolean;
|
|
46
44
|
appveyor: boolean;
|
|
47
|
-
codecov: boolean;
|
|
48
45
|
ts: boolean;
|
|
49
46
|
eslint: boolean;
|
|
50
47
|
yarn: boolean;
|
package/lib/generators/app.js
CHANGED
|
@@ -39,7 +39,6 @@ class App extends Generator {
|
|
|
39
39
|
mocha: opts.options.includes('mocha'),
|
|
40
40
|
circleci: opts.options.includes('circleci'),
|
|
41
41
|
appveyor: opts.options.includes('appveyor'),
|
|
42
|
-
codecov: opts.options.includes('codecov'),
|
|
43
42
|
typescript: opts.options.includes('typescript'),
|
|
44
43
|
eslint: opts.options.includes('eslint'),
|
|
45
44
|
yarn: opts.options.includes('yarn') || hasYarn,
|
|
@@ -179,7 +178,6 @@ class App extends Generator {
|
|
|
179
178
|
choices: [
|
|
180
179
|
{ name: 'circleci (continuous integration/delivery service)', value: 'circleci' },
|
|
181
180
|
{ name: 'appveyor (continuous integration/delivery service)', value: 'appveyor' },
|
|
182
|
-
{ name: 'codecov (online code coverage report viewer)', value: 'codecov' },
|
|
183
181
|
{ name: 'travisci (continuous integration/delivery service)', value: 'travisci' },
|
|
184
182
|
],
|
|
185
183
|
filter: ((arr) => _.keyBy(arr)),
|
|
@@ -195,7 +193,6 @@ class App extends Generator {
|
|
|
195
193
|
this.mocha = this.options.mocha;
|
|
196
194
|
this.circleci = this.options.circleci;
|
|
197
195
|
this.appveyor = this.options.appveyor;
|
|
198
|
-
this.codecov = this.options.codecov;
|
|
199
196
|
this.eslint = this.options.eslint;
|
|
200
197
|
this.travisci = this.options.travisci;
|
|
201
198
|
this.pjson.name = this.answers.name || defaults.name;
|
|
@@ -365,9 +362,10 @@ class App extends Generator {
|
|
|
365
362
|
}
|
|
366
363
|
}
|
|
367
364
|
if (this.eslint) {
|
|
368
|
-
devDependencies.push('eslint@^
|
|
365
|
+
devDependencies.push('eslint@^7.3.0', // this should stay in sync with the eslint dependency in this repo's package.json
|
|
366
|
+
'eslint-config-oclif@^3.1');
|
|
369
367
|
if (this.ts) {
|
|
370
|
-
devDependencies.push('eslint-config-oclif-typescript@^0.
|
|
368
|
+
devDependencies.push('eslint-config-oclif-typescript@^0.2.0');
|
|
371
369
|
}
|
|
372
370
|
}
|
|
373
371
|
if (isWindows)
|
package/lib/tarballs/build.js
CHANGED
|
@@ -47,15 +47,11 @@ async function build(c, options = {}) {
|
|
|
47
47
|
};
|
|
48
48
|
const addDependencies = async () => {
|
|
49
49
|
qq.cd(c.workspace());
|
|
50
|
-
const pjson = await qq.readJSON('package.json');
|
|
51
50
|
const yarnRoot = findYarnWorkspaceRoot(c.root) || c.root;
|
|
52
51
|
const yarn = await qq.exists([yarnRoot, 'yarn.lock']);
|
|
53
52
|
if (yarn) {
|
|
54
53
|
await qq.cp([yarnRoot, 'yarn.lock'], '.');
|
|
55
54
|
await qq.x('yarn --no-progress --production --non-interactive');
|
|
56
|
-
if (pjson.scripts.pretarball) {
|
|
57
|
-
await qq.x('yarn run pretarball');
|
|
58
|
-
}
|
|
59
55
|
}
|
|
60
56
|
else {
|
|
61
57
|
let lockpath = qq.join(c.root, 'package-lock.json');
|
|
@@ -64,9 +60,17 @@ async function build(c, options = {}) {
|
|
|
64
60
|
}
|
|
65
61
|
await qq.cp(lockpath, '.');
|
|
66
62
|
await qq.x('npm install --production');
|
|
67
|
-
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const pretarball = async () => {
|
|
66
|
+
qq.cd(c.workspace());
|
|
67
|
+
const pjson = await qq.readJSON('package.json');
|
|
68
|
+
const yarnRoot = findYarnWorkspaceRoot(c.root) || c.root;
|
|
69
|
+
const yarn = await qq.exists([yarnRoot, 'yarn.lock']);
|
|
70
|
+
if (pjson.scripts.pretarball) {
|
|
71
|
+
yarn ?
|
|
72
|
+
await qq.x('yarn run pretarball') :
|
|
68
73
|
await qq.x('npm run pretarball', {});
|
|
69
|
-
}
|
|
70
74
|
}
|
|
71
75
|
};
|
|
72
76
|
const buildTarget = async (target) => {
|
|
@@ -135,6 +139,7 @@ async function build(c, options = {}) {
|
|
|
135
139
|
await updatePJSON();
|
|
136
140
|
await addDependencies();
|
|
137
141
|
await bin_1.writeBinScripts({ config, baseWorkspace: c.workspace(), nodeVersion: c.nodeVersion });
|
|
142
|
+
await pretarball();
|
|
138
143
|
for (const target of c.targets) {
|
|
139
144
|
if (!options.platform || options.platform === target.platform) {
|
|
140
145
|
// eslint-disable-next-line no-await-in-loop
|
package/lib/tarballs/config.d.ts
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const appendToIndex: (input: {
|
|
2
|
+
version: string;
|
|
3
|
+
originalUrl: string;
|
|
4
|
+
filename: string;
|
|
5
|
+
maxAge: string;
|
|
6
|
+
s3Config: import("@oclif/config").PJSON.S3 & {
|
|
7
|
+
folder?: string | undefined;
|
|
8
|
+
indexVersionLimit?: number | undefined;
|
|
9
|
+
};
|
|
10
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const fs = require("fs-extra");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const aws_1 = require("./aws");
|
|
6
|
+
const log_1 = require("./log");
|
|
7
|
+
const debug = log_1.debug.new('version-indexes');
|
|
8
|
+
const sortVersionsObjectByKeysDesc = (input, keyLimit) => {
|
|
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));
|
|
12
|
+
// sort by major
|
|
13
|
+
if (splitA[0] < splitB[0])
|
|
14
|
+
return 1;
|
|
15
|
+
if (splitA[0] > splitB[0])
|
|
16
|
+
return -1;
|
|
17
|
+
// sort by minor
|
|
18
|
+
if (splitA[1] < splitB[1])
|
|
19
|
+
return 1;
|
|
20
|
+
if (splitA[1] > splitB[1])
|
|
21
|
+
return -1;
|
|
22
|
+
// sort by patch
|
|
23
|
+
if (splitA[2] < splitB[2])
|
|
24
|
+
return 1;
|
|
25
|
+
if (splitA[2] > splitB[2])
|
|
26
|
+
return -1;
|
|
27
|
+
return 0;
|
|
28
|
+
}).slice(0, keyLimit); // undefined keyLimit returns the entire array
|
|
29
|
+
const result = {};
|
|
30
|
+
keys.forEach(key => {
|
|
31
|
+
result[key] = input[key];
|
|
32
|
+
});
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
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
|
|
36
|
+
exports.appendToIndex = async (input) => {
|
|
37
|
+
var _a;
|
|
38
|
+
const { version, originalUrl, filename, maxAge, s3Config } = input;
|
|
39
|
+
// these checks are both nice for users AND helpful for TS
|
|
40
|
+
if (!s3Config.bucket)
|
|
41
|
+
throw new Error('[package.json].oclif.s3.bucket is required for indexes');
|
|
42
|
+
if (!s3Config.host)
|
|
43
|
+
throw new Error('[package.json].oclif.s3.host is required for indexes');
|
|
44
|
+
// json-friendly filenames like sfdx-linux-x64-tar-gz
|
|
45
|
+
const jsonFileName = `${filename.replace(/\./g, '-')}.json`;
|
|
46
|
+
const key = path.join(s3Config.folder, 'versions', jsonFileName);
|
|
47
|
+
// retrieve existing index file
|
|
48
|
+
let existing = {};
|
|
49
|
+
try {
|
|
50
|
+
existing = JSON.parse((_a = (await aws_1.default.s3.getObject({
|
|
51
|
+
Bucket: s3Config.bucket,
|
|
52
|
+
Key: key,
|
|
53
|
+
})).Body) === null || _a === void 0 ? void 0 : _a.toString());
|
|
54
|
+
debug('appending to existing index file');
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
debug(`error on ${key}`, error);
|
|
58
|
+
}
|
|
59
|
+
// appends new version from this promotion if not already present (idempotent)
|
|
60
|
+
await fs.writeJSON(jsonFileName, sortVersionsObjectByKeysDesc(Object.assign(Object.assign({}, existing), { [version]: originalUrl.replace(s3Config.bucket, s3Config.host) }), s3Config.indexVersionLimit), { spaces: 2 });
|
|
61
|
+
// put the file back in the same place
|
|
62
|
+
await aws_1.default.s3.uploadFile(jsonFileName, {
|
|
63
|
+
Bucket: s3Config.bucket,
|
|
64
|
+
Key: key,
|
|
65
|
+
CacheControl: maxAge,
|
|
66
|
+
});
|
|
67
|
+
// cleans up local fs
|
|
68
|
+
await fs.remove(jsonFileName);
|
|
69
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oclif",
|
|
3
3
|
"description": "oclif: create your own CLI",
|
|
4
|
-
"version": "1.18.
|
|
4
|
+
"version": "1.18.2-dev.2",
|
|
5
5
|
"author": "Jeff Dickey @jdxcode",
|
|
6
6
|
"bin": {
|
|
7
7
|
"oclif": "bin/run"
|
|
@@ -60,12 +60,13 @@
|
|
|
60
60
|
"npm-run-path": "^4.0.1",
|
|
61
61
|
"nps": "^5.9.3",
|
|
62
62
|
"shelljs": "^0.8.3",
|
|
63
|
+
"shx": "^0.3.3",
|
|
63
64
|
"tmp": "^0.2.1",
|
|
64
65
|
"ts-node": "^9.0.0",
|
|
65
66
|
"typescript": "3.8.3"
|
|
66
67
|
},
|
|
67
68
|
"engines": {
|
|
68
|
-
"node": ">=
|
|
69
|
+
"node": ">=12.0.0"
|
|
69
70
|
},
|
|
70
71
|
"files": [
|
|
71
72
|
".oclif.manifest.json",
|
|
@@ -116,14 +117,14 @@
|
|
|
116
117
|
},
|
|
117
118
|
"repository": "oclif/oclif",
|
|
118
119
|
"scripts": {
|
|
119
|
-
"build": "rm -rf lib && tsc",
|
|
120
|
+
"build": "shx rm -rf lib && tsc",
|
|
120
121
|
"devcli:lint": "eslint . --ext .ts --config .eslintrc",
|
|
121
122
|
"devcli:test": "mocha --forbid-only \"test/*.test.ts\"",
|
|
122
123
|
"devcli": "yarn build --noEmit && yarn run devcli:test && yarn run devcli:lint",
|
|
123
124
|
"lint": "nps lint",
|
|
124
|
-
"postpack": "rm .oclif.manifest.json",
|
|
125
|
+
"postpack": "shx rm .oclif.manifest.json",
|
|
125
126
|
"posttest": "yarn run lint",
|
|
126
|
-
"prepack": "rm -rf lib && tsc && oclif-dev manifest",
|
|
127
|
+
"prepack": "shx rm -rf lib && tsc && oclif-dev manifest",
|
|
127
128
|
"version": "oclif-dev readme && git add README.md",
|
|
128
129
|
"test": "nps test"
|
|
129
130
|
},
|
package/templates/README.md.ejs
CHANGED
|
@@ -11,9 +11,6 @@
|
|
|
11
11
|
<%_ if (appveyor) { _%>
|
|
12
12
|
[](https://ci.appveyor.com/project/<%= repository %>/branch/master)
|
|
13
13
|
<%_ } _%>
|
|
14
|
-
<%_ if (codecov) { _%>
|
|
15
|
-
[](https://codecov.io/gh/<%= repository %>)
|
|
16
|
-
<%_ } _%>
|
|
17
14
|
[](https://npmjs.org/package/<%= pjson.name %>)
|
|
18
15
|
[](https://github.com/<%= repository %>/blob/master/package.json)
|
|
19
16
|
|
|
@@ -24,13 +24,9 @@ test_script:
|
|
|
24
24
|
- .\bin\run --help
|
|
25
25
|
<%_ } _%>
|
|
26
26
|
- <%- yarn ? 'yarn' : 'npm' %> test
|
|
27
|
-
<% if (mocha
|
|
27
|
+
<% if (mocha) { %>
|
|
28
28
|
after_test:
|
|
29
29
|
- .\node_modules\.bin\nyc report --reporter text-lcov > coverage.lcov
|
|
30
|
-
- ps: |
|
|
31
|
-
$env:PATH = 'C:\msys64\usr\bin;' + $env:PATH
|
|
32
|
-
Invoke-WebRequest -Uri 'https://codecov.io/bash' -OutFile codecov.sh
|
|
33
|
-
bash codecov.sh
|
|
34
30
|
<% } %>
|
|
35
31
|
|
|
36
32
|
build: off
|
package/templates/circle.yml.ejs
CHANGED
|
@@ -23,13 +23,6 @@ jobs:
|
|
|
23
23
|
- run:
|
|
24
24
|
name: Testing
|
|
25
25
|
command: <%- yarn ? 'yarn' : 'npm' %> test
|
|
26
|
-
<%_ if (mocha && codecov) { _%>
|
|
27
|
-
- run:
|
|
28
|
-
name: Submitting code coverage to codecov
|
|
29
|
-
command: |
|
|
30
|
-
./node_modules/.bin/nyc report --reporter text-lcov > coverage.lcov
|
|
31
|
-
curl -s https://codecov.io/bash | bash
|
|
32
|
-
<%_ } _%>
|
|
33
26
|
node-12:
|
|
34
27
|
<<: *test
|
|
35
28
|
docker:
|
package/templates/travis.yml.ejs
CHANGED
|
@@ -12,9 +12,3 @@ script:
|
|
|
12
12
|
- ./bin/run --help
|
|
13
13
|
<%_ } _%>
|
|
14
14
|
- <%- yarn ? 'yarn' : 'npm' %> run test
|
|
15
|
-
|
|
16
|
-
<% if(mocha && codecov) { %>
|
|
17
|
-
after_success:
|
|
18
|
-
- ./node_modules/.bin/nyc report --reporter text-lcov > coverage.lcov
|
|
19
|
-
- bash < (curl -s https://codecov.io/bash)
|
|
20
|
-
<% } %>
|