@capacitor/cli 6.0.0-rc.0 → 6.0.0-rc.1
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/android/run.js +1 -1
- package/dist/common.js +6 -1
- package/dist/config.js +9 -10
- package/dist/index.js +6 -2
- package/dist/ios/build.js +16 -2
- package/dist/ios/run.js +20 -5
- package/dist/tasks/build.js +1 -0
- package/dist/tasks/copy.js +0 -5
- package/dist/tasks/migrate.js +5 -5
- package/dist/util/node.js +5 -0
- package/dist/util/spm.js +48 -62
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/android/build.js
CHANGED
package/dist/android/run.js
CHANGED
|
@@ -30,7 +30,7 @@ async function runAndroid(config, { target: selectedTarget, flavor: selectedFlav
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
const pathToApk = `${config.android.platformDirAbs}/${config.android.appDir}/build/outputs/apk${runFlavor !== '' ? '/' + runFlavor : ''}/debug`;
|
|
33
|
-
const apkName =
|
|
33
|
+
const apkName = (0, common_1.parseApkNameFromFlavor)(runFlavor);
|
|
34
34
|
const apkPath = (0, path_1.resolve)(pathToApk, apkName);
|
|
35
35
|
const nativeRunArgs = ['android', '--app', apkPath, '--target', target.id];
|
|
36
36
|
if (selectedPorts) {
|
package/dist/common.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.checkJDKMajorVersion = exports.resolvePlatform = exports.checkPlatformVersions = exports.getAddedPlatforms = exports.getPlatformTargetName = exports.promptForPlatformTarget = exports.promptForPlatform = exports.isValidEnterprisePlatform = exports.getKnownEnterprisePlatforms = exports.isValidCommunityPlatform = exports.getKnownCommunityPlatforms = exports.isValidPlatform = exports.getKnownPlatforms = exports.selectPlatforms = exports.getProjectPlatformDirectory = exports.getCLIVersion = exports.getCoreVersion = exports.getCapacitorPackageVersion = exports.requireCapacitorPackage = exports.getCapacitorPackage = exports.runTask = exports.runPlatformHook = exports.wait = exports.checkAppName = exports.checkAppId = exports.checkAppDir = exports.checkAppConfig = exports.checkCapacitorPlatform = exports.checkPackage = exports.checkWebDir = exports.check = void 0;
|
|
3
|
+
exports.parseApkNameFromFlavor = exports.checkJDKMajorVersion = exports.resolvePlatform = exports.checkPlatformVersions = exports.getAddedPlatforms = exports.getPlatformTargetName = exports.promptForPlatformTarget = exports.promptForPlatform = exports.isValidEnterprisePlatform = exports.getKnownEnterprisePlatforms = exports.isValidCommunityPlatform = exports.getKnownCommunityPlatforms = exports.isValidPlatform = exports.getKnownPlatforms = exports.selectPlatforms = exports.getProjectPlatformDirectory = exports.getCLIVersion = exports.getCoreVersion = exports.getCapacitorPackageVersion = exports.requireCapacitorPackage = exports.getCapacitorPackage = exports.runTask = exports.runPlatformHook = exports.wait = exports.checkAppName = exports.checkAppId = exports.checkAppDir = exports.checkAppConfig = exports.checkCapacitorPlatform = exports.checkPackage = exports.checkWebDir = exports.check = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const utils_fs_1 = require("@ionic/utils-fs");
|
|
6
6
|
const utils_terminal_1 = require("@ionic/utils-terminal");
|
|
@@ -391,3 +391,8 @@ async function checkJDKMajorVersion() {
|
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
393
|
exports.checkJDKMajorVersion = checkJDKMajorVersion;
|
|
394
|
+
function parseApkNameFromFlavor(flavor) {
|
|
395
|
+
const convertedName = flavor.replace(/([A-Z])/g, '-$1').toLowerCase();
|
|
396
|
+
return `app-${convertedName ? `${convertedName}-` : ''}debug.apk`;
|
|
397
|
+
}
|
|
398
|
+
exports.parseApkNameFromFlavor = parseApkNameFromFlavor;
|
package/dist/config.js
CHANGED
|
@@ -6,6 +6,7 @@ const utils_fs_1 = require("@ionic/utils-fs");
|
|
|
6
6
|
const debug_1 = tslib_1.__importDefault(require("debug"));
|
|
7
7
|
const path_1 = require("path");
|
|
8
8
|
const colors_1 = tslib_1.__importDefault(require("./colors"));
|
|
9
|
+
const common_1 = require("./common");
|
|
9
10
|
const errors_1 = require("./errors");
|
|
10
11
|
const log_1 = require("./log");
|
|
11
12
|
const fn_1 = require("./util/fn");
|
|
@@ -166,7 +167,7 @@ async function loadCLIConfig(rootDir) {
|
|
|
166
167
|
};
|
|
167
168
|
}
|
|
168
169
|
async function loadAndroidConfig(rootDir, extConfig, cliConfig) {
|
|
169
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s
|
|
170
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
170
171
|
const name = 'android';
|
|
171
172
|
const platformDir = (_b = (_a = extConfig.android) === null || _a === void 0 ? void 0 : _a.path) !== null && _b !== void 0 ? _b : 'android';
|
|
172
173
|
const platformDirAbs = (0, path_1.resolve)(rootDir, platformDir);
|
|
@@ -177,23 +178,21 @@ async function loadAndroidConfig(rootDir, extConfig, cliConfig) {
|
|
|
177
178
|
const webDir = `${assetsDir}/public`;
|
|
178
179
|
const resDir = `${srcMainDir}/res`;
|
|
179
180
|
let apkPath = `${appDir}/build/outputs/apk/`;
|
|
180
|
-
let flavorPrefix = '';
|
|
181
181
|
const flavor = ((_c = extConfig.android) === null || _c === void 0 ? void 0 : _c.flavor) || '';
|
|
182
182
|
if ((_d = extConfig.android) === null || _d === void 0 ? void 0 : _d.flavor) {
|
|
183
183
|
apkPath = `${apkPath}/${(_e = extConfig.android) === null || _e === void 0 ? void 0 : _e.flavor}`;
|
|
184
|
-
flavorPrefix = `-${(_f = extConfig.android) === null || _f === void 0 ? void 0 : _f.flavor}`;
|
|
185
184
|
}
|
|
186
|
-
const apkName =
|
|
185
|
+
const apkName = (0, common_1.parseApkNameFromFlavor)(flavor);
|
|
187
186
|
const buildOutputDir = `${apkPath}/debug`;
|
|
188
187
|
const cordovaPluginsDir = 'capacitor-cordova-android-plugins';
|
|
189
188
|
const studioPath = (0, promise_1.lazy)(() => determineAndroidStudioPath(cliConfig.os));
|
|
190
189
|
const buildOptions = {
|
|
191
|
-
keystorePath: (
|
|
192
|
-
keystorePassword: (
|
|
193
|
-
keystoreAlias: (
|
|
194
|
-
keystoreAliasPassword: (
|
|
195
|
-
signingType: (
|
|
196
|
-
releaseType: (
|
|
190
|
+
keystorePath: (_g = (_f = extConfig.android) === null || _f === void 0 ? void 0 : _f.buildOptions) === null || _g === void 0 ? void 0 : _g.keystorePath,
|
|
191
|
+
keystorePassword: (_j = (_h = extConfig.android) === null || _h === void 0 ? void 0 : _h.buildOptions) === null || _j === void 0 ? void 0 : _j.keystorePassword,
|
|
192
|
+
keystoreAlias: (_l = (_k = extConfig.android) === null || _k === void 0 ? void 0 : _k.buildOptions) === null || _l === void 0 ? void 0 : _l.keystoreAlias,
|
|
193
|
+
keystoreAliasPassword: (_o = (_m = extConfig.android) === null || _m === void 0 ? void 0 : _m.buildOptions) === null || _o === void 0 ? void 0 : _o.keystoreAliasPassword,
|
|
194
|
+
signingType: (_q = (_p = extConfig.android) === null || _p === void 0 ? void 0 : _p.buildOptions) === null || _q === void 0 ? void 0 : _q.signingType,
|
|
195
|
+
releaseType: (_s = (_r = extConfig.android) === null || _r === void 0 ? void 0 : _r.buildOptions) === null || _s === void 0 ? void 0 : _s.releaseType,
|
|
197
196
|
};
|
|
198
197
|
return {
|
|
199
198
|
name,
|
package/dist/index.js
CHANGED
|
@@ -95,10 +95,11 @@ function runProgram(config) {
|
|
|
95
95
|
.option('--keystorepath <keystorePath>', 'Path to the keystore')
|
|
96
96
|
.option('--keystorepass <keystorePass>', 'Password to the keystore')
|
|
97
97
|
.option('--keystorealias <keystoreAlias>', 'Key Alias in the keystore')
|
|
98
|
+
.option('--configuration <name>', 'Configuration name of the iOS Scheme')
|
|
98
99
|
.option('--keystorealiaspass <keystoreAliasPass>', 'Password for the Key Alias')
|
|
99
100
|
.addOption(new commander_1.Option('--androidreleasetype <androidreleasetype>', 'Android release type; APK or AAB').choices(['AAB', 'APK']))
|
|
100
101
|
.addOption(new commander_1.Option('--signing-type <signingtype>', 'Program used to sign apps (default: jarsigner)').choices(['apksigner', 'jarsigner']))
|
|
101
|
-
.action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { scheme, flavor, keystorepath, keystorepass, keystorealias, keystorealiaspass, androidreleasetype, signingType, }) => {
|
|
102
|
+
.action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { scheme, flavor, keystorepath, keystorepass, keystorealias, keystorealiaspass, androidreleasetype, signingType, configuration, }) => {
|
|
102
103
|
const { buildCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/build')));
|
|
103
104
|
await buildCommand(config, platform, {
|
|
104
105
|
scheme,
|
|
@@ -109,6 +110,7 @@ function runProgram(config) {
|
|
|
109
110
|
keystorealiaspass,
|
|
110
111
|
androidreleasetype,
|
|
111
112
|
signingtype: signingType,
|
|
113
|
+
configuration,
|
|
112
114
|
});
|
|
113
115
|
})));
|
|
114
116
|
commander_1.program
|
|
@@ -125,7 +127,8 @@ function runProgram(config) {
|
|
|
125
127
|
.option('-l, --live-reload', 'Enable Live Reload')
|
|
126
128
|
.option('--host <host>', 'Host used for live reload')
|
|
127
129
|
.option('--port <port>', 'Port used for live reload')
|
|
128
|
-
.
|
|
130
|
+
.option('--configuration <name>', 'Configuration name of the iOS Scheme')
|
|
131
|
+
.action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { scheme, flavor, list, target, sync, forwardPorts, liveReload, host, port, configuration, }) => {
|
|
129
132
|
const { runCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/run')));
|
|
130
133
|
await runCommand(config, platform, {
|
|
131
134
|
scheme,
|
|
@@ -137,6 +140,7 @@ function runProgram(config) {
|
|
|
137
140
|
liveReload,
|
|
138
141
|
host,
|
|
139
142
|
port,
|
|
143
|
+
configuration,
|
|
140
144
|
});
|
|
141
145
|
})));
|
|
142
146
|
commander_1.program
|
package/dist/ios/build.js
CHANGED
|
@@ -7,13 +7,25 @@ const path_1 = require("path");
|
|
|
7
7
|
const rimraf_1 = tslib_1.__importDefault(require("rimraf"));
|
|
8
8
|
const common_1 = require("../common");
|
|
9
9
|
const log_1 = require("../log");
|
|
10
|
+
const spm_1 = require("../util/spm");
|
|
10
11
|
const subprocess_1 = require("../util/subprocess");
|
|
11
12
|
async function buildiOS(config, buildOptions) {
|
|
12
13
|
var _a;
|
|
13
14
|
const theScheme = (_a = buildOptions.scheme) !== null && _a !== void 0 ? _a : 'App';
|
|
15
|
+
const packageManager = await (0, spm_1.checkPackageManager)(config);
|
|
16
|
+
let typeOfBuild;
|
|
17
|
+
let projectName;
|
|
18
|
+
if (packageManager == 'Cocoapods') {
|
|
19
|
+
typeOfBuild = '-workspace';
|
|
20
|
+
projectName = (0, path_1.basename)(await config.ios.nativeXcodeWorkspaceDirAbs);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
typeOfBuild = '-project';
|
|
24
|
+
projectName = (0, path_1.basename)(await config.ios.nativeXcodeProjDirAbs);
|
|
25
|
+
}
|
|
14
26
|
await (0, common_1.runTask)('Building xArchive', async () => (0, subprocess_1.runCommand)('xcodebuild', [
|
|
15
|
-
|
|
16
|
-
|
|
27
|
+
typeOfBuild,
|
|
28
|
+
projectName,
|
|
17
29
|
'-scheme',
|
|
18
30
|
`${theScheme}`,
|
|
19
31
|
'-destination',
|
|
@@ -44,6 +56,8 @@ async function buildiOS(config, buildOptions) {
|
|
|
44
56
|
'-exportPath',
|
|
45
57
|
'output',
|
|
46
58
|
'-allowProvisioningUpdates',
|
|
59
|
+
'-configuration',
|
|
60
|
+
buildOptions.configuration,
|
|
47
61
|
], {
|
|
48
62
|
cwd: config.ios.nativeProjectDirAbs,
|
|
49
63
|
}));
|
package/dist/ios/run.js
CHANGED
|
@@ -7,19 +7,32 @@ const path_1 = require("path");
|
|
|
7
7
|
const colors_1 = tslib_1.__importDefault(require("../colors"));
|
|
8
8
|
const common_1 = require("../common");
|
|
9
9
|
const native_run_1 = require("../util/native-run");
|
|
10
|
+
const spm_1 = require("../util/spm");
|
|
10
11
|
const subprocess_1 = require("../util/subprocess");
|
|
11
12
|
const debug = (0, debug_1.default)('capacitor:ios:run');
|
|
12
|
-
async function runIOS(config, { target: selectedTarget, scheme: selectedScheme }) {
|
|
13
|
+
async function runIOS(config, { target: selectedTarget, scheme: selectedScheme, configuration: selectedConfiguration, }) {
|
|
13
14
|
const target = await (0, common_1.promptForPlatformTarget)(await (0, native_run_1.getPlatformTargets)('ios'), selectedTarget);
|
|
14
15
|
const runScheme = selectedScheme || config.ios.scheme;
|
|
16
|
+
const configuration = selectedConfiguration || 'Debug';
|
|
15
17
|
const derivedDataPath = (0, path_1.resolve)(config.ios.platformDirAbs, 'DerivedData', target.id);
|
|
18
|
+
const packageManager = await (0, spm_1.checkPackageManager)(config);
|
|
19
|
+
let typeOfBuild;
|
|
20
|
+
let projectName;
|
|
21
|
+
if (packageManager == 'Cocoapods') {
|
|
22
|
+
typeOfBuild = '-workspace';
|
|
23
|
+
projectName = (0, path_1.basename)(await config.ios.nativeXcodeWorkspaceDirAbs);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
typeOfBuild = '-project';
|
|
27
|
+
projectName = (0, path_1.basename)(await config.ios.nativeXcodeProjDirAbs);
|
|
28
|
+
}
|
|
16
29
|
const xcodebuildArgs = [
|
|
17
|
-
|
|
18
|
-
|
|
30
|
+
typeOfBuild,
|
|
31
|
+
projectName,
|
|
19
32
|
'-scheme',
|
|
20
33
|
runScheme,
|
|
21
34
|
'-configuration',
|
|
22
|
-
|
|
35
|
+
configuration,
|
|
23
36
|
'-destination',
|
|
24
37
|
`id=${target.id}`,
|
|
25
38
|
'-derivedDataPath',
|
|
@@ -30,7 +43,9 @@ async function runIOS(config, { target: selectedTarget, scheme: selectedScheme }
|
|
|
30
43
|
cwd: config.ios.nativeProjectDirAbs,
|
|
31
44
|
}));
|
|
32
45
|
const appName = `${runScheme}.app`;
|
|
33
|
-
const appPath = (0, path_1.resolve)(derivedDataPath, 'Build/Products', target.virtual
|
|
46
|
+
const appPath = (0, path_1.resolve)(derivedDataPath, 'Build/Products', target.virtual
|
|
47
|
+
? `${configuration}-iphonesimulator`
|
|
48
|
+
: `${configuration}-iphoneos`, appName);
|
|
34
49
|
const nativeRunArgs = ['ios', '--app', appPath, '--target', target.id];
|
|
35
50
|
debug('Invoking native-run with args: %O', nativeRunArgs);
|
|
36
51
|
await (0, common_1.runTask)(`Deploying ${colors_1.default.strong(appName)} to ${colors_1.default.input(target.id)}`, async () => (0, native_run_1.runNativeRun)(nativeRunArgs));
|
package/dist/tasks/build.js
CHANGED
|
@@ -29,6 +29,7 @@ async function buildCommand(config, selectedPlatformName, buildOptions) {
|
|
|
29
29
|
signingtype: buildOptions.signingtype ||
|
|
30
30
|
config.android.buildOptions.signingType ||
|
|
31
31
|
'jarsigner',
|
|
32
|
+
configuration: buildOptions.configuration || 'Release',
|
|
32
33
|
};
|
|
33
34
|
try {
|
|
34
35
|
await build(config, platformName, buildCommandOptions);
|
package/dist/tasks/copy.js
CHANGED
|
@@ -193,11 +193,6 @@ async function copySSLCert(sslCertPaths, rootDir, targetDir) {
|
|
|
193
193
|
const validCertPaths = [];
|
|
194
194
|
for (const sslCertPath of sslCertPaths) {
|
|
195
195
|
const certAbsFromPath = (0, path_1.join)(rootDir, sslCertPath);
|
|
196
|
-
if (!/^.+\.(cer)$/.test(certAbsFromPath)) {
|
|
197
|
-
log_1.logger.warn(`Cannot copy file from ${colors_1.default.strong(certAbsFromPath)}\n` +
|
|
198
|
-
`The file is not a .cer SSL Certificate file.`);
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
196
|
if (!(await (0, utils_fs_1.pathExists)(certAbsFromPath))) {
|
|
202
197
|
log_1.logger.warn(`Cannot copy SSL Certificate file from ${colors_1.default.strong(certAbsFromPath)}\n` +
|
|
203
198
|
`SSL Certificate does not exist at specified path.`);
|
package/dist/tasks/migrate.js
CHANGED
|
@@ -181,15 +181,15 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
181
181
|
}
|
|
182
182
|
const pluginVariables = {
|
|
183
183
|
firebaseMessagingVersion: '23.3.1',
|
|
184
|
-
playServicesLocationVersion: '21.0
|
|
184
|
+
playServicesLocationVersion: '21.1.0',
|
|
185
185
|
androidxBrowserVersion: '1.7.0',
|
|
186
186
|
androidxMaterialVersion: '1.10.0',
|
|
187
187
|
androidxExifInterfaceVersion: '1.3.6',
|
|
188
188
|
androidxCoreKTXVersion: '1.12.0',
|
|
189
|
-
googleMapsPlayServicesVersion: '18.
|
|
190
|
-
googleMapsUtilsVersion: '3.
|
|
191
|
-
googleMapsKtxVersion: '
|
|
192
|
-
googleMapsUtilsKtxVersion: '
|
|
189
|
+
googleMapsPlayServicesVersion: '18.2.0',
|
|
190
|
+
googleMapsUtilsVersion: '3.8.2',
|
|
191
|
+
googleMapsKtxVersion: '5.0.0',
|
|
192
|
+
googleMapsUtilsKtxVersion: '5.0.0',
|
|
193
193
|
kotlinxCoroutinesVersion: '1.7.3',
|
|
194
194
|
coreSplashScreenVersion: '1.0.1',
|
|
195
195
|
};
|
package/dist/util/node.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveNode = exports.requireTS = void 0;
|
|
4
4
|
const utils_fs_1 = require("@ionic/utils-fs");
|
|
5
|
+
const fs_1 = require("fs");
|
|
5
6
|
const path_1 = require("path");
|
|
6
7
|
/**
|
|
7
8
|
* @see https://github.com/ionic-team/stencil/blob/HEAD/src/compiler/sys/node-require.ts
|
|
@@ -43,6 +44,10 @@ function resolveNode(root, ...pathSegments) {
|
|
|
43
44
|
return require.resolve(pathSegments.join('/'), { paths: [root] });
|
|
44
45
|
}
|
|
45
46
|
catch (e) {
|
|
47
|
+
const path = [root, 'node_modules', ...pathSegments].join('/');
|
|
48
|
+
if ((0, fs_1.existsSync)(path)) {
|
|
49
|
+
return path;
|
|
50
|
+
}
|
|
46
51
|
return null;
|
|
47
52
|
}
|
|
48
53
|
}
|
package/dist/util/spm.js
CHANGED
|
@@ -1,83 +1,69 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.generatePackageFile = exports.findPackageSwiftFile = exports.checkPackageManager = void 0;
|
|
4
4
|
const utils_fs_1 = require("@ionic/utils-fs");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const log_1 = require("../log");
|
|
7
|
+
async function checkPackageManager(config) {
|
|
8
|
+
const iosDirectory = config.ios.nativeProjectDirAbs;
|
|
9
|
+
if ((0, utils_fs_1.existsSync)((0, path_1.resolve)(iosDirectory, 'CapApp-SPM'))) {
|
|
10
|
+
return 'SPM';
|
|
11
|
+
}
|
|
12
|
+
return 'Cocoapods';
|
|
13
|
+
}
|
|
14
|
+
exports.checkPackageManager = checkPackageManager;
|
|
7
15
|
async function findPackageSwiftFile(config) {
|
|
8
16
|
const packageDirectory = (0, path_1.resolve)(config.ios.nativeProjectDirAbs, 'CapApp-SPM');
|
|
9
17
|
return (0, path_1.resolve)(packageDirectory, 'Package.swift');
|
|
10
18
|
}
|
|
11
19
|
exports.findPackageSwiftFile = findPackageSwiftFile;
|
|
12
|
-
function readSwiftPackage(packageLine) {
|
|
13
|
-
const packageRegex = RegExp(/.package\(\s*name:\s*"([A-Za-z0-9_-]+)"/);
|
|
14
|
-
const lineMatch = packageLine.match(packageRegex);
|
|
15
|
-
if (lineMatch === null) {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
return lineMatch[1];
|
|
19
|
-
}
|
|
20
20
|
async function generatePackageFile(config, plugins) {
|
|
21
|
-
var _a, _b;
|
|
22
|
-
const swiftPluginList = [];
|
|
23
|
-
for (const plugin of plugins) {
|
|
24
|
-
const relPath = (0, path_1.relative)(config.ios.nativeXcodeProjDirAbs, plugin.rootPath);
|
|
25
|
-
const pluginStatement = `.package(name: "${(_a = plugin.ios) === null || _a === void 0 ? void 0 : _a.name}", path: "${relPath}"),`;
|
|
26
|
-
swiftPluginList.push(pluginStatement);
|
|
27
|
-
}
|
|
28
21
|
const packageSwiftFile = await findPackageSwiftFile(config);
|
|
29
22
|
try {
|
|
30
|
-
|
|
31
|
-
log_1.logger.error(`Unable to find ${packageSwiftFile}. Try updating it manually`);
|
|
32
|
-
}
|
|
33
|
-
const packageSwiftText = (0, utils_fs_1.readFileSync)(packageSwiftFile, 'utf-8');
|
|
34
|
-
const packageSwiftTextLines = packageSwiftText.split('\n');
|
|
35
|
-
let textToWrite = '';
|
|
36
|
-
const packages = [];
|
|
37
|
-
for (const lineIndex in packageSwiftTextLines) {
|
|
38
|
-
const line = packageSwiftTextLines;
|
|
39
|
-
const index = parseInt(lineIndex);
|
|
40
|
-
if (line[index].includes('dependencies: [') &&
|
|
41
|
-
line[index + 1].includes('.package(url: "https://github.com/ionic-team/capacitor6-spm-test.git", branch: "main")')) {
|
|
42
|
-
let tempIndex = index + 1;
|
|
43
|
-
while (!line[tempIndex].includes('],')) {
|
|
44
|
-
const swiftPack = readSwiftPackage(line[tempIndex]);
|
|
45
|
-
if (swiftPack !== null) {
|
|
46
|
-
packages.push(swiftPack);
|
|
47
|
-
}
|
|
48
|
-
tempIndex++;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
if (line[index].includes('.package(url: "https://github.com/ionic-team/capacitor6-spm-test.git", branch: "main")')) {
|
|
52
|
-
if (line[index].endsWith(',')) {
|
|
53
|
-
textToWrite += line[index] + '\n';
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
textToWrite += line[index] + ',\n';
|
|
57
|
-
}
|
|
58
|
-
for (const swiftPlugin of swiftPluginList) {
|
|
59
|
-
const name = (_b = readSwiftPackage(swiftPlugin)) !== null && _b !== void 0 ? _b : '';
|
|
60
|
-
if (!packages.includes(name)) {
|
|
61
|
-
textToWrite += ' ' + swiftPlugin + '\n';
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
textToWrite += line[index] + '\n';
|
|
67
|
-
}
|
|
68
|
-
}
|
|
23
|
+
const textToWrite = generatePackageText(config, plugins);
|
|
69
24
|
(0, utils_fs_1.writeFileSync)(packageSwiftFile, textToWrite);
|
|
70
25
|
}
|
|
71
26
|
catch (err) {
|
|
72
|
-
log_1.logger.error(`Unable to
|
|
27
|
+
log_1.logger.error(`Unable to write to ${packageSwiftFile}. Verify it is not already open. \n Error: ${err}`);
|
|
73
28
|
}
|
|
74
29
|
}
|
|
75
30
|
exports.generatePackageFile = generatePackageFile;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
31
|
+
function generatePackageText(config, plugins) {
|
|
32
|
+
var _a, _b, _c;
|
|
33
|
+
let packageSwiftText = `// swift-tools-version: 5.9
|
|
34
|
+
import PackageDescription
|
|
35
|
+
|
|
36
|
+
// DO NOT MODIFY THIS FILE - managed by Capacitor CLI commands
|
|
37
|
+
let package = Package(
|
|
38
|
+
name: "CapApp-SPM",
|
|
39
|
+
platforms: [.iOS(.v13)],
|
|
40
|
+
products: [
|
|
41
|
+
.library(
|
|
42
|
+
name: "CapApp-SPM",
|
|
43
|
+
targets: ["CapApp-SPM"])
|
|
44
|
+
],
|
|
45
|
+
dependencies: [
|
|
46
|
+
.package(url: "https://github.com/ionic-team/capacitor-spm.git", branch: "main")`;
|
|
47
|
+
for (const plugin of plugins) {
|
|
48
|
+
const relPath = (0, path_1.relative)(config.ios.nativeXcodeProjDirAbs, plugin.rootPath);
|
|
49
|
+
packageSwiftText += `,\n .package(name: "${(_a = plugin.ios) === null || _a === void 0 ? void 0 : _a.name}", path: "${relPath}")`;
|
|
80
50
|
}
|
|
81
|
-
|
|
51
|
+
packageSwiftText += `
|
|
52
|
+
],
|
|
53
|
+
targets: [
|
|
54
|
+
.target(
|
|
55
|
+
name: "CapApp-SPM",
|
|
56
|
+
dependencies: [
|
|
57
|
+
.product(name: "Capacitor", package: "capacitor-spm"),
|
|
58
|
+
.product(name: "Cordova", package: "capacitor-spm")`;
|
|
59
|
+
for (const plugin of plugins) {
|
|
60
|
+
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
|
+
packageSwiftText += `
|
|
63
|
+
]
|
|
64
|
+
)
|
|
65
|
+
]
|
|
66
|
+
)
|
|
67
|
+
`;
|
|
68
|
+
return packageSwiftText;
|
|
82
69
|
}
|
|
83
|
-
exports.checkPackageManager = checkPackageManager;
|
package/package.json
CHANGED