@capacitor/cli 6.0.0-rc.1 → 6.0.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 +1 -1
- package/dist/common.js +1 -1
- package/dist/index.js +1 -1
- package/dist/ios/update.js +1 -6
- package/dist/tasks/copy.js +4 -0
- package/dist/tasks/migrate.js +32 -38
- package/dist/util/iosplugin.js +16 -4
- package/dist/util/spm.js +4 -3
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/android/build.js
CHANGED
|
@@ -67,7 +67,7 @@ async function signWithApkSigner(config, buildOptions, releasePath, signedReleas
|
|
|
67
67
|
signingArgs.push('--ks-key-alias', buildOptions.keystorealias);
|
|
68
68
|
}
|
|
69
69
|
if (buildOptions.keystorealiaspass) {
|
|
70
|
-
signingArgs.push('--key-pass', buildOptions.keystorealiaspass);
|
|
70
|
+
signingArgs.push('--key-pass', `pass:${buildOptions.keystorealiaspass}`);
|
|
71
71
|
}
|
|
72
72
|
await (0, common_1.runTask)('Signing Release', async () => {
|
|
73
73
|
await (0, subprocess_1.runCommand)('apksigner', signingArgs, {
|
package/dist/common.js
CHANGED
|
@@ -392,7 +392,7 @@ async function checkJDKMajorVersion() {
|
|
|
392
392
|
}
|
|
393
393
|
exports.checkJDKMajorVersion = checkJDKMajorVersion;
|
|
394
394
|
function parseApkNameFromFlavor(flavor) {
|
|
395
|
-
const convertedName = flavor.replace(/([A-Z])/g, '
|
|
395
|
+
const convertedName = flavor.replace(/([A-Z])/g, '$1').toLowerCase();
|
|
396
396
|
return `app-${convertedName ? `${convertedName}-` : ''}debug.apk`;
|
|
397
397
|
}
|
|
398
398
|
exports.parseApkNameFromFlavor = parseApkNameFromFlavor;
|
package/dist/index.js
CHANGED
|
@@ -153,7 +153,7 @@ function runProgram(config) {
|
|
|
153
153
|
commander_1.program
|
|
154
154
|
.command('add [platform]')
|
|
155
155
|
.description('add a native platform project')
|
|
156
|
-
.option('--packagemanager <packageManager>', 'The package manager to use for dependency installs (
|
|
156
|
+
.option('--packagemanager <packageManager>', 'The package manager to use for dependency installs (Cocoapods, SPM **experimental**)')
|
|
157
157
|
.action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { packagemanager }) => {
|
|
158
158
|
(0, config_1.checkExternalConfig)(config.app);
|
|
159
159
|
const { addCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/add')));
|
package/dist/ios/update.js
CHANGED
|
@@ -28,7 +28,7 @@ async function updateIOS(config, deployment) {
|
|
|
28
28
|
else {
|
|
29
29
|
await updateIOSCocoaPods(config, plugins, deployment);
|
|
30
30
|
}
|
|
31
|
-
generateIOSPackageJSON(config, plugins);
|
|
31
|
+
(0, iosplugin_1.generateIOSPackageJSON)(config, plugins);
|
|
32
32
|
(0, plugin_1.printPlugins)(capacitorPlugins, 'ios');
|
|
33
33
|
}
|
|
34
34
|
exports.updateIOS = updateIOS;
|
|
@@ -100,11 +100,6 @@ end`, `require_relative '${relativeCapacitoriOSPath}/scripts/pods_helpers'`);
|
|
|
100
100
|
log_1.logger.warn('Unable to find "xcodebuild". Skipping xcodebuild clean step...');
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
async function generateIOSPackageJSON(config, plugins) {
|
|
104
|
-
const fileList = await (0, iosplugin_1.getPluginFiles)(plugins);
|
|
105
|
-
const classList = await (0, iosplugin_1.findPluginClasses)(fileList);
|
|
106
|
-
(0, iosplugin_1.writePluginJSON)(config, classList);
|
|
107
|
-
}
|
|
108
103
|
async function getRelativeCapacitoriOSPath(config) {
|
|
109
104
|
const capacitoriOSPath = (0, node_1.resolveNode)(config.app.rootDir, '@capacitor/ios', 'package.json');
|
|
110
105
|
if (!capacitoriOSPath) {
|
package/dist/tasks/copy.js
CHANGED
|
@@ -8,8 +8,10 @@ const colors_1 = tslib_1.__importDefault(require("../colors"));
|
|
|
8
8
|
const common_1 = require("../common");
|
|
9
9
|
const cordova_1 = require("../cordova");
|
|
10
10
|
const errors_1 = require("../errors");
|
|
11
|
+
const common_2 = require("../ios/common");
|
|
11
12
|
const log_1 = require("../log");
|
|
12
13
|
const plugin_1 = require("../plugin");
|
|
14
|
+
const iosplugin_1 = require("../util/iosplugin");
|
|
13
15
|
const promise_1 = require("../util/promise");
|
|
14
16
|
const copy_1 = require("../web/copy");
|
|
15
17
|
const sourcemaps_1 = require("./sourcemaps");
|
|
@@ -80,6 +82,8 @@ async function copy(config, platformName, inline = false) {
|
|
|
80
82
|
await copyCapacitorConfig(config, config.ios.nativeTargetDirAbs);
|
|
81
83
|
const cordovaPlugins = await (0, cordova_1.getCordovaPlugins)(config, platformName);
|
|
82
84
|
await (0, cordova_1.handleCordovaPluginsJS)(cordovaPlugins, config, platformName);
|
|
85
|
+
const iosPlugins = await (0, common_2.getIOSPlugins)(allPlugins);
|
|
86
|
+
await (0, iosplugin_1.generateIOSPackageJSON)(config, iosPlugins);
|
|
83
87
|
}
|
|
84
88
|
else if (platformName === config.android.name) {
|
|
85
89
|
if (usesFederatedCapacitor) {
|
package/dist/tasks/migrate.js
CHANGED
|
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const utils_fs_1 = require("@ionic/utils-fs");
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
const rimraf_1 = tslib_1.__importDefault(require("rimraf"));
|
|
8
|
+
const semver_1 = require("semver");
|
|
8
9
|
const common_1 = require("../android/common");
|
|
9
10
|
const colors_1 = tslib_1.__importDefault(require("../colors"));
|
|
10
11
|
const common_2 = require("../common");
|
|
@@ -34,7 +35,6 @@ const plugins = [
|
|
|
34
35
|
'@capacitor/dialog',
|
|
35
36
|
'@capacitor/filesystem',
|
|
36
37
|
'@capacitor/geolocation',
|
|
37
|
-
'@capacitor/google-maps',
|
|
38
38
|
'@capacitor/haptics',
|
|
39
39
|
'@capacitor/keyboard',
|
|
40
40
|
'@capacitor/local-notifications',
|
|
@@ -50,8 +50,8 @@ const plugins = [
|
|
|
50
50
|
'@capacitor/text-zoom',
|
|
51
51
|
'@capacitor/toast',
|
|
52
52
|
];
|
|
53
|
-
const coreVersion = '
|
|
54
|
-
const pluginVersion = '
|
|
53
|
+
const coreVersion = '^6.0.0';
|
|
54
|
+
const pluginVersion = '^6.0.0';
|
|
55
55
|
const gradleVersion = '8.2.1';
|
|
56
56
|
let installFailed = false;
|
|
57
57
|
async function migrateCommand(config, noprompt, packagemanager) {
|
|
@@ -74,7 +74,7 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
74
74
|
...config.app.package.dependencies,
|
|
75
75
|
...config.app.package.devDependencies,
|
|
76
76
|
};
|
|
77
|
-
const monorepoWarning = 'Please note this tool is not intended for use in a mono-repo
|
|
77
|
+
const monorepoWarning = 'Please note this tool is not intended for use in a mono-repo environment, please check out the Ionic vscode extension for this functionality.';
|
|
78
78
|
log_1.logger.info(monorepoWarning);
|
|
79
79
|
const { migrateconfirm } = noprompt
|
|
80
80
|
? { migrateconfirm: 'y' }
|
|
@@ -89,7 +89,7 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
89
89
|
try {
|
|
90
90
|
const { depInstallConfirm } = noprompt
|
|
91
91
|
? { depInstallConfirm: 'y' }
|
|
92
|
-
: await (0, log_1.logPrompt)(`Would you like the migrator to run npm, yarn, or
|
|
92
|
+
: await (0, log_1.logPrompt)(`Would you like the migrator to run npm, yarn, pnpm, or bun install to install the latest versions of capacitor packages? (Those using other package managers should answer N)`, {
|
|
93
93
|
type: 'text',
|
|
94
94
|
name: 'depInstallConfirm',
|
|
95
95
|
message: `Run Dependency Install? (Y/n)`,
|
|
@@ -109,6 +109,7 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
109
109
|
{ title: 'NPM', value: 'npm' },
|
|
110
110
|
{ title: 'Yarn', value: 'yarn' },
|
|
111
111
|
{ title: 'PNPM', value: 'pnpm' },
|
|
112
|
+
{ title: 'Bun', value: 'bun' },
|
|
112
113
|
],
|
|
113
114
|
initial: 0,
|
|
114
115
|
});
|
|
@@ -134,6 +135,25 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
134
135
|
}
|
|
135
136
|
if (allDependencies['@capacitor/android'] &&
|
|
136
137
|
(0, utils_fs_1.existsSync)(config.android.platformDirAbs)) {
|
|
138
|
+
const gradleWrapperVersion = getGradleWrapperVersion((0, path_1.join)(config.android.platformDirAbs, 'gradle', 'wrapper', 'gradle-wrapper.properties'));
|
|
139
|
+
if (!installFailed && (0, semver_1.gt)(gradleVersion, gradleWrapperVersion)) {
|
|
140
|
+
try {
|
|
141
|
+
await (0, common_2.runTask)(`Upgrading gradle wrapper files`, () => {
|
|
142
|
+
return updateGradleWrapperFiles(config.android.platformDirAbs);
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
catch (e) {
|
|
146
|
+
if (e.includes('EACCES')) {
|
|
147
|
+
log_1.logger.error(`gradlew file does not have executable permissions. This can happen if the Android platform was added on a Windows machine. Please run ${colors_1.default.input(`chmod +x ./${config.android.platformDir}/gradlew`)} and ${colors_1.default.input(`cd ${config.android.platformDir} && ./gradlew wrapper --distribution-type all --gradle-version ${gradleVersion} --warning-mode all`)} to update the files manually`);
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
log_1.logger.error(`gradle wrapper files were not updated`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
log_1.logger.warn('Skipped upgrading gradle wrapper files');
|
|
156
|
+
}
|
|
137
157
|
await (0, common_2.runTask)(`Migrating build.gradle file.`, () => {
|
|
138
158
|
return updateBuildGradle((0, path_1.join)(config.android.platformDirAbs, 'build.gradle'), variablesAndClasspaths);
|
|
139
159
|
});
|
|
@@ -153,10 +173,6 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
153
173
|
}
|
|
154
174
|
})();
|
|
155
175
|
});
|
|
156
|
-
// Update gradle-wrapper.properties
|
|
157
|
-
await (0, common_2.runTask)(`Migrating gradle-wrapper.properties by updating gradle version to ${gradleVersion}.`, () => {
|
|
158
|
-
return updateGradleWrapper((0, path_1.join)(config.android.platformDirAbs, 'gradle', 'wrapper', 'gradle-wrapper.properties'));
|
|
159
|
-
});
|
|
160
176
|
// Variables gradle
|
|
161
177
|
await (0, common_2.runTask)(`Migrating variables.gradle file.`, () => {
|
|
162
178
|
return (async () => {
|
|
@@ -217,27 +233,6 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
217
233
|
else {
|
|
218
234
|
log_1.logger.warn('Skipped Running cap sync.');
|
|
219
235
|
}
|
|
220
|
-
if (allDependencies['@capacitor/android'] &&
|
|
221
|
-
(0, utils_fs_1.existsSync)(config.android.platformDirAbs)) {
|
|
222
|
-
if (!installFailed) {
|
|
223
|
-
try {
|
|
224
|
-
await (0, common_2.runTask)(`Upgrading gradle wrapper files`, () => {
|
|
225
|
-
return updateGradleWrapperFiles(config.android.platformDirAbs);
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
catch (e) {
|
|
229
|
-
if (e.includes('EACCES')) {
|
|
230
|
-
log_1.logger.error(`gradlew file does not have executable permissions. This can happen if the Android platform was added on a Windows machine. Please run ${colors_1.default.input(`chmod +x ./${config.android.platformDir}/gradlew`)} and ${colors_1.default.input(`cd ${config.android.platformDir} && ./gradlew wrapper --distribution-type all --gradle-version ${gradleVersion} --warning-mode all`)} to update the files manually`);
|
|
231
|
-
}
|
|
232
|
-
else {
|
|
233
|
-
log_1.logger.error(`gradle wrapper files were not updated`);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
else {
|
|
238
|
-
log_1.logger.warn('Skipped upgrading gradle wrapper files');
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
236
|
// Write all breaking changes
|
|
242
237
|
await (0, common_2.runTask)(`Writing breaking changes.`, () => {
|
|
243
238
|
return writeBreakingChanges();
|
|
@@ -367,15 +362,15 @@ function readFile(filename) {
|
|
|
367
362
|
log_1.logger.error(`Unable to read ${filename}. Verify it is not already open. ${err}`);
|
|
368
363
|
}
|
|
369
364
|
}
|
|
370
|
-
|
|
365
|
+
function getGradleWrapperVersion(filename) {
|
|
366
|
+
var _a;
|
|
371
367
|
const txt = readFile(filename);
|
|
372
368
|
if (!txt) {
|
|
373
|
-
return;
|
|
369
|
+
return '0.0.0';
|
|
374
370
|
}
|
|
375
|
-
const
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
(0, utils_fs_1.writeFileSync)(filename, replaced, 'utf-8');
|
|
371
|
+
const version = txt.substring(txt.indexOf('gradle-') + 7, txt.indexOf('-all.zip'));
|
|
372
|
+
const semverVersion = (_a = (0, semver_1.coerce)(version)) === null || _a === void 0 ? void 0 : _a.version;
|
|
373
|
+
return semverVersion ? semverVersion : '0.0.0';
|
|
379
374
|
}
|
|
380
375
|
async function updateGradleWrapperFiles(platformDir) {
|
|
381
376
|
await (0, subprocess_1.runCommand)(`./gradlew`, [
|
|
@@ -443,10 +438,9 @@ async function updateBuildGradle(filename, variablesAndClasspaths) {
|
|
|
443
438
|
let replaced = txt;
|
|
444
439
|
for (const dep of Object.keys(neededDeps)) {
|
|
445
440
|
if (replaced.includes(`classpath '${dep}`)) {
|
|
446
|
-
const semver = await Promise.resolve().then(() => tslib_1.__importStar(require('semver')));
|
|
447
441
|
const firstIndex = replaced.indexOf(dep) + dep.length + 1;
|
|
448
442
|
const existingVersion = '' + replaced.substring(firstIndex, replaced.indexOf("'", firstIndex));
|
|
449
|
-
if (
|
|
443
|
+
if ((0, semver_1.gte)(neededDeps[dep], existingVersion)) {
|
|
450
444
|
replaced = setAllStringIn(replaced, `classpath '${dep}:`, `'`, neededDeps[dep]);
|
|
451
445
|
log_1.logger.info(`Set ${dep} = ${neededDeps[dep]}.`);
|
|
452
446
|
}
|
package/dist/util/iosplugin.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.writePluginJSON = exports.findPluginClasses = exports.getPluginFiles = void 0;
|
|
3
|
+
exports.generateIOSPackageJSON = exports.writePluginJSON = exports.findPluginClasses = exports.getPluginFiles = void 0;
|
|
4
4
|
const utils_fs_1 = require("@ionic/utils-fs");
|
|
5
5
|
const path_1 = require("path");
|
|
6
|
+
const cordova_1 = require("../cordova");
|
|
7
|
+
const plugin_1 = require("../plugin");
|
|
6
8
|
async function getPluginFiles(plugins) {
|
|
7
|
-
var _a
|
|
9
|
+
var _a;
|
|
8
10
|
let filenameList = [];
|
|
9
11
|
const options = {
|
|
10
12
|
filter: item => {
|
|
@@ -17,8 +19,8 @@ async function getPluginFiles(plugins) {
|
|
|
17
19
|
},
|
|
18
20
|
};
|
|
19
21
|
for (const plugin of plugins) {
|
|
20
|
-
if (
|
|
21
|
-
const pluginPath = (0, path_1.resolve)(plugin.rootPath, (
|
|
22
|
+
if (plugin.ios && (0, plugin_1.getPluginType)(plugin, 'ios') === 0 /* PluginType.Core */) {
|
|
23
|
+
const pluginPath = (0, path_1.resolve)(plugin.rootPath, (_a = plugin.ios) === null || _a === void 0 ? void 0 : _a.path);
|
|
22
24
|
const filenames = await (0, utils_fs_1.readdirp)(pluginPath, options);
|
|
23
25
|
filenameList = filenameList.concat(filenames);
|
|
24
26
|
}
|
|
@@ -51,3 +53,13 @@ async function writePluginJSON(config, classList) {
|
|
|
51
53
|
(0, utils_fs_1.writeJSONSync)(capJSONFile, capJSON, { spaces: '\t' });
|
|
52
54
|
}
|
|
53
55
|
exports.writePluginJSON = writePluginJSON;
|
|
56
|
+
async function generateIOSPackageJSON(config, plugins) {
|
|
57
|
+
const fileList = await getPluginFiles(plugins);
|
|
58
|
+
const classList = await findPluginClasses(fileList);
|
|
59
|
+
const cordovaPlugins = await (0, cordova_1.getCordovaPlugins)(config, 'ios');
|
|
60
|
+
if (cordovaPlugins.length > 0) {
|
|
61
|
+
classList.push('CDVPlugin');
|
|
62
|
+
}
|
|
63
|
+
writePluginJSON(config, classList);
|
|
64
|
+
}
|
|
65
|
+
exports.generateIOSPackageJSON = generateIOSPackageJSON;
|
package/dist/util/spm.js
CHANGED
|
@@ -20,6 +20,7 @@ exports.findPackageSwiftFile = findPackageSwiftFile;
|
|
|
20
20
|
async function generatePackageFile(config, plugins) {
|
|
21
21
|
const packageSwiftFile = await findPackageSwiftFile(config);
|
|
22
22
|
try {
|
|
23
|
+
log_1.logger.warn('SPM Support is still experimental');
|
|
23
24
|
const textToWrite = generatePackageText(config, plugins);
|
|
24
25
|
(0, utils_fs_1.writeFileSync)(packageSwiftFile, textToWrite);
|
|
25
26
|
}
|
|
@@ -43,7 +44,7 @@ let package = Package(
|
|
|
43
44
|
targets: ["CapApp-SPM"])
|
|
44
45
|
],
|
|
45
46
|
dependencies: [
|
|
46
|
-
.package(url: "https://github.com/ionic-team/capacitor-
|
|
47
|
+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", branch: "main")`;
|
|
47
48
|
for (const plugin of plugins) {
|
|
48
49
|
const relPath = (0, path_1.relative)(config.ios.nativeXcodeProjDirAbs, plugin.rootPath);
|
|
49
50
|
packageSwiftText += `,\n .package(name: "${(_a = plugin.ios) === null || _a === void 0 ? void 0 : _a.name}", path: "${relPath}")`;
|
|
@@ -54,8 +55,8 @@ let package = Package(
|
|
|
54
55
|
.target(
|
|
55
56
|
name: "CapApp-SPM",
|
|
56
57
|
dependencies: [
|
|
57
|
-
.product(name: "Capacitor", package: "capacitor-
|
|
58
|
-
.product(name: "Cordova", package: "capacitor-
|
|
58
|
+
.product(name: "Capacitor", package: "capacitor-swift-pm"),
|
|
59
|
+
.product(name: "Cordova", package: "capacitor-swift-pm")`;
|
|
59
60
|
for (const plugin of plugins) {
|
|
60
61
|
packageSwiftText += `,\n .product(name: "${(_b = plugin.ios) === null || _b === void 0 ? void 0 : _b.name}", package: "${(_c = plugin.ios) === null || _c === void 0 ? void 0 : _c.name}")`;
|
|
61
62
|
}
|
package/package.json
CHANGED