@capawesome/cli 1.6.1 → 1.6.3
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 +14 -0
- package/dist/commands/apps/bundles/create.js +21 -13
- package/dist/utils/file.js +13 -0
- package/dist/utils/manifest.js +1 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
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.3](https://github.com/capawesome-team/cli/compare/v1.6.2...v1.6.3) (2025-03-20)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **apps:bundles:create:** handle backslashes on WIndows ([8754f93](https://github.com/capawesome-team/cli/commit/8754f9306e25ff466ec14ba817781f5cad2b4634))
|
|
11
|
+
|
|
12
|
+
## [1.6.2](https://github.com/capawesome-team/cli/compare/v1.6.1...v1.6.2) (2025-03-18)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* invalid hrefs were created for the artifact type `manifest` if path starts with `./` ([5d3f629](https://github.com/capawesome-team/cli/commit/5d3f6299fbfde98705589e1518af654dba7e234f))
|
|
18
|
+
|
|
5
19
|
## [1.6.1](https://github.com/capawesome-team/cli/compare/v1.6.0...v1.6.1) (2025-03-16)
|
|
6
20
|
|
|
7
21
|
|
|
@@ -152,9 +152,27 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
152
152
|
process.exit(1);
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
+
if (path) {
|
|
156
|
+
// Check if the path exists when a path is provided
|
|
157
|
+
const pathExists = yield (0, file_1.fileExistsAtPath)(path);
|
|
158
|
+
if (!pathExists) {
|
|
159
|
+
consola_1.default.error(`The path does not exist.`);
|
|
160
|
+
process.exit(1);
|
|
161
|
+
}
|
|
162
|
+
// Check if the directory contains an index.html file
|
|
163
|
+
const pathIsDirectory = yield (0, file_1.isDirectory)(path);
|
|
164
|
+
if (pathIsDirectory) {
|
|
165
|
+
const files = yield (0, file_1.getFilesInDirectoryAndSubdirectories)(path);
|
|
166
|
+
const indexHtml = files.find((file) => file.href === 'index.html');
|
|
167
|
+
if (!indexHtml) {
|
|
168
|
+
consola_1.default.error('The directory must contain an `index.html` file.');
|
|
169
|
+
process.exit(1);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
155
173
|
// Check that the path is a directory when creating a bundle with an artifact type
|
|
156
174
|
if (artifactType === 'manifest' && path) {
|
|
157
|
-
const pathIsDirectory = (0, file_1.isDirectory)(path);
|
|
175
|
+
const pathIsDirectory = yield (0, file_1.isDirectory)(path);
|
|
158
176
|
if (!pathIsDirectory) {
|
|
159
177
|
consola_1.default.error('The path must be a folder when creating a bundle with an artifact type of `manifest`.');
|
|
160
178
|
process.exit(1);
|
|
@@ -165,14 +183,6 @@ exports.default = (0, citty_1.defineCommand)({
|
|
|
165
183
|
consola_1.default.error('It is not yet possible to provide a URL when creating a bundle with an artifact type of `manifest`.');
|
|
166
184
|
process.exit(1);
|
|
167
185
|
}
|
|
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
186
|
// Let the user select an app and channel if not provided
|
|
177
187
|
if (!appId) {
|
|
178
188
|
const apps = yield apps_1.default.findAll();
|
|
@@ -340,14 +350,12 @@ const uploadFiles = (options) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
340
350
|
fileIndex++;
|
|
341
351
|
consola_1.default.start(`Uploading file (${fileIndex}/${files.length})...`);
|
|
342
352
|
const fileBuffer = yield (0, buffer_1.createBufferFromPath)(file.path);
|
|
343
|
-
const fileName = file.name;
|
|
344
|
-
const href = file.path.replace(options.path + '/', '');
|
|
345
353
|
yield uploadFile({
|
|
346
354
|
appId: options.appId,
|
|
347
355
|
appBundleId: options.appBundleId,
|
|
348
356
|
fileBuffer,
|
|
349
|
-
fileName,
|
|
350
|
-
href,
|
|
357
|
+
fileName: file.name,
|
|
358
|
+
href: file.href,
|
|
351
359
|
privateKeyBuffer: options.privateKeyBuffer,
|
|
352
360
|
retryOnFailure: true,
|
|
353
361
|
});
|
package/dist/utils/file.js
CHANGED
|
@@ -45,7 +45,20 @@ const getFilesInDirectoryAndSubdirectories = (path) => __awaiter(void 0, void 0,
|
|
|
45
45
|
yield walk(fullPath);
|
|
46
46
|
}
|
|
47
47
|
else {
|
|
48
|
+
let pathToReplace = pathModule.normalize(path);
|
|
49
|
+
// Remove the leading './' from the path
|
|
50
|
+
if (pathToReplace.startsWith('./')) {
|
|
51
|
+
pathToReplace = pathToReplace.replace('./', '');
|
|
52
|
+
}
|
|
53
|
+
let href = fullPath.replace(pathToReplace, '');
|
|
54
|
+
// Replace the backslashes with forward slashes (Windows only)
|
|
55
|
+
href = href.replace(/\\/g, '/');
|
|
56
|
+
// Remove the leading '/' from the href
|
|
57
|
+
if (href.startsWith('/')) {
|
|
58
|
+
href = href.replace('/', '');
|
|
59
|
+
}
|
|
48
60
|
files.push({
|
|
61
|
+
href,
|
|
49
62
|
name: dirEntry.name,
|
|
50
63
|
path: fullPath,
|
|
51
64
|
});
|
package/dist/utils/manifest.js
CHANGED
|
@@ -24,14 +24,13 @@ const generateManifestJson = (path) => __awaiter(void 0, void 0, void 0, functio
|
|
|
24
24
|
const fileBuffer = yield (0, buffer_1.createBufferFromPath)(file.path);
|
|
25
25
|
const checksum = yield (0, hash_1.createHash)(fileBuffer);
|
|
26
26
|
const sizeInBytes = fileBuffer.byteLength;
|
|
27
|
-
const href = file.path.replace(path + '/', '');
|
|
28
27
|
// Skip ignored files
|
|
29
28
|
if (ignoreFiles.includes(file.name)) {
|
|
30
29
|
continue;
|
|
31
30
|
}
|
|
32
31
|
manifestItems.push({
|
|
33
32
|
checksum,
|
|
34
|
-
href,
|
|
33
|
+
href: file.href,
|
|
35
34
|
sizeInBytes,
|
|
36
35
|
});
|
|
37
36
|
}
|
package/package.json
CHANGED