@capacitor/cli 9.0.0-alpha.3 → 9.0.0-alpha.6
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/update.js +0 -34
- package/dist/config.js +1 -1
- package/dist/ios/update.js +18 -0
- package/dist/tasks/migrate.js +59 -50
- package/dist/util/cordova-ios.js +14 -2
- package/dist/util/spm.js +2 -2
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/android/update.js
CHANGED
|
@@ -206,10 +206,7 @@ if (hasProperty('postBuildExtras')) {
|
|
|
206
206
|
}
|
|
207
207
|
exports.installGradlePlugins = installGradlePlugins;
|
|
208
208
|
async function handleCordovaPluginsGradle(config, cordovaPlugins) {
|
|
209
|
-
var _a, _b, _c;
|
|
210
209
|
const pluginsGradlePath = (0, path_1.join)(config.android.cordovaPluginsDirAbs, 'build.gradle');
|
|
211
|
-
const kotlinNeeded = await kotlinNeededCheck(config, cordovaPlugins);
|
|
212
|
-
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 : '2.2.20';
|
|
213
210
|
const frameworksArray = [];
|
|
214
211
|
let prefsArray = [];
|
|
215
212
|
const applyArray = [];
|
|
@@ -241,21 +238,10 @@ async function handleCordovaPluginsGradle(config, cordovaPlugins) {
|
|
|
241
238
|
})
|
|
242
239
|
.join('\n');
|
|
243
240
|
frameworkString = await replaceFrameworkVariables(config, prefsArray, frameworkString);
|
|
244
|
-
if (kotlinNeeded) {
|
|
245
|
-
frameworkString += `\n implementation "androidx.core:core-ktx:$androidxCoreKTXVersion"`;
|
|
246
|
-
frameworkString += `\n implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"`;
|
|
247
|
-
}
|
|
248
241
|
const applyString = applyArray.join('\n');
|
|
249
242
|
let buildGradle = await (0, fs_extra_1.readFile)(pluginsGradlePath, { encoding: 'utf-8' });
|
|
250
243
|
buildGradle = buildGradle.replace(/(SUB-PROJECT DEPENDENCIES START)[\s\S]*(\/\/ SUB-PROJECT DEPENDENCIES END)/, '$1\n' + frameworkString.concat('\n') + ' $2');
|
|
251
244
|
buildGradle = buildGradle.replace(/(PLUGIN GRADLE EXTENSIONS START)[\s\S]*(\/\/ PLUGIN GRADLE EXTENSIONS END)/, '$1\n' + applyString.concat('\n') + '$2');
|
|
252
|
-
if (kotlinNeeded) {
|
|
253
|
-
buildGradle = buildGradle.replace(/(buildscript\s{\n(\t|\s{4})repositories\s{\n((\t{2}|\s{8}).+\n)+(\t|\s{4})}\n(\t|\s{4})dependencies\s{\n(\t{2}|\s{8}).+)\n((\t|\s{4})}\n}\n)/, `$1\n classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"\n$8`);
|
|
254
|
-
buildGradle = buildGradle.replace(/(ext\s{)/, `$1\n androidxCoreKTXVersion = project.hasProperty('androidxCoreKTXVersion') ? rootProject.ext.androidxCoreKTXVersion : '1.8.0'`);
|
|
255
|
-
buildGradle = buildGradle.replace(/(buildscript\s{)/, `$1\n ext.kotlin_version = project.hasProperty('kotlin_version') ? rootProject.ext.kotlin_version : '${kotlinVersionString}'`);
|
|
256
|
-
buildGradle = buildGradle.replace(/(apply\splugin:\s'com\.android\.library')/, `$1\napply plugin: 'kotlin-android'`);
|
|
257
|
-
buildGradle = buildGradle.replace(/(compileOptions\s{\n((\t{2}|\s{8}).+\n)+(\t|\s{4})})\n(})/, `$1\n sourceSets {\n main.java.srcDirs += 'src/main/kotlin'\n }\n$5`);
|
|
258
|
-
}
|
|
259
245
|
await (0, fs_extra_1.writeFile)(pluginsGradlePath, buildGradle);
|
|
260
246
|
const cordovaVariables = `// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
|
|
261
247
|
ext {
|
|
@@ -267,26 +253,6 @@ ext {
|
|
|
267
253
|
await (0, fs_extra_1.writeFile)((0, path_1.join)(config.android.cordovaPluginsDirAbs, 'cordova.variables.gradle'), cordovaVariables);
|
|
268
254
|
}
|
|
269
255
|
exports.handleCordovaPluginsGradle = handleCordovaPluginsGradle;
|
|
270
|
-
async function kotlinNeededCheck(config, cordovaPlugins) {
|
|
271
|
-
var _a, _b;
|
|
272
|
-
if (((_b = (_a = config.app.extConfig.cordova) === null || _a === void 0 ? void 0 : _a.preferences) === null || _b === void 0 ? void 0 : _b.GradlePluginKotlinEnabled) !== 'true') {
|
|
273
|
-
for (const plugin of cordovaPlugins) {
|
|
274
|
-
const androidPlatform = (0, plugin_1.getPluginPlatform)(plugin, platform);
|
|
275
|
-
const sourceFiles = androidPlatform['source-file'];
|
|
276
|
-
if (sourceFiles) {
|
|
277
|
-
for (const srcFile of sourceFiles) {
|
|
278
|
-
if (/^.*\.kt$/.test(srcFile['$'].src)) {
|
|
279
|
-
return true;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
return false;
|
|
285
|
-
}
|
|
286
|
-
else {
|
|
287
|
-
return true;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
256
|
async function copyPluginsNativeFiles(config, cordovaPlugins) {
|
|
291
257
|
const pluginsPath = (0, path_1.join)(config.android.cordovaPluginsDirAbs, 'src', 'main');
|
|
292
258
|
for (const p of cordovaPlugins) {
|
package/dist/config.js
CHANGED
package/dist/ios/update.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.installCocoaPodsPlugins = exports.updateIOS = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const fs_extra_1 = require("fs-extra");
|
|
6
6
|
const path_1 = require("path");
|
|
7
|
+
const semver_1 = require("semver");
|
|
7
8
|
const colors_1 = tslib_1.__importDefault(require("../colors"));
|
|
8
9
|
const common_1 = require("../common");
|
|
9
10
|
const cordova_1 = require("../cordova");
|
|
@@ -11,6 +12,7 @@ const errors_1 = require("../errors");
|
|
|
11
12
|
const log_1 = require("../log");
|
|
12
13
|
const plugin_1 = require("../plugin");
|
|
13
14
|
const copy_1 = require("../tasks/copy");
|
|
15
|
+
const migrate_1 = require("../tasks/migrate");
|
|
14
16
|
const cordova_ios_1 = require("../util/cordova-ios");
|
|
15
17
|
const fs_1 = require("../util/fs");
|
|
16
18
|
const iosplugin_1 = require("../util/iosplugin");
|
|
@@ -47,6 +49,22 @@ async function updatePluginFiles(config, plugins, deployment) {
|
|
|
47
49
|
await (0, cordova_ios_1.generateCordovaPackageFiles)(cordovaPlugins, config);
|
|
48
50
|
}
|
|
49
51
|
const validSPMPackages = await (0, spm_1.checkPluginsForPackageSwift)(config, plugins);
|
|
52
|
+
await Promise.all(validSPMPackages.map(async (plugin) => {
|
|
53
|
+
var _a;
|
|
54
|
+
const iosPlatformVersion = await (0, common_1.getCapacitorPackageVersion)(config, config.ios.name);
|
|
55
|
+
const packageSwiftPath = (0, path_1.join)(plugin.rootPath, 'Package.swift');
|
|
56
|
+
let content = await (0, fs_extra_1.readFile)(packageSwiftPath, { encoding: 'utf-8' });
|
|
57
|
+
const regex = new RegExp('url:\\s*"https://github.com/ionic-team/capacitor-swift-pm\\.git",\\s*from:\\s*"([^"]+)"');
|
|
58
|
+
const version = (_a = content.match(regex)) === null || _a === void 0 ? void 0 : _a[1];
|
|
59
|
+
const majorCapVersion = (0, semver_1.major)(iosPlatformVersion);
|
|
60
|
+
if (version && (0, semver_1.major)(version) != majorCapVersion) {
|
|
61
|
+
const preCapVersion = (0, semver_1.prerelease)(iosPlatformVersion);
|
|
62
|
+
const forceVersion = preCapVersion ? iosPlatformVersion : `${majorCapVersion}.0.0`;
|
|
63
|
+
content = (0, migrate_1.setAllStringIn)(content, `url: "https://github.com/ionic-team/capacitor-swift-pm.git",`, `)`, ` from: "${forceVersion}"`);
|
|
64
|
+
await (0, fs_extra_1.writeFile)(packageSwiftPath, content);
|
|
65
|
+
log_1.logger.warn(`${plugin.id} is built for Capacitor ${(0, semver_1.major)(version)}, it might cause issues`);
|
|
66
|
+
}
|
|
67
|
+
}));
|
|
50
68
|
await (0, spm_1.generatePackageFile)(config, validSPMPackages.concat(cordovaPlugins));
|
|
51
69
|
}
|
|
52
70
|
else {
|
package/dist/tasks/migrate.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.setAllStringIn = exports.migrateCommand = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const fs_extra_1 = require("fs-extra");
|
|
6
6
|
const path_1 = require("path");
|
|
7
|
-
const rimraf_1 =
|
|
7
|
+
const rimraf_1 = require("rimraf");
|
|
8
8
|
const semver_1 = require("semver");
|
|
9
9
|
const colors_1 = tslib_1.__importDefault(require("../colors"));
|
|
10
10
|
const common_1 = require("../common");
|
|
@@ -44,23 +44,22 @@ const plugins = [
|
|
|
44
44
|
'@capacitor/text-zoom',
|
|
45
45
|
'@capacitor/toast',
|
|
46
46
|
];
|
|
47
|
-
const coreVersion = '
|
|
48
|
-
const pluginVersion = '
|
|
49
|
-
const gradleVersion = '
|
|
47
|
+
const coreVersion = 'next';
|
|
48
|
+
const pluginVersion = 'next';
|
|
49
|
+
const gradleVersion = '9.5.1';
|
|
50
50
|
const iOSVersion = '16';
|
|
51
|
-
const kotlinVersion = '2.2.20';
|
|
52
51
|
let installFailed = false;
|
|
53
52
|
async function migrateCommand(config, noprompt, packagemanager) {
|
|
54
53
|
if (config === null) {
|
|
55
54
|
(0, errors_1.fatal)('Config data missing');
|
|
56
55
|
}
|
|
57
56
|
const capMajor = await checkCapacitorMajorVersion(config);
|
|
58
|
-
if (capMajor <
|
|
59
|
-
(0, errors_1.fatal)('Migrate can only be used on Capacitor
|
|
57
|
+
if (capMajor < 8) {
|
|
58
|
+
(0, errors_1.fatal)('Migrate can only be used on Capacitor 8, please use the CLI in Capacitor 8 to upgrade to 8 first');
|
|
60
59
|
}
|
|
61
60
|
const jdkMajor = await (0, common_1.checkJDKMajorVersion)();
|
|
62
61
|
if (jdkMajor < 21) {
|
|
63
|
-
log_1.logger.warn('Capacitor
|
|
62
|
+
log_1.logger.warn('Capacitor 9 requires JDK 21 or higher. Some steps may fail.');
|
|
64
63
|
}
|
|
65
64
|
const variablesAndClasspaths = await getAndroidVariablesAndClasspaths(config);
|
|
66
65
|
if (!variablesAndClasspaths) {
|
|
@@ -70,11 +69,11 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
70
69
|
...config.app.package.dependencies,
|
|
71
70
|
...config.app.package.devDependencies,
|
|
72
71
|
};
|
|
73
|
-
const monorepoWarning = 'Please note this tool is not intended for use in a mono-repo environment, you should migrate manually instead. Refer to https://capacitorjs.com/docs/next/updating/
|
|
72
|
+
const monorepoWarning = 'Please note this tool is not intended for use in a mono-repo environment, you should migrate manually instead. Refer to https://capacitorjs.com/docs/next/updating/9-0';
|
|
74
73
|
log_1.logger.info(monorepoWarning);
|
|
75
74
|
const { migrateconfirm } = noprompt
|
|
76
75
|
? { migrateconfirm: 'y' }
|
|
77
|
-
: await (0, log_1.logPrompt)(`Capacitor
|
|
76
|
+
: await (0, log_1.logPrompt)(`Capacitor 9 sets a deployment target of iOS ${iOSVersion} and Android 17 (SDK 37). \n`, {
|
|
78
77
|
type: 'text',
|
|
79
78
|
name: 'migrateconfirm',
|
|
80
79
|
message: `Are you sure you want to migrate? (Y/n)`,
|
|
@@ -136,6 +135,9 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
136
135
|
else {
|
|
137
136
|
log_1.logger.warn('Skipped updating deployment target');
|
|
138
137
|
}
|
|
138
|
+
await (0, common_1.runTask)(`Migrating AppDelegate.swift`, () => {
|
|
139
|
+
return updateAppDelegate((0, path_1.join)(config.ios.nativeTargetDirAbs, 'AppDelegate.swift'));
|
|
140
|
+
});
|
|
139
141
|
}
|
|
140
142
|
if (!installFailed) {
|
|
141
143
|
await (0, common_1.runTask)(`Running cap sync.`, () => {
|
|
@@ -179,6 +181,19 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
179
181
|
await (0, common_1.runTask)(`Migrating app build.gradle file.`, () => {
|
|
180
182
|
return updateAppBuildGradle((0, path_1.join)(config.android.appDirAbs, 'build.gradle'));
|
|
181
183
|
});
|
|
184
|
+
// settings.gradle
|
|
185
|
+
await (0, common_1.runTask)(`Migrating settings.gradle file.`, () => {
|
|
186
|
+
return (async () => {
|
|
187
|
+
const settingsPath = (0, path_1.join)(config.android.platformDirAbs, 'settings.gradle');
|
|
188
|
+
let txt = readFile(settingsPath);
|
|
189
|
+
if (!txt) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
txt = txt.replace(`include ':capacitor-cordova-android-plugins'\n`, '');
|
|
193
|
+
txt = txt.replace(`project(':capacitor-cordova-android-plugins').projectDir = new File('./capacitor-cordova-android-plugins/')\n`, '');
|
|
194
|
+
(0, fs_extra_1.writeFileSync)(settingsPath, txt, { encoding: 'utf-8' });
|
|
195
|
+
})();
|
|
196
|
+
});
|
|
182
197
|
// Variables gradle
|
|
183
198
|
await (0, common_1.runTask)(`Migrating variables.gradle file.`, () => {
|
|
184
199
|
return (async () => {
|
|
@@ -233,7 +248,7 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
233
248
|
}
|
|
234
249
|
})();
|
|
235
250
|
});
|
|
236
|
-
rimraf_1.
|
|
251
|
+
rimraf_1.rimraf.sync((0, path_1.join)(config.android.appDirAbs, 'build'));
|
|
237
252
|
}
|
|
238
253
|
// Write all breaking changes
|
|
239
254
|
await (0, common_1.runTask)(`Writing breaking changes.`, () => {
|
|
@@ -273,7 +288,9 @@ async function installLatestLibs(dependencyManager, runInstall, config) {
|
|
|
273
288
|
if (libs.includes(devDepKey)) {
|
|
274
289
|
pkgJson['devDependencies'][devDepKey] = coreVersion;
|
|
275
290
|
}
|
|
276
|
-
else if (plugins.includes(devDepKey)
|
|
291
|
+
else if (plugins.includes(devDepKey) &&
|
|
292
|
+
!(pkgJson['devDependencies'][devDepKey].startsWith('file:') ||
|
|
293
|
+
pkgJson['devDependencies'][devDepKey].startsWith('workspace:'))) {
|
|
277
294
|
pkgJson['devDependencies'][devDepKey] = pluginVersion;
|
|
278
295
|
}
|
|
279
296
|
}
|
|
@@ -281,7 +298,8 @@ async function installLatestLibs(dependencyManager, runInstall, config) {
|
|
|
281
298
|
if (libs.includes(depKey)) {
|
|
282
299
|
pkgJson['dependencies'][depKey] = coreVersion;
|
|
283
300
|
}
|
|
284
|
-
else if (plugins.includes(depKey)
|
|
301
|
+
else if (plugins.includes(depKey) &&
|
|
302
|
+
!(pkgJson['dependencies'][depKey].startsWith('file:') || pkgJson['dependencies'][depKey].startsWith('workspace:'))) {
|
|
285
303
|
pkgJson['dependencies'][depKey] = pluginVersion;
|
|
286
304
|
}
|
|
287
305
|
}
|
|
@@ -289,7 +307,7 @@ async function installLatestLibs(dependencyManager, runInstall, config) {
|
|
|
289
307
|
encoding: 'utf-8',
|
|
290
308
|
});
|
|
291
309
|
if (runInstall) {
|
|
292
|
-
rimraf_1.
|
|
310
|
+
rimraf_1.rimraf.sync((0, path_1.join)(config.app.rootDir, 'node_modules/@capacitor/!(cli)'));
|
|
293
311
|
await (0, subprocess_1.runCommand)(dependencyManager, ['install']);
|
|
294
312
|
if (dependencyManager == 'yarn') {
|
|
295
313
|
await (0, subprocess_1.runCommand)(dependencyManager, ['upgrade']);
|
|
@@ -303,18 +321,7 @@ async function installLatestLibs(dependencyManager, runInstall, config) {
|
|
|
303
321
|
}
|
|
304
322
|
}
|
|
305
323
|
async function writeBreakingChanges() {
|
|
306
|
-
const breaking = [
|
|
307
|
-
'@capacitor/action-sheet',
|
|
308
|
-
'@capacitor/barcode-scanner',
|
|
309
|
-
'@capacitor/browser',
|
|
310
|
-
'@capacitor/camera',
|
|
311
|
-
'@capacitor/geolocation',
|
|
312
|
-
'@capacitor/google-maps',
|
|
313
|
-
'@capacitor/push-notifications',
|
|
314
|
-
'@capacitor/screen-orientation',
|
|
315
|
-
'@capacitor/splash-screen',
|
|
316
|
-
'@capacitor/status-bar',
|
|
317
|
-
];
|
|
324
|
+
const breaking = ['@capacitor/push-notifications', '@capacitor/splash-screen'];
|
|
318
325
|
const broken = [];
|
|
319
326
|
for (const lib of breaking) {
|
|
320
327
|
if (allDependencies[lib]) {
|
|
@@ -322,7 +329,7 @@ async function writeBreakingChanges() {
|
|
|
322
329
|
}
|
|
323
330
|
}
|
|
324
331
|
if (broken.length > 0) {
|
|
325
|
-
log_1.logger.info(`IMPORTANT: Review https://capacitorjs.com/docs/next/updating/
|
|
332
|
+
log_1.logger.info(`IMPORTANT: Review https://capacitorjs.com/docs/next/updating/9-0#plugins for breaking changes in these plugins that you use: ${broken.join(', ')}.`);
|
|
326
333
|
}
|
|
327
334
|
}
|
|
328
335
|
async function getAndroidVariablesAndClasspaths(config) {
|
|
@@ -402,38 +409,24 @@ async function updateBuildGradle(filename, variablesAndClasspaths) {
|
|
|
402
409
|
}
|
|
403
410
|
}
|
|
404
411
|
}
|
|
405
|
-
const beforeKotlinVersionUpdate = replaced;
|
|
406
|
-
replaced = replaceVersion(replaced, /(ext\.kotlin_version\s*=\s*['"])([^'"]+)(['"])/, kotlinVersion);
|
|
407
|
-
replaced = replaceVersion(replaced, /(org\.jetbrains\.kotlin:kotlin[^:]*:)([\d.]+)(['"])/, kotlinVersion);
|
|
408
|
-
if (beforeKotlinVersionUpdate !== replaced) {
|
|
409
|
-
log_1.logger.info(`Set Kotlin version to ${kotlinVersion}`);
|
|
410
|
-
}
|
|
411
412
|
(0, fs_extra_1.writeFileSync)(filename, replaced, 'utf-8');
|
|
412
413
|
}
|
|
413
|
-
function replaceVersion(text, regex, newVersion) {
|
|
414
|
-
return text.replace(regex, (match, prefix, currentVersion, suffix) => {
|
|
415
|
-
var _a;
|
|
416
|
-
const semVer = (_a = (0, semver_1.coerce)(currentVersion)) === null || _a === void 0 ? void 0 : _a.version;
|
|
417
|
-
if ((0, semver_1.gte)(newVersion, semVer ? semVer : '0.0.0')) {
|
|
418
|
-
return `${prefix || ''}${newVersion}${suffix || ''}`;
|
|
419
|
-
}
|
|
420
|
-
return match;
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
414
|
async function updateAppBuildGradle(filename) {
|
|
424
415
|
const txt = readFile(filename);
|
|
425
416
|
if (!txt) {
|
|
426
417
|
return;
|
|
427
418
|
}
|
|
428
419
|
let replaced = txt;
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
});
|
|
420
|
+
replaced = replaced.replace(`proguard-android.txt`, `proguard-android-optimize.txt`);
|
|
421
|
+
replaced = replaced.replace(' targetSdkVersion rootProject.ext.targetSdkVersion\n', '');
|
|
422
|
+
replaced = replaced.replace(` implementation project(':capacitor-cordova-android-plugins')\n`, '');
|
|
423
|
+
replaced = replaced.replace(`repositories {
|
|
424
|
+
flatDir{
|
|
425
|
+
dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
|
|
436
426
|
}
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
`, '');
|
|
437
430
|
(0, fs_extra_1.writeFileSync)(filename, replaced, 'utf-8');
|
|
438
431
|
}
|
|
439
432
|
async function updateFile(config, filename, textStart, textEnd, replacement, skipIfNotFound) {
|
|
@@ -517,3 +510,19 @@ async function updateAndroidManifest(filename) {
|
|
|
517
510
|
(0, fs_extra_1.writeFileSync)(filename, replaced, 'utf-8');
|
|
518
511
|
}
|
|
519
512
|
}
|
|
513
|
+
async function updateAppDelegate(filename) {
|
|
514
|
+
const txt = readFile(filename);
|
|
515
|
+
if (!txt) {
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
if (txt.includes('@main')) {
|
|
519
|
+
return; // Probably already updated
|
|
520
|
+
}
|
|
521
|
+
const replaced = txt.replace('@UIApplicationMain', '@main');
|
|
522
|
+
if (!replaced.includes('@main')) {
|
|
523
|
+
log_1.logger.error(`Unable to replace @UIApplicationMain to @main in ${filename}. Try replacing it manually`);
|
|
524
|
+
}
|
|
525
|
+
else {
|
|
526
|
+
(0, fs_extra_1.writeFileSync)(filename, replaced, 'utf-8');
|
|
527
|
+
}
|
|
528
|
+
}
|
package/dist/util/cordova-ios.js
CHANGED
|
@@ -7,6 +7,7 @@ const common_1 = require("../common");
|
|
|
7
7
|
const cordova_1 = require("../cordova");
|
|
8
8
|
const common_2 = require("../ios/common");
|
|
9
9
|
const plugin_1 = require("../plugin");
|
|
10
|
+
const migrate_1 = require("../tasks/migrate");
|
|
10
11
|
const template_1 = require("../util/template");
|
|
11
12
|
const platform = 'ios';
|
|
12
13
|
async function generateCordovaPodspecs(cordovaPlugins, config) {
|
|
@@ -321,6 +322,7 @@ async function generateCordovaPackageFiles(cordovaPlugins, config) {
|
|
|
321
322
|
}
|
|
322
323
|
exports.generateCordovaPackageFiles = generateCordovaPackageFiles;
|
|
323
324
|
async function generateCordovaPackageFile(p, config) {
|
|
325
|
+
var _a;
|
|
324
326
|
const iosPlatformVersion = await (0, common_1.getCapacitorPackageVersion)(config, config.ios.name);
|
|
325
327
|
const iosVersion = (0, common_2.getMajoriOSVersion)(config);
|
|
326
328
|
const headerFiles = (0, plugin_1.getPlatformElement)(p, platform, 'header-file');
|
|
@@ -329,7 +331,16 @@ async function generateCordovaPackageFile(p, config) {
|
|
|
329
331
|
headersText = `,
|
|
330
332
|
publicHeadersPath: "."`;
|
|
331
333
|
}
|
|
332
|
-
const
|
|
334
|
+
const platformTag = (0, plugin_1.getPluginPlatform)(p, platform);
|
|
335
|
+
if ((_a = platformTag.$) === null || _a === void 0 ? void 0 : _a.package) {
|
|
336
|
+
const packageSwiftPath = (0, path_1.join)(p.rootPath, 'Package.swift');
|
|
337
|
+
let content = await (0, fs_extra_1.readFile)(packageSwiftPath, { encoding: 'utf-8' });
|
|
338
|
+
content = content.replace(`apache`, `ionic-team`).replaceAll(`cordova-ios`, `capacitor-swift-pm`);
|
|
339
|
+
content = (0, migrate_1.setAllStringIn)(content, `url: "https://github.com/ionic-team/capacitor-swift-pm.git",`, `)`, ` from: "${iosPlatformVersion}"`);
|
|
340
|
+
await (0, fs_extra_1.writeFile)(packageSwiftPath, content);
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
const content = `// swift-tools-version: 5.9
|
|
333
344
|
|
|
334
345
|
import PackageDescription
|
|
335
346
|
|
|
@@ -355,6 +366,7 @@ let package = Package(
|
|
|
355
366
|
)
|
|
356
367
|
]
|
|
357
368
|
)`;
|
|
358
|
-
|
|
369
|
+
await (0, fs_extra_1.writeFile)((0, path_1.join)(config.ios.cordovaPluginsDirAbs, 'sources', p.name, 'Package.swift'), content);
|
|
370
|
+
}
|
|
359
371
|
}
|
|
360
372
|
exports.generateCordovaPackageFile = generateCordovaPackageFile;
|
package/dist/util/spm.js
CHANGED
|
@@ -149,9 +149,9 @@ let package = Package(
|
|
|
149
149
|
.target(
|
|
150
150
|
name: "CapApp-SPM",
|
|
151
151
|
dependencies: [
|
|
152
|
-
.product(name: "Capacitor", package: "capacitor-swift-pm")
|
|
152
|
+
.product(name: "Capacitor", package: "capacitor-swift-pm")`;
|
|
153
153
|
if (enableCordova) {
|
|
154
|
-
packageSwiftText +=
|
|
154
|
+
packageSwiftText += `,\n .product(name: "Cordova", package: "capacitor-swift-pm")`;
|
|
155
155
|
}
|
|
156
156
|
for (const plugin of plugins) {
|
|
157
157
|
const aliases = Object.entries((_r = (_q = packageOptions[plugin.id]) === null || _q === void 0 ? void 0 : _q.moduleAliases) !== null && _r !== void 0 ? _r : {});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/cli",
|
|
3
|
-
"version": "9.0.0-alpha.
|
|
3
|
+
"version": "9.0.0-alpha.6",
|
|
4
4
|
"description": "Capacitor: Cross-platform apps with JavaScript and the web",
|
|
5
5
|
"homepage": "https://capacitorjs.com",
|
|
6
6
|
"author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
|