@capacitor/cli 6.1.3-nightly-20241011T150501.0 → 6.2.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/assets/android-template.tar.gz +0 -0
- package/assets/capacitor-cordova-android-plugins.tar.gz +0 -0
- package/assets/capacitor-cordova-ios-plugins.tar.gz +0 -0
- package/assets/ios-pods-template.tar.gz +0 -0
- package/assets/ios-spm-template.tar.gz +0 -0
- package/dist/android/build.js +3 -1
- package/dist/android/common.js +5 -2
- package/dist/android/doctor.js +11 -7
- package/dist/android/run.js +1 -1
- package/dist/android/update.js +18 -13
- package/dist/common.js +25 -25
- package/dist/config.js +16 -4
- package/dist/cordova.js +63 -31
- package/dist/declarations.d.ts +24 -0
- package/dist/framework-configs.js +14 -14
- package/dist/index.js +14 -14
- package/dist/ios/common.js +8 -3
- package/dist/ios/doctor.js +5 -1
- package/dist/ios/run.js +4 -2
- package/dist/ios/update.js +35 -22
- package/dist/ipc.js +2 -2
- package/dist/log.js +3 -1
- package/dist/plugin.js +8 -4
- package/dist/tasks/add.js +9 -2
- package/dist/tasks/build.js +9 -4
- package/dist/tasks/config.js +4 -1
- package/dist/tasks/copy.js +13 -6
- package/dist/tasks/create.js +2 -1
- package/dist/tasks/doctor.js +7 -2
- package/dist/tasks/init.js +11 -10
- package/dist/tasks/list.js +4 -4
- package/dist/tasks/migrate.js +37 -13
- package/dist/tasks/new-plugin.js +2 -1
- package/dist/tasks/open.js +1 -1
- package/dist/tasks/run.js +6 -5
- package/dist/tasks/sourcemaps.js +3 -2
- package/dist/tasks/sync.js +6 -2
- package/dist/tasks/update.js +1 -1
- package/dist/util/fs.js +1 -1
- package/dist/util/iosplugin.js +3 -2
- package/dist/util/livereload.js +6 -3
- package/dist/util/monorepotools.js +2 -1
- package/dist/util/promise.js +1 -1
- package/dist/util/spm.js +5 -3
- package/dist/util/subprocess.js +7 -1
- package/dist/util/term.js +1 -1
- package/dist/util/uuid.js +1 -1
- package/dist/util/xml.js +4 -2
- package/dist/web/copy.js +22 -0
- package/package.json +2 -2
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/android/build.js
CHANGED
|
@@ -12,7 +12,9 @@ async function buildAndroid(config, buildOptions) {
|
|
|
12
12
|
const releaseType = (_a = buildOptions.androidreleasetype) !== null && _a !== void 0 ? _a : 'AAB';
|
|
13
13
|
const releaseTypeIsAAB = releaseType === 'AAB';
|
|
14
14
|
const flavor = (_b = buildOptions.flavor) !== null && _b !== void 0 ? _b : '';
|
|
15
|
-
const arg = releaseTypeIsAAB
|
|
15
|
+
const arg = releaseTypeIsAAB
|
|
16
|
+
? `:app:bundle${flavor}Release`
|
|
17
|
+
: `assemble${flavor}Release`;
|
|
16
18
|
const gradleArgs = [arg];
|
|
17
19
|
try {
|
|
18
20
|
await (0, common_1.runTask)('Running Gradle build', async () => (0, subprocess_1.runCommand)('./gradlew', gradleArgs, {
|
package/dist/android/common.js
CHANGED
|
@@ -20,7 +20,9 @@ async function resolvePlugin(plugin) {
|
|
|
20
20
|
var _a;
|
|
21
21
|
const platform = 'android';
|
|
22
22
|
if ((_a = plugin.manifest) === null || _a === void 0 ? void 0 : _a.android) {
|
|
23
|
-
let pluginFilesPath = plugin.manifest.android.src
|
|
23
|
+
let pluginFilesPath = plugin.manifest.android.src
|
|
24
|
+
? plugin.manifest.android.src
|
|
25
|
+
: platform;
|
|
24
26
|
const absolutePath = (0, path_1.join)(plugin.rootPath, pluginFilesPath, plugin.id);
|
|
25
27
|
// Android folder shouldn't have subfolders, but they used to, so search for them for compatibility reasons
|
|
26
28
|
if (await (0, utils_fs_1.pathExists)(absolutePath)) {
|
|
@@ -36,7 +38,8 @@ async function resolvePlugin(plugin) {
|
|
|
36
38
|
type: 1 /* PluginType.Cordova */,
|
|
37
39
|
path: 'src/' + platform,
|
|
38
40
|
};
|
|
39
|
-
if ((0, cordova_1.getIncompatibleCordovaPlugins)(platform).includes(plugin.id) ||
|
|
41
|
+
if ((0, cordova_1.getIncompatibleCordovaPlugins)(platform).includes(plugin.id) ||
|
|
42
|
+
!(0, plugin_1.getPluginPlatform)(plugin, platform)) {
|
|
40
43
|
plugin.android.type = 2 /* PluginType.Incompatible */;
|
|
41
44
|
}
|
|
42
45
|
}
|
package/dist/android/doctor.js
CHANGED
|
@@ -12,7 +12,11 @@ const xml_1 = require("../util/xml");
|
|
|
12
12
|
async function doctorAndroid(config) {
|
|
13
13
|
var _a;
|
|
14
14
|
try {
|
|
15
|
-
await (0, common_1.check)([
|
|
15
|
+
await (0, common_1.check)([
|
|
16
|
+
checkAndroidInstalled,
|
|
17
|
+
() => checkGradlew(config),
|
|
18
|
+
() => checkAppSrcDirs(config),
|
|
19
|
+
]);
|
|
16
20
|
(0, log_1.logSuccess)('Android looking great! 👌');
|
|
17
21
|
}
|
|
18
22
|
catch (e) {
|
|
@@ -66,22 +70,22 @@ async function checkAndroidManifestData(config, xmlData) {
|
|
|
66
70
|
return `Missing ${colors_1.default.input('<application>')} XML node as a child node of ${colors_1.default.input('<manifest>')} in ${colors_1.default.strong(config.android.srcMainDir)}`;
|
|
67
71
|
}
|
|
68
72
|
let mainActivityClassPath = '';
|
|
69
|
-
const mainApplicationNode = applicationChildNodes.find(
|
|
73
|
+
const mainApplicationNode = applicationChildNodes.find(applicationChildNode => {
|
|
70
74
|
const activityChildNodes = applicationChildNode.activity;
|
|
71
75
|
if (!Array.isArray(activityChildNodes)) {
|
|
72
76
|
return false;
|
|
73
77
|
}
|
|
74
|
-
const mainActivityNode = activityChildNodes.find(
|
|
78
|
+
const mainActivityNode = activityChildNodes.find(activityChildNode => {
|
|
75
79
|
const intentFilterChildNodes = activityChildNode['intent-filter'];
|
|
76
80
|
if (!Array.isArray(intentFilterChildNodes)) {
|
|
77
81
|
return false;
|
|
78
82
|
}
|
|
79
|
-
return intentFilterChildNodes.find(
|
|
83
|
+
return intentFilterChildNodes.find(intentFilterChildNode => {
|
|
80
84
|
const actionChildNodes = intentFilterChildNode.action;
|
|
81
85
|
if (!Array.isArray(actionChildNodes)) {
|
|
82
86
|
return false;
|
|
83
87
|
}
|
|
84
|
-
const mainActionChildNode = actionChildNodes.find(
|
|
88
|
+
const mainActionChildNode = actionChildNodes.find(actionChildNode => {
|
|
85
89
|
const androidName = actionChildNode.$['android:name'];
|
|
86
90
|
return androidName === 'android.intent.action.MAIN';
|
|
87
91
|
});
|
|
@@ -92,7 +96,7 @@ async function checkAndroidManifestData(config, xmlData) {
|
|
|
92
96
|
if (!Array.isArray(categoryChildNodes)) {
|
|
93
97
|
return false;
|
|
94
98
|
}
|
|
95
|
-
return categoryChildNodes.find(
|
|
99
|
+
return categoryChildNodes.find(categoryChildNode => {
|
|
96
100
|
const androidName = categoryChildNode.$['android:name'];
|
|
97
101
|
return androidName === 'android.intent.category.LAUNCHER';
|
|
98
102
|
});
|
|
@@ -118,7 +122,7 @@ async function checkPackage(config, mainActivityClassPath) {
|
|
|
118
122
|
}
|
|
119
123
|
const mainActivityClassName = mainActivityClassPath.split('.').pop();
|
|
120
124
|
const srcFiles = await (0, utils_fs_1.readdirp)(appSrcMainJavaDir, {
|
|
121
|
-
filter:
|
|
125
|
+
filter: entry => !entry.stats.isDirectory() &&
|
|
122
126
|
['.java', '.kt'].includes((0, path_1.extname)(entry.path)) &&
|
|
123
127
|
mainActivityClassName === (0, path_1.parse)(entry.path).name,
|
|
124
128
|
});
|
package/dist/android/run.js
CHANGED
|
@@ -9,7 +9,7 @@ const common_1 = require("../common");
|
|
|
9
9
|
const native_run_1 = require("../util/native-run");
|
|
10
10
|
const subprocess_1 = require("../util/subprocess");
|
|
11
11
|
const debug = (0, debug_1.default)('capacitor:android:run');
|
|
12
|
-
async function runAndroid(config, { target: selectedTarget, flavor: selectedFlavor, forwardPorts: selectedPorts }) {
|
|
12
|
+
async function runAndroid(config, { target: selectedTarget, flavor: selectedFlavor, forwardPorts: selectedPorts, }) {
|
|
13
13
|
var _a;
|
|
14
14
|
const target = await (0, common_1.promptForPlatformTarget)(await (0, native_run_1.getPlatformTargets)('android'), selectedTarget);
|
|
15
15
|
const runFlavor = selectedFlavor || ((_a = config.android) === null || _a === void 0 ? void 0 : _a.flavor) || '';
|
package/dist/android/update.js
CHANGED
|
@@ -20,11 +20,11 @@ const platform = 'android';
|
|
|
20
20
|
const debug = (0, debug_1.default)('capacitor:android:update');
|
|
21
21
|
async function updateAndroid(config) {
|
|
22
22
|
const plugins = await getPluginsTask(config);
|
|
23
|
-
const capacitorPlugins = plugins.filter(
|
|
23
|
+
const capacitorPlugins = plugins.filter(p => (0, plugin_1.getPluginType)(p, platform) === 0 /* PluginType.Core */);
|
|
24
24
|
(0, plugin_1.printPlugins)(capacitorPlugins, 'android');
|
|
25
25
|
await writePluginsJson(config, capacitorPlugins);
|
|
26
26
|
await removePluginsNativeFiles(config);
|
|
27
|
-
const cordovaPlugins = plugins.filter(
|
|
27
|
+
const cordovaPlugins = plugins.filter(p => (0, plugin_1.getPluginType)(p, platform) === 1 /* PluginType.Cordova */);
|
|
28
28
|
await (0, migrate_1.patchOldCapacitorPlugins)(config);
|
|
29
29
|
if (cordovaPlugins.length > 0) {
|
|
30
30
|
await copyPluginsNativeFiles(config, cordovaPlugins);
|
|
@@ -37,7 +37,7 @@ async function updateAndroid(config) {
|
|
|
37
37
|
await installGradlePlugins(config, capacitorPlugins, cordovaPlugins);
|
|
38
38
|
await handleCordovaPluginsGradle(config, cordovaPlugins);
|
|
39
39
|
await (0, cordova_1.writeCordovaAndroidManifest)(cordovaPlugins, config, platform);
|
|
40
|
-
const incompatibleCordovaPlugins = plugins.filter(
|
|
40
|
+
const incompatibleCordovaPlugins = plugins.filter(p => (0, plugin_1.getPluginType)(p, platform) === 2 /* PluginType.Incompatible */);
|
|
41
41
|
(0, plugin_1.printPlugins)(incompatibleCordovaPlugins, platform, 'incompatible');
|
|
42
42
|
await (0, common_1.checkPlatformVersions)(config, platform);
|
|
43
43
|
}
|
|
@@ -63,7 +63,8 @@ async function findAndroidPluginClassesInPlugin(plugin) {
|
|
|
63
63
|
}
|
|
64
64
|
const srcPath = (0, path_1.resolve)(plugin.rootPath, plugin.android.path, 'src/main');
|
|
65
65
|
const srcFiles = await (0, utils_fs_1.readdirp)(srcPath, {
|
|
66
|
-
filter:
|
|
66
|
+
filter: entry => !entry.stats.isDirectory() &&
|
|
67
|
+
['.java', '.kt'].includes((0, path_1.extname)(entry.path)),
|
|
67
68
|
});
|
|
68
69
|
const classRegex = /^@(?:CapacitorPlugin|NativePlugin)[\s\S]+?class ([\w]+)/gm;
|
|
69
70
|
const packageRegex = /^package ([\w.]+);?$/gm;
|
|
@@ -78,7 +79,8 @@ async function findAndroidPluginClassesInPlugin(plugin) {
|
|
|
78
79
|
packageRegex.lastIndex = 0;
|
|
79
80
|
const packageMatch = packageRegex.exec(srcFileContents.substring(0, classMatch.index));
|
|
80
81
|
if (!packageMatch) {
|
|
81
|
-
(0, errors_1.fatal)(`Package could not be parsed from Android plugin.\n` +
|
|
82
|
+
(0, errors_1.fatal)(`Package could not be parsed from Android plugin.\n` +
|
|
83
|
+
`Location: ${colors_1.default.strong(srcFile)}`);
|
|
82
84
|
}
|
|
83
85
|
const packageName = packageMatch[1];
|
|
84
86
|
const classpath = `${packageName}.${className}`;
|
|
@@ -105,7 +107,7 @@ async function installGradlePlugins(config, capacitorPlugins, cordovaPlugins) {
|
|
|
105
107
|
include ':capacitor-android'
|
|
106
108
|
project(':capacitor-android').projectDir = new File('${relativeCapcitorAndroidPath}')
|
|
107
109
|
${capacitorPlugins
|
|
108
|
-
.map(
|
|
110
|
+
.map(p => {
|
|
109
111
|
if (!p.android) {
|
|
110
112
|
return '';
|
|
111
113
|
}
|
|
@@ -119,7 +121,7 @@ project(':${getGradlePackageName(p.id)}').projectDir = new File('${relativePlugi
|
|
|
119
121
|
const applyArray = [];
|
|
120
122
|
const frameworksArray = [];
|
|
121
123
|
let prefsArray = [];
|
|
122
|
-
cordovaPlugins.map(
|
|
124
|
+
cordovaPlugins.map(p => {
|
|
123
125
|
const relativePluginPath = (0, fs_1.convertToUnixPath)((0, path_1.relative)(dependencyPath, p.rootPath));
|
|
124
126
|
const frameworks = (0, plugin_1.getPlatformElement)(p, platform, 'framework');
|
|
125
127
|
frameworks.map((framework) => {
|
|
@@ -154,7 +156,7 @@ android {
|
|
|
154
156
|
apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
|
|
155
157
|
dependencies {
|
|
156
158
|
${capacitorPlugins
|
|
157
|
-
.map(
|
|
159
|
+
.map(p => {
|
|
158
160
|
return ` implementation project(':${getGradlePackageName(p.id)}')`;
|
|
159
161
|
})
|
|
160
162
|
.join('\n')}
|
|
@@ -174,12 +176,12 @@ async function handleCordovaPluginsGradle(config, cordovaPlugins) {
|
|
|
174
176
|
var _a, _b, _c;
|
|
175
177
|
const pluginsGradlePath = (0, path_1.join)(config.android.cordovaPluginsDirAbs, 'build.gradle');
|
|
176
178
|
const kotlinNeeded = await kotlinNeededCheck(config, cordovaPlugins);
|
|
177
|
-
const kotlinVersionString = (_c = (_b = (_a = config.app.extConfig.cordova) === null || _a === void 0 ? void 0 : _a.preferences) === null || _b === void 0 ? void 0 : _b.GradlePluginKotlinVersion) !== null && _c !== void 0 ? _c : '1.
|
|
179
|
+
const kotlinVersionString = (_c = (_b = (_a = config.app.extConfig.cordova) === null || _a === void 0 ? void 0 : _a.preferences) === null || _b === void 0 ? void 0 : _b.GradlePluginKotlinVersion) !== null && _c !== void 0 ? _c : '1.9.10';
|
|
178
180
|
const frameworksArray = [];
|
|
179
181
|
let prefsArray = [];
|
|
180
182
|
const applyArray = [];
|
|
181
183
|
applyArray.push(`apply from: "cordova.variables.gradle"`);
|
|
182
|
-
cordovaPlugins.map(
|
|
184
|
+
cordovaPlugins.map(p => {
|
|
183
185
|
const relativePluginPath = (0, fs_1.convertToUnixPath)((0, path_1.relative)(config.android.cordovaPluginsDirAbs, p.rootPath));
|
|
184
186
|
const frameworks = (0, plugin_1.getPlatformElement)(p, platform, 'framework');
|
|
185
187
|
frameworks.map((framework) => {
|
|
@@ -196,7 +198,7 @@ async function handleCordovaPluginsGradle(config, cordovaPlugins) {
|
|
|
196
198
|
prefsArray = prefsArray.concat((0, plugin_1.getAllElements)(p, platform, 'preference'));
|
|
197
199
|
});
|
|
198
200
|
let frameworkString = frameworksArray
|
|
199
|
-
.map(
|
|
201
|
+
.map(f => {
|
|
200
202
|
if (f.startsWith('platform(')) {
|
|
201
203
|
return ` implementation ${f}`;
|
|
202
204
|
}
|
|
@@ -234,7 +236,8 @@ ext {
|
|
|
234
236
|
exports.handleCordovaPluginsGradle = handleCordovaPluginsGradle;
|
|
235
237
|
async function kotlinNeededCheck(config, cordovaPlugins) {
|
|
236
238
|
var _a, _b;
|
|
237
|
-
if (((_b = (_a = config.app.extConfig.cordova) === null || _a === void 0 ? void 0 : _a.preferences) === null || _b === void 0 ? void 0 : _b.GradlePluginKotlinEnabled) !==
|
|
239
|
+
if (((_b = (_a = config.app.extConfig.cordova) === null || _a === void 0 ? void 0 : _a.preferences) === null || _b === void 0 ? void 0 : _b.GradlePluginKotlinEnabled) !==
|
|
240
|
+
'true') {
|
|
238
241
|
for (const plugin of cordovaPlugins) {
|
|
239
242
|
const androidPlatform = (0, plugin_1.getPluginPlatform)(plugin, platform);
|
|
240
243
|
const sourceFiles = androidPlatform['source-file'];
|
|
@@ -265,7 +268,9 @@ async function copyPluginsNativeFiles(config, cordovaPlugins) {
|
|
|
265
268
|
if (fileName.split('.').pop() === 'aidl') {
|
|
266
269
|
baseFolder = 'aidl/';
|
|
267
270
|
}
|
|
268
|
-
const target = sourceFile.$['target-dir']
|
|
271
|
+
const target = sourceFile.$['target-dir']
|
|
272
|
+
.replace('app/src/main/', '')
|
|
273
|
+
.replace('src/', baseFolder);
|
|
269
274
|
await (0, utils_fs_1.copy)((0, plugin_1.getFilePath)(config, p, sourceFile.$.src), (0, path_1.join)(pluginsPath, target, fileName));
|
|
270
275
|
}
|
|
271
276
|
}
|
package/dist/common.js
CHANGED
|
@@ -13,8 +13,8 @@ const monorepotools_1 = require("./util/monorepotools");
|
|
|
13
13
|
const node_1 = require("./util/node");
|
|
14
14
|
const subprocess_1 = require("./util/subprocess");
|
|
15
15
|
async function check(checks) {
|
|
16
|
-
const results = await Promise.all(checks.map(
|
|
17
|
-
const errors = results.filter(
|
|
16
|
+
const results = await Promise.all(checks.map(f => f()));
|
|
17
|
+
const errors = results.filter(r => r != null);
|
|
18
18
|
if (errors.length > 0) {
|
|
19
19
|
throw errors.join('\n');
|
|
20
20
|
}
|
|
@@ -93,20 +93,12 @@ async function checkAppDir(config, dir) {
|
|
|
93
93
|
exports.checkAppDir = checkAppDir;
|
|
94
94
|
async function checkAppId(config, id) {
|
|
95
95
|
if (!id) {
|
|
96
|
-
return `Invalid App ID.
|
|
96
|
+
return `Invalid App ID. Must be in Java package form with no dashes (ex: com.example.app)`;
|
|
97
97
|
}
|
|
98
|
-
if (/^[a-
|
|
98
|
+
if (/^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+$/.test(id.toLowerCase())) {
|
|
99
99
|
return null;
|
|
100
100
|
}
|
|
101
|
-
return `
|
|
102
|
-
Invalid App ID "${id}". Your App ID must meet the following requirements to be valid on both iOS and Android:
|
|
103
|
-
- Must be in Java package form with no dashes (ex: com.example.app)
|
|
104
|
-
- It must have at least two segments (one or more dots).
|
|
105
|
-
- Each segment must start with a letter.
|
|
106
|
-
- All characters must be alphanumeric or an underscore [a-zA-Z][a-zA-Z0-9]+.
|
|
107
|
-
|
|
108
|
-
If you would like to skip validation, run "cap init" with the "--skip-appid-validation" flag.
|
|
109
|
-
`;
|
|
101
|
+
return `Invalid App ID "${id}". Must be in Java package form with no dashes (ex: com.example.app)`;
|
|
110
102
|
}
|
|
111
103
|
exports.checkAppId = checkAppId;
|
|
112
104
|
async function checkAppName(config, name) {
|
|
@@ -118,7 +110,7 @@ async function checkAppName(config, name) {
|
|
|
118
110
|
}
|
|
119
111
|
exports.checkAppName = checkAppName;
|
|
120
112
|
async function wait(time) {
|
|
121
|
-
return new Promise(
|
|
113
|
+
return new Promise(resolve => setTimeout(resolve, time));
|
|
122
114
|
}
|
|
123
115
|
exports.wait = wait;
|
|
124
116
|
async function runHooks(config, platformName, dir, hook) {
|
|
@@ -160,7 +152,7 @@ async function runPlatformHook(config, platformName, platformDir, hook) {
|
|
|
160
152
|
p.on('close', () => {
|
|
161
153
|
resolve();
|
|
162
154
|
});
|
|
163
|
-
p.on('error',
|
|
155
|
+
p.on('error', err => {
|
|
164
156
|
reject(err);
|
|
165
157
|
});
|
|
166
158
|
});
|
|
@@ -237,7 +229,8 @@ async function selectPlatforms(config, selectedPlatformName) {
|
|
|
237
229
|
}
|
|
238
230
|
else if (!(await getProjectPlatformDirectory(config, platformName))) {
|
|
239
231
|
if (platformName === 'web') {
|
|
240
|
-
(0, errors_1.fatal)(`Could not find the web platform directory.\n` +
|
|
232
|
+
(0, errors_1.fatal)(`Could not find the web platform directory.\n` +
|
|
233
|
+
`Make sure ${colors_1.default.strong(config.app.webDir)} exists.`);
|
|
241
234
|
}
|
|
242
235
|
(0, errors_1.fatal)(`${colors_1.default.strong(platformName)} platform has not been added yet.\n` +
|
|
243
236
|
`See the docs for adding the ${colors_1.default.strong(platformName)} platform: ${colors_1.default.strong(`https://capacitorjs.com/docs/${platformName}#adding-the-${platformName}-platform`)}`);
|
|
@@ -282,7 +275,7 @@ async function promptForPlatform(platforms, promptMessage, selectedPlatformName)
|
|
|
282
275
|
type: 'select',
|
|
283
276
|
name: 'mode',
|
|
284
277
|
message: promptMessage,
|
|
285
|
-
choices: platforms.map(
|
|
278
|
+
choices: platforms.map(p => ({ title: p, value: p })),
|
|
286
279
|
},
|
|
287
280
|
], { onCancel: () => process.exit(1) });
|
|
288
281
|
return answers.mode.toLowerCase().trim();
|
|
@@ -290,14 +283,15 @@ async function promptForPlatform(platforms, promptMessage, selectedPlatformName)
|
|
|
290
283
|
const platformName = selectedPlatformName.toLowerCase().trim();
|
|
291
284
|
if (!(await isValidPlatform(platformName))) {
|
|
292
285
|
const knownPlatforms = await getKnownPlatforms();
|
|
293
|
-
(0, errors_1.fatal)(`Invalid platform: ${colors_1.default.input(platformName)}.\n` +
|
|
286
|
+
(0, errors_1.fatal)(`Invalid platform: ${colors_1.default.input(platformName)}.\n` +
|
|
287
|
+
`Valid platforms include: ${knownPlatforms.join(', ')}`);
|
|
294
288
|
}
|
|
295
289
|
return platformName;
|
|
296
290
|
}
|
|
297
291
|
exports.promptForPlatform = promptForPlatform;
|
|
298
292
|
async function promptForPlatformTarget(targets, selectedTarget) {
|
|
299
293
|
const { prompt } = await Promise.resolve().then(() => tslib_1.__importStar(require('prompts')));
|
|
300
|
-
const validTargets = targets.filter(
|
|
294
|
+
const validTargets = targets.filter(t => t.id !== undefined);
|
|
301
295
|
if (!selectedTarget) {
|
|
302
296
|
if (validTargets.length === 1) {
|
|
303
297
|
return validTargets[0];
|
|
@@ -308,7 +302,7 @@ async function promptForPlatformTarget(targets, selectedTarget) {
|
|
|
308
302
|
type: 'select',
|
|
309
303
|
name: 'target',
|
|
310
304
|
message: 'Please choose a target device:',
|
|
311
|
-
choices: validTargets.map(
|
|
305
|
+
choices: validTargets.map(t => ({
|
|
312
306
|
title: `${getPlatformTargetName(t)} (${t.id})`,
|
|
313
307
|
value: t,
|
|
314
308
|
})),
|
|
@@ -318,16 +312,19 @@ async function promptForPlatformTarget(targets, selectedTarget) {
|
|
|
318
312
|
}
|
|
319
313
|
}
|
|
320
314
|
const targetID = selectedTarget.trim();
|
|
321
|
-
const target = targets.find(
|
|
315
|
+
const target = targets.find(t => t.id === targetID);
|
|
322
316
|
if (!target) {
|
|
323
|
-
(0, errors_1.fatal)(`Invalid target ID: ${colors_1.default.input(targetID)}.\n` +
|
|
317
|
+
(0, errors_1.fatal)(`Invalid target ID: ${colors_1.default.input(targetID)}.\n` +
|
|
318
|
+
`Valid targets are: ${targets.map(t => t.id).join(', ')}`);
|
|
324
319
|
}
|
|
325
320
|
return target;
|
|
326
321
|
}
|
|
327
322
|
exports.promptForPlatformTarget = promptForPlatformTarget;
|
|
328
323
|
function getPlatformTargetName(target) {
|
|
329
324
|
var _a, _b, _c;
|
|
330
|
-
return `${(_c = (_b = (_a = target.name) !== null && _a !== void 0 ? _a : target.model) !== null && _b !== void 0 ? _b : target.id) !== null && _c !== void 0 ? _c : '?'}${target.virtual
|
|
325
|
+
return `${(_c = (_b = (_a = target.name) !== null && _a !== void 0 ? _a : target.model) !== null && _b !== void 0 ? _b : target.id) !== null && _c !== void 0 ? _c : '?'}${target.virtual
|
|
326
|
+
? ` (${target.platform === 'ios' ? 'simulator' : 'emulator'})`
|
|
327
|
+
: ''}`;
|
|
331
328
|
}
|
|
332
329
|
exports.getPlatformTargetName = getPlatformTargetName;
|
|
333
330
|
async function getAddedPlatforms(config) {
|
|
@@ -346,7 +343,8 @@ async function checkPlatformVersions(config, platform) {
|
|
|
346
343
|
const semver = await Promise.resolve().then(() => tslib_1.__importStar(require('semver')));
|
|
347
344
|
const coreVersion = await getCoreVersion(config);
|
|
348
345
|
const platformVersion = await getCapacitorPackageVersion(config, platform);
|
|
349
|
-
if (semver.diff(coreVersion, platformVersion) === 'minor' ||
|
|
346
|
+
if (semver.diff(coreVersion, platformVersion) === 'minor' ||
|
|
347
|
+
semver.diff(coreVersion, platformVersion) === 'major') {
|
|
350
348
|
log_1.logger.warn(`${colors_1.default.strong('@capacitor/core')}${colors_1.default.weak(`@${coreVersion}`)} version doesn't match ${colors_1.default.strong(`@capacitor/${platform}`)}${colors_1.default.weak(`@${platformVersion}`)} version.\n` +
|
|
351
349
|
`Consider updating to a matching version, e.g. w/ ${colors_1.default.input(`npm install @capacitor/core@${platformVersion}`)}`);
|
|
352
350
|
}
|
|
@@ -388,7 +386,9 @@ async function checkJDKMajorVersion() {
|
|
|
388
386
|
if (typeof firstVersionNumber === 'number' && firstVersionNumber != 1) {
|
|
389
387
|
return firstVersionNumber;
|
|
390
388
|
}
|
|
391
|
-
else if (typeof secondVersionNumber === 'number' &&
|
|
389
|
+
else if (typeof secondVersionNumber === 'number' &&
|
|
390
|
+
firstVersionNumber == 1 &&
|
|
391
|
+
secondVersionNumber < 9) {
|
|
392
392
|
return secondVersionNumber;
|
|
393
393
|
}
|
|
394
394
|
else {
|
package/dist/config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.writeConfig = exports.loadConfig = exports.CONFIG_FILE_NAME_JSON = exports.CONFIG_FILE_NAME_JS = exports.CONFIG_FILE_NAME_TS = void 0;
|
|
3
|
+
exports.checkExternalConfig = exports.writeConfig = exports.loadConfig = exports.CONFIG_FILE_NAME_JSON = exports.CONFIG_FILE_NAME_JS = exports.CONFIG_FILE_NAME_TS = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const utils_fs_1 = require("@ionic/utils-fs");
|
|
6
6
|
const debug_1 = tslib_1.__importDefault(require("debug"));
|
|
@@ -88,7 +88,9 @@ async function loadExtConfigTS(rootDir, extConfigName, extConfigFilePath) {
|
|
|
88
88
|
}
|
|
89
89
|
const ts = require(tsPath); // eslint-disable-line @typescript-eslint/no-var-requires
|
|
90
90
|
const extConfigObject = (0, node_1.requireTS)(ts, extConfigFilePath);
|
|
91
|
-
const extConfig = extConfigObject.default
|
|
91
|
+
const extConfig = extConfigObject.default
|
|
92
|
+
? await extConfigObject.default
|
|
93
|
+
: extConfigObject;
|
|
92
94
|
return {
|
|
93
95
|
extConfigType: 'ts',
|
|
94
96
|
extConfigName,
|
|
@@ -194,7 +196,7 @@ async function loadAndroidConfig(rootDir, extConfig, cliConfig) {
|
|
|
194
196
|
};
|
|
195
197
|
return {
|
|
196
198
|
name,
|
|
197
|
-
minVersion: '
|
|
199
|
+
minVersion: '22',
|
|
198
200
|
studioPath,
|
|
199
201
|
platformDir,
|
|
200
202
|
platformDirAbs,
|
|
@@ -237,7 +239,7 @@ async function loadIOSConfig(rootDir, extConfig) {
|
|
|
237
239
|
const cordovaPluginsDir = 'capacitor-cordova-ios-plugins';
|
|
238
240
|
return {
|
|
239
241
|
name,
|
|
240
|
-
minVersion: '
|
|
242
|
+
minVersion: '13.0',
|
|
241
243
|
platformDir,
|
|
242
244
|
platformDirAbs,
|
|
243
245
|
scheme,
|
|
@@ -384,3 +386,13 @@ const config: CapacitorConfig = ${(0, js_1.formatJSObject)(extConfig)};
|
|
|
384
386
|
|
|
385
387
|
export default config;\n`;
|
|
386
388
|
}
|
|
389
|
+
function checkExternalConfig(config) {
|
|
390
|
+
if (typeof config.extConfig.bundledWebRuntime !== 'undefined') {
|
|
391
|
+
let actionMessage = `Can be safely deleted.`;
|
|
392
|
+
if (config.extConfig.bundledWebRuntime === true) {
|
|
393
|
+
actionMessage = `Please, use a bundler to bundle Capacitor and its plugins.`;
|
|
394
|
+
}
|
|
395
|
+
log_1.logger.warn(`The ${colors_1.default.strong('bundledWebRuntime')} configuration option has been deprecated. ${actionMessage}`);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
exports.checkExternalConfig = checkExternalConfig;
|