@scalebun/cli 1.10.2 ā 1.12.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.
- package/lib/commands/ci-init.d.ts.map +1 -1
- package/lib/commands/ci-init.js +80 -2
- package/lib/commands/ci-init.js.map +1 -1
- package/lib/commands/doctor.d.ts.map +1 -1
- package/lib/commands/doctor.js +148 -3
- package/lib/commands/doctor.js.map +1 -1
- package/lib/commands/link.d.ts +16 -0
- package/lib/commands/link.d.ts.map +1 -0
- package/lib/commands/link.js +164 -0
- package/lib/commands/link.js.map +1 -0
- package/lib/commands/login.d.ts.map +1 -1
- package/lib/commands/login.js +29 -7
- package/lib/commands/login.js.map +1 -1
- package/lib/commands/ota-bundle.d.ts +15 -2
- package/lib/commands/ota-bundle.d.ts.map +1 -1
- package/lib/commands/ota-bundle.js +142 -12
- package/lib/commands/ota-bundle.js.map +1 -1
- package/lib/commands/ota-channels.d.ts.map +1 -1
- package/lib/commands/ota-channels.js +213 -21
- package/lib/commands/ota-channels.js.map +1 -1
- package/lib/commands/ota-delete-bundle.d.ts.map +1 -1
- package/lib/commands/ota-delete-bundle.js +15 -4
- package/lib/commands/ota-delete-bundle.js.map +1 -1
- package/lib/commands/ota-inspect.d.ts +3 -0
- package/lib/commands/ota-inspect.d.ts.map +1 -0
- package/lib/commands/ota-inspect.js +258 -0
- package/lib/commands/ota-inspect.js.map +1 -0
- package/lib/commands/ota-keys.d.ts +25 -0
- package/lib/commands/ota-keys.d.ts.map +1 -1
- package/lib/commands/ota-keys.js +329 -27
- package/lib/commands/ota-keys.js.map +1 -1
- package/lib/commands/ota-promote.d.ts +3 -0
- package/lib/commands/ota-promote.d.ts.map +1 -0
- package/lib/commands/ota-promote.js +194 -0
- package/lib/commands/ota-promote.js.map +1 -0
- package/lib/commands/ota-publish.d.ts.map +1 -1
- package/lib/commands/ota-publish.js +108 -38
- package/lib/commands/ota-publish.js.map +1 -1
- package/lib/commands/ota-rollout.d.ts.map +1 -1
- package/lib/commands/ota-rollout.js +212 -171
- package/lib/commands/ota-rollout.js.map +1 -1
- package/lib/commands/quickstart.d.ts.map +1 -1
- package/lib/commands/quickstart.js +110 -8
- package/lib/commands/quickstart.js.map +1 -1
- package/lib/commands/shell.d.ts +28 -0
- package/lib/commands/shell.d.ts.map +1 -0
- package/lib/commands/shell.js +512 -0
- package/lib/commands/shell.js.map +1 -0
- package/lib/index.js +140 -4
- package/lib/index.js.map +1 -1
- package/lib/ui/menu.d.ts +109 -0
- package/lib/ui/menu.d.ts.map +1 -0
- package/lib/ui/menu.js +314 -0
- package/lib/ui/menu.js.map +1 -0
- package/lib/utils/bundle.d.ts.map +1 -1
- package/lib/utils/bundle.js +7 -1
- package/lib/utils/bundle.js.map +1 -1
- package/lib/utils/context.d.ts +88 -0
- package/lib/utils/context.d.ts.map +1 -0
- package/lib/utils/context.js +247 -0
- package/lib/utils/context.js.map +1 -0
- package/lib/utils/credentials.d.ts +16 -0
- package/lib/utils/credentials.d.ts.map +1 -1
- package/lib/utils/credentials.js +14 -3
- package/lib/utils/credentials.js.map +1 -1
- package/lib/utils/guide.d.ts +63 -0
- package/lib/utils/guide.d.ts.map +1 -0
- package/lib/utils/guide.js +189 -0
- package/lib/utils/guide.js.map +1 -0
- package/lib/utils/output.d.ts +96 -0
- package/lib/utils/output.d.ts.map +1 -0
- package/lib/utils/output.js +135 -0
- package/lib/utils/output.js.map +1 -0
- package/lib/utils/prompt.d.ts +109 -6
- package/lib/utils/prompt.d.ts.map +1 -1
- package/lib/utils/prompt.js +222 -20
- package/lib/utils/prompt.js.map +1 -1
- package/lib/utils/provenance.d.ts +30 -0
- package/lib/utils/provenance.d.ts.map +1 -0
- package/lib/utils/provenance.js +157 -0
- package/lib/utils/provenance.js.map +1 -0
- package/lib/utils/resolve.d.ts +81 -0
- package/lib/utils/resolve.d.ts.map +1 -0
- package/lib/utils/resolve.js +139 -0
- package/lib/utils/resolve.js.map +1 -0
- package/lib/utils/sdkBin.d.ts +18 -0
- package/lib/utils/sdkBin.d.ts.map +1 -0
- package/lib/utils/sdkBin.js +76 -0
- package/lib/utils/sdkBin.js.map +1 -0
- package/lib/utils/ui.d.ts +10 -1
- package/lib/utils/ui.d.ts.map +1 -1
- package/lib/utils/ui.js +18 -57
- package/lib/utils/ui.js.map +1 -1
- package/lib/utils/validate.d.ts +62 -0
- package/lib/utils/validate.d.ts.map +1 -0
- package/lib/utils/validate.js +189 -0
- package/lib/utils/validate.js.map +1 -0
- package/package.json +3 -2
package/lib/commands/login.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.registerLoginCommand = registerLoginCommand;
|
|
4
7
|
exports.runLogin = runLogin;
|
|
@@ -6,6 +9,8 @@ const credentials_1 = require("../utils/credentials");
|
|
|
6
9
|
const client_1 = require("../api/client");
|
|
7
10
|
const transportSecurity_1 = require("../utils/transportSecurity");
|
|
8
11
|
const prompt_1 = require("../utils/prompt");
|
|
12
|
+
const output_1 = require("../utils/output");
|
|
13
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
14
|
/**
|
|
10
15
|
* `scalebun login` ā store a durable access token for this machine.
|
|
11
16
|
*
|
|
@@ -73,10 +78,22 @@ async function runLogin(opts) {
|
|
|
73
78
|
console.log(`Create one at: ${TOKEN_PAGE}`);
|
|
74
79
|
console.log('(Settings ā Access Tokens ā New token ā scope: read, write)');
|
|
75
80
|
console.log('');
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
81
|
+
// Re-ask rather than exit. A paste that did not land ā the clipboard was
|
|
82
|
+
// empty, or the terminal swallowed it ā is the single most likely reason
|
|
83
|
+
// this prompt comes back blank, and the fix is to paste again, not to
|
|
84
|
+
// re-run the whole command. Three tries, so a non-interactive stdin that
|
|
85
|
+
// returns '' forever cannot spin.
|
|
86
|
+
for (let attempt = 1;; attempt++) {
|
|
87
|
+
token = (await (0, prompt_1.promptHidden)('Access token (scalebun_pat_ā¦): ')).trim();
|
|
88
|
+
if (token)
|
|
89
|
+
break;
|
|
90
|
+
if (attempt >= 3) {
|
|
91
|
+
console.error('ā No token entered.');
|
|
92
|
+
console.error(` Create one at ${TOKEN_PAGE}, or set SCALEBUN_TOKEN.`);
|
|
93
|
+
process.exit(1);
|
|
94
|
+
}
|
|
95
|
+
console.log(' Nothing pasted ā the token is hidden as you type, so a blank line');
|
|
96
|
+
console.log(' usually means the paste did not land. Try again.');
|
|
80
97
|
}
|
|
81
98
|
}
|
|
82
99
|
// Soft format check ā warn, don't reject (the token prefix may evolve).
|
|
@@ -90,9 +107,14 @@ async function runLogin(opts) {
|
|
|
90
107
|
(0, credentials_1.writeCredentials)({ apiUrl, token, email: me.email });
|
|
91
108
|
console.log(`ā
Logged in as ${me.email} (${me.role ?? 'User'})`);
|
|
92
109
|
console.log(' Credentials saved to ~/.scalebun/credentials.json');
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
110
|
+
// `--app-id <id>` was load-bearing here before `link` and the resolver
|
|
111
|
+
// existed. Suggesting a command with a placeholder in it is suggesting
|
|
112
|
+
// homework, not a command ā and `link` is what removes the need for it.
|
|
113
|
+
(0, output_1.printNextSteps)([
|
|
114
|
+
{ label: 'Bind this project', argv: ['link'] },
|
|
115
|
+
{ label: 'Check it is OTA-ready', argv: ['doctor'] },
|
|
116
|
+
{ label: 'Ship your first update', argv: ['ota', 'publish'] },
|
|
117
|
+
], chalk_1.default.cyan);
|
|
96
118
|
}
|
|
97
119
|
catch (err) {
|
|
98
120
|
console.error(`ā Login failed: ${err.message}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version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AC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
/**
|
|
3
|
-
* `scalebun ota bundle` ā package a standalone bundle file for
|
|
3
|
+
* `scalebun ota bundle build` ā package a standalone bundle file for upload.
|
|
4
|
+
*
|
|
5
|
+
* āā Why this is `bundle build` and not `bundle` āāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
6
|
+
*
|
|
7
|
+
* `ota bundles` (plural) lists what is on the server; `ota bundle` (singular)
|
|
8
|
+
* ran Metro and hermesc and wrote a file to disk. Two commands one character
|
|
9
|
+
* apart doing entirely different things is a footgun: reaching for the list
|
|
10
|
+
* and getting a full Hermes compile is a minute of confusion at best, and at
|
|
11
|
+
* worst it happens in a pipeline.
|
|
12
|
+
*
|
|
13
|
+
* Moving the builder under an explicit verb makes bare `ota bundle` print the
|
|
14
|
+
* group's help ā which disambiguates instead of guessing. `bundle` is kept as
|
|
15
|
+
* an alias of the group, so nothing that already worked stops working.
|
|
4
16
|
*
|
|
5
17
|
* Usage:
|
|
6
|
-
* npx scalebun ota bundle --platform android
|
|
18
|
+
* npx scalebun ota bundle build --platform android
|
|
19
|
+
* npx scalebun ota bundle build --platform ios --output ./bundles/my-app.bundle
|
|
7
20
|
*/
|
|
8
21
|
export declare function registerOtaBundleCommand(ota: Command): void;
|
|
9
22
|
//# sourceMappingURL=ota-bundle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ota-bundle.d.ts","sourceRoot":"","sources":["../../src/commands/ota-bundle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ota-bundle.d.ts","sourceRoot":"","sources":["../../src/commands/ota-bundle.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiFpC;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAkH3D"}
|
|
@@ -34,29 +34,117 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.registerOtaBundleCommand = registerOtaBundleCommand;
|
|
37
|
+
const crypto = __importStar(require("crypto"));
|
|
37
38
|
const fs = __importStar(require("fs"));
|
|
38
39
|
const path = __importStar(require("path"));
|
|
39
40
|
const bundle_1 = require("../utils/bundle");
|
|
41
|
+
const validate_1 = require("../utils/validate");
|
|
42
|
+
const ota_keys_1 = require("./ota-keys");
|
|
40
43
|
/**
|
|
41
|
-
*
|
|
44
|
+
* Ensure that the bundles folder and its artifacts are ignored by git.
|
|
45
|
+
*/
|
|
46
|
+
function ensureBundlesGitIgnored(bundleFilePath) {
|
|
47
|
+
const bundleDir = path.dirname(bundleFilePath);
|
|
48
|
+
if (!fs.existsSync(bundleDir)) {
|
|
49
|
+
fs.mkdirSync(bundleDir, { recursive: true });
|
|
50
|
+
}
|
|
51
|
+
let updatedGitignore = false;
|
|
52
|
+
// 1. Inside the bundles directory itself, create a .gitignore so all files are ignored by default
|
|
53
|
+
const baseDirName = path.basename(bundleDir).toLowerCase();
|
|
54
|
+
if (baseDirName === 'bundles' || baseDirName === 'bundels') {
|
|
55
|
+
const localGitignore = path.join(bundleDir, '.gitignore');
|
|
56
|
+
if (!fs.existsSync(localGitignore)) {
|
|
57
|
+
try {
|
|
58
|
+
fs.writeFileSync(localGitignore, '# Ignore all bundle files in this directory\n*\n!.gitignore\n', 'utf8');
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
/* ignore */
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// 2. Also ensure root project .gitignore ignores bundles/
|
|
66
|
+
let curr = process.cwd();
|
|
67
|
+
for (let i = 0; i < 5; i++) {
|
|
68
|
+
const gitignorePath = path.join(curr, '.gitignore');
|
|
69
|
+
const isGitRepo = fs.existsSync(path.join(curr, '.git'));
|
|
70
|
+
if (fs.existsSync(gitignorePath) || isGitRepo) {
|
|
71
|
+
const gitignoreTarget = fs.existsSync(gitignorePath) ? gitignorePath : path.join(curr, '.gitignore');
|
|
72
|
+
let content = '';
|
|
73
|
+
try {
|
|
74
|
+
if (fs.existsSync(gitignoreTarget)) {
|
|
75
|
+
content = fs.readFileSync(gitignoreTarget, 'utf8');
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
content = '';
|
|
80
|
+
}
|
|
81
|
+
// Check if bundles or bundles/ is already ignored
|
|
82
|
+
const lines = content.split(/\r?\n/).map((l) => l.trim());
|
|
83
|
+
const alreadyIgnored = lines.some((l) => l === 'bundles' ||
|
|
84
|
+
l === 'bundles/' ||
|
|
85
|
+
l === '/bundles' ||
|
|
86
|
+
l === '/bundles/' ||
|
|
87
|
+
l === '**/bundles/**' ||
|
|
88
|
+
l === '**/bundles');
|
|
89
|
+
if (!alreadyIgnored) {
|
|
90
|
+
const prefix = content.length > 0 && !content.endsWith('\n') ? '\n' : '';
|
|
91
|
+
const entry = `${prefix}\n# Scalebun OTA bundles\nbundles/\n`;
|
|
92
|
+
try {
|
|
93
|
+
fs.writeFileSync(gitignoreTarget, content + entry, 'utf8');
|
|
94
|
+
updatedGitignore = true;
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
/* ignore */
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
const parent = path.dirname(curr);
|
|
103
|
+
if (parent === curr)
|
|
104
|
+
break;
|
|
105
|
+
curr = parent;
|
|
106
|
+
}
|
|
107
|
+
return updatedGitignore;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* `scalebun ota bundle build` ā package a standalone bundle file for upload.
|
|
111
|
+
*
|
|
112
|
+
* āā Why this is `bundle build` and not `bundle` āāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
113
|
+
*
|
|
114
|
+
* `ota bundles` (plural) lists what is on the server; `ota bundle` (singular)
|
|
115
|
+
* ran Metro and hermesc and wrote a file to disk. Two commands one character
|
|
116
|
+
* apart doing entirely different things is a footgun: reaching for the list
|
|
117
|
+
* and getting a full Hermes compile is a minute of confusion at best, and at
|
|
118
|
+
* worst it happens in a pipeline.
|
|
119
|
+
*
|
|
120
|
+
* Moving the builder under an explicit verb makes bare `ota bundle` print the
|
|
121
|
+
* group's help ā which disambiguates instead of guessing. `bundle` is kept as
|
|
122
|
+
* an alias of the group, so nothing that already worked stops working.
|
|
42
123
|
*
|
|
43
124
|
* Usage:
|
|
44
|
-
* npx scalebun ota bundle --platform android
|
|
125
|
+
* npx scalebun ota bundle build --platform android
|
|
126
|
+
* npx scalebun ota bundle build --platform ios --output ./bundles/my-app.bundle
|
|
45
127
|
*/
|
|
46
128
|
function registerOtaBundleCommand(ota) {
|
|
47
|
-
ota
|
|
129
|
+
const bundle = ota
|
|
48
130
|
.command('bundle')
|
|
131
|
+
.description('Build a bundle file locally (see `ota bundles` to list uploaded ones)');
|
|
132
|
+
bundle
|
|
133
|
+
.command('build', { isDefault: false })
|
|
49
134
|
.description('Build a standalone OTA bundle file for manual upload in the Scalebun Dashboard')
|
|
50
135
|
.option('--platform <platform>', 'Target platform: android | ios', 'android')
|
|
51
136
|
.option('--entry-file <path>', 'JS entry file', 'index.js')
|
|
52
|
-
.option('--output <path>', 'Output bundle destination path
|
|
53
|
-
.option('--
|
|
54
|
-
.option('--hermes
|
|
137
|
+
.option('--output <path>', 'Output bundle destination path (default: ./bundles/index.<platform>.bundle)')
|
|
138
|
+
.option('--key-dir <path>', 'Directory containing ota-signing-key.pem (default: .scalebun)')
|
|
139
|
+
.option('--hermes', 'Compile to Hermes bytecode (the default ā flag kept for compatibility)')
|
|
140
|
+
.option('--hermes-disabled', 'Ship plain JS instead of Hermes bytecode (~20-30% slower cold start)')
|
|
55
141
|
.option('--allow-plain-js', 'Emit uncompiled JS if hermesc fails, instead of aborting')
|
|
56
142
|
.option('--sourcemap', 'Generate sourcemap alongside the bundle')
|
|
57
143
|
.action(async (opts) => {
|
|
58
|
-
const platform = opts.platform
|
|
59
|
-
|
|
144
|
+
const platform = (0, validate_1.checkedEnum)('--platform', opts.platform, ['android', 'ios'], {
|
|
145
|
+
caseInsensitive: true,
|
|
146
|
+
});
|
|
147
|
+
const useHermes = opts.hermesDisabled ? false : true;
|
|
60
148
|
console.log(`š¦ Bundling ${platform} application${useHermes ? ' (Hermes bytecode)' : ''}ā¦`);
|
|
61
149
|
try {
|
|
62
150
|
const result = (0, bundle_1.buildBundle)({
|
|
@@ -67,21 +155,63 @@ function registerOtaBundleCommand(ota) {
|
|
|
67
155
|
allowPlainJs: opts.allowPlainJs ?? false,
|
|
68
156
|
sourcemap: opts.sourcemap,
|
|
69
157
|
});
|
|
70
|
-
|
|
158
|
+
// Resolve destination inside bundles/ by default
|
|
159
|
+
let destPath;
|
|
160
|
+
if (opts.output) {
|
|
161
|
+
const resolved = path.resolve(opts.output);
|
|
162
|
+
if (fs.existsSync(resolved) && fs.statSync(resolved).isDirectory()) {
|
|
163
|
+
destPath = path.join(resolved, `index.${platform}.bundle`);
|
|
164
|
+
}
|
|
165
|
+
else if (opts.output.endsWith('/') || opts.output.endsWith('\\')) {
|
|
166
|
+
destPath = path.join(resolved, `index.${platform}.bundle`);
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
destPath = resolved;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
destPath = path.resolve('bundles', `index.${platform}.bundle`);
|
|
174
|
+
}
|
|
71
175
|
const destDir = path.dirname(destPath);
|
|
72
176
|
if (!fs.existsSync(destDir)) {
|
|
73
177
|
fs.mkdirSync(destDir, { recursive: true });
|
|
74
178
|
}
|
|
179
|
+
// Ensure bundles directory is git-ignored
|
|
180
|
+
const gitignoreUpdated = ensureBundlesGitIgnored(destPath);
|
|
75
181
|
fs.copyFileSync(result.bundlePath, destPath);
|
|
182
|
+
// Compute SHA-256 and sign if private key exists
|
|
183
|
+
const bundleBytes = fs.readFileSync(destPath);
|
|
184
|
+
const sha256 = crypto.createHash('sha256').update(bundleBytes).digest('hex');
|
|
185
|
+
const signature = (0, ota_keys_1.signBundleHash)(sha256, opts.keyDir);
|
|
186
|
+
let sigPath = null;
|
|
187
|
+
if (signature) {
|
|
188
|
+
sigPath = `${destPath}.sig`;
|
|
189
|
+
fs.writeFileSync(sigPath, signature.trim(), 'utf8');
|
|
190
|
+
}
|
|
191
|
+
// If sourcemap was generated, also copy it alongside the bundle in bundles/
|
|
192
|
+
if (opts.sourcemap && result.sourcemapPath && fs.existsSync(result.sourcemapPath)) {
|
|
193
|
+
const mapDest = `${destPath}.map`;
|
|
194
|
+
fs.copyFileSync(result.sourcemapPath, mapDest);
|
|
195
|
+
}
|
|
76
196
|
const stats = fs.statSync(destPath);
|
|
77
197
|
const sizeMb = (stats.size / (1024 * 1024)).toFixed(2);
|
|
78
|
-
console.log(`\n
|
|
198
|
+
console.log(`\nā Bundle successfully created!`);
|
|
79
199
|
console.log(` Output Path: ${destPath}`);
|
|
80
200
|
console.log(` Size: ${sizeMb} MB (${stats.size} bytes)`);
|
|
81
|
-
console.log(
|
|
201
|
+
console.log(` SHA-256: ${sha256}`);
|
|
202
|
+
if (sigPath) {
|
|
203
|
+
console.log(` Signature: ${sigPath} (Signed with local ed25519 key)`);
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
console.log(` Signature: Unsigned (no .scalebun/ota-signing-key.pem found)`);
|
|
207
|
+
}
|
|
208
|
+
if (gitignoreUpdated) {
|
|
209
|
+
console.log(` Git Status: Added 'bundles/' to .gitignore`);
|
|
210
|
+
}
|
|
211
|
+
console.log(`\nš” You can now drag & drop this file into the Scalebun Dashboard at https://dash.scalebun.com/ota/publish`);
|
|
82
212
|
}
|
|
83
213
|
catch (err) {
|
|
84
|
-
console.error(
|
|
214
|
+
console.error(`ā Bundling failed: ${err?.message || err}`);
|
|
85
215
|
process.exit(1);
|
|
86
216
|
}
|
|
87
217
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ota-bundle.js","sourceRoot":"","sources":["../../src/commands/ota-bundle.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"ota-bundle.js","sourceRoot":"","sources":["../../src/commands/ota-bundle.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuGA,4DAkHC;AAzND,+CAAiC;AACjC,uCAAyB;AACzB,2CAA6B;AAE7B,4CAA8C;AAC9C,gDAAgD;AAChD,yCAA4C;AAE5C;;GAEG;AACH,SAAS,uBAAuB,CAAC,cAAsB;IACrD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAC/C,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC9B,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED,IAAI,gBAAgB,GAAG,KAAK,CAAC;IAE7B,kGAAkG;IAClG,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC;IAC3D,IAAI,WAAW,KAAK,SAAS,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC3D,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;QAC1D,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;YACnC,IAAI,CAAC;gBACH,EAAE,CAAC,aAAa,CACd,cAAc,EACd,+DAA+D,EAC/D,MAAM,CACP,CAAC;YACJ,CAAC;YAAC,MAAM,CAAC;gBACP,YAAY;YACd,CAAC;QACH,CAAC;IACH,C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C,CAAC;YAC3D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CACF,CAAC;AACN,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ota-channels.d.ts","sourceRoot":"","sources":["../../src/commands/ota-channels.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"ota-channels.d.ts","sourceRoot":"","sources":["../../src/commands/ota-channels.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsHpC,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CA2M7D"}
|
|
@@ -1,39 +1,231 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.registerOtaChannelsCommand = registerOtaChannelsCommand;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
4
8
|
const credentials_1 = require("../utils/credentials");
|
|
5
9
|
const client_1 = require("../api/client");
|
|
10
|
+
const resolve_1 = require("../utils/resolve");
|
|
11
|
+
const prompt_1 = require("../utils/prompt");
|
|
12
|
+
const output_1 = require("../utils/output");
|
|
13
|
+
async function loadChannels(api, appId) {
|
|
14
|
+
try {
|
|
15
|
+
const res = await api.get(`/saas/apps/${appId}/ota/channels`);
|
|
16
|
+
return Array.isArray(res) ? res : [];
|
|
17
|
+
}
|
|
18
|
+
catch (err) {
|
|
19
|
+
(0, output_1.failFromError)('Could not list channels', err);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Accept a channel by name OR id.
|
|
24
|
+
*
|
|
25
|
+
* Operators think in names ā "production" ā and ids appear nowhere in their
|
|
26
|
+
* workflow. The backend already resolves either for bundle lookups, so the CLI
|
|
27
|
+
* matching only ids would be gratuitously stricter than the API.
|
|
28
|
+
*/
|
|
29
|
+
function findChannel(channels, nameOrId) {
|
|
30
|
+
return (channels.find((c) => c.id === nameOrId) ||
|
|
31
|
+
channels.find((c) => c.name.toLowerCase() === nameOrId.toLowerCase()));
|
|
32
|
+
}
|
|
33
|
+
function client() {
|
|
34
|
+
const creds = (0, credentials_1.readCredentials)();
|
|
35
|
+
if (!creds)
|
|
36
|
+
(0, output_1.fail)('Not signed in.', ['Run `scalebun login` first.'], output_1.ExitCode.Usage);
|
|
37
|
+
return new client_1.ApiClient(creds);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Which environment a new channel belongs to.
|
|
41
|
+
*
|
|
42
|
+
* Order: an explicit --env (by name or id) > the environment an existing
|
|
43
|
+
* channel already uses > the app's only environment. Fails with the real list
|
|
44
|
+
* rather than a bare 400 when none of those resolve, because "environmentId
|
|
45
|
+
* must be a string" tells the operator nothing they can act on.
|
|
46
|
+
*/
|
|
47
|
+
async function resolveEnvironmentId(api, appId, existing, wanted) {
|
|
48
|
+
let environments = [];
|
|
49
|
+
try {
|
|
50
|
+
const paged = await api.get(`/saas/apps/${appId}/ota/channels/paged?page=1&pageSize=1`);
|
|
51
|
+
environments = paged?.environments ?? [];
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
// Listing is a convenience here; the fallbacks below still work.
|
|
55
|
+
}
|
|
56
|
+
if (wanted) {
|
|
57
|
+
const hit = environments.find((e) => e.id === wanted) ||
|
|
58
|
+
environments.find((e) => e.name.toLowerCase() === wanted.toLowerCase());
|
|
59
|
+
if (hit)
|
|
60
|
+
return hit.id;
|
|
61
|
+
(0, output_1.fail)(`No environment "${wanted}" on this app.`, environments.length
|
|
62
|
+
? [`Existing: ${environments.map((e) => e.name).join(', ')}`]
|
|
63
|
+
: ['This app has no environments yet ā create one in the dashboard.'], output_1.ExitCode.Usage);
|
|
64
|
+
}
|
|
65
|
+
const fromChannel = existing.find((c) => c.environmentId)?.environmentId;
|
|
66
|
+
if (fromChannel)
|
|
67
|
+
return fromChannel;
|
|
68
|
+
if (environments.length === 1)
|
|
69
|
+
return environments[0].id;
|
|
70
|
+
if (environments.length > 1) {
|
|
71
|
+
(0, output_1.fail)('This app has several environments ā say which one with --env.', environments.map((e) => ` ${e.name} ${e.id}`), output_1.ExitCode.Usage);
|
|
72
|
+
}
|
|
73
|
+
(0, output_1.fail)('Could not determine which environment this channel belongs to.', ['Pass --env <name>, or create the first channel from the dashboard.'], output_1.ExitCode.Usage);
|
|
74
|
+
}
|
|
6
75
|
function registerOtaChannelsCommand(ota) {
|
|
7
|
-
ota
|
|
76
|
+
const channels = ota
|
|
8
77
|
.command('channels')
|
|
9
|
-
.alias('
|
|
10
|
-
.description('List
|
|
11
|
-
|
|
78
|
+
.alias('channel')
|
|
79
|
+
.description('List, create, rename or remove OTA channels');
|
|
80
|
+
// Bare `ota channels` keeps listing, which is what it has always done.
|
|
81
|
+
channels
|
|
82
|
+
.option('--app-id <id>', 'Scalebun app ID (resolved from scalebun.json when omitted)')
|
|
83
|
+
.option('--json', 'Machine-readable output')
|
|
12
84
|
.action(async (opts) => {
|
|
13
|
-
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
|
|
85
|
+
// A subcommand was given ā commander runs that action, not this one.
|
|
86
|
+
if (channels.args.length && channels.commands.some((c) => c.name() === channels.args[0]))
|
|
87
|
+
return;
|
|
88
|
+
const api = client();
|
|
89
|
+
const appId = await (0, resolve_1.resolveAppId)({ appId: opts.appId, nonInteractive: opts.json });
|
|
90
|
+
const rows = await loadChannels(api, appId);
|
|
91
|
+
(0, output_1.emit)(() => {
|
|
92
|
+
console.log('');
|
|
93
|
+
if (!rows.length) {
|
|
94
|
+
console.log(' No channels yet ā `scalebun ota publish` creates `default` automatically.\n');
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
for (const c of rows) {
|
|
98
|
+
const env = c.environment?.name ? chalk_1.default.dim(` env ${c.environment.name}`) : '';
|
|
99
|
+
console.log(` ${chalk_1.default.bold(c.name.padEnd(16))}${env}`);
|
|
100
|
+
console.log(chalk_1.default.dim(` ${c.id}`));
|
|
101
|
+
}
|
|
102
|
+
// One channel means every bundle ever built goes straight to
|
|
103
|
+
// production with nowhere to test first. Worth saying out loud.
|
|
104
|
+
if (rows.length === 1) {
|
|
105
|
+
console.log(chalk_1.default.yellow(`\n Only one channel. Everything ships straight to ${rows[0].name} ā\n` +
|
|
106
|
+
' `scalebun ota channels create --name staging` gives you somewhere to test.'));
|
|
107
|
+
}
|
|
108
|
+
console.log('');
|
|
109
|
+
}, { ok: true, count: rows.length, channels: rows });
|
|
110
|
+
});
|
|
111
|
+
// āā create āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
112
|
+
channels
|
|
113
|
+
.command('create')
|
|
114
|
+
.description('Create a channel')
|
|
115
|
+
.requiredOption('--name <name>', 'Channel name, e.g. staging')
|
|
116
|
+
.option('--app-id <id>', 'Scalebun app ID (resolved from scalebun.json when omitted)')
|
|
117
|
+
.option('--env <nameOrId>', 'Environment to attach it to')
|
|
118
|
+
.option('--json', 'Machine-readable output')
|
|
119
|
+
.action(async (_raw, cmd) => {
|
|
120
|
+
// optsWithGlobals, not the action's own opts. The PARENT `ota channels`
|
|
121
|
+
// also declares --app-id, and commander gives a flag to the first command
|
|
122
|
+
// that declares it ā so `ota channels create --app-id X` parsed X onto the
|
|
123
|
+
// parent and handed this action an undefined, which then reported
|
|
124
|
+
// "--app-id is required" with the id sitting right there in the command.
|
|
125
|
+
// Only the env var worked, which is a miserable thing to discover.
|
|
126
|
+
const opts = cmd.optsWithGlobals();
|
|
127
|
+
const api = client();
|
|
128
|
+
const appId = await (0, resolve_1.resolveAppId)({ appId: opts.appId, nonInteractive: opts.json });
|
|
129
|
+
const existing = await loadChannels(api, appId);
|
|
130
|
+
if (findChannel(existing, opts.name)) {
|
|
131
|
+
(0, output_1.fail)(`A channel named "${opts.name}" already exists on this app.`, [], output_1.ExitCode.Usage);
|
|
17
132
|
}
|
|
18
|
-
|
|
133
|
+
// environmentId is REQUIRED by the API and this never sent it, so every
|
|
134
|
+
// `channels create` failed with `400 environmentId must be a string` ā
|
|
135
|
+
// the command could not have worked once since it was added.
|
|
136
|
+
//
|
|
137
|
+
// Channels live inside an environment, and an app that already has one
|
|
138
|
+
// channel already has the answer. Reuse it rather than making the user
|
|
139
|
+
// find an id that never appears in their workflow.
|
|
140
|
+
const environmentId = await resolveEnvironmentId(api, appId, existing, opts.env);
|
|
141
|
+
const body = { name: opts.name, environmentId };
|
|
142
|
+
let created;
|
|
19
143
|
try {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
144
|
+
created = await api.post(`/saas/apps/${appId}/ota/channels`, body);
|
|
145
|
+
}
|
|
146
|
+
catch (err) {
|
|
147
|
+
(0, output_1.failFromError)('Could not create the channel', err);
|
|
148
|
+
}
|
|
149
|
+
(0, output_1.emit)(() => {
|
|
150
|
+
console.log(`\nā
Created channel ${chalk_1.default.bold(created.name)}`);
|
|
151
|
+
console.log(chalk_1.default.dim(` ${created.id}`));
|
|
152
|
+
(0, output_1.printNextSteps)([
|
|
153
|
+
{ label: 'Ship to it', argv: ['ota', 'publish', '--channel', created.name] },
|
|
154
|
+
{ label: 'See every channel', argv: ['ota', 'channels'] },
|
|
155
|
+
], chalk_1.default.cyan);
|
|
156
|
+
}, { ok: true, channel: created });
|
|
157
|
+
});
|
|
158
|
+
// āā rename āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
159
|
+
channels
|
|
160
|
+
.command('rename')
|
|
161
|
+
.description('Rename a channel (this route had no client anywhere)')
|
|
162
|
+
.requiredOption('--channel <nameOrId>', 'Channel to rename')
|
|
163
|
+
.requiredOption('--name <newName>', 'New name')
|
|
164
|
+
.option('--app-id <id>', 'Scalebun app ID (resolved from scalebun.json when omitted)')
|
|
165
|
+
.option('--json', 'Machine-readable output')
|
|
166
|
+
.action(async (_raw, cmd) => {
|
|
167
|
+
// Same parent-swallow as `create`: --app-id lands on the parent
|
|
168
|
+
// `ota channels`, so read the merged view.
|
|
169
|
+
const opts = cmd.optsWithGlobals();
|
|
170
|
+
const api = client();
|
|
171
|
+
const appId = await (0, resolve_1.resolveAppId)({ appId: opts.appId, nonInteractive: opts.json });
|
|
172
|
+
const rows = await loadChannels(api, appId);
|
|
173
|
+
const target = findChannel(rows, opts.channel);
|
|
174
|
+
if (!target) {
|
|
175
|
+
(0, output_1.fail)(`No channel "${opts.channel}" on this app.`, rows.map((c) => ` ${c.name} ${c.id}`), output_1.ExitCode.Usage);
|
|
176
|
+
}
|
|
177
|
+
try {
|
|
178
|
+
await api.patch(`/saas/apps/${appId}/ota/channels/${target.id}`, { name: opts.name });
|
|
179
|
+
}
|
|
180
|
+
catch (err) {
|
|
181
|
+
(0, output_1.failFromError)('Could not rename the channel', err);
|
|
182
|
+
}
|
|
183
|
+
(0, output_1.emit)(() => console.log(`\nā
${chalk_1.default.bold(target.name)} ā ${chalk_1.default.bold(opts.name)}\n`), { ok: true, channelId: target.id, from: target.name, to: opts.name });
|
|
184
|
+
});
|
|
185
|
+
// āā remove āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
186
|
+
channels
|
|
187
|
+
.command('rm')
|
|
188
|
+
.alias('delete')
|
|
189
|
+
.description('Delete a channel ā cascades to its bundles and releases')
|
|
190
|
+
.requiredOption('--channel <nameOrId>', 'Channel to delete')
|
|
191
|
+
.option('--app-id <id>', 'Scalebun app ID (resolved from scalebun.json when omitted)')
|
|
192
|
+
.option('--yes', 'Skip the confirmation (required off a TTY)')
|
|
193
|
+
.option('--json', 'Machine-readable output')
|
|
194
|
+
.action(async (_raw, cmd) => {
|
|
195
|
+
// Same parent-swallow as `create`: --app-id lands on the parent
|
|
196
|
+
// `ota channels`, so read the merged view.
|
|
197
|
+
const opts = cmd.optsWithGlobals();
|
|
198
|
+
const api = client();
|
|
199
|
+
const appId = await (0, resolve_1.resolveAppId)({ appId: opts.appId, nonInteractive: opts.json });
|
|
200
|
+
const rows = await loadChannels(api, appId);
|
|
201
|
+
const target = findChannel(rows, opts.channel);
|
|
202
|
+
if (!target) {
|
|
203
|
+
(0, output_1.fail)(`No channel "${opts.channel}" on this app.`, rows.map((c) => ` ${c.name} ${c.id}`), output_1.ExitCode.Usage);
|
|
204
|
+
}
|
|
205
|
+
// This destroys the channel's bundles and releases. Confirming by name
|
|
206
|
+
// rather than y/n is the same bar delete-bundle sets for one bundle.
|
|
207
|
+
if (!opts.yes) {
|
|
208
|
+
if ((0, resolve_1.isNonInteractive)({ nonInteractive: opts.json })) {
|
|
209
|
+
(0, output_1.fail)('Refusing to delete a channel without confirmation.', ['Pass --yes if this is intentional.'], output_1.ExitCode.Usage);
|
|
30
210
|
}
|
|
31
211
|
console.log('');
|
|
212
|
+
console.log(chalk_1.default.yellow(`ā ļø Deleting ${chalk_1.default.bold(target.name)} also deletes every bundle and release on it.`));
|
|
213
|
+
const ok = await (0, prompt_1.confirmPhrase)(' Type the channel name to confirm: ', target.name);
|
|
214
|
+
(0, prompt_1.closePrompts)();
|
|
215
|
+
if (!ok) {
|
|
216
|
+
console.log('Cancelled ā nothing was deleted.');
|
|
217
|
+
process.exit(output_1.ExitCode.Ok);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
try {
|
|
221
|
+
await api.delete(`/saas/apps/${appId}/ota/channels/${target.id}`);
|
|
32
222
|
}
|
|
33
223
|
catch (err) {
|
|
34
|
-
|
|
35
|
-
|
|
224
|
+
(0, output_1.failFromError)('Could not delete the channel', err, [
|
|
225
|
+
'Deleting a channel requires an owner or admin role.',
|
|
226
|
+
]);
|
|
36
227
|
}
|
|
228
|
+
(0, output_1.emit)(() => console.log(`\nš Deleted channel ${chalk_1.default.bold(target.name)}\n`), { ok: true, channelId: target.id, name: target.name });
|
|
37
229
|
});
|
|
38
230
|
}
|
|
39
231
|
//# sourceMappingURL=ota-channels.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ota-channels.js","sourceRoot":"","sources":["../../src/commands/ota-channels.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ota-channels.js","sourceRoot":"","sources":["../../src/commands/ota-channels.ts"],"names":[],"mappings":";;;;;AAsHA,gEA2MC;AAhUD,kDAA0B;AAC1B,sDAAuD;AACvD,0CAA0C;AAC1C,8CAAkE;AAClE,4CAA8D;AAC9D,4CAAsF;AA4BtF,KAAK,UAAU,YAAY,CAAC,GAAc,EAAE,KAAa;IACvD,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,GAAG,CAAgB,cAAc,KAAK,eAAe,CAAC,CAAC;QAC7E,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IACvC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAA,sBAAa,EAAC,yBAAyB,EAAE,GAAG,CAAC,CAAC;IAChD,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,SAAS,WAAW,CAAC,QAAuB,EAAE,QAAgB;IAC5D,OAAO,CACL,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC;QACvC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,QAAQ,CAAC,WAAW,EAAE,CAAC,CACtE,CAAC;AACJ,CAAC;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AAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ota-delete-bundle.d.ts","sourceRoot":"","sources":["../../src/commands/ota-delete-bundle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"ota-delete-bundle.d.ts","sourceRoot":"","sources":["../../src/commands/ota-delete-bundle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC;;;;;;;GAOG;AACH,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAyDjE"}
|