@capawesome/cli 1.6.1 → 1.6.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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
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.2](https://github.com/capawesome-team/cli/compare/v1.6.1...v1.6.2) (2025-03-18)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * invalid hrefs were created for the artifact type `manifest` if path starts with `./` ([5d3f629](https://github.com/capawesome-team/cli/commit/5d3f6299fbfde98705589e1518af654dba7e234f))
11
+
5
12
  ## [1.6.1](https://github.com/capawesome-team/cli/compare/v1.6.0...v1.6.1) (2025-03-16)
6
13
 
7
14
 
@@ -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
  });
@@ -45,7 +45,18 @@ const getFilesInDirectoryAndSubdirectories = (path) => __awaiter(void 0, void 0,
45
45
  yield walk(fullPath);
46
46
  }
47
47
  else {
48
+ let pathToReplace = path;
49
+ // Remove the leading './' from the path
50
+ if (pathToReplace.startsWith('./')) {
51
+ pathToReplace = pathToReplace.replace('./', '');
52
+ }
53
+ let href = fullPath.replace(pathToReplace, '');
54
+ // Remove the leading '/' from the href
55
+ if (href.startsWith('/')) {
56
+ href = href.replace('/', '');
57
+ }
48
58
  files.push({
59
+ href,
49
60
  name: dirEntry.name,
50
61
  path: fullPath,
51
62
  });
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capawesome/cli",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "The Capawesome Cloud Command Line Interface (CLI) to manage Live Updates and more.",
5
5
  "scripts": {
6
6
  "build": "patch-package && rimraf ./dist && tsc",