@capacitor/cli 6.1.3-nightly-20241011T150501.0 → 6.2.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 +3 -1
- package/dist/android/common.js +5 -2
- package/dist/android/doctor.js +11 -7
- package/dist/android/run.js +1 -1
- package/dist/android/update.js +18 -13
- package/dist/common.js +25 -25
- package/dist/config.js +16 -4
- package/dist/cordova.js +63 -31
- package/dist/declarations.d.ts +24 -0
- package/dist/framework-configs.js +14 -14
- package/dist/index.js +14 -14
- package/dist/ios/common.js +8 -3
- package/dist/ios/doctor.js +5 -1
- package/dist/ios/run.js +4 -2
- package/dist/ios/update.js +36 -23
- package/dist/ipc.js +2 -2
- package/dist/log.js +3 -1
- package/dist/plugin.js +8 -4
- package/dist/tasks/add.js +9 -2
- package/dist/tasks/build.js +9 -4
- package/dist/tasks/config.js +4 -1
- package/dist/tasks/copy.js +13 -6
- package/dist/tasks/create.js +2 -1
- package/dist/tasks/doctor.js +7 -2
- package/dist/tasks/init.js +11 -10
- package/dist/tasks/list.js +4 -4
- package/dist/tasks/migrate.js +37 -13
- package/dist/tasks/new-plugin.js +2 -1
- package/dist/tasks/open.js +1 -1
- package/dist/tasks/run.js +6 -5
- package/dist/tasks/sourcemaps.js +3 -2
- package/dist/tasks/sync.js +6 -2
- package/dist/tasks/update.js +1 -1
- package/dist/util/fs.js +1 -1
- package/dist/util/iosplugin.js +3 -2
- package/dist/util/livereload.js +6 -3
- package/dist/util/monorepotools.js +2 -1
- package/dist/util/promise.js +1 -1
- package/dist/util/spm.js +5 -3
- package/dist/util/subprocess.js +7 -1
- package/dist/util/term.js +1 -1
- package/dist/util/uuid.js +1 -1
- package/dist/util/xml.js +4 -2
- package/dist/web/copy.js +22 -0
- package/package.json +2 -2
package/dist/cordova.js
CHANGED
|
@@ -21,7 +21,7 @@ const xml_1 = require("./util/xml");
|
|
|
21
21
|
function generateCordovaPluginsJSFile(config, plugins, platform) {
|
|
22
22
|
const pluginModules = [];
|
|
23
23
|
const pluginExports = [];
|
|
24
|
-
plugins.map(
|
|
24
|
+
plugins.map(p => {
|
|
25
25
|
const pluginId = p.xml.$.id;
|
|
26
26
|
const jsModules = (0, plugin_1.getJSModules)(p, platform);
|
|
27
27
|
jsModules.map((jsModule) => {
|
|
@@ -60,7 +60,9 @@ function generateCordovaPluginsJSFile(config, plugins, platform) {
|
|
|
60
60
|
merge: mergeKey,
|
|
61
61
|
// mimics Cordova's module name logic if the name attr is missing
|
|
62
62
|
pluginContent: `{
|
|
63
|
-
"id": "${pluginId +
|
|
63
|
+
"id": "${pluginId +
|
|
64
|
+
'.' +
|
|
65
|
+
(jsModule.$.name || jsModule.$.src.match(/([^/]+)\.js/)[1])}",
|
|
64
66
|
"file": "plugins/${pluginId}/${jsModule.$.src}",
|
|
65
67
|
"pluginId": "${pluginId}"${clobbersModule}${mergesModule}${runsModule}
|
|
66
68
|
}`,
|
|
@@ -78,7 +80,7 @@ function generateCordovaPluginsJSFile(config, plugins, platform) {
|
|
|
78
80
|
: a.clobber || b.clobber // Clobbers before anything else
|
|
79
81
|
? b.clobber.localeCompare(a.clobber)
|
|
80
82
|
: a.merge.localeCompare(b.merge))
|
|
81
|
-
.map(
|
|
83
|
+
.map(e => e.pluginContent)
|
|
82
84
|
.join(',\n ')}
|
|
83
85
|
];
|
|
84
86
|
module.exports.metadata =
|
|
@@ -110,7 +112,10 @@ async function copyPluginsJS(config, cordovaPlugins, platform) {
|
|
|
110
112
|
let data = await (0, utils_fs_1.readFile)(filePath, { encoding: 'utf-8' });
|
|
111
113
|
data = data.trim();
|
|
112
114
|
// mimics Cordova's module name logic if the name attr is missing
|
|
113
|
-
const name = pluginId +
|
|
115
|
+
const name = pluginId +
|
|
116
|
+
'.' +
|
|
117
|
+
(jsModule.$.name ||
|
|
118
|
+
(0, path_1.basename)(jsModule.$.src, (0, path_1.extname)(jsModule.$.src)));
|
|
114
119
|
data = `cordova.define("${name}", function(require, exports, module) { \n${data}\n});`;
|
|
115
120
|
data = data.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script\s*>/gi, '');
|
|
116
121
|
await (0, utils_fs_1.writeFile)(filePath, data, { encoding: 'utf-8' });
|
|
@@ -127,8 +132,7 @@ exports.copyPluginsJS = copyPluginsJS;
|
|
|
127
132
|
async function copyCordovaJS(config, platform) {
|
|
128
133
|
const cordovaPath = (0, node_1.resolveNode)(config.app.rootDir, '@capacitor/core', 'cordova.js');
|
|
129
134
|
if (!cordovaPath) {
|
|
130
|
-
(0, errors_1.fatal)(`Unable to find ${colors_1.default.strong('node_modules/@capacitor/core/cordova.js')}.\n` +
|
|
131
|
-
`Are you sure ${colors_1.default.strong('@capacitor/core')} is installed?`);
|
|
135
|
+
(0, errors_1.fatal)(`Unable to find ${colors_1.default.strong('node_modules/@capacitor/core/cordova.js')}.\n` + `Are you sure ${colors_1.default.strong('@capacitor/core')} is installed?`);
|
|
132
136
|
}
|
|
133
137
|
return (0, utils_fs_1.copy)(cordovaPath, (0, path_1.join)(await getWebDir(config, platform), 'cordova.js'));
|
|
134
138
|
}
|
|
@@ -158,7 +162,7 @@ async function autoGenerateConfig(config, cordovaPlugins, platform) {
|
|
|
158
162
|
const cordovaConfigXMLFile = (0, path_1.join)(xmlDir, fileName);
|
|
159
163
|
await (0, utils_fs_1.remove)(cordovaConfigXMLFile);
|
|
160
164
|
const pluginEntries = [];
|
|
161
|
-
cordovaPlugins.map(
|
|
165
|
+
cordovaPlugins.map(p => {
|
|
162
166
|
const currentPlatform = (0, plugin_1.getPluginPlatform)(p, platform);
|
|
163
167
|
if (currentPlatform) {
|
|
164
168
|
const configFiles = currentPlatform['config-file'];
|
|
@@ -239,11 +243,11 @@ async function getCordovaPlugins(config, platform) {
|
|
|
239
243
|
else if (platform === config.android.name) {
|
|
240
244
|
plugins = await (0, common_1.getAndroidPlugins)(allPlugins);
|
|
241
245
|
}
|
|
242
|
-
return plugins.filter(
|
|
246
|
+
return plugins.filter(p => (0, plugin_1.getPluginType)(p, platform) === 1 /* PluginType.Cordova */);
|
|
243
247
|
}
|
|
244
248
|
exports.getCordovaPlugins = getCordovaPlugins;
|
|
245
249
|
async function logCordovaManualSteps(cordovaPlugins, config, platform) {
|
|
246
|
-
cordovaPlugins.map(
|
|
250
|
+
cordovaPlugins.map(p => {
|
|
247
251
|
const editConfig = (0, plugin_1.getPlatformElement)(p, platform, 'edit-config');
|
|
248
252
|
const configFile = (0, plugin_1.getPlatformElement)(p, platform, 'config-file');
|
|
249
253
|
editConfig.concat(configFile).map(async (configElement) => {
|
|
@@ -276,10 +280,14 @@ async function logiOSPlist(configElement, config, plugin) {
|
|
|
276
280
|
if (!dict.key.includes(configElement.$.parent)) {
|
|
277
281
|
let xml = buildConfigFileXml(configElement);
|
|
278
282
|
xml = `<key>${configElement.$.parent}</key>${getConfigFileTagContent(xml)}`;
|
|
279
|
-
log_1.logger.warn(`Configuration required for ${colors_1.default.strong(plugin.id)}.\n` +
|
|
283
|
+
log_1.logger.warn(`Configuration required for ${colors_1.default.strong(plugin.id)}.\n` +
|
|
284
|
+
`Add the following to Info.plist:\n` +
|
|
285
|
+
xml);
|
|
280
286
|
}
|
|
281
287
|
else if (configElement.array || configElement.dict) {
|
|
282
|
-
if (configElement.array &&
|
|
288
|
+
if (configElement.array &&
|
|
289
|
+
configElement.array.length > 0 &&
|
|
290
|
+
configElement.array[0].string) {
|
|
283
291
|
let xml = '';
|
|
284
292
|
configElement.array[0].string.map((element) => {
|
|
285
293
|
const d = plistData[configElement.$.parent];
|
|
@@ -348,7 +356,8 @@ async function logiOSPlist(configElement, config, plugin) {
|
|
|
348
356
|
parsedRequiredElements.push(rootOfRequiredElementsToAdd);
|
|
349
357
|
const doesContainElements = (requiredElementsArray, existingElementsArray) => {
|
|
350
358
|
for (const requiredElement of requiredElementsArray) {
|
|
351
|
-
if (requiredElement.name === 'key' ||
|
|
359
|
+
if (requiredElement.name === 'key' ||
|
|
360
|
+
requiredElement.name === 'string') {
|
|
352
361
|
let foundMatch = false;
|
|
353
362
|
for (const existingElement of existingElementsArray) {
|
|
354
363
|
if (existingElement.name === requiredElement.name &&
|
|
@@ -366,7 +375,8 @@ async function logiOSPlist(configElement, config, plugin) {
|
|
|
366
375
|
let foundMatch = false;
|
|
367
376
|
for (const existingElement of existingElementsArray) {
|
|
368
377
|
if (existingElement.name === requiredElement.name) {
|
|
369
|
-
if ((requiredElement.children !== undefined) ===
|
|
378
|
+
if ((requiredElement.children !== undefined) ===
|
|
379
|
+
(existingElement.children !== undefined)) {
|
|
370
380
|
if (doesContainElements(requiredElement.children, existingElement.children)) {
|
|
371
381
|
foundMatch = true;
|
|
372
382
|
break;
|
|
@@ -412,8 +422,8 @@ function removeOuterTags(str) {
|
|
|
412
422
|
}
|
|
413
423
|
async function checkPluginDependencies(plugins, platform) {
|
|
414
424
|
const pluginDeps = new Map();
|
|
415
|
-
const cordovaPlugins = plugins.filter(
|
|
416
|
-
const incompatible = plugins.filter(
|
|
425
|
+
const cordovaPlugins = plugins.filter(p => (0, plugin_1.getPluginType)(p, platform) === 1 /* PluginType.Cordova */);
|
|
426
|
+
const incompatible = plugins.filter(p => (0, plugin_1.getPluginType)(p, platform) === 2 /* PluginType.Incompatible */);
|
|
417
427
|
await Promise.all(cordovaPlugins.map(async (p) => {
|
|
418
428
|
let allDependencies = [];
|
|
419
429
|
allDependencies = allDependencies.concat((0, plugin_1.getPlatformElement)(p, platform, 'dependency'));
|
|
@@ -421,7 +431,8 @@ async function checkPluginDependencies(plugins, platform) {
|
|
|
421
431
|
allDependencies = allDependencies.concat(p.xml['dependency']);
|
|
422
432
|
}
|
|
423
433
|
allDependencies = allDependencies.filter((dep) => !getIncompatibleCordovaPlugins(platform).includes(dep.$.id) &&
|
|
424
|
-
incompatible.filter(
|
|
434
|
+
incompatible.filter(p => p.id === dep.$.id || p.xml.$.id === dep.$.id)
|
|
435
|
+
.length === 0);
|
|
425
436
|
if (allDependencies) {
|
|
426
437
|
await Promise.all(allDependencies.map(async (dep) => {
|
|
427
438
|
var _a;
|
|
@@ -430,7 +441,7 @@ async function checkPluginDependencies(plugins, platform) {
|
|
|
430
441
|
if (plugin.includes('@') && plugin.indexOf('@') !== 0) {
|
|
431
442
|
[plugin, version] = plugin.split('@');
|
|
432
443
|
}
|
|
433
|
-
if (cordovaPlugins.filter(
|
|
444
|
+
if (cordovaPlugins.filter(p => p.id === plugin || p.xml.$.id === plugin).length === 0) {
|
|
434
445
|
if ((_a = dep.$.url) === null || _a === void 0 ? void 0 : _a.startsWith('http')) {
|
|
435
446
|
plugin = dep.$.url;
|
|
436
447
|
version = dep.$.commit;
|
|
@@ -446,7 +457,9 @@ async function checkPluginDependencies(plugins, platform) {
|
|
|
446
457
|
let msg = `${colors_1.default.failure(colors_1.default.strong('Plugins are missing dependencies.'))}\n` +
|
|
447
458
|
`Cordova plugin dependencies must be installed in your project (e.g. w/ ${colors_1.default.input('npm install')}).\n`;
|
|
448
459
|
for (const [plugin, deps] of pluginDeps.entries()) {
|
|
449
|
-
msg +=
|
|
460
|
+
msg +=
|
|
461
|
+
`\n ${colors_1.default.strong(plugin)} is missing dependencies:\n` +
|
|
462
|
+
deps.map(d => ` - ${d}`).join('\n');
|
|
450
463
|
}
|
|
451
464
|
log_1.logger.warn(`${msg}\n`);
|
|
452
465
|
}
|
|
@@ -477,8 +490,18 @@ function getIncompatibleCordovaPlugins(platform) {
|
|
|
477
490
|
return pluginList;
|
|
478
491
|
}
|
|
479
492
|
exports.getIncompatibleCordovaPlugins = getIncompatibleCordovaPlugins;
|
|
480
|
-
function needsStaticPod(plugin) {
|
|
481
|
-
|
|
493
|
+
function needsStaticPod(plugin, config) {
|
|
494
|
+
var _a, _b, _c, _d;
|
|
495
|
+
let pluginList = [
|
|
496
|
+
'phonegap-plugin-push',
|
|
497
|
+
'@batch.com/cordova-plugin',
|
|
498
|
+
'onesignal-cordova-plugin',
|
|
499
|
+
];
|
|
500
|
+
if ((_b = (_a = config.app.extConfig) === null || _a === void 0 ? void 0 : _a.cordova) === null || _b === void 0 ? void 0 : _b.staticPlugins) {
|
|
501
|
+
log_1.logger.warn('cordova.staticPlugins is deprecated, make sure you are using latest version of the plugin');
|
|
502
|
+
pluginList = pluginList.concat((_d = (_c = config.app.extConfig) === null || _c === void 0 ? void 0 : _c.cordova) === null || _d === void 0 ? void 0 : _d.staticPlugins);
|
|
503
|
+
}
|
|
504
|
+
return pluginList.includes(plugin.id) || useFrameworks(plugin);
|
|
482
505
|
}
|
|
483
506
|
exports.needsStaticPod = needsStaticPod;
|
|
484
507
|
function useFrameworks(plugin) {
|
|
@@ -550,14 +573,16 @@ async function writeCordovaAndroidManifest(cordovaPlugins, config, platform, cle
|
|
|
550
573
|
if (configElement.$ &&
|
|
551
574
|
(((_a = configElement.$.target) === null || _a === void 0 ? void 0 : _a.includes('AndroidManifest.xml')) ||
|
|
552
575
|
((_b = configElement.$.file) === null || _b === void 0 ? void 0 : _b.includes('AndroidManifest.xml')))) {
|
|
553
|
-
const keys = Object.keys(configElement).filter(
|
|
554
|
-
keys.map(
|
|
576
|
+
const keys = Object.keys(configElement).filter(k => k !== '$');
|
|
577
|
+
keys.map(k => {
|
|
555
578
|
configElement[k].map(async (e) => {
|
|
556
579
|
const xmlElement = (0, xml_1.buildXmlElement)(e, k);
|
|
557
580
|
const pathParts = getPathParts(configElement.$.parent || configElement.$.target);
|
|
558
581
|
if (pathParts.length > 1) {
|
|
559
582
|
if (pathParts.pop() === 'application') {
|
|
560
|
-
if (configElement.$.mode &&
|
|
583
|
+
if (configElement.$.mode &&
|
|
584
|
+
configElement.$.mode === 'merge' &&
|
|
585
|
+
xmlElement.startsWith('<application')) {
|
|
561
586
|
Object.keys(e.$).map((ek) => {
|
|
562
587
|
applicationXMLAttributes.push(`${ek}="${e.$[ek]}"`);
|
|
563
588
|
});
|
|
@@ -632,7 +657,8 @@ async function writeCordovaAndroidManifest(cordovaPlugins, config, platform, cle
|
|
|
632
657
|
if (requiredElement.name !== existingElement.name) {
|
|
633
658
|
return false;
|
|
634
659
|
}
|
|
635
|
-
if ((requiredElement.attrs !== undefined) !==
|
|
660
|
+
if ((requiredElement.attrs !== undefined) !==
|
|
661
|
+
(existingElement.attrs !== undefined)) {
|
|
636
662
|
return false;
|
|
637
663
|
}
|
|
638
664
|
else {
|
|
@@ -640,14 +666,16 @@ async function writeCordovaAndroidManifest(cordovaPlugins, config, platform, cle
|
|
|
640
666
|
const requiredELementAttrKeys = Object.keys(requiredElement.attrs);
|
|
641
667
|
for (const key of requiredELementAttrKeys) {
|
|
642
668
|
if (!/^[$].{1,}$/.test(requiredElement.attrs[key].trim())) {
|
|
643
|
-
if (requiredElement.attrs[key] !==
|
|
669
|
+
if (requiredElement.attrs[key] !==
|
|
670
|
+
existingElement.attrs[key]) {
|
|
644
671
|
return false;
|
|
645
672
|
}
|
|
646
673
|
}
|
|
647
674
|
}
|
|
648
675
|
}
|
|
649
676
|
}
|
|
650
|
-
if ((requiredElement.children !== undefined) !==
|
|
677
|
+
if ((requiredElement.children !== undefined) !==
|
|
678
|
+
(existingElement.children !== undefined) &&
|
|
651
679
|
((_a = requiredElement.children) === null || _a === void 0 ? void 0 : _a.length) !== 0) {
|
|
652
680
|
return false;
|
|
653
681
|
}
|
|
@@ -669,7 +697,8 @@ async function writeCordovaAndroidManifest(cordovaPlugins, config, platform, cle
|
|
|
669
697
|
}
|
|
670
698
|
}
|
|
671
699
|
else {
|
|
672
|
-
if (requiredElement.children === undefined &&
|
|
700
|
+
if (requiredElement.children === undefined &&
|
|
701
|
+
existingElement.children === undefined) {
|
|
673
702
|
return true;
|
|
674
703
|
}
|
|
675
704
|
else {
|
|
@@ -707,7 +736,8 @@ async function writeCordovaAndroidManifest(cordovaPlugins, config, platform, cle
|
|
|
707
736
|
...requiredElements[rootKeyOfRequiredElements]['$'],
|
|
708
737
|
};
|
|
709
738
|
}
|
|
710
|
-
if (requiredElements[rootKeyOfRequiredElements]['$$'] !==
|
|
739
|
+
if (requiredElements[rootKeyOfRequiredElements]['$$'] !==
|
|
740
|
+
undefined) {
|
|
711
741
|
parseXmlToSearchable(requiredElements[rootKeyOfRequiredElements]['$$'], rootOfRequiredElementsToAdd['children']);
|
|
712
742
|
}
|
|
713
743
|
parsedRequiredElements.push(rootOfRequiredElementsToAdd);
|
|
@@ -741,7 +771,8 @@ async function writeCordovaAndroidManifest(cordovaPlugins, config, platform, cle
|
|
|
741
771
|
}
|
|
742
772
|
}
|
|
743
773
|
else {
|
|
744
|
-
if (!rootXMLEntries.includes(xmlElement) &&
|
|
774
|
+
if (!rootXMLEntries.includes(xmlElement) &&
|
|
775
|
+
!contains(rootXMLEntries, xmlElement, k)) {
|
|
745
776
|
rootXMLEntries.push(xmlElement);
|
|
746
777
|
}
|
|
747
778
|
}
|
|
@@ -751,7 +782,8 @@ async function writeCordovaAndroidManifest(cordovaPlugins, config, platform, cle
|
|
|
751
782
|
});
|
|
752
783
|
});
|
|
753
784
|
const cleartextString = 'android:usesCleartextTraffic="true"';
|
|
754
|
-
const cleartextValue = (cleartext || ((_a = config.app.extConfig.server) === null || _a === void 0 ? void 0 : _a.cleartext)) &&
|
|
785
|
+
const cleartextValue = (cleartext || ((_a = config.app.extConfig.server) === null || _a === void 0 ? void 0 : _a.cleartext)) &&
|
|
786
|
+
!applicationXMLAttributes.includes(cleartextString)
|
|
755
787
|
? cleartextString
|
|
756
788
|
: '';
|
|
757
789
|
let content = `<?xml version='1.0' encoding='utf-8'?>
|
|
@@ -774,7 +806,7 @@ exports.writeCordovaAndroidManifest = writeCordovaAndroidManifest;
|
|
|
774
806
|
function getPathParts(path) {
|
|
775
807
|
const rootPath = 'manifest';
|
|
776
808
|
path = path.replace('/*', rootPath);
|
|
777
|
-
const parts = path.split('/').filter(
|
|
809
|
+
const parts = path.split('/').filter(part => part !== '');
|
|
778
810
|
if (parts.length > 1 || parts.includes(rootPath)) {
|
|
779
811
|
return parts;
|
|
780
812
|
}
|
package/dist/declarations.d.ts
CHANGED
|
@@ -26,6 +26,20 @@ export interface CapacitorConfig {
|
|
|
26
26
|
* @since 1.0.0
|
|
27
27
|
*/
|
|
28
28
|
webDir?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Whether to copy the Capacitor runtime bundle or not.
|
|
31
|
+
*
|
|
32
|
+
* If your app is not using a bundler, set this to `true`, then Capacitor
|
|
33
|
+
* will create a `capacitor.js` file that you'll need to add as a script in
|
|
34
|
+
* your `index.html` file.
|
|
35
|
+
*
|
|
36
|
+
* It's deprecated and will be removed in Capacitor 6
|
|
37
|
+
*
|
|
38
|
+
* @since 1.0.0
|
|
39
|
+
* @deprecated 5.0.0
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
bundledWebRuntime?: boolean;
|
|
29
43
|
/**
|
|
30
44
|
* The build configuration (as defined by the native app) under which Capacitor
|
|
31
45
|
* will send statements to the log system. This applies to log statements in
|
|
@@ -509,6 +523,16 @@ export interface CapacitorConfig {
|
|
|
509
523
|
preferences?: {
|
|
510
524
|
[key: string]: string | undefined;
|
|
511
525
|
};
|
|
526
|
+
/**
|
|
527
|
+
* List of Cordova plugins that need to be static but are not
|
|
528
|
+
* already in the static plugin list.
|
|
529
|
+
*
|
|
530
|
+
* It's deprecated and will be removed in Capacitor 7
|
|
531
|
+
*
|
|
532
|
+
* @since 3.3.0
|
|
533
|
+
* @deprecated 6.1.1
|
|
534
|
+
*/
|
|
535
|
+
staticPlugins?: string[];
|
|
512
536
|
};
|
|
513
537
|
/**
|
|
514
538
|
* Configure plugins.
|
|
@@ -4,85 +4,85 @@ exports.detectFramework = void 0;
|
|
|
4
4
|
const FRAMEWORK_CONFIGS = [
|
|
5
5
|
{
|
|
6
6
|
name: 'Angular',
|
|
7
|
-
isMatch:
|
|
7
|
+
isMatch: config => hasDependency(config, '@angular/cli'),
|
|
8
8
|
webDir: 'dist',
|
|
9
9
|
priority: 3,
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
12
|
name: 'Create React App',
|
|
13
|
-
isMatch:
|
|
13
|
+
isMatch: config => hasDependency(config, 'react-scripts'),
|
|
14
14
|
webDir: 'build',
|
|
15
15
|
priority: 3,
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
name: 'Ember',
|
|
19
|
-
isMatch:
|
|
19
|
+
isMatch: config => hasDependency(config, 'ember-cli'),
|
|
20
20
|
webDir: 'dist',
|
|
21
21
|
priority: 3,
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
24
|
name: 'Gatsby',
|
|
25
|
-
isMatch:
|
|
25
|
+
isMatch: config => hasDependency(config, 'gatsby'),
|
|
26
26
|
webDir: 'public',
|
|
27
27
|
priority: 2,
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
name: 'Ionic Angular',
|
|
31
|
-
isMatch:
|
|
31
|
+
isMatch: config => hasDependency(config, '@ionic/angular'),
|
|
32
32
|
webDir: 'www',
|
|
33
33
|
priority: 1,
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
name: 'Ionic React',
|
|
37
|
-
isMatch:
|
|
37
|
+
isMatch: config => hasDependency(config, '@ionic/react'),
|
|
38
38
|
webDir: 'build',
|
|
39
39
|
priority: 1,
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
name: 'Ionic Vue',
|
|
43
|
-
isMatch:
|
|
43
|
+
isMatch: config => hasDependency(config, '@ionic/vue'),
|
|
44
44
|
webDir: 'public',
|
|
45
45
|
priority: 1,
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
48
|
name: 'Next',
|
|
49
|
-
isMatch:
|
|
49
|
+
isMatch: config => hasDependency(config, 'next'),
|
|
50
50
|
webDir: 'public',
|
|
51
51
|
priority: 2,
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
name: 'Preact',
|
|
55
|
-
isMatch:
|
|
55
|
+
isMatch: config => hasDependency(config, 'preact-cli'),
|
|
56
56
|
webDir: 'build',
|
|
57
57
|
priority: 3,
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
name: 'Stencil',
|
|
61
|
-
isMatch:
|
|
61
|
+
isMatch: config => hasDependency(config, '@stencil/core'),
|
|
62
62
|
webDir: 'www',
|
|
63
63
|
priority: 3,
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
66
|
name: 'Svelte',
|
|
67
|
-
isMatch:
|
|
67
|
+
isMatch: config => hasDependency(config, 'svelte') && hasDependency(config, 'sirv-cli'),
|
|
68
68
|
webDir: 'public',
|
|
69
69
|
priority: 3,
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
72
|
name: 'Vite',
|
|
73
|
-
isMatch:
|
|
73
|
+
isMatch: config => hasDependency(config, 'vite'),
|
|
74
74
|
webDir: 'dist',
|
|
75
75
|
priority: 2,
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
78
|
name: 'Vue',
|
|
79
|
-
isMatch:
|
|
79
|
+
isMatch: config => hasDependency(config, '@vue/cli-service'),
|
|
80
80
|
webDir: 'dist',
|
|
81
81
|
priority: 3,
|
|
82
82
|
},
|
|
83
83
|
];
|
|
84
84
|
function detectFramework(config) {
|
|
85
|
-
const frameworks = FRAMEWORK_CONFIGS.filter(
|
|
85
|
+
const frameworks = FRAMEWORK_CONFIGS.filter(f => f.isMatch(config)).sort((a, b) => {
|
|
86
86
|
if (a.priority < b.priority)
|
|
87
87
|
return -1;
|
|
88
88
|
if (a.priority > b.priority)
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ const log_1 = require("./log");
|
|
|
12
12
|
const telemetry_1 = require("./telemetry");
|
|
13
13
|
const cli_1 = require("./util/cli");
|
|
14
14
|
const emoji_1 = require("./util/emoji");
|
|
15
|
-
process.on('unhandledRejection',
|
|
15
|
+
process.on('unhandledRejection', error => {
|
|
16
16
|
console.error(colors_1.default.failure('[fatal]'), error);
|
|
17
17
|
});
|
|
18
18
|
process.on('message', ipc_1.receive);
|
|
@@ -48,10 +48,9 @@ function runProgram(config) {
|
|
|
48
48
|
.command('init [appName] [appId]')
|
|
49
49
|
.description(`Initialize Capacitor configuration`)
|
|
50
50
|
.option('--web-dir <value>', 'Optional: Directory of your projects built web assets')
|
|
51
|
-
.
|
|
52
|
-
.action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (appName, appId, { webDir, skipAppidValidation }) => {
|
|
51
|
+
.action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (appName, appId, { webDir }) => {
|
|
53
52
|
const { initCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/init')));
|
|
54
|
-
await initCommand(config, appName, appId, webDir
|
|
53
|
+
await initCommand(config, appName, appId, webDir);
|
|
55
54
|
})));
|
|
56
55
|
commander_1.program
|
|
57
56
|
.command('serve', { hidden: true })
|
|
@@ -66,6 +65,7 @@ function runProgram(config) {
|
|
|
66
65
|
.option('--deployment', 'Optional: if provided, pod install will use --deployment option')
|
|
67
66
|
.option('--inline', 'Optional: if true, all source maps will be inlined for easier debugging on mobile devices', false)
|
|
68
67
|
.action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { deployment, inline }) => {
|
|
68
|
+
(0, config_1.checkExternalConfig)(config.app);
|
|
69
69
|
const { syncCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/sync')));
|
|
70
70
|
await syncCommand(config, platform, deployment, inline);
|
|
71
71
|
})));
|
|
@@ -74,6 +74,7 @@ function runProgram(config) {
|
|
|
74
74
|
.description(`updates the native plugins and dependencies based on ${colors_1.default.strong('package.json')}`)
|
|
75
75
|
.option('--deployment', 'Optional: if provided, pod install will use --deployment option')
|
|
76
76
|
.action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { deployment }) => {
|
|
77
|
+
(0, config_1.checkExternalConfig)(config.app);
|
|
77
78
|
const { updateCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/update')));
|
|
78
79
|
await updateCommand(config, platform, deployment);
|
|
79
80
|
})));
|
|
@@ -82,6 +83,7 @@ function runProgram(config) {
|
|
|
82
83
|
.description('copies the web app build into the native app')
|
|
83
84
|
.option('--inline', 'Optional: if true, all source maps will be inlined for easier debugging on mobile devices', false)
|
|
84
85
|
.action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { inline }) => {
|
|
86
|
+
(0, config_1.checkExternalConfig)(config.app);
|
|
85
87
|
const { copyCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/copy')));
|
|
86
88
|
await copyCommand(config, platform, inline);
|
|
87
89
|
})));
|
|
@@ -95,14 +97,8 @@ function runProgram(config) {
|
|
|
95
97
|
.option('--keystorealias <keystoreAlias>', 'Key Alias in the keystore')
|
|
96
98
|
.option('--configuration <name>', 'Configuration name of the iOS Scheme')
|
|
97
99
|
.option('--keystorealiaspass <keystoreAliasPass>', 'Password for the Key Alias')
|
|
98
|
-
.addOption(new commander_1.Option('--androidreleasetype <androidreleasetype>', 'Android release type; APK or AAB').choices([
|
|
99
|
-
'
|
|
100
|
-
'APK',
|
|
101
|
-
]))
|
|
102
|
-
.addOption(new commander_1.Option('--signing-type <signingtype>', 'Program used to sign apps (default: jarsigner)').choices([
|
|
103
|
-
'apksigner',
|
|
104
|
-
'jarsigner',
|
|
105
|
-
]))
|
|
100
|
+
.addOption(new commander_1.Option('--androidreleasetype <androidreleasetype>', 'Android release type; APK or AAB').choices(['AAB', 'APK']))
|
|
101
|
+
.addOption(new commander_1.Option('--signing-type <signingtype>', 'Program used to sign apps (default: jarsigner)').choices(['apksigner', 'jarsigner']))
|
|
106
102
|
.action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { scheme, flavor, keystorepath, keystorepass, keystorealias, keystorealiaspass, androidreleasetype, signingType, configuration, }) => {
|
|
107
103
|
const { buildCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/build')));
|
|
108
104
|
await buildCommand(config, platform, {
|
|
@@ -132,7 +128,7 @@ function runProgram(config) {
|
|
|
132
128
|
.option('--host <host>', 'Host used for live reload')
|
|
133
129
|
.option('--port <port>', 'Port used for live reload')
|
|
134
130
|
.option('--configuration <name>', 'Configuration name of the iOS Scheme')
|
|
135
|
-
.action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { scheme, flavor, list, target, sync, forwardPorts, liveReload, host, port, configuration }) => {
|
|
131
|
+
.action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { scheme, flavor, list, target, sync, forwardPorts, liveReload, host, port, configuration, }) => {
|
|
136
132
|
const { runCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/run')));
|
|
137
133
|
await runCommand(config, platform, {
|
|
138
134
|
scheme,
|
|
@@ -159,10 +155,12 @@ function runProgram(config) {
|
|
|
159
155
|
.description('add a native platform project')
|
|
160
156
|
.option('--packagemanager <packageManager>', 'The package manager to use for dependency installs (Cocoapods, SPM **experimental**)')
|
|
161
157
|
.action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform, { packagemanager }) => {
|
|
158
|
+
(0, config_1.checkExternalConfig)(config.app);
|
|
162
159
|
const { addCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/add')));
|
|
163
160
|
const configWritable = config;
|
|
164
161
|
if (packagemanager === 'SPM') {
|
|
165
|
-
configWritable.cli.assets.ios.platformTemplateArchive =
|
|
162
|
+
configWritable.cli.assets.ios.platformTemplateArchive =
|
|
163
|
+
'ios-spm-template.tar.gz';
|
|
166
164
|
configWritable.cli.assets.ios.platformTemplateArchiveAbs = (0, path_1.resolve)(configWritable.cli.assetsDirAbs, configWritable.cli.assets.ios.platformTemplateArchive);
|
|
167
165
|
}
|
|
168
166
|
await addCommand(configWritable, platform);
|
|
@@ -171,6 +169,7 @@ function runProgram(config) {
|
|
|
171
169
|
.command('ls [platform]')
|
|
172
170
|
.description('list installed Cordova and Capacitor plugins')
|
|
173
171
|
.action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform) => {
|
|
172
|
+
(0, config_1.checkExternalConfig)(config.app);
|
|
174
173
|
const { listCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/list')));
|
|
175
174
|
await listCommand(config, platform);
|
|
176
175
|
})));
|
|
@@ -178,6 +177,7 @@ function runProgram(config) {
|
|
|
178
177
|
.command('doctor [platform]')
|
|
179
178
|
.description('checks the current setup for common errors')
|
|
180
179
|
.action((0, cli_1.wrapAction)((0, telemetry_1.telemetryAction)(config, async (platform) => {
|
|
180
|
+
(0, config_1.checkExternalConfig)(config.app);
|
|
181
181
|
const { doctorCommand } = await Promise.resolve().then(() => tslib_1.__importStar(require('./tasks/doctor')));
|
|
182
182
|
await doctorCommand(config, platform);
|
|
183
183
|
})));
|
package/dist/ios/common.js
CHANGED
|
@@ -42,7 +42,8 @@ async function checkBundler(config) {
|
|
|
42
42
|
}
|
|
43
43
|
exports.checkBundler = checkBundler;
|
|
44
44
|
async function checkCocoaPods(config) {
|
|
45
|
-
if (!(await (0, subprocess_1.isInstalled)(await config.ios.podPath)) &&
|
|
45
|
+
if (!(await (0, subprocess_1.isInstalled)(await config.ios.podPath)) &&
|
|
46
|
+
config.cli.os === "mac" /* OS.Mac */) {
|
|
46
47
|
return (`CocoaPods is not installed.\n` +
|
|
47
48
|
`See this install guide: ${colors_1.default.strong('https://capacitorjs.com/docs/getting-started/environment-setup#homebrew')}`);
|
|
48
49
|
}
|
|
@@ -70,7 +71,8 @@ async function resolvePlugin(plugin) {
|
|
|
70
71
|
type: 1 /* PluginType.Cordova */,
|
|
71
72
|
path: 'src/' + platform,
|
|
72
73
|
};
|
|
73
|
-
if ((0, cordova_1.getIncompatibleCordovaPlugins)(platform).includes(plugin.id) ||
|
|
74
|
+
if ((0, cordova_1.getIncompatibleCordovaPlugins)(platform).includes(plugin.id) ||
|
|
75
|
+
!(0, plugin_1.getPluginPlatform)(plugin, platform)) {
|
|
74
76
|
plugin.ios.type = 2 /* PluginType.Incompatible */;
|
|
75
77
|
}
|
|
76
78
|
}
|
|
@@ -85,7 +87,10 @@ exports.resolvePlugin = resolvePlugin;
|
|
|
85
87
|
*/
|
|
86
88
|
async function editProjectSettingsIOS(config) {
|
|
87
89
|
const appId = config.app.appId;
|
|
88
|
-
const appName = config.app.appName
|
|
90
|
+
const appName = config.app.appName
|
|
91
|
+
.replace(/&/g, '&')
|
|
92
|
+
.replace(/</g, '<')
|
|
93
|
+
.replace(/>/g, '>');
|
|
89
94
|
const pbxPath = `${config.ios.nativeXcodeProjDirAbs}/project.pbxproj`;
|
|
90
95
|
const plistPath = (0, path_1.resolve)(config.ios.nativeTargetDirAbs, 'Info.plist');
|
|
91
96
|
let plistContent = await (0, utils_fs_1.readFile)(plistPath, { encoding: 'utf-8' });
|
package/dist/ios/doctor.js
CHANGED
|
@@ -20,7 +20,11 @@ async function doctorIOS(config) {
|
|
|
20
20
|
// check online datebase of common errors
|
|
21
21
|
// check if www folder is empty (index.html does not exist)
|
|
22
22
|
try {
|
|
23
|
-
await (0, common_1.check)([
|
|
23
|
+
await (0, common_1.check)([
|
|
24
|
+
() => (0, common_2.checkBundler)(config) || (0, common_2.checkCocoaPods)(config),
|
|
25
|
+
() => (0, common_1.checkWebDir)(config),
|
|
26
|
+
checkXcode,
|
|
27
|
+
]);
|
|
24
28
|
(0, log_1.logSuccess)('iOS looking great! 👌');
|
|
25
29
|
}
|
|
26
30
|
catch (e) {
|
package/dist/ios/run.js
CHANGED
|
@@ -10,7 +10,7 @@ const native_run_1 = require("../util/native-run");
|
|
|
10
10
|
const spm_1 = require("../util/spm");
|
|
11
11
|
const subprocess_1 = require("../util/subprocess");
|
|
12
12
|
const debug = (0, debug_1.default)('capacitor:ios:run');
|
|
13
|
-
async function runIOS(config, { target: selectedTarget, scheme: selectedScheme, configuration: selectedConfiguration }) {
|
|
13
|
+
async function runIOS(config, { target: selectedTarget, scheme: selectedScheme, configuration: selectedConfiguration, }) {
|
|
14
14
|
const target = await (0, common_1.promptForPlatformTarget)(await (0, native_run_1.getPlatformTargets)('ios'), selectedTarget);
|
|
15
15
|
const runScheme = selectedScheme || config.ios.scheme;
|
|
16
16
|
const configuration = selectedConfiguration || 'Debug';
|
|
@@ -43,7 +43,9 @@ async function runIOS(config, { target: selectedTarget, scheme: selectedScheme,
|
|
|
43
43
|
cwd: config.ios.nativeProjectDirAbs,
|
|
44
44
|
}));
|
|
45
45
|
const appName = `${runScheme}.app`;
|
|
46
|
-
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);
|
|
47
49
|
const nativeRunArgs = ['ios', '--app', appPath, '--target', target.id];
|
|
48
50
|
debug('Invoking native-run with args: %O', nativeRunArgs);
|
|
49
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));
|