@capacitor/cli 6.0.0-beta.2 → 6.0.0-dev-8046d907.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.
Binary file
Binary file
Binary file
Binary file
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createLocalProperties = exports.addAndroid = void 0;
3
+ exports.createLocalProperties = exports.addAndroid = exports.defaultAndroidTemplatePackage = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const utils_fs_1 = require("@ionic/utils-fs");
6
6
  const os_1 = require("os");
@@ -9,9 +9,10 @@ const colors_1 = tslib_1.__importDefault(require("../colors"));
9
9
  const common_1 = require("../common");
10
10
  const subprocess_1 = require("../util/subprocess");
11
11
  const template_1 = require("../util/template");
12
+ exports.defaultAndroidTemplatePackage = '@capacitor/android-template';
12
13
  async function addAndroid(config) {
13
14
  await (0, common_1.runTask)(`Adding native android project in ${colors_1.default.strong(config.android.platformDir)}`, async () => {
14
- return (0, template_1.extractTemplate)(config.cli.assets.android.platformTemplateArchiveAbs, config.android.platformDirAbs);
15
+ return (0, template_1.extractTemplatePackage)(config.cli.assets.android.platformTemplateArchiveAbs, config.android.platformDirAbs);
15
16
  });
16
17
  }
17
18
  exports.addAndroid = addAndroid;
@@ -29,8 +29,15 @@ async function buildAndroid(config, buildOptions) {
29
29
  throw e;
30
30
  }
31
31
  }
32
- const releasePath = (0, path_1.join)(config.android.appDirAbs, 'build', 'outputs', releaseTypeIsAAB ? 'bundle' : 'apk', buildOptions.flavor ? `${flavor}Release` : 'release');
33
- const unsignedReleaseName = `app${config.android.flavor ? `-${config.android.flavor}` : ''}-release${releaseTypeIsAAB ? '' : '-unsigned'}.${releaseType.toLowerCase()}`;
32
+ const releaseDir = releaseTypeIsAAB
33
+ ? flavor !== ''
34
+ ? `${flavor}Release`
35
+ : 'release'
36
+ : flavor !== ''
37
+ ? (0, path_1.join)(flavor, 'release')
38
+ : 'release';
39
+ const releasePath = (0, path_1.join)(config.android.appDirAbs, 'build', 'outputs', releaseTypeIsAAB ? 'bundle' : 'apk', releaseDir);
40
+ const unsignedReleaseName = `app${flavor !== '' ? `-${flavor}` : ''}-release${releaseTypeIsAAB ? '' : '-unsigned'}.${releaseType.toLowerCase()}`;
34
41
  const signedReleaseName = unsignedReleaseName.replace(`-release${releaseTypeIsAAB ? '' : '-unsigned'}.${releaseType.toLowerCase()}`, `-release-signed.${releaseType.toLowerCase()}`);
35
42
  if (buildOptions.signingtype == 'jarsigner') {
36
43
  await signWithJarSigner(config, buildOptions, releasePath, signedReleaseName, unsignedReleaseName);
@@ -56,6 +63,12 @@ async function signWithApkSigner(config, buildOptions, releasePath, signedReleas
56
63
  '--out',
57
64
  `${(0, path_1.join)(releasePath, signedReleaseName)}`,
58
65
  ];
66
+ if (buildOptions.keystorealias) {
67
+ signingArgs.push('--ks-key-alias', buildOptions.keystorealias);
68
+ }
69
+ if (buildOptions.keystorealiaspass) {
70
+ signingArgs.push('--key-pass', `pass:${buildOptions.keystorealiaspass}`);
71
+ }
59
72
  await (0, common_1.runTask)('Signing Release', async () => {
60
73
  await (0, subprocess_1.runCommand)('apksigner', signingArgs, {
61
74
  cwd: config.android.platformDirAbs,
@@ -54,6 +54,7 @@ exports.resolvePlugin = resolvePlugin;
54
54
  * This is a little trickier for Android because the appId becomes
55
55
  * the package name.
56
56
  */
57
+ // TODO: Remove
57
58
  async function editProjectSettingsAndroid(config) {
58
59
  const appId = config.app.appId;
59
60
  const appName = config.app.appName
@@ -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 = `app${runFlavor !== '' ? '-' + runFlavor : ''}-debug.apk`;
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");
@@ -78,7 +79,7 @@ async function writeConfig(extConfig, extConfigFilePath) {
78
79
  }
79
80
  exports.writeConfig = writeConfig;
80
81
  async function loadExtConfigTS(rootDir, extConfigName, extConfigFilePath) {
81
- var _a, _b;
82
+ var _a;
82
83
  try {
83
84
  const tsPath = (0, node_1.resolveNode)(rootDir, 'typescript');
84
85
  if (!tsPath) {
@@ -87,7 +88,9 @@ async function loadExtConfigTS(rootDir, extConfigName, extConfigFilePath) {
87
88
  }
88
89
  const ts = require(tsPath); // eslint-disable-line @typescript-eslint/no-var-requires
89
90
  const extConfigObject = (0, node_1.requireTS)(ts, extConfigFilePath);
90
- const extConfig = (_a = extConfigObject.default) !== null && _a !== void 0 ? _a : extConfigObject;
91
+ const extConfig = extConfigObject.default
92
+ ? await extConfigObject.default
93
+ : extConfigObject;
91
94
  return {
92
95
  extConfigType: 'ts',
93
96
  extConfigName,
@@ -97,7 +100,7 @@ async function loadExtConfigTS(rootDir, extConfigName, extConfigFilePath) {
97
100
  }
98
101
  catch (e) {
99
102
  if (!(0, errors_1.isFatal)(e)) {
100
- (0, errors_1.fatal)(`Parsing ${colors_1.default.strong(extConfigName)} failed.\n\n${(_b = e.stack) !== null && _b !== void 0 ? _b : e}`);
103
+ (0, errors_1.fatal)(`Parsing ${colors_1.default.strong(extConfigName)} failed.\n\n${(_a = e.stack) !== null && _a !== void 0 ? _a : e}`);
101
104
  }
102
105
  throw e;
103
106
  }
@@ -109,7 +112,7 @@ async function loadExtConfigJS(rootDir, extConfigName, extConfigFilePath) {
109
112
  extConfigType: 'js',
110
113
  extConfigName,
111
114
  extConfigFilePath: extConfigFilePath,
112
- extConfig: require(extConfigFilePath),
115
+ extConfig: await require(extConfigFilePath),
113
116
  };
114
117
  }
115
118
  catch (e) {
@@ -164,7 +167,7 @@ async function loadCLIConfig(rootDir) {
164
167
  };
165
168
  }
166
169
  async function loadAndroidConfig(rootDir, extConfig, cliConfig) {
167
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
170
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
168
171
  const name = 'android';
169
172
  const platformDir = (_b = (_a = extConfig.android) === null || _a === void 0 ? void 0 : _a.path) !== null && _b !== void 0 ? _b : 'android';
170
173
  const platformDirAbs = (0, path_1.resolve)(rootDir, platformDir);
@@ -175,23 +178,21 @@ async function loadAndroidConfig(rootDir, extConfig, cliConfig) {
175
178
  const webDir = `${assetsDir}/public`;
176
179
  const resDir = `${srcMainDir}/res`;
177
180
  let apkPath = `${appDir}/build/outputs/apk/`;
178
- let flavorPrefix = '';
179
181
  const flavor = ((_c = extConfig.android) === null || _c === void 0 ? void 0 : _c.flavor) || '';
180
182
  if ((_d = extConfig.android) === null || _d === void 0 ? void 0 : _d.flavor) {
181
183
  apkPath = `${apkPath}/${(_e = extConfig.android) === null || _e === void 0 ? void 0 : _e.flavor}`;
182
- flavorPrefix = `-${(_f = extConfig.android) === null || _f === void 0 ? void 0 : _f.flavor}`;
183
184
  }
184
- const apkName = `app${flavorPrefix}-debug.apk`;
185
+ const apkName = (0, common_1.parseApkNameFromFlavor)(flavor);
185
186
  const buildOutputDir = `${apkPath}/debug`;
186
187
  const cordovaPluginsDir = 'capacitor-cordova-android-plugins';
187
188
  const studioPath = (0, promise_1.lazy)(() => determineAndroidStudioPath(cliConfig.os));
188
189
  const buildOptions = {
189
- keystorePath: (_h = (_g = extConfig.android) === null || _g === void 0 ? void 0 : _g.buildOptions) === null || _h === void 0 ? void 0 : _h.keystorePath,
190
- keystorePassword: (_k = (_j = extConfig.android) === null || _j === void 0 ? void 0 : _j.buildOptions) === null || _k === void 0 ? void 0 : _k.keystorePassword,
191
- keystoreAlias: (_m = (_l = extConfig.android) === null || _l === void 0 ? void 0 : _l.buildOptions) === null || _m === void 0 ? void 0 : _m.keystoreAlias,
192
- keystoreAliasPassword: (_p = (_o = extConfig.android) === null || _o === void 0 ? void 0 : _o.buildOptions) === null || _p === void 0 ? void 0 : _p.keystoreAliasPassword,
193
- signingType: (_r = (_q = extConfig.android) === null || _q === void 0 ? void 0 : _q.buildOptions) === null || _r === void 0 ? void 0 : _r.signingType,
194
- releaseType: (_t = (_s = extConfig.android) === null || _s === void 0 ? void 0 : _s.buildOptions) === null || _t === void 0 ? void 0 : _t.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,
195
196
  };
196
197
  return {
197
198
  name,
@@ -379,7 +380,7 @@ async function determineGemfileOrCocoapodPath(rootDir, platformDir, nativeProjec
379
380
  }
380
381
  function formatConfigTS(extConfig) {
381
382
  // TODO: <reference> tags
382
- return `import { CapacitorConfig } from '@capacitor/cli';
383
+ return `import type { CapacitorConfig } from '@capacitor/cli';
383
384
 
384
385
  const config: CapacitorConfig = ${(0, js_1.formatJSObject)(extConfig)};
385
386
 
package/dist/index.js CHANGED
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runProgram = exports.run = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const commander_1 = require("commander");
6
- const path_1 = require("path");
6
+ const add_1 = require("./android/add");
7
7
  const colors_1 = tslib_1.__importDefault(require("./colors"));
8
8
  const config_1 = require("./config");
9
9
  const errors_1 = require("./errors");
10
+ const add_2 = require("./ios/add");
10
11
  const ipc_1 = require("./ipc");
11
12
  const log_1 = require("./log");
12
13
  const telemetry_1 = require("./telemetry");
@@ -95,19 +96,22 @@ function runProgram(config) {
95
96
  .option('--keystorepath <keystorePath>', 'Path to the keystore')
96
97
  .option('--keystorepass <keystorePass>', 'Password to the keystore')
97
98
  .option('--keystorealias <keystoreAlias>', 'Key Alias in the keystore')
99
+ .option('--configuration <name>', 'Configuration name of the iOS Scheme')
98
100
  .option('--keystorealiaspass <keystoreAliasPass>', 'Password for the Key Alias')
99
101
  .addOption(new commander_1.Option('--androidreleasetype <androidreleasetype>', 'Android release type; APK or AAB').choices(['AAB', 'APK']))
100
102
  .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, keystorepath, keystorepass, keystorealias, keystorealiaspass, androidreleasetype, signingType, }) => {
103
+ .action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { scheme, flavor, keystorepath, keystorepass, keystorealias, keystorealiaspass, androidreleasetype, signingType, configuration, }) => {
102
104
  const { buildCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/build')));
103
105
  await buildCommand(config, platform, {
104
106
  scheme,
107
+ flavor,
105
108
  keystorepath,
106
109
  keystorepass,
107
110
  keystorealias,
108
111
  keystorealiaspass,
109
112
  androidreleasetype,
110
113
  signingtype: signingType,
114
+ configuration,
111
115
  });
112
116
  })));
113
117
  commander_1.program
@@ -124,7 +128,8 @@ function runProgram(config) {
124
128
  .option('-l, --live-reload', 'Enable Live Reload')
125
129
  .option('--host <host>', 'Host used for live reload')
126
130
  .option('--port <port>', 'Port used for live reload')
127
- .action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { scheme, flavor, list, target, sync, forwardPorts, liveReload, host, port, }) => {
131
+ .option('--configuration <name>', 'Configuration name of the iOS Scheme')
132
+ .action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { scheme, flavor, list, target, sync, forwardPorts, liveReload, host, port, configuration, }) => {
128
133
  const { runCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/run')));
129
134
  await runCommand(config, platform, {
130
135
  scheme,
@@ -136,6 +141,7 @@ function runProgram(config) {
136
141
  liveReload,
137
142
  host,
138
143
  port,
144
+ configuration,
139
145
  });
140
146
  })));
141
147
  commander_1.program
@@ -149,15 +155,36 @@ function runProgram(config) {
149
155
  .command('add [platform]')
150
156
  .description('add a native platform project')
151
157
  .option('--packagemanager <packageManager>', 'The package manager to use for dependency installs (SPM, Cocoapods)')
152
- .action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { packagemanager }) => {
158
+ .option('--template <>', 'An external template package to use for the specified platform')
159
+ .option('--packageName <>', `A package name to use when installing a local template tgz. Defaults to the package file name`)
160
+ .action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { packagemanager, template, packageName }) => {
153
161
  (0, config_1.checkExternalConfig)(config.app);
154
- const { addCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/add')));
162
+ const { addCommand, prepareTemplate } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/add')));
155
163
  const configWritable = config;
156
- if (packagemanager === 'SPM') {
157
- configWritable.cli.assets.ios.platformTemplateArchive =
158
- 'ios-spm-template.tar.gz';
159
- configWritable.cli.assets.ios.platformTemplateArchiveAbs = (0, path_1.resolve)(configWritable.cli.assetsDirAbs, configWritable.cli.assets.ios.platformTemplateArchive);
164
+ if (!template) {
165
+ // TODO: do we need to be able to specify a particular version?
166
+ if (platform === configWritable.ios.name) {
167
+ if (packagemanager === 'SPM') {
168
+ template = add_2.defaultIOSTemplatePackageSPM;
169
+ }
170
+ else {
171
+ template = add_2.defaultIOSTemplatePackageCocoapods;
172
+ }
173
+ }
174
+ else if (platform === configWritable.android.name) {
175
+ template = add_1.defaultAndroidTemplatePackage;
176
+ }
177
+ }
178
+ // TODO: how handle SPM with custom templates?
179
+ if (platform === configWritable.ios.name) {
180
+ configWritable.cli.assets.ios.platformTemplateArchiveAbs =
181
+ await prepareTemplate(configWritable, template, packageName);
182
+ }
183
+ else if (platform === configWritable.android.name) {
184
+ configWritable.cli.assets.android.platformTemplateArchiveAbs =
185
+ await prepareTemplate(configWritable, template, packageName);
160
186
  }
187
+ // TODO: should we validate custom templates?
161
188
  await addCommand(configWritable, platform);
162
189
  })));
163
190
  commander_1.program
package/dist/ios/add.js CHANGED
@@ -1,13 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addIOS = void 0;
3
+ exports.addIOS = exports.defaultIOSTemplatePackageCocoapods = exports.defaultIOSTemplatePackageSPM = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const colors_1 = tslib_1.__importDefault(require("../colors"));
6
6
  const common_1 = require("../common");
7
7
  const template_1 = require("../util/template");
8
+ exports.defaultIOSTemplatePackageSPM = '@capacitor/ios-spm-template';
9
+ exports.defaultIOSTemplatePackageCocoapods = '@capacitor/ios-cocoapods-template';
8
10
  async function addIOS(config) {
9
11
  await (0, common_1.runTask)(`Adding native Xcode project in ${colors_1.default.strong(config.ios.platformDir)}`, () => {
10
- return (0, template_1.extractTemplate)(config.cli.assets.ios.platformTemplateArchiveAbs, config.ios.platformDirAbs);
12
+ return (0, template_1.extractTemplatePackage)(config.cli.assets.ios.platformTemplateArchiveAbs, config.ios.platformDirAbs);
11
13
  });
12
14
  }
13
15
  exports.addIOS = addIOS;
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
- '-workspace',
16
- (0, path_1.basename)(await config.ios.nativeXcodeWorkspaceDirAbs),
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
  }));
@@ -85,6 +85,7 @@ exports.resolvePlugin = resolvePlugin;
85
85
  /**
86
86
  * Update the native project files with the desired app id and app name
87
87
  */
88
+ // TODO: Remove
88
89
  async function editProjectSettingsIOS(config) {
89
90
  const appId = config.app.appId;
90
91
  const appName = config.app.appName
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
- '-workspace',
18
- (0, path_1.basename)(await config.ios.nativeXcodeWorkspaceDirAbs),
30
+ typeOfBuild,
31
+ projectName,
19
32
  '-scheme',
20
33
  runScheme,
21
34
  '-configuration',
22
- 'Debug',
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 ? 'Debug-iphonesimulator' : 'Debug-iphoneos', appName);
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));
@@ -12,6 +12,7 @@ const log_1 = require("../log");
12
12
  const plugin_1 = require("../plugin");
13
13
  const copy_1 = require("../tasks/copy");
14
14
  const fs_1 = require("../util/fs");
15
+ const iosplugin_1 = require("../util/iosplugin");
15
16
  const node_1 = require("../util/node");
16
17
  const spm_1 = require("../util/spm");
17
18
  const subprocess_1 = require("../util/subprocess");
@@ -27,6 +28,7 @@ async function updateIOS(config, deployment) {
27
28
  else {
28
29
  await updateIOSCocoaPods(config, plugins, deployment);
29
30
  }
31
+ (0, iosplugin_1.generateIOSPackageJSON)(config, plugins);
30
32
  (0, plugin_1.printPlugins)(capacitorPlugins, 'ios');
31
33
  }
32
34
  exports.updateIOS = updateIOS;
package/dist/tasks/add.js CHANGED
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addCommand = void 0;
3
+ exports.addCommand = exports.prepareTemplate = 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");
7
+ const node_path_1 = require("node:path");
7
8
  const add_1 = require("../android/add");
8
9
  const common_1 = require("../android/common");
9
10
  const colors_1 = tslib_1.__importDefault(require("../colors"));
@@ -12,7 +13,39 @@ const errors_1 = require("../errors");
12
13
  const add_2 = require("../ios/add");
13
14
  const common_3 = require("../ios/common");
14
15
  const log_1 = require("../log");
16
+ const subprocess_1 = require("../util/subprocess");
15
17
  const sync_1 = require("./sync");
18
+ async function prepareTemplate(config, template, packageName) {
19
+ // a local template file
20
+ if (template.startsWith('file://')) {
21
+ const templatePath = (0, node_path_1.resolve)(template.replace('file://', ''));
22
+ if (!(0, utils_fs_1.existsSync)(templatePath)) {
23
+ (0, errors_1.fatal)(`Template file not found at path: ${templatePath}`);
24
+ }
25
+ if (!templatePath.endsWith('.tar.gz') && !templatePath.endsWith('.tgz')) {
26
+ (0, errors_1.fatal)('Template file must be .tar.gz or .tgz');
27
+ }
28
+ log_1.logger.info(`Using local template at ${templatePath}`);
29
+ if (!packageName) {
30
+ packageName = (0, node_path_1.basename)(templatePath)
31
+ .replace('.tar.gz', '')
32
+ .replace('.tgz', '');
33
+ }
34
+ }
35
+ else {
36
+ const packageComponents = template.split(/@[~^]?([\dvx*]+(?:[-.](?:[\dx*]+|alpha|beta|rc))*)/gm);
37
+ packageName = packageComponents[0];
38
+ }
39
+ try {
40
+ log_1.logger.info(`Installing template package: ${template}`);
41
+ await (0, subprocess_1.runCommand)('npm', ['install', '--save-dev', template]);
42
+ return (0, node_path_1.join)(config.app.rootDir, 'node_modules', packageName);
43
+ }
44
+ catch (err) {
45
+ (0, errors_1.fatal)(`Could not install template package ${template}:\n ${err}`);
46
+ }
47
+ }
48
+ exports.prepareTemplate = prepareTemplate;
16
49
  async function addCommand(config, selectedPlatformName) {
17
50
  var _a;
18
51
  if (selectedPlatformName && !(await (0, common_2.isValidPlatform)(selectedPlatformName))) {
@@ -53,7 +86,7 @@ async function addCommand(config, selectedPlatformName) {
53
86
  ...addChecks(config, platformName),
54
87
  ]);
55
88
  await doAdd(config, platformName);
56
- await editPlatforms(config, platformName);
89
+ await runTemplateHooks(config, platformName);
57
90
  if (await (0, utils_fs_1.pathExists)(config.app.webDirAbs)) {
58
91
  await (0, sync_1.sync)(config, platformName, false, false);
59
92
  if (platformName === config.android.name) {
@@ -107,6 +140,7 @@ async function doAdd(config, platformName) {
107
140
  }
108
141
  });
109
142
  }
143
+ // TODO: Remove
110
144
  async function editPlatforms(config, platformName) {
111
145
  if (platformName === config.ios.name) {
112
146
  await (0, common_3.editProjectSettingsIOS)(config);
@@ -115,6 +149,18 @@ async function editPlatforms(config, platformName) {
115
149
  await (0, common_1.editProjectSettingsAndroid)(config);
116
150
  }
117
151
  }
152
+ async function runTemplateHooks(config, platformName) {
153
+ let templateDir = undefined;
154
+ if (platformName === config.ios.name) {
155
+ templateDir = config.cli.assets.ios.platformTemplateArchiveAbs;
156
+ }
157
+ else if (platformName === config.android.name) {
158
+ templateDir = config.cli.assets.android.platformTemplateArchiveAbs;
159
+ }
160
+ if (templateDir) {
161
+ await (0, common_2.runPlatformHook)(config, platformName, templateDir, 'capacitor:add:after');
162
+ }
163
+ }
118
164
  function webWarning() {
119
165
  log_1.logger.error(`Not adding platform ${colors_1.default.strong('web')}.\n` +
120
166
  `In Capacitor, the web platform is just your web app! For example, if you have a React or Angular project, the web platform is that project.\n` +
@@ -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);
@@ -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) {
@@ -193,11 +197,6 @@ async function copySSLCert(sslCertPaths, rootDir, targetDir) {
193
197
  const validCertPaths = [];
194
198
  for (const sslCertPath of sslCertPaths) {
195
199
  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
200
  if (!(await (0, utils_fs_1.pathExists)(certAbsFromPath))) {
202
201
  log_1.logger.warn(`Cannot copy SSL Certificate file from ${colors_1.default.strong(certAbsFromPath)}\n` +
203
202
  `SSL Certificate does not exist at specified path.`);
@@ -127,6 +127,10 @@ async function migrateCommand(config, noprompt, packagemanager) {
127
127
  if (allDependencies['@capacitor/ios'] &&
128
128
  (0, utils_fs_1.existsSync)(config.ios.platformDirAbs)) {
129
129
  // ios template changes
130
+ // Remove NSLocationAlwaysUsageDescription
131
+ await (0, common_2.runTask)(`Migrating Info.plist by removing NSLocationAlwaysUsageDescription key.`, () => {
132
+ return removeKey((0, path_1.join)(config.ios.nativeTargetDirAbs, 'Info.plist'), 'NSLocationAlwaysUsageDescription');
133
+ });
130
134
  }
131
135
  if (allDependencies['@capacitor/android'] &&
132
136
  (0, utils_fs_1.existsSync)(config.android.platformDirAbs)) {
@@ -177,15 +181,15 @@ async function migrateCommand(config, noprompt, packagemanager) {
177
181
  }
178
182
  const pluginVariables = {
179
183
  firebaseMessagingVersion: '23.3.1',
180
- playServicesLocationVersion: '21.0.1',
184
+ playServicesLocationVersion: '21.1.0',
181
185
  androidxBrowserVersion: '1.7.0',
182
186
  androidxMaterialVersion: '1.10.0',
183
187
  androidxExifInterfaceVersion: '1.3.6',
184
188
  androidxCoreKTXVersion: '1.12.0',
185
- googleMapsPlayServicesVersion: '18.1.0',
186
- googleMapsUtilsVersion: '3.5.3',
187
- googleMapsKtxVersion: '3.4.0',
188
- googleMapsUtilsKtxVersion: '3.4.0',
189
+ googleMapsPlayServicesVersion: '18.2.0',
190
+ googleMapsUtilsVersion: '3.8.2',
191
+ googleMapsKtxVersion: '5.0.0',
192
+ googleMapsUtilsKtxVersion: '5.0.0',
189
193
  kotlinxCoroutinesVersion: '1.7.3',
190
194
  coreSplashScreenVersion: '1.0.1',
191
195
  };
@@ -304,9 +308,10 @@ async function installLatestLibs(dependencyManager, runInstall, config) {
304
308
  async function writeBreakingChanges() {
305
309
  const breaking = [
306
310
  '@capacitor/camera',
307
- '@capacitor/device',
311
+ '@capacitor/filesystem',
312
+ '@capacitor/geolocation',
313
+ '@capacitor/google-maps',
308
314
  '@capacitor/local-notifications',
309
- '@capacitor/push-notifications',
310
315
  ];
311
316
  const broken = [];
312
317
  for (const lib of breaking) {
@@ -315,7 +320,7 @@ async function writeBreakingChanges() {
315
320
  }
316
321
  }
317
322
  if (broken.length > 0) {
318
- log_1.logger.info(`IMPORTANT: Review https://capacitorjs.com/docs/updating/5-0#plugins for breaking changes in these plugins that you use: ${broken.join(', ')}.`);
323
+ log_1.logger.info(`IMPORTANT: Review https://capacitorjs.com/docs/next/updating/6-0#plugins for breaking changes in these plugins that you use: ${broken.join(', ')}.`);
319
324
  }
320
325
  }
321
326
  async function getAndroidVariablesAndClasspaths(config) {
@@ -537,3 +542,26 @@ async function patchOldCapacitorPlugins(config) {
537
542
  }));
538
543
  }
539
544
  exports.patchOldCapacitorPlugins = patchOldCapacitorPlugins;
545
+ async function removeKey(filename, key) {
546
+ const txt = readFile(filename);
547
+ if (!txt) {
548
+ return;
549
+ }
550
+ let lines = txt.split('\n');
551
+ let removed = false;
552
+ let removing = false;
553
+ lines = lines.filter(line => {
554
+ if (removing && line.includes('</string>')) {
555
+ removing = false;
556
+ return false;
557
+ }
558
+ if (line.includes(`<key>${key}</key`)) {
559
+ removing = true;
560
+ removed = true;
561
+ }
562
+ return !removing;
563
+ });
564
+ if (removed) {
565
+ (0, utils_fs_1.writeFileSync)(filename, lines.join('\n'), 'utf-8');
566
+ }
567
+ }
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateIOSPackageJSON = exports.writePluginJSON = exports.findPluginClasses = exports.getPluginFiles = void 0;
4
+ const utils_fs_1 = require("@ionic/utils-fs");
5
+ const path_1 = require("path");
6
+ const cordova_1 = require("../cordova");
7
+ async function getPluginFiles(plugins) {
8
+ var _a, _b;
9
+ let filenameList = [];
10
+ const options = {
11
+ filter: item => {
12
+ if (item.path.endsWith('.swift') || item.path.endsWith('.m')) {
13
+ return true;
14
+ }
15
+ else {
16
+ return false;
17
+ }
18
+ },
19
+ };
20
+ for (const plugin of plugins) {
21
+ if (typeof ((_a = plugin.ios) === null || _a === void 0 ? void 0 : _a.name) !== 'undefined') {
22
+ const pluginPath = (0, path_1.resolve)(plugin.rootPath, (_b = plugin.ios) === null || _b === void 0 ? void 0 : _b.path);
23
+ const filenames = await (0, utils_fs_1.readdirp)(pluginPath, options);
24
+ filenameList = filenameList.concat(filenames);
25
+ }
26
+ }
27
+ return filenameList;
28
+ }
29
+ exports.getPluginFiles = getPluginFiles;
30
+ async function findPluginClasses(files) {
31
+ const classList = [];
32
+ for (const file of files) {
33
+ const fileData = (0, utils_fs_1.readFileSync)(file, 'utf-8');
34
+ const swiftPluginRegex = RegExp(/@objc\(([A-Za-z0-9_-]+)\)/);
35
+ const objcPluginRegex = RegExp(/CAP_PLUGIN\(([A-Za-z0-9_-]+)/);
36
+ const swiftMatches = swiftPluginRegex.exec(fileData);
37
+ if ((swiftMatches === null || swiftMatches === void 0 ? void 0 : swiftMatches[1]) != null) {
38
+ classList.push(swiftMatches[1]);
39
+ }
40
+ const objcMatches = objcPluginRegex.exec(fileData);
41
+ if ((objcMatches === null || objcMatches === void 0 ? void 0 : objcMatches[1]) != null) {
42
+ classList.push(objcMatches[1]);
43
+ }
44
+ }
45
+ return classList;
46
+ }
47
+ exports.findPluginClasses = findPluginClasses;
48
+ async function writePluginJSON(config, classList) {
49
+ const capJSONFile = (0, path_1.resolve)(config.ios.nativeTargetDirAbs, 'capacitor.config.json');
50
+ const capJSON = (0, utils_fs_1.readJSONSync)(capJSONFile);
51
+ capJSON['packageClassList'] = classList;
52
+ (0, utils_fs_1.writeJSONSync)(capJSONFile, capJSON, { spaces: '\t' });
53
+ }
54
+ exports.writePluginJSON = writePluginJSON;
55
+ async function generateIOSPackageJSON(config, plugins) {
56
+ const fileList = await getPluginFiles(plugins);
57
+ const classList = await findPluginClasses(fileList);
58
+ const cordovaPlugins = await (0, cordova_1.getCordovaPlugins)(config, 'ios');
59
+ if (cordovaPlugins.length > 0) {
60
+ classList.push('CDVPlugin');
61
+ }
62
+ writePluginJSON(config, classList);
63
+ }
64
+ exports.generateIOSPackageJSON = generateIOSPackageJSON;
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.checkPackageManager = exports.generatePackageFile = exports.findPackageSwiftFile = void 0;
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
- if (!(0, utils_fs_1.existsSync)(packageSwiftFile)) {
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 read ${packageSwiftFile}. Verify it is not already open. ${err}`);
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
- async function checkPackageManager(config) {
77
- const iosDirectory = config.ios.nativeProjectDirAbs;
78
- if ((0, utils_fs_1.existsSync)((0, path_1.resolve)(iosDirectory, 'CapApp-SPM'))) {
79
- return 'SPM';
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
- return 'Cocoapods';
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;
@@ -1,11 +1,41 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.extractTemplate = void 0;
3
+ exports.extractTemplatePackage = exports.extractTemplate = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const utils_fs_1 = require("@ionic/utils-fs");
6
+ const node_path_1 = require("node:path");
6
7
  const tar_1 = tslib_1.__importDefault(require("tar"));
7
8
  async function extractTemplate(src, dir) {
8
9
  await (0, utils_fs_1.mkdirp)(dir);
9
- await tar_1.default.extract({ file: src, cwd: dir });
10
+ if (!(0, utils_fs_1.lstatSync)(src).isDirectory()) {
11
+ await tar_1.default.extract({ file: src, cwd: dir });
12
+ }
13
+ else {
14
+ (0, utils_fs_1.cpSync)(src, dir, {
15
+ recursive: true,
16
+ });
17
+ }
10
18
  }
11
19
  exports.extractTemplate = extractTemplate;
20
+ async function extractTemplatePackage(src, dir) {
21
+ await (0, utils_fs_1.mkdirp)(dir);
22
+ if (!(0, utils_fs_1.lstatSync)(src).isDirectory()) {
23
+ await tar_1.default.extract({
24
+ file: src,
25
+ cwd: dir,
26
+ filter: (path, entry) => {
27
+ if (path.startsWith('./template/')) {
28
+ entry.path = entry.path.replace('./template/', './');
29
+ return true;
30
+ }
31
+ return false;
32
+ },
33
+ });
34
+ }
35
+ else {
36
+ (0, utils_fs_1.cpSync)((0, node_path_1.join)(src, 'template'), dir, {
37
+ recursive: true,
38
+ });
39
+ }
40
+ }
41
+ exports.extractTemplatePackage = extractTemplatePackage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/cli",
3
- "version": "6.0.0-beta.2",
3
+ "version": "6.0.0-dev-8046d907.0",
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)",
@@ -85,5 +85,6 @@
85
85
  },
86
86
  "publishConfig": {
87
87
  "access": "public"
88
- }
88
+ },
89
+ "gitHead": "8046d907d2d2c0779316adbcabda426acee2dfc3"
89
90
  }