@capawesome/cli 3.7.0-dev.3ddf02d.1764834835 → 3.7.0-dev.9668558.1764835928
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.
|
@@ -5,7 +5,7 @@ import appsService from '../../../services/apps.js';
|
|
|
5
5
|
import authorizationService from '../../../services/authorization-service.js';
|
|
6
6
|
import organizationsService from '../../../services/organizations.js';
|
|
7
7
|
import { createBufferFromPath, createBufferFromReadStream, createBufferFromString, isPrivateKeyContent, } from '../../../utils/buffer.js';
|
|
8
|
-
import { findCapacitorConfigPath,
|
|
8
|
+
import { findCapacitorConfigPath, getCapawesomeCloudAppIdFromConfig, getWebDirFromConfig, } from '../../../utils/capacitor-config.js';
|
|
9
9
|
import { fileExistsAtPath, getFilesInDirectoryAndSubdirectories, isDirectory } from '../../../utils/file.js';
|
|
10
10
|
import { createHash } from '../../../utils/hash.js';
|
|
11
11
|
import { generateManifestJson } from '../../../utils/manifest.js';
|
|
@@ -18,6 +18,7 @@ import { defineCommand, defineOptions } from '@robingenz/zli';
|
|
|
18
18
|
import { exec } from 'child_process';
|
|
19
19
|
import consola from 'consola';
|
|
20
20
|
import { createReadStream } from 'fs';
|
|
21
|
+
import pathModule from 'path';
|
|
21
22
|
import { hasTTY } from 'std-env';
|
|
22
23
|
import { promisify } from 'util';
|
|
23
24
|
import { z } from 'zod';
|
|
@@ -120,16 +121,18 @@ export default defineCommand({
|
|
|
120
121
|
// Try to auto-detect webDir from Capacitor config
|
|
121
122
|
const capacitorConfigPath = await findCapacitorConfigPath();
|
|
122
123
|
if (capacitorConfigPath) {
|
|
123
|
-
const
|
|
124
|
-
if (
|
|
125
|
-
|
|
124
|
+
const webDirPath = await getWebDirFromConfig(capacitorConfigPath);
|
|
125
|
+
if (webDirPath) {
|
|
126
|
+
const relativeWebDirPath = pathModule.relative(process.cwd(), webDirPath);
|
|
127
|
+
consola.success(`Auto-detected web asset directory "${relativeWebDirPath}" from Capacitor config.`);
|
|
128
|
+
path = webDirPath;
|
|
126
129
|
}
|
|
127
130
|
else {
|
|
128
|
-
consola.warn('No
|
|
131
|
+
consola.warn('No web asset directory found in Capacitor config (`webDir`).');
|
|
129
132
|
}
|
|
130
133
|
}
|
|
131
134
|
else {
|
|
132
|
-
consola.warn('No Capacitor config found to auto-detect
|
|
135
|
+
consola.warn('No Capacitor config found to auto-detect web asset directory.');
|
|
133
136
|
}
|
|
134
137
|
// If still no path, prompt the user
|
|
135
138
|
if (!path) {
|
|
@@ -160,7 +163,7 @@ export default defineCommand({
|
|
|
160
163
|
consola.warn('No build script found in package.json.');
|
|
161
164
|
}
|
|
162
165
|
else if (hasTTY) {
|
|
163
|
-
const shouldBuild = await prompt('Do you want to rebuild your web assets before
|
|
166
|
+
const shouldBuild = await prompt('Do you want to rebuild your web assets before proceeding?', {
|
|
164
167
|
type: 'select',
|
|
165
168
|
options: ['Yes', 'No'],
|
|
166
169
|
});
|
|
@@ -233,16 +236,17 @@ export default defineCommand({
|
|
|
233
236
|
// Try to auto-detect appId from Capacitor config
|
|
234
237
|
const capacitorConfigPath = await findCapacitorConfigPath();
|
|
235
238
|
if (capacitorConfigPath) {
|
|
236
|
-
const configAppId = await
|
|
239
|
+
const configAppId = await getCapawesomeCloudAppIdFromConfig(capacitorConfigPath);
|
|
237
240
|
if (configAppId) {
|
|
241
|
+
consola.success(`Auto-detected Capawesome Cloud app ID "${configAppId}" from Capacitor config.`);
|
|
238
242
|
appId = configAppId;
|
|
239
243
|
}
|
|
240
244
|
else {
|
|
241
|
-
consola.warn('No
|
|
245
|
+
consola.warn('No Capawesome Cloud app ID found in Capacitor config (`plugins.LiveUpdate.appId`).');
|
|
242
246
|
}
|
|
243
247
|
}
|
|
244
248
|
else {
|
|
245
|
-
consola.warn('No Capacitor config found to auto-detect
|
|
249
|
+
consola.warn('No Capacitor config found to auto-detect Capawesome Cloud app ID.');
|
|
246
250
|
}
|
|
247
251
|
// If still no appId, prompt the user
|
|
248
252
|
if (!appId) {
|
|
@@ -329,7 +333,8 @@ export default defineCommand({
|
|
|
329
333
|
const appName = app.name;
|
|
330
334
|
// Final confirmation before creating bundle
|
|
331
335
|
if (path && hasTTY) {
|
|
332
|
-
const
|
|
336
|
+
const relativePath = pathModule.relative(process.cwd(), path);
|
|
337
|
+
const confirmed = await prompt(`Are you sure you want to create a bundle from path "${relativePath}" for app "${appName}" (${appId})?`, {
|
|
333
338
|
type: 'confirm',
|
|
334
339
|
});
|
|
335
340
|
if (confirmed) {
|
|
@@ -78,7 +78,7 @@ export const getWebDirFromConfig = async (configPath) => {
|
|
|
78
78
|
* @param configPath The path to the config file.
|
|
79
79
|
* @returns The appId, or undefined if not found.
|
|
80
80
|
*/
|
|
81
|
-
export const
|
|
81
|
+
export const getCapawesomeCloudAppIdFromConfig = async (configPath) => {
|
|
82
82
|
const config = await readCapacitorConfig(configPath);
|
|
83
83
|
return config?.plugins?.LiveUpdate?.appId;
|
|
84
84
|
};
|
package/package.json
CHANGED