@capawesome/cli 1.4.1 → 1.6.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/CHANGELOG.md +19 -0
- package/dist/commands/apps/bundles/create.js +61 -13
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [1.6.0](https://github.com/capawesome-team/cli/compare/v1.5.0...v1.6.0) (2025-03-03)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* add git integration ([#34](https://github.com/capawesome-team/cli/issues/34)) ([7ca323a](https://github.com/capawesome-team/cli/commit/7ca323a030e9c70866c2cf1c34c69ef9dc0129e0))
|
|
11
|
+
|
|
12
|
+
## [1.5.0](https://github.com/capawesome-team/cli/compare/v1.4.1...v1.5.0) (2025-02-21)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **apps:bundles:create:** support code signing for self-hosted bundles ([ebc84ec](https://github.com/capawesome-team/cli/commit/ebc84ecdf3006e9b68491d3082991d0bcf8f9423))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **apps:bundles:create:** provide a url without path to support self-hosted bundles ([1dcf020](https://github.com/capawesome-team/cli/commit/1dcf020ff006445e3ff211ed66a1cec1afdd012d))
|
|
23
|
+
|
|
5
24
|
## [1.4.1](https://github.com/capawesome-team/cli/compare/v1.4.0...v1.4.1) (2025-02-16)
|
|
6
25
|
|
|
7
26
|
|
|
@@ -52,6 +52,18 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
52
52
|
type: 'string',
|
|
53
53
|
description: 'Channel to associate the bundle with.',
|
|
54
54
|
},
|
|
55
|
+
commitMessage: {
|
|
56
|
+
type: 'string',
|
|
57
|
+
description: 'The commit message related to the bundle.',
|
|
58
|
+
},
|
|
59
|
+
commitRef: {
|
|
60
|
+
type: 'string',
|
|
61
|
+
description: 'The commit ref related to the bundle.',
|
|
62
|
+
},
|
|
63
|
+
commitSha: {
|
|
64
|
+
type: 'string',
|
|
65
|
+
description: 'The commit sha related to the bundle.',
|
|
66
|
+
},
|
|
55
67
|
customProperty: {
|
|
56
68
|
type: 'string',
|
|
57
69
|
description: 'A custom property to assign to the bundle. Must be in the format `key=value`. Can be specified multiple times.',
|
|
@@ -105,6 +117,9 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
105
117
|
let privateKey = ctx.args.privateKey;
|
|
106
118
|
let rolloutAsString = ctx.args.rollout === undefined ? undefined : ctx.args.rollout + ''; // Convert to string
|
|
107
119
|
let url = ctx.args.url;
|
|
120
|
+
let commitMessage = ctx.args.commitMessage;
|
|
121
|
+
let commitRef = ctx.args.commitRef;
|
|
122
|
+
let commitSha = ctx.args.commitSha;
|
|
108
123
|
// Validate the expiration days
|
|
109
124
|
let expiresAt;
|
|
110
125
|
if (expiresInDays) {
|
|
@@ -127,6 +142,7 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
127
142
|
}
|
|
128
143
|
rolloutPercentage = rolloutAsNumber;
|
|
129
144
|
}
|
|
145
|
+
// Check that either a path or a url is provided
|
|
130
146
|
if (!path && !url) {
|
|
131
147
|
path = yield (0, prompt_1.prompt)('Enter the path to the app bundle:', {
|
|
132
148
|
type: 'text',
|
|
@@ -136,6 +152,7 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
136
152
|
process.exit(1);
|
|
137
153
|
}
|
|
138
154
|
}
|
|
155
|
+
// Check that the path is a directory when creating a bundle with an artifact type
|
|
139
156
|
if (artifactType === 'manifest' && path) {
|
|
140
157
|
const pathIsDirectory = (0, file_1.isDirectory)(path);
|
|
141
158
|
if (!pathIsDirectory) {
|
|
@@ -143,12 +160,20 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
143
160
|
process.exit(1);
|
|
144
161
|
}
|
|
145
162
|
}
|
|
146
|
-
// Check
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
consola_1.default.error(`The path does not exist.`);
|
|
163
|
+
// Check that a URL is not provided when creating a bundle with an artifact type of manifest
|
|
164
|
+
if (artifactType === 'manifest' && url) {
|
|
165
|
+
consola_1.default.error('It is not yet possible to provide a URL when creating a bundle with an artifact type of `manifest`.');
|
|
150
166
|
process.exit(1);
|
|
151
167
|
}
|
|
168
|
+
// Check if the path exists when a path is provided
|
|
169
|
+
if (path) {
|
|
170
|
+
const pathExists = yield (0, file_1.fileExistsAtPath)(path);
|
|
171
|
+
if (!pathExists) {
|
|
172
|
+
consola_1.default.error(`The path does not exist.`);
|
|
173
|
+
process.exit(1);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
// Let the user select an app and channel if not provided
|
|
152
177
|
if (!appId) {
|
|
153
178
|
const apps = yield apps_1.default.findAll();
|
|
154
179
|
if (apps.length === 0) {
|
|
@@ -180,6 +205,7 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
180
205
|
}
|
|
181
206
|
}
|
|
182
207
|
}
|
|
208
|
+
// Create the private key buffer
|
|
183
209
|
let privateKeyBuffer;
|
|
184
210
|
if (privateKey) {
|
|
185
211
|
if (privateKey.endsWith('.pem')) {
|
|
@@ -201,10 +227,25 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
201
227
|
try {
|
|
202
228
|
// Create the app bundle
|
|
203
229
|
consola_1.default.start('Creating bundle...');
|
|
230
|
+
let checksum;
|
|
231
|
+
let signature;
|
|
232
|
+
if (path && url) {
|
|
233
|
+
const fileBuffer = yield (0, buffer_1.createBufferFromPath)(path);
|
|
234
|
+
// Generate checksum
|
|
235
|
+
checksum = yield (0, hash_1.createHash)(fileBuffer);
|
|
236
|
+
// Sign the bundle
|
|
237
|
+
if (privateKeyBuffer) {
|
|
238
|
+
signature = yield (0, signature_1.createSignature)(privateKeyBuffer, fileBuffer);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
204
241
|
const response = yield app_bundles_1.default.create({
|
|
205
242
|
appId,
|
|
206
243
|
artifactType,
|
|
207
244
|
channelName,
|
|
245
|
+
checksum,
|
|
246
|
+
gitCommitMessage: commitMessage,
|
|
247
|
+
gitCommitRef: commitRef,
|
|
248
|
+
gitCommitSha: commitSha,
|
|
208
249
|
customProperties: parseCustomProperties(customProperty),
|
|
209
250
|
expiresAt: expiresAt,
|
|
210
251
|
url,
|
|
@@ -213,21 +254,28 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
213
254
|
minAndroidAppVersionCode: androidMin,
|
|
214
255
|
minIosAppVersionCode: iosMin,
|
|
215
256
|
rolloutPercentage,
|
|
257
|
+
signature,
|
|
216
258
|
});
|
|
217
259
|
appBundleId = response.id;
|
|
218
260
|
if (path) {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
yield uploadFiles({ appId, appBundleId: response.id, path, privateKeyBuffer });
|
|
261
|
+
if (url) {
|
|
262
|
+
// Important: Do NOT upload files if the URL is provided.
|
|
263
|
+
// The user wants to self-host the bundle. The path is only needed for code signing.
|
|
223
264
|
}
|
|
224
265
|
else {
|
|
225
|
-
|
|
226
|
-
|
|
266
|
+
let appBundleFileId;
|
|
267
|
+
// Upload the app bundle files
|
|
268
|
+
if (artifactType === 'manifest') {
|
|
269
|
+
yield uploadFiles({ appId, appBundleId: response.id, path, privateKeyBuffer });
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
const result = yield uploadZip({ appId, appBundleId: response.id, path, privateKeyBuffer });
|
|
273
|
+
appBundleFileId = result.appBundleFileId;
|
|
274
|
+
}
|
|
275
|
+
// Update the app bundle
|
|
276
|
+
consola_1.default.start('Updating bundle...');
|
|
277
|
+
yield app_bundles_1.default.update({ appBundleFileId, appId, artifactStatus: 'ready', appBundleId: response.id });
|
|
227
278
|
}
|
|
228
|
-
// Update the app bundle
|
|
229
|
-
consola_1.default.start('Updating bundle...');
|
|
230
|
-
yield app_bundles_1.default.update({ appBundleFileId, appId, artifactStatus: 'ready', appBundleId: response.id });
|
|
231
279
|
}
|
|
232
280
|
consola_1.default.success('Bundle successfully created.');
|
|
233
281
|
consola_1.default.info(`Bundle ID: ${response.id}`);
|
package/package.json
CHANGED