@capacitor/cli 6.2.0 → 7.0.0-alpha.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/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 +1 -3
- package/dist/android/common.js +2 -5
- package/dist/android/doctor.js +7 -11
- package/dist/android/run.js +1 -1
- package/dist/android/update.js +12 -17
- package/dist/common.js +25 -25
- package/dist/config.js +4 -16
- package/dist/cordova.js +31 -63
- package/dist/declarations.d.ts +0 -24
- package/dist/framework-configs.js +14 -14
- package/dist/index.js +14 -14
- package/dist/ios/common.js +3 -8
- package/dist/ios/doctor.js +1 -5
- package/dist/ios/run.js +2 -4
- package/dist/ios/update.js +22 -35
- package/dist/ipc.js +2 -2
- package/dist/log.js +1 -3
- package/dist/plugin.js +4 -8
- package/dist/tasks/add.js +2 -9
- package/dist/tasks/build.js +4 -9
- package/dist/tasks/config.js +1 -4
- package/dist/tasks/copy.js +6 -13
- package/dist/tasks/create.js +1 -2
- package/dist/tasks/doctor.js +2 -7
- package/dist/tasks/init.js +10 -11
- package/dist/tasks/list.js +4 -4
- package/dist/tasks/migrate.js +13 -37
- package/dist/tasks/new-plugin.js +1 -2
- package/dist/tasks/open.js +1 -1
- package/dist/tasks/run.js +5 -6
- package/dist/tasks/sourcemaps.js +2 -3
- package/dist/tasks/sync.js +2 -6
- package/dist/tasks/telemetry.js +3 -2
- package/dist/tasks/update.js +1 -1
- package/dist/telemetry.js +7 -18
- package/dist/util/fs.js +1 -1
- package/dist/util/iosplugin.js +2 -3
- package/dist/util/livereload.js +3 -6
- package/dist/util/monorepotools.js +1 -2
- package/dist/util/promise.js +1 -1
- package/dist/util/spm.js +3 -5
- package/dist/util/subprocess.js +1 -7
- package/dist/util/term.js +1 -1
- package/dist/util/uuid.js +1 -1
- package/dist/util/xml.js +2 -4
- package/package.json +2 -2
- package/dist/web/copy.js +0 -22
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/android/build.js
CHANGED
|
@@ -12,9 +12,7 @@ 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
|
|
16
|
-
? `:app:bundle${flavor}Release`
|
|
17
|
-
: `assemble${flavor}Release`;
|
|
15
|
+
const arg = releaseTypeIsAAB ? `:app:bundle${flavor}Release` : `assemble${flavor}Release`;
|
|
18
16
|
const gradleArgs = [arg];
|
|
19
17
|
try {
|
|
20
18
|
await (0, common_1.runTask)('Running Gradle build', async () => (0, subprocess_1.runCommand)('./gradlew', gradleArgs, {
|
package/dist/android/common.js
CHANGED
|
@@ -20,9 +20,7 @@ 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
|
|
24
|
-
? plugin.manifest.android.src
|
|
25
|
-
: platform;
|
|
23
|
+
let pluginFilesPath = plugin.manifest.android.src ? plugin.manifest.android.src : platform;
|
|
26
24
|
const absolutePath = (0, path_1.join)(plugin.rootPath, pluginFilesPath, plugin.id);
|
|
27
25
|
// Android folder shouldn't have subfolders, but they used to, so search for them for compatibility reasons
|
|
28
26
|
if (await (0, utils_fs_1.pathExists)(absolutePath)) {
|
|
@@ -38,8 +36,7 @@ async function resolvePlugin(plugin) {
|
|
|
38
36
|
type: 1 /* PluginType.Cordova */,
|
|
39
37
|
path: 'src/' + platform,
|
|
40
38
|
};
|
|
41
|
-
if ((0, cordova_1.getIncompatibleCordovaPlugins)(platform).includes(plugin.id) ||
|
|
42
|
-
!(0, plugin_1.getPluginPlatform)(plugin, platform)) {
|
|
39
|
+
if ((0, cordova_1.getIncompatibleCordovaPlugins)(platform).includes(plugin.id) || !(0, plugin_1.getPluginPlatform)(plugin, platform)) {
|
|
43
40
|
plugin.android.type = 2 /* PluginType.Incompatible */;
|
|
44
41
|
}
|
|
45
42
|
}
|
package/dist/android/doctor.js
CHANGED
|
@@ -12,11 +12,7 @@ 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)([
|
|
16
|
-
checkAndroidInstalled,
|
|
17
|
-
() => checkGradlew(config),
|
|
18
|
-
() => checkAppSrcDirs(config),
|
|
19
|
-
]);
|
|
15
|
+
await (0, common_1.check)([checkAndroidInstalled, () => checkGradlew(config), () => checkAppSrcDirs(config)]);
|
|
20
16
|
(0, log_1.logSuccess)('Android looking great! 👌');
|
|
21
17
|
}
|
|
22
18
|
catch (e) {
|
|
@@ -70,22 +66,22 @@ async function checkAndroidManifestData(config, xmlData) {
|
|
|
70
66
|
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)}`;
|
|
71
67
|
}
|
|
72
68
|
let mainActivityClassPath = '';
|
|
73
|
-
const mainApplicationNode = applicationChildNodes.find(applicationChildNode => {
|
|
69
|
+
const mainApplicationNode = applicationChildNodes.find((applicationChildNode) => {
|
|
74
70
|
const activityChildNodes = applicationChildNode.activity;
|
|
75
71
|
if (!Array.isArray(activityChildNodes)) {
|
|
76
72
|
return false;
|
|
77
73
|
}
|
|
78
|
-
const mainActivityNode = activityChildNodes.find(activityChildNode => {
|
|
74
|
+
const mainActivityNode = activityChildNodes.find((activityChildNode) => {
|
|
79
75
|
const intentFilterChildNodes = activityChildNode['intent-filter'];
|
|
80
76
|
if (!Array.isArray(intentFilterChildNodes)) {
|
|
81
77
|
return false;
|
|
82
78
|
}
|
|
83
|
-
return intentFilterChildNodes.find(intentFilterChildNode => {
|
|
79
|
+
return intentFilterChildNodes.find((intentFilterChildNode) => {
|
|
84
80
|
const actionChildNodes = intentFilterChildNode.action;
|
|
85
81
|
if (!Array.isArray(actionChildNodes)) {
|
|
86
82
|
return false;
|
|
87
83
|
}
|
|
88
|
-
const mainActionChildNode = actionChildNodes.find(actionChildNode => {
|
|
84
|
+
const mainActionChildNode = actionChildNodes.find((actionChildNode) => {
|
|
89
85
|
const androidName = actionChildNode.$['android:name'];
|
|
90
86
|
return androidName === 'android.intent.action.MAIN';
|
|
91
87
|
});
|
|
@@ -96,7 +92,7 @@ async function checkAndroidManifestData(config, xmlData) {
|
|
|
96
92
|
if (!Array.isArray(categoryChildNodes)) {
|
|
97
93
|
return false;
|
|
98
94
|
}
|
|
99
|
-
return categoryChildNodes.find(categoryChildNode => {
|
|
95
|
+
return categoryChildNodes.find((categoryChildNode) => {
|
|
100
96
|
const androidName = categoryChildNode.$['android:name'];
|
|
101
97
|
return androidName === 'android.intent.category.LAUNCHER';
|
|
102
98
|
});
|
|
@@ -122,7 +118,7 @@ async function checkPackage(config, mainActivityClassPath) {
|
|
|
122
118
|
}
|
|
123
119
|
const mainActivityClassName = mainActivityClassPath.split('.').pop();
|
|
124
120
|
const srcFiles = await (0, utils_fs_1.readdirp)(appSrcMainJavaDir, {
|
|
125
|
-
filter: entry => !entry.stats.isDirectory() &&
|
|
121
|
+
filter: (entry) => !entry.stats.isDirectory() &&
|
|
126
122
|
['.java', '.kt'].includes((0, path_1.extname)(entry.path)) &&
|
|
127
123
|
mainActivityClassName === (0, path_1.parse)(entry.path).name,
|
|
128
124
|
});
|
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(p => (0, plugin_1.getPluginType)(p, platform) === 0 /* PluginType.Core */);
|
|
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(p => (0, plugin_1.getPluginType)(p, platform) === 1 /* PluginType.Cordova */);
|
|
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(p => (0, plugin_1.getPluginType)(p, platform) === 2 /* PluginType.Incompatible */);
|
|
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,8 +63,7 @@ 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: entry => !entry.stats.isDirectory() &&
|
|
67
|
-
['.java', '.kt'].includes((0, path_1.extname)(entry.path)),
|
|
66
|
+
filter: (entry) => !entry.stats.isDirectory() && ['.java', '.kt'].includes((0, path_1.extname)(entry.path)),
|
|
68
67
|
});
|
|
69
68
|
const classRegex = /^@(?:CapacitorPlugin|NativePlugin)[\s\S]+?class ([\w]+)/gm;
|
|
70
69
|
const packageRegex = /^package ([\w.]+);?$/gm;
|
|
@@ -79,8 +78,7 @@ async function findAndroidPluginClassesInPlugin(plugin) {
|
|
|
79
78
|
packageRegex.lastIndex = 0;
|
|
80
79
|
const packageMatch = packageRegex.exec(srcFileContents.substring(0, classMatch.index));
|
|
81
80
|
if (!packageMatch) {
|
|
82
|
-
(0, errors_1.fatal)(`Package could not be parsed from Android plugin.\n` +
|
|
83
|
-
`Location: ${colors_1.default.strong(srcFile)}`);
|
|
81
|
+
(0, errors_1.fatal)(`Package could not be parsed from Android plugin.\n` + `Location: ${colors_1.default.strong(srcFile)}`);
|
|
84
82
|
}
|
|
85
83
|
const packageName = packageMatch[1];
|
|
86
84
|
const classpath = `${packageName}.${className}`;
|
|
@@ -107,7 +105,7 @@ async function installGradlePlugins(config, capacitorPlugins, cordovaPlugins) {
|
|
|
107
105
|
include ':capacitor-android'
|
|
108
106
|
project(':capacitor-android').projectDir = new File('${relativeCapcitorAndroidPath}')
|
|
109
107
|
${capacitorPlugins
|
|
110
|
-
.map(p => {
|
|
108
|
+
.map((p) => {
|
|
111
109
|
if (!p.android) {
|
|
112
110
|
return '';
|
|
113
111
|
}
|
|
@@ -121,7 +119,7 @@ project(':${getGradlePackageName(p.id)}').projectDir = new File('${relativePlugi
|
|
|
121
119
|
const applyArray = [];
|
|
122
120
|
const frameworksArray = [];
|
|
123
121
|
let prefsArray = [];
|
|
124
|
-
cordovaPlugins.map(p => {
|
|
122
|
+
cordovaPlugins.map((p) => {
|
|
125
123
|
const relativePluginPath = (0, fs_1.convertToUnixPath)((0, path_1.relative)(dependencyPath, p.rootPath));
|
|
126
124
|
const frameworks = (0, plugin_1.getPlatformElement)(p, platform, 'framework');
|
|
127
125
|
frameworks.map((framework) => {
|
|
@@ -156,7 +154,7 @@ android {
|
|
|
156
154
|
apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
|
|
157
155
|
dependencies {
|
|
158
156
|
${capacitorPlugins
|
|
159
|
-
.map(p => {
|
|
157
|
+
.map((p) => {
|
|
160
158
|
return ` implementation project(':${getGradlePackageName(p.id)}')`;
|
|
161
159
|
})
|
|
162
160
|
.join('\n')}
|
|
@@ -181,7 +179,7 @@ async function handleCordovaPluginsGradle(config, cordovaPlugins) {
|
|
|
181
179
|
let prefsArray = [];
|
|
182
180
|
const applyArray = [];
|
|
183
181
|
applyArray.push(`apply from: "cordova.variables.gradle"`);
|
|
184
|
-
cordovaPlugins.map(p => {
|
|
182
|
+
cordovaPlugins.map((p) => {
|
|
185
183
|
const relativePluginPath = (0, fs_1.convertToUnixPath)((0, path_1.relative)(config.android.cordovaPluginsDirAbs, p.rootPath));
|
|
186
184
|
const frameworks = (0, plugin_1.getPlatformElement)(p, platform, 'framework');
|
|
187
185
|
frameworks.map((framework) => {
|
|
@@ -198,7 +196,7 @@ async function handleCordovaPluginsGradle(config, cordovaPlugins) {
|
|
|
198
196
|
prefsArray = prefsArray.concat((0, plugin_1.getAllElements)(p, platform, 'preference'));
|
|
199
197
|
});
|
|
200
198
|
let frameworkString = frameworksArray
|
|
201
|
-
.map(f => {
|
|
199
|
+
.map((f) => {
|
|
202
200
|
if (f.startsWith('platform(')) {
|
|
203
201
|
return ` implementation ${f}`;
|
|
204
202
|
}
|
|
@@ -236,8 +234,7 @@ ext {
|
|
|
236
234
|
exports.handleCordovaPluginsGradle = handleCordovaPluginsGradle;
|
|
237
235
|
async function kotlinNeededCheck(config, cordovaPlugins) {
|
|
238
236
|
var _a, _b;
|
|
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') {
|
|
237
|
+
if (((_b = (_a = config.app.extConfig.cordova) === null || _a === void 0 ? void 0 : _a.preferences) === null || _b === void 0 ? void 0 : _b.GradlePluginKotlinEnabled) !== 'true') {
|
|
241
238
|
for (const plugin of cordovaPlugins) {
|
|
242
239
|
const androidPlatform = (0, plugin_1.getPluginPlatform)(plugin, platform);
|
|
243
240
|
const sourceFiles = androidPlatform['source-file'];
|
|
@@ -268,9 +265,7 @@ async function copyPluginsNativeFiles(config, cordovaPlugins) {
|
|
|
268
265
|
if (fileName.split('.').pop() === 'aidl') {
|
|
269
266
|
baseFolder = 'aidl/';
|
|
270
267
|
}
|
|
271
|
-
const target = sourceFile.$['target-dir']
|
|
272
|
-
.replace('app/src/main/', '')
|
|
273
|
-
.replace('src/', baseFolder);
|
|
268
|
+
const target = sourceFile.$['target-dir'].replace('app/src/main/', '').replace('src/', baseFolder);
|
|
274
269
|
await (0, utils_fs_1.copy)((0, plugin_1.getFilePath)(config, p, sourceFile.$.src), (0, path_1.join)(pluginsPath, target, fileName));
|
|
275
270
|
}
|
|
276
271
|
}
|
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(f => f()));
|
|
17
|
-
const errors = results.filter(r => r != null);
|
|
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,12 +93,20 @@ 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. App ID is required and cannot be blank.`;
|
|
97
97
|
}
|
|
98
|
-
if (/^[a-
|
|
98
|
+
if (/^[a-zA-Z][\w]*(?:\.[a-zA-Z][\w]*)+$/.test(id.toLowerCase())) {
|
|
99
99
|
return null;
|
|
100
100
|
}
|
|
101
|
-
return `
|
|
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
|
+
`;
|
|
102
110
|
}
|
|
103
111
|
exports.checkAppId = checkAppId;
|
|
104
112
|
async function checkAppName(config, name) {
|
|
@@ -110,7 +118,7 @@ async function checkAppName(config, name) {
|
|
|
110
118
|
}
|
|
111
119
|
exports.checkAppName = checkAppName;
|
|
112
120
|
async function wait(time) {
|
|
113
|
-
return new Promise(resolve => setTimeout(resolve, time));
|
|
121
|
+
return new Promise((resolve) => setTimeout(resolve, time));
|
|
114
122
|
}
|
|
115
123
|
exports.wait = wait;
|
|
116
124
|
async function runHooks(config, platformName, dir, hook) {
|
|
@@ -152,7 +160,7 @@ async function runPlatformHook(config, platformName, platformDir, hook) {
|
|
|
152
160
|
p.on('close', () => {
|
|
153
161
|
resolve();
|
|
154
162
|
});
|
|
155
|
-
p.on('error', err => {
|
|
163
|
+
p.on('error', (err) => {
|
|
156
164
|
reject(err);
|
|
157
165
|
});
|
|
158
166
|
});
|
|
@@ -229,8 +237,7 @@ async function selectPlatforms(config, selectedPlatformName) {
|
|
|
229
237
|
}
|
|
230
238
|
else if (!(await getProjectPlatformDirectory(config, platformName))) {
|
|
231
239
|
if (platformName === 'web') {
|
|
232
|
-
(0, errors_1.fatal)(`Could not find the web platform directory.\n` +
|
|
233
|
-
`Make sure ${colors_1.default.strong(config.app.webDir)} exists.`);
|
|
240
|
+
(0, errors_1.fatal)(`Could not find the web platform directory.\n` + `Make sure ${colors_1.default.strong(config.app.webDir)} exists.`);
|
|
234
241
|
}
|
|
235
242
|
(0, errors_1.fatal)(`${colors_1.default.strong(platformName)} platform has not been added yet.\n` +
|
|
236
243
|
`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`)}`);
|
|
@@ -275,7 +282,7 @@ async function promptForPlatform(platforms, promptMessage, selectedPlatformName)
|
|
|
275
282
|
type: 'select',
|
|
276
283
|
name: 'mode',
|
|
277
284
|
message: promptMessage,
|
|
278
|
-
choices: platforms.map(p => ({ title: p, value: p })),
|
|
285
|
+
choices: platforms.map((p) => ({ title: p, value: p })),
|
|
279
286
|
},
|
|
280
287
|
], { onCancel: () => process.exit(1) });
|
|
281
288
|
return answers.mode.toLowerCase().trim();
|
|
@@ -283,15 +290,14 @@ async function promptForPlatform(platforms, promptMessage, selectedPlatformName)
|
|
|
283
290
|
const platformName = selectedPlatformName.toLowerCase().trim();
|
|
284
291
|
if (!(await isValidPlatform(platformName))) {
|
|
285
292
|
const knownPlatforms = await getKnownPlatforms();
|
|
286
|
-
(0, errors_1.fatal)(`Invalid platform: ${colors_1.default.input(platformName)}.\n` +
|
|
287
|
-
`Valid platforms include: ${knownPlatforms.join(', ')}`);
|
|
293
|
+
(0, errors_1.fatal)(`Invalid platform: ${colors_1.default.input(platformName)}.\n` + `Valid platforms include: ${knownPlatforms.join(', ')}`);
|
|
288
294
|
}
|
|
289
295
|
return platformName;
|
|
290
296
|
}
|
|
291
297
|
exports.promptForPlatform = promptForPlatform;
|
|
292
298
|
async function promptForPlatformTarget(targets, selectedTarget) {
|
|
293
299
|
const { prompt } = await Promise.resolve().then(() => tslib_1.__importStar(require('prompts')));
|
|
294
|
-
const validTargets = targets.filter(t => t.id !== undefined);
|
|
300
|
+
const validTargets = targets.filter((t) => t.id !== undefined);
|
|
295
301
|
if (!selectedTarget) {
|
|
296
302
|
if (validTargets.length === 1) {
|
|
297
303
|
return validTargets[0];
|
|
@@ -302,7 +308,7 @@ async function promptForPlatformTarget(targets, selectedTarget) {
|
|
|
302
308
|
type: 'select',
|
|
303
309
|
name: 'target',
|
|
304
310
|
message: 'Please choose a target device:',
|
|
305
|
-
choices: validTargets.map(t => ({
|
|
311
|
+
choices: validTargets.map((t) => ({
|
|
306
312
|
title: `${getPlatformTargetName(t)} (${t.id})`,
|
|
307
313
|
value: t,
|
|
308
314
|
})),
|
|
@@ -312,19 +318,16 @@ async function promptForPlatformTarget(targets, selectedTarget) {
|
|
|
312
318
|
}
|
|
313
319
|
}
|
|
314
320
|
const targetID = selectedTarget.trim();
|
|
315
|
-
const target = targets.find(t => t.id === targetID);
|
|
321
|
+
const target = targets.find((t) => t.id === targetID);
|
|
316
322
|
if (!target) {
|
|
317
|
-
(0, errors_1.fatal)(`Invalid target ID: ${colors_1.default.input(targetID)}.\n` +
|
|
318
|
-
`Valid targets are: ${targets.map(t => t.id).join(', ')}`);
|
|
323
|
+
(0, errors_1.fatal)(`Invalid target ID: ${colors_1.default.input(targetID)}.\n` + `Valid targets are: ${targets.map((t) => t.id).join(', ')}`);
|
|
319
324
|
}
|
|
320
325
|
return target;
|
|
321
326
|
}
|
|
322
327
|
exports.promptForPlatformTarget = promptForPlatformTarget;
|
|
323
328
|
function getPlatformTargetName(target) {
|
|
324
329
|
var _a, _b, _c;
|
|
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
|
-
: ''}`;
|
|
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 ? ` (${target.platform === 'ios' ? 'simulator' : 'emulator'})` : ''}`;
|
|
328
331
|
}
|
|
329
332
|
exports.getPlatformTargetName = getPlatformTargetName;
|
|
330
333
|
async function getAddedPlatforms(config) {
|
|
@@ -343,8 +346,7 @@ async function checkPlatformVersions(config, platform) {
|
|
|
343
346
|
const semver = await Promise.resolve().then(() => tslib_1.__importStar(require('semver')));
|
|
344
347
|
const coreVersion = await getCoreVersion(config);
|
|
345
348
|
const platformVersion = await getCapacitorPackageVersion(config, platform);
|
|
346
|
-
if (semver.diff(coreVersion, platformVersion) === 'minor' ||
|
|
347
|
-
semver.diff(coreVersion, platformVersion) === 'major') {
|
|
349
|
+
if (semver.diff(coreVersion, platformVersion) === 'minor' || semver.diff(coreVersion, platformVersion) === 'major') {
|
|
348
350
|
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` +
|
|
349
351
|
`Consider updating to a matching version, e.g. w/ ${colors_1.default.input(`npm install @capacitor/core@${platformVersion}`)}`);
|
|
350
352
|
}
|
|
@@ -386,9 +388,7 @@ async function checkJDKMajorVersion() {
|
|
|
386
388
|
if (typeof firstVersionNumber === 'number' && firstVersionNumber != 1) {
|
|
387
389
|
return firstVersionNumber;
|
|
388
390
|
}
|
|
389
|
-
else if (typeof secondVersionNumber === 'number' &&
|
|
390
|
-
firstVersionNumber == 1 &&
|
|
391
|
-
secondVersionNumber < 9) {
|
|
391
|
+
else if (typeof secondVersionNumber === 'number' && firstVersionNumber == 1 && 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.
|
|
3
|
+
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,9 +88,7 @@ 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
|
|
92
|
-
? await extConfigObject.default
|
|
93
|
-
: extConfigObject;
|
|
91
|
+
const extConfig = extConfigObject.default ? await extConfigObject.default : extConfigObject;
|
|
94
92
|
return {
|
|
95
93
|
extConfigType: 'ts',
|
|
96
94
|
extConfigName,
|
|
@@ -196,7 +194,7 @@ async function loadAndroidConfig(rootDir, extConfig, cliConfig) {
|
|
|
196
194
|
};
|
|
197
195
|
return {
|
|
198
196
|
name,
|
|
199
|
-
minVersion: '
|
|
197
|
+
minVersion: '23',
|
|
200
198
|
studioPath,
|
|
201
199
|
platformDir,
|
|
202
200
|
platformDirAbs,
|
|
@@ -239,7 +237,7 @@ async function loadIOSConfig(rootDir, extConfig) {
|
|
|
239
237
|
const cordovaPluginsDir = 'capacitor-cordova-ios-plugins';
|
|
240
238
|
return {
|
|
241
239
|
name,
|
|
242
|
-
minVersion: '
|
|
240
|
+
minVersion: '14.0',
|
|
243
241
|
platformDir,
|
|
244
242
|
platformDirAbs,
|
|
245
243
|
scheme,
|
|
@@ -386,13 +384,3 @@ const config: CapacitorConfig = ${(0, js_1.formatJSObject)(extConfig)};
|
|
|
386
384
|
|
|
387
385
|
export default config;\n`;
|
|
388
386
|
}
|
|
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;
|