@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/ios/update.js
CHANGED
|
@@ -21,7 +21,7 @@ const common_2 = require("./common");
|
|
|
21
21
|
const platform = 'ios';
|
|
22
22
|
async function updateIOS(config, deployment) {
|
|
23
23
|
const plugins = await getPluginsTask(config);
|
|
24
|
-
const capacitorPlugins = plugins.filter(
|
|
24
|
+
const capacitorPlugins = plugins.filter(p => (0, plugin_1.getPluginType)(p, platform) === 0 /* PluginType.Core */);
|
|
25
25
|
if ((await (0, spm_1.checkPackageManager)(config)) === 'SPM') {
|
|
26
26
|
await (0, spm_1.generatePackageFile)(config, capacitorPlugins);
|
|
27
27
|
}
|
|
@@ -34,7 +34,7 @@ async function updateIOS(config, deployment) {
|
|
|
34
34
|
exports.updateIOS = updateIOS;
|
|
35
35
|
async function updateIOSCocoaPods(config, plugins, deployment) {
|
|
36
36
|
await removePluginsNativeFiles(config);
|
|
37
|
-
const cordovaPlugins = plugins.filter(
|
|
37
|
+
const cordovaPlugins = plugins.filter(p => (0, plugin_1.getPluginType)(p, platform) === 1 /* PluginType.Cordova */);
|
|
38
38
|
if (cordovaPlugins.length > 0) {
|
|
39
39
|
await copyPluginsNativeFiles(config, cordovaPlugins);
|
|
40
40
|
}
|
|
@@ -46,7 +46,7 @@ async function updateIOSCocoaPods(config, plugins, deployment) {
|
|
|
46
46
|
await generateCordovaPodspecs(cordovaPlugins, config);
|
|
47
47
|
await installCocoaPodsPlugins(config, plugins, deployment);
|
|
48
48
|
await (0, cordova_1.logCordovaManualSteps)(cordovaPlugins, config, platform);
|
|
49
|
-
const incompatibleCordovaPlugins = plugins.filter(
|
|
49
|
+
const incompatibleCordovaPlugins = plugins.filter(p => (0, plugin_1.getPluginType)(p, platform) === 2 /* PluginType.Incompatible */);
|
|
50
50
|
(0, plugin_1.printPlugins)(incompatibleCordovaPlugins, platform, 'incompatible');
|
|
51
51
|
await (0, common_1.checkPlatformVersions)(config, platform);
|
|
52
52
|
}
|
|
@@ -63,20 +63,28 @@ async function updatePodfile(config, plugins, deployment) {
|
|
|
63
63
|
let podfileContent = await (0, utils_fs_1.readFile)(podfilePath, { encoding: 'utf-8' });
|
|
64
64
|
podfileContent = podfileContent.replace(/(def capacitor_pods)[\s\S]+?(\nend)/, `$1${dependenciesContent}$2`);
|
|
65
65
|
podfileContent = podfileContent.replace(/(require_relative)[\s\S]+?(@capacitor\/ios\/scripts\/pods_helpers')/, `require_relative '${relativeCapacitoriOSPath}/scripts/pods_helpers'`);
|
|
66
|
+
podfileContent = podfileContent.replace(`def assertDeploymentTarget(installer)
|
|
67
|
+
installer.pods_project.targets.each do |target|
|
|
68
|
+
target.build_configurations.each do |config|
|
|
69
|
+
# ensure IPHONEOS_DEPLOYMENT_TARGET is at least 13.0
|
|
70
|
+
deployment_target = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f
|
|
71
|
+
should_upgrade = deployment_target < 13.0 && deployment_target != 0.0
|
|
72
|
+
if should_upgrade
|
|
73
|
+
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end`, `require_relative '${relativeCapacitoriOSPath}/scripts/pods_helpers'`);
|
|
66
78
|
await (0, utils_fs_1.writeFile)(podfilePath, podfileContent, { encoding: 'utf-8' });
|
|
67
79
|
const podPath = await config.ios.podPath;
|
|
68
|
-
const useBundler = podPath.startsWith('bundle');
|
|
80
|
+
const useBundler = podPath.startsWith('bundle') && (await (0, subprocess_1.isInstalled)('bundle'));
|
|
69
81
|
const podCommandExists = await (0, subprocess_1.isInstalled)('pod');
|
|
70
82
|
if (useBundler || podCommandExists) {
|
|
71
83
|
if (useBundler) {
|
|
72
|
-
await (0, subprocess_1.runCommand)('bundle', ['exec', 'pod', 'install', ...(deployment ? ['--deployment'] : [])], {
|
|
73
|
-
cwd: config.ios.nativeProjectDirAbs,
|
|
74
|
-
});
|
|
84
|
+
await (0, subprocess_1.runCommand)('bundle', ['exec', 'pod', 'install', ...(deployment ? ['--deployment'] : [])], { cwd: config.ios.nativeProjectDirAbs });
|
|
75
85
|
}
|
|
76
86
|
else {
|
|
77
|
-
await (0, subprocess_1.runCommand)(podPath, ['install', ...(deployment ? ['--deployment'] : [])], {
|
|
78
|
-
cwd: config.ios.nativeProjectDirAbs,
|
|
79
|
-
});
|
|
87
|
+
await (0, subprocess_1.runCommand)(podPath, ['install', ...(deployment ? ['--deployment'] : [])], { cwd: config.ios.nativeProjectDirAbs });
|
|
80
88
|
}
|
|
81
89
|
}
|
|
82
90
|
else {
|
|
@@ -102,14 +110,14 @@ async function getRelativeCapacitoriOSPath(config) {
|
|
|
102
110
|
}
|
|
103
111
|
async function generatePodFile(config, plugins) {
|
|
104
112
|
const relativeCapacitoriOSPath = await getRelativeCapacitoriOSPath(config);
|
|
105
|
-
const capacitorPlugins = plugins.filter(
|
|
113
|
+
const capacitorPlugins = plugins.filter(p => (0, plugin_1.getPluginType)(p, platform) === 0 /* PluginType.Core */);
|
|
106
114
|
const pods = await Promise.all(capacitorPlugins.map(async (p) => {
|
|
107
115
|
if (!p.ios) {
|
|
108
116
|
return '';
|
|
109
117
|
}
|
|
110
118
|
return ` pod '${p.ios.name}', :path => '${(0, fs_1.convertToUnixPath)((0, path_1.relative)(config.ios.nativeProjectDirAbs, await (0, utils_fs_1.realpath)(p.rootPath)))}'\n`;
|
|
111
119
|
}));
|
|
112
|
-
const cordovaPlugins = plugins.filter(
|
|
120
|
+
const cordovaPlugins = plugins.filter(p => (0, plugin_1.getPluginType)(p, platform) === 1 /* PluginType.Cordova */);
|
|
113
121
|
cordovaPlugins.map(async (p) => {
|
|
114
122
|
const podspecs = (0, plugin_1.getPlatformElement)(p, platform, 'podspec');
|
|
115
123
|
podspecs.map((podspec) => {
|
|
@@ -132,8 +140,8 @@ async function generatePodFile(config, plugins) {
|
|
|
132
140
|
});
|
|
133
141
|
});
|
|
134
142
|
});
|
|
135
|
-
const staticPlugins = cordovaPlugins.filter(
|
|
136
|
-
const noStaticPlugins = cordovaPlugins.filter(
|
|
143
|
+
const staticPlugins = cordovaPlugins.filter(p => (0, cordova_1.needsStaticPod)(p, config));
|
|
144
|
+
const noStaticPlugins = cordovaPlugins.filter(el => !staticPlugins.includes(el));
|
|
137
145
|
if (noStaticPlugins.length > 0) {
|
|
138
146
|
pods.push(` pod 'CordovaPlugins', :path => '../capacitor-cordova-ios-plugins'\n`);
|
|
139
147
|
}
|
|
@@ -156,14 +164,16 @@ function getFrameworkName(framework) {
|
|
|
156
164
|
}
|
|
157
165
|
return framework.$.src.substr(0, framework.$.src.indexOf('.'));
|
|
158
166
|
}
|
|
159
|
-
return framework.$.src
|
|
167
|
+
return framework.$.src
|
|
168
|
+
.substr(0, framework.$.src.indexOf('.'))
|
|
169
|
+
.replace('lib', '');
|
|
160
170
|
}
|
|
161
171
|
function isFramework(framework) {
|
|
162
172
|
return framework.$.src.split('.').pop().includes('framework');
|
|
163
173
|
}
|
|
164
174
|
async function generateCordovaPodspecs(cordovaPlugins, config) {
|
|
165
|
-
const staticPlugins = cordovaPlugins.filter(
|
|
166
|
-
const noStaticPlugins = cordovaPlugins.filter(
|
|
175
|
+
const staticPlugins = cordovaPlugins.filter(p => (0, cordova_1.needsStaticPod)(p, config));
|
|
176
|
+
const noStaticPlugins = cordovaPlugins.filter(el => !staticPlugins.includes(el));
|
|
167
177
|
generateCordovaPodspec(noStaticPlugins, config, false);
|
|
168
178
|
generateCordovaPodspec(staticPlugins, config, true);
|
|
169
179
|
}
|
|
@@ -257,7 +267,7 @@ async function generateCordovaPodspec(cordovaPlugins, config, isStatic) {
|
|
|
257
267
|
}
|
|
258
268
|
});
|
|
259
269
|
});
|
|
260
|
-
const onlySystemLibraries = systemLibraries.filter(
|
|
270
|
+
const onlySystemLibraries = systemLibraries.filter(library => removeNoSystem(library, sourceFrameworks));
|
|
261
271
|
if (weakFrameworks.length > 0) {
|
|
262
272
|
frameworkDeps.push(`s.weak_frameworks = '${weakFrameworks.join(`', '`)}'`);
|
|
263
273
|
}
|
|
@@ -318,7 +328,7 @@ async function copyPluginsNativeFiles(config, cordovaPlugins) {
|
|
|
318
328
|
const codeFiles = sourceFiles.concat(headerFiles);
|
|
319
329
|
const frameworks = (0, plugin_1.getPlatformElement)(p, platform, 'framework');
|
|
320
330
|
let sourcesFolderName = 'sources';
|
|
321
|
-
if ((0, cordova_1.needsStaticPod)(p)) {
|
|
331
|
+
if ((0, cordova_1.needsStaticPod)(p, config)) {
|
|
322
332
|
sourcesFolderName += 'static';
|
|
323
333
|
}
|
|
324
334
|
const sourcesFolder = (0, path_1.join)(config.ios.cordovaPluginsDirAbs, sourcesFolderName, p.name);
|
|
@@ -329,7 +339,8 @@ async function copyPluginsNativeFiles(config, cordovaPlugins) {
|
|
|
329
339
|
fileName = 'lib' + fileName;
|
|
330
340
|
}
|
|
331
341
|
let destFolder = sourcesFolderName;
|
|
332
|
-
if (codeFile.$['compiler-flags'] &&
|
|
342
|
+
if (codeFile.$['compiler-flags'] &&
|
|
343
|
+
codeFile.$['compiler-flags'] === '-fno-objc-arc') {
|
|
333
344
|
destFolder = 'noarc';
|
|
334
345
|
}
|
|
335
346
|
const filePath = (0, plugin_1.getFilePath)(config, p, codeFile.$.src);
|
|
@@ -352,7 +363,8 @@ async function copyPluginsNativeFiles(config, cordovaPlugins) {
|
|
|
352
363
|
fileContent = fileContent.replace('[NSBundle bundleForClass:[CDVCapture class]]', '[NSBundle mainBundle]');
|
|
353
364
|
await (0, utils_fs_1.writeFile)(fileDest, fileContent, { encoding: 'utf-8' });
|
|
354
365
|
}
|
|
355
|
-
if (fileContent.includes('[self.webView superview]') ||
|
|
366
|
+
if (fileContent.includes('[self.webView superview]') ||
|
|
367
|
+
fileContent.includes('self.webView.superview')) {
|
|
356
368
|
fileContent = fileContent.replace(/\[self.webView superview\]/g, 'self.viewController.view');
|
|
357
369
|
fileContent = fileContent.replace(/self.webView.superview/g, 'self.viewController.view');
|
|
358
370
|
await (0, utils_fs_1.writeFile)(fileDest, fileContent, { encoding: 'utf-8' });
|
|
@@ -382,11 +394,12 @@ function filterResources(plugin) {
|
|
|
382
394
|
}
|
|
383
395
|
function filterARCFiles(plugin) {
|
|
384
396
|
const sources = (0, plugin_1.getPlatformElement)(plugin, platform, 'source-file');
|
|
385
|
-
const sourcesARC = sources.filter((sourceFile) => sourceFile.$['compiler-flags'] &&
|
|
397
|
+
const sourcesARC = sources.filter((sourceFile) => sourceFile.$['compiler-flags'] &&
|
|
398
|
+
sourceFile.$['compiler-flags'] === '-fno-objc-arc');
|
|
386
399
|
return sourcesARC.length > 0;
|
|
387
400
|
}
|
|
388
401
|
function removeNoSystem(library, sourceFrameworks) {
|
|
389
|
-
const libraries = sourceFrameworks.filter(
|
|
402
|
+
const libraries = sourceFrameworks.filter(framework => framework.includes(library));
|
|
390
403
|
return libraries.length === 0;
|
|
391
404
|
}
|
|
392
405
|
async function getPluginsTask(config) {
|
package/dist/ipc.js
CHANGED
|
@@ -43,10 +43,10 @@ async function receive(msg) {
|
|
|
43
43
|
headers: {
|
|
44
44
|
'Content-Type': 'application/json',
|
|
45
45
|
},
|
|
46
|
-
},
|
|
46
|
+
}, response => {
|
|
47
47
|
debug('Sent %O metric to events service (status: %O)', data.name, response.statusCode);
|
|
48
48
|
if (response.statusCode !== 204) {
|
|
49
|
-
response.on('data',
|
|
49
|
+
response.on('data', chunk => {
|
|
50
50
|
debug('Bad response from events service. Request body: %O', chunk.toString());
|
|
51
51
|
});
|
|
52
52
|
}
|
package/dist/log.js
CHANGED
|
@@ -9,7 +9,9 @@ const options = {
|
|
|
9
9
|
colors: colors_1.default,
|
|
10
10
|
stream: process.argv.includes('--json') ? process.stderr : process.stdout,
|
|
11
11
|
};
|
|
12
|
-
exports.output = (0, term_1.isInteractive)()
|
|
12
|
+
exports.output = (0, term_1.isInteractive)()
|
|
13
|
+
? new cli_framework_output_1.TTYOutputStrategy(options)
|
|
14
|
+
: new cli_framework_output_1.StreamOutputStrategy(options);
|
|
13
15
|
exports.logger = (0, cli_framework_output_1.createDefaultLogger)({
|
|
14
16
|
output: exports.output,
|
|
15
17
|
formatterOptions: {
|
package/dist/plugin.js
CHANGED
|
@@ -31,7 +31,8 @@ async function resolvePlugin(config, name) {
|
|
|
31
31
|
try {
|
|
32
32
|
const packagePath = (0, node_1.resolveNode)(config.app.rootDir, name, 'package.json');
|
|
33
33
|
if (!packagePath) {
|
|
34
|
-
(0, errors_1.fatal)(`Unable to find ${colors_1.default.strong(`node_modules/${name}`)}.\n` +
|
|
34
|
+
(0, errors_1.fatal)(`Unable to find ${colors_1.default.strong(`node_modules/${name}`)}.\n` +
|
|
35
|
+
`Are you sure ${colors_1.default.strong(name)} is installed?`);
|
|
35
36
|
}
|
|
36
37
|
const rootPath = (0, path_1.dirname)(packagePath);
|
|
37
38
|
const meta = await (0, utils_fs_1.readJSON)(packagePath);
|
|
@@ -78,7 +79,7 @@ function fixName(name) {
|
|
|
78
79
|
.replace(/\//g, '_')
|
|
79
80
|
.replace(/-/g, '_')
|
|
80
81
|
.replace(/@/g, '')
|
|
81
|
-
.replace(/_\w/g,
|
|
82
|
+
.replace(/_\w/g, m => m[1].toUpperCase());
|
|
82
83
|
return name.charAt(0).toUpperCase() + name.slice(1);
|
|
83
84
|
}
|
|
84
85
|
exports.fixName = fixName;
|
|
@@ -99,7 +100,7 @@ function printPlugins(plugins, platform, type = 'capacitor') {
|
|
|
99
100
|
msg = `Found ${plugins.length} Capacitor plugin${plural} for ${colors_1.default.strong(platform)}:\n`;
|
|
100
101
|
break;
|
|
101
102
|
}
|
|
102
|
-
msg += plugins.map(
|
|
103
|
+
msg += plugins.map(p => `${p.id}${colors_1.default.weak(`@${p.version}`)}`).join('\n');
|
|
103
104
|
log_1.logger.info(msg);
|
|
104
105
|
}
|
|
105
106
|
exports.printPlugins = printPlugins;
|
|
@@ -154,7 +155,10 @@ function getFilePath(config, plugin, path) {
|
|
|
154
155
|
if (path.startsWith('node_modules')) {
|
|
155
156
|
let pathSegments = path.split('/').slice(1);
|
|
156
157
|
if (pathSegments[0].startsWith('@')) {
|
|
157
|
-
pathSegments = [
|
|
158
|
+
pathSegments = [
|
|
159
|
+
pathSegments[0] + '/' + pathSegments[1],
|
|
160
|
+
...pathSegments.slice(2),
|
|
161
|
+
];
|
|
158
162
|
}
|
|
159
163
|
const filePath = (0, node_1.resolveNode)(config.app.rootDir, ...pathSegments);
|
|
160
164
|
if (!filePath) {
|
package/dist/tasks/add.js
CHANGED
|
@@ -47,7 +47,11 @@ async function addCommand(config, selectedPlatformName) {
|
|
|
47
47
|
`${colors_1.default.strong('WARNING')}: Your native project will be completely removed.`);
|
|
48
48
|
}
|
|
49
49
|
try {
|
|
50
|
-
await (0, common_2.check)([
|
|
50
|
+
await (0, common_2.check)([
|
|
51
|
+
() => (0, common_2.checkPackage)(),
|
|
52
|
+
() => (0, common_2.checkAppConfig)(config),
|
|
53
|
+
...addChecks(config, platformName),
|
|
54
|
+
]);
|
|
51
55
|
await doAdd(config, platformName);
|
|
52
56
|
await editPlatforms(config, platformName);
|
|
53
57
|
if (await (0, utils_fs_1.pathExists)(config.app.webDirAbs)) {
|
|
@@ -78,7 +82,10 @@ function printNextSteps(platformName) {
|
|
|
78
82
|
}
|
|
79
83
|
function addChecks(config, platformName) {
|
|
80
84
|
if (platformName === config.ios.name) {
|
|
81
|
-
return [
|
|
85
|
+
return [
|
|
86
|
+
() => (0, common_3.checkIOSPackage)(config),
|
|
87
|
+
() => (0, common_3.checkBundler)(config) || (0, common_3.checkCocoaPods)(config),
|
|
88
|
+
];
|
|
82
89
|
}
|
|
83
90
|
else if (platformName === config.android.name) {
|
|
84
91
|
return [() => (0, common_1.checkAndroidPackage)(config)];
|
package/dist/tasks/build.js
CHANGED
|
@@ -21,9 +21,14 @@ async function buildCommand(config, selectedPlatformName, buildOptions) {
|
|
|
21
21
|
keystorepath: buildOptions.keystorepath || config.android.buildOptions.keystorePath,
|
|
22
22
|
keystorepass: buildOptions.keystorepass || config.android.buildOptions.keystorePassword,
|
|
23
23
|
keystorealias: buildOptions.keystorealias || config.android.buildOptions.keystoreAlias,
|
|
24
|
-
keystorealiaspass: buildOptions.keystorealiaspass ||
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
keystorealiaspass: buildOptions.keystorealiaspass ||
|
|
25
|
+
config.android.buildOptions.keystoreAliasPassword,
|
|
26
|
+
androidreleasetype: buildOptions.androidreleasetype ||
|
|
27
|
+
config.android.buildOptions.releaseType ||
|
|
28
|
+
'AAB',
|
|
29
|
+
signingtype: buildOptions.signingtype ||
|
|
30
|
+
config.android.buildOptions.signingType ||
|
|
31
|
+
'jarsigner',
|
|
27
32
|
configuration: buildOptions.configuration || 'Release',
|
|
28
33
|
};
|
|
29
34
|
try {
|
|
@@ -53,5 +58,5 @@ async function build(config, platformName, buildOptions) {
|
|
|
53
58
|
}
|
|
54
59
|
exports.build = build;
|
|
55
60
|
function createBuildablePlatformFilter(config) {
|
|
56
|
-
return
|
|
61
|
+
return platform => platform === config.ios.name || platform === config.android.name;
|
|
57
62
|
}
|
package/dist/tasks/config.js
CHANGED
|
@@ -15,7 +15,10 @@ async function configCommand(config, json) {
|
|
|
15
15
|
}
|
|
16
16
|
exports.configCommand = configCommand;
|
|
17
17
|
async function deepAwait(obj) {
|
|
18
|
-
if (obj &&
|
|
18
|
+
if (obj &&
|
|
19
|
+
!Array.isArray(obj) &&
|
|
20
|
+
typeof obj === 'object' &&
|
|
21
|
+
obj.constructor === Object) {
|
|
19
22
|
const o = {};
|
|
20
23
|
for (const [k, v] of Object.entries(obj)) {
|
|
21
24
|
o[k] = await deepAwait(v);
|
package/dist/tasks/copy.js
CHANGED
|
@@ -13,6 +13,7 @@ const log_1 = require("../log");
|
|
|
13
13
|
const plugin_1 = require("../plugin");
|
|
14
14
|
const iosplugin_1 = require("../util/iosplugin");
|
|
15
15
|
const promise_1 = require("../util/promise");
|
|
16
|
+
const copy_1 = require("../web/copy");
|
|
16
17
|
const sourcemaps_1 = require("./sourcemaps");
|
|
17
18
|
async function copyCommand(config, selectedPlatformName, inline = false) {
|
|
18
19
|
var _a;
|
|
@@ -28,7 +29,7 @@ async function copyCommand(config, selectedPlatformName, inline = false) {
|
|
|
28
29
|
else {
|
|
29
30
|
const platforms = await (0, common_1.selectPlatforms)(config, selectedPlatformName);
|
|
30
31
|
try {
|
|
31
|
-
await (0, promise_1.allSerial)(platforms.map(
|
|
32
|
+
await (0, promise_1.allSerial)(platforms.map(platformName => () => copy(config, platformName, inline)));
|
|
32
33
|
}
|
|
33
34
|
catch (e) {
|
|
34
35
|
if ((0, errors_1.isFatal)(e)) {
|
|
@@ -49,15 +50,17 @@ async function copy(config, platformName, inline = false) {
|
|
|
49
50
|
await (0, common_1.runHooks)(config, platformName, config.app.rootDir, 'capacitor:copy:before');
|
|
50
51
|
const allPlugins = await (0, plugin_1.getPlugins)(config, platformName);
|
|
51
52
|
let usesFederatedCapacitor = false;
|
|
52
|
-
if (allPlugins.filter(
|
|
53
|
+
if (allPlugins.filter(plugin => plugin.id === '@ionic-enterprise/federated-capacitor').length > 0) {
|
|
53
54
|
usesFederatedCapacitor = true;
|
|
54
55
|
}
|
|
55
56
|
let usesLiveUpdates = false;
|
|
56
|
-
if (allPlugins.filter(
|
|
57
|
+
if (allPlugins.filter(plugin => plugin.id === '@capacitor/live-updates')
|
|
58
|
+
.length > 0) {
|
|
57
59
|
usesLiveUpdates = true;
|
|
58
60
|
}
|
|
59
61
|
let usesSSLPinning = false;
|
|
60
|
-
if (allPlugins.filter(
|
|
62
|
+
if (allPlugins.filter(plugin => plugin.id === '@ionic-enterprise/ssl-pinning')
|
|
63
|
+
.length > 0) {
|
|
61
64
|
usesSSLPinning = true;
|
|
62
65
|
}
|
|
63
66
|
if (platformName === config.ios.name) {
|
|
@@ -107,6 +110,9 @@ async function copy(config, platformName, inline = false) {
|
|
|
107
110
|
if (usesFederatedCapacitor) {
|
|
108
111
|
log_1.logger.info('FederatedCapacitor Plugin installed, skipping web bundling...');
|
|
109
112
|
}
|
|
113
|
+
else {
|
|
114
|
+
await (0, copy_1.copyWeb)(config);
|
|
115
|
+
}
|
|
110
116
|
}
|
|
111
117
|
else {
|
|
112
118
|
throw `Platform ${platformName} is not valid.`;
|
|
@@ -159,7 +165,7 @@ async function copyFederatedWebDirs(config, nativeAbsDir) {
|
|
|
159
165
|
throw `FederatedCapacitor plugin is present but there is a problem with the apps defined in the config.`;
|
|
160
166
|
}
|
|
161
167
|
const copyApps = () => {
|
|
162
|
-
return federatedConfig.apps.map(
|
|
168
|
+
return federatedConfig.apps.map(app => {
|
|
163
169
|
const appDir = (0, path_1.resolve)(config.app.rootDir, app.webDir);
|
|
164
170
|
return copyWebDir(config, (0, path_1.resolve)(nativeAbsDir, app.name), appDir);
|
|
165
171
|
});
|
|
@@ -171,7 +177,8 @@ async function copyFederatedWebDirs(config, nativeAbsDir) {
|
|
|
171
177
|
}
|
|
172
178
|
}
|
|
173
179
|
function isFederatedApp(config) {
|
|
174
|
-
return config.webDir !== undefined &&
|
|
180
|
+
return (config.webDir !== undefined &&
|
|
181
|
+
config.name !== undefined);
|
|
175
182
|
}
|
|
176
183
|
async function copySecureLiveUpdatesKey(secureLiveUpdatesKeyFile, rootDir, nativeAbsDir) {
|
|
177
184
|
const keyAbsFromPath = (0, path_1.join)(rootDir, secureLiveUpdatesKeyFile);
|
package/dist/tasks/create.js
CHANGED
|
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const colors_1 = tslib_1.__importDefault(require("../colors"));
|
|
6
6
|
const errors_1 = require("../errors");
|
|
7
7
|
async function createCommand() {
|
|
8
|
-
(0, errors_1.fatal)(`The create command has been removed.\n` +
|
|
8
|
+
(0, errors_1.fatal)(`The create command has been removed.\n` +
|
|
9
|
+
`Use ${colors_1.default.input('npm init @capacitor/app')}`);
|
|
9
10
|
}
|
|
10
11
|
exports.createCommand = createCommand;
|
package/dist/tasks/doctor.js
CHANGED
|
@@ -15,7 +15,7 @@ async function doctorCommand(config, selectedPlatformName) {
|
|
|
15
15
|
log_1.output.write(`${(0, emoji_1.emoji)('💊', '')} ${colors_1.default.strong('Capacitor Doctor')} ${(0, emoji_1.emoji)('💊', '')} \n\n`);
|
|
16
16
|
await doctorCore(config);
|
|
17
17
|
const platforms = await (0, common_1.selectPlatforms)(config, selectedPlatformName);
|
|
18
|
-
await Promise.all(platforms.map(
|
|
18
|
+
await Promise.all(platforms.map(platformName => {
|
|
19
19
|
return doctor(config, platformName);
|
|
20
20
|
}));
|
|
21
21
|
}
|
|
@@ -38,7 +38,12 @@ async function doctorCore(config) {
|
|
|
38
38
|
}
|
|
39
39
|
exports.doctorCore = doctorCore;
|
|
40
40
|
async function printInstalledPackages(config) {
|
|
41
|
-
const packageNames = [
|
|
41
|
+
const packageNames = [
|
|
42
|
+
'@capacitor/cli',
|
|
43
|
+
'@capacitor/core',
|
|
44
|
+
'@capacitor/android',
|
|
45
|
+
'@capacitor/ios',
|
|
46
|
+
];
|
|
42
47
|
await Promise.all(packageNames.map(async (packageName) => {
|
|
43
48
|
const packagePath = (0, node_1.resolveNode)(config.app.rootDir, packageName, 'package.json');
|
|
44
49
|
await printPackageVersion(packageName, packagePath);
|
package/dist/tasks/init.js
CHANGED
|
@@ -14,7 +14,7 @@ const log_1 = require("../log");
|
|
|
14
14
|
const sysconfig_1 = require("../sysconfig");
|
|
15
15
|
const node_1 = require("../util/node");
|
|
16
16
|
const term_1 = require("../util/term");
|
|
17
|
-
async function initCommand(config, name, id, webDirFromCLI
|
|
17
|
+
async function initCommand(config, name, id, webDirFromCLI) {
|
|
18
18
|
var _a, _b;
|
|
19
19
|
try {
|
|
20
20
|
if (!(0, term_1.checkInteractive)(name, id)) {
|
|
@@ -30,13 +30,11 @@ async function initCommand(config, name, id, webDirFromCLI, skipAppIDValidation)
|
|
|
30
30
|
const appId = await getAppId(config, id);
|
|
31
31
|
const webDir = (0, term_1.isInteractive)()
|
|
32
32
|
? await getWebDir(config, webDirFromCLI)
|
|
33
|
-
: (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
await (0, common_1.check)([() => (0, common_1.checkAppName)(config, appName), () => (0, common_1.checkAppId)(config, appId)]);
|
|
39
|
-
}
|
|
33
|
+
: (_a = webDirFromCLI !== null && webDirFromCLI !== void 0 ? webDirFromCLI : config.app.extConfig.webDir) !== null && _a !== void 0 ? _a : 'www';
|
|
34
|
+
await (0, common_1.check)([
|
|
35
|
+
() => (0, common_1.checkAppName)(config, appName),
|
|
36
|
+
() => (0, common_1.checkAppId)(config, appId),
|
|
37
|
+
]);
|
|
40
38
|
const cordova = await (0, cordova_1.getCordovaPreferences)(config);
|
|
41
39
|
await runMergeConfig(config, {
|
|
42
40
|
appId,
|
|
@@ -47,7 +45,8 @@ async function initCommand(config, name, id, webDirFromCLI, skipAppIDValidation)
|
|
|
47
45
|
}
|
|
48
46
|
catch (e) {
|
|
49
47
|
if (!(0, errors_1.isFatal)(e)) {
|
|
50
|
-
log_1.output.write('Usage: npx cap init appName appId\n' +
|
|
48
|
+
log_1.output.write('Usage: npx cap init appName appId\n' +
|
|
49
|
+
'Example: npx cap init "My App" "com.example.myapp"\n\n');
|
|
51
50
|
(0, errors_1.fatal)((_b = e.stack) !== null && _b !== void 0 ? _b : e);
|
|
52
51
|
}
|
|
53
52
|
throw e;
|
|
@@ -62,7 +61,9 @@ async function getName(config, name) {
|
|
|
62
61
|
type: 'text',
|
|
63
62
|
name: 'name',
|
|
64
63
|
message: `Name`,
|
|
65
|
-
initial: config.app.appName
|
|
64
|
+
initial: config.app.appName
|
|
65
|
+
? config.app.appName
|
|
66
|
+
: (_a = config.app.package.name) !== null && _a !== void 0 ? _a : 'App',
|
|
66
67
|
});
|
|
67
68
|
return answers.name;
|
|
68
69
|
}
|
package/dist/tasks/list.js
CHANGED
|
@@ -14,7 +14,7 @@ async function listCommand(config, selectedPlatformName) {
|
|
|
14
14
|
var _a;
|
|
15
15
|
const platforms = await (0, common_2.selectPlatforms)(config, selectedPlatformName);
|
|
16
16
|
try {
|
|
17
|
-
await (0, promise_1.allSerial)(platforms.map(
|
|
17
|
+
await (0, promise_1.allSerial)(platforms.map(platformName => () => list(config, platformName)));
|
|
18
18
|
}
|
|
19
19
|
catch (e) {
|
|
20
20
|
if ((0, errors_1.isFatal)(e)) {
|
|
@@ -40,11 +40,11 @@ async function list(config, platform) {
|
|
|
40
40
|
else {
|
|
41
41
|
throw `Platform ${colors_1.default.input(platform)} is not valid.`;
|
|
42
42
|
}
|
|
43
|
-
const capacitorPlugins = plugins.filter(
|
|
43
|
+
const capacitorPlugins = plugins.filter(p => (0, plugin_1.getPluginType)(p, platform) === 0 /* PluginType.Core */);
|
|
44
44
|
(0, plugin_1.printPlugins)(capacitorPlugins, platform);
|
|
45
|
-
const cordovaPlugins = plugins.filter(
|
|
45
|
+
const cordovaPlugins = plugins.filter(p => (0, plugin_1.getPluginType)(p, platform) === 1 /* PluginType.Cordova */);
|
|
46
46
|
(0, plugin_1.printPlugins)(cordovaPlugins, platform, 'cordova');
|
|
47
|
-
const incompatibleCordovaPlugins = plugins.filter(
|
|
47
|
+
const incompatibleCordovaPlugins = plugins.filter(p => (0, plugin_1.getPluginType)(p, platform) === 2 /* PluginType.Incompatible */);
|
|
48
48
|
(0, plugin_1.printPlugins)(incompatibleCordovaPlugins, platform, 'incompatible');
|
|
49
49
|
}
|
|
50
50
|
exports.list = list;
|
package/dist/tasks/migrate.js
CHANGED
|
@@ -18,7 +18,12 @@ const subprocess_1 = require("../util/subprocess");
|
|
|
18
18
|
const template_1 = require("../util/template");
|
|
19
19
|
// eslint-disable-next-line prefer-const
|
|
20
20
|
let allDependencies = {};
|
|
21
|
-
const libs = [
|
|
21
|
+
const libs = [
|
|
22
|
+
'@capacitor/core',
|
|
23
|
+
'@capacitor/cli',
|
|
24
|
+
'@capacitor/ios',
|
|
25
|
+
'@capacitor/android',
|
|
26
|
+
];
|
|
22
27
|
const plugins = [
|
|
23
28
|
'@capacitor/action-sheet',
|
|
24
29
|
'@capacitor/app',
|
|
@@ -79,7 +84,8 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
79
84
|
message: `Are you sure you want to migrate? (Y/n)`,
|
|
80
85
|
initial: 'y',
|
|
81
86
|
});
|
|
82
|
-
if (typeof migrateconfirm === 'string' &&
|
|
87
|
+
if (typeof migrateconfirm === 'string' &&
|
|
88
|
+
migrateconfirm.toLowerCase() === 'y') {
|
|
83
89
|
try {
|
|
84
90
|
const { depInstallConfirm } = noprompt
|
|
85
91
|
? { depInstallConfirm: 'y' }
|
|
@@ -89,7 +95,8 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
89
95
|
message: `Run Dependency Install? (Y/n)`,
|
|
90
96
|
initial: 'y',
|
|
91
97
|
});
|
|
92
|
-
const runNpmInstall = typeof depInstallConfirm === 'string' &&
|
|
98
|
+
const runNpmInstall = typeof depInstallConfirm === 'string' &&
|
|
99
|
+
depInstallConfirm.toLowerCase() === 'y';
|
|
93
100
|
let installerType = 'npm';
|
|
94
101
|
if (runNpmInstall) {
|
|
95
102
|
const { manager } = packagemanager
|
|
@@ -118,7 +125,8 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
118
125
|
installFailed = true;
|
|
119
126
|
}
|
|
120
127
|
// Update iOS Projects
|
|
121
|
-
if (allDependencies['@capacitor/ios'] &&
|
|
128
|
+
if (allDependencies['@capacitor/ios'] &&
|
|
129
|
+
(0, utils_fs_1.existsSync)(config.ios.platformDirAbs)) {
|
|
122
130
|
// ios template changes
|
|
123
131
|
// Remove NSLocationAlwaysUsageDescription
|
|
124
132
|
await (0, common_2.runTask)(`Migrating Info.plist by removing NSLocationAlwaysUsageDescription key.`, () => {
|
|
@@ -133,7 +141,8 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
133
141
|
else {
|
|
134
142
|
log_1.logger.warn('Skipped Running cap sync.');
|
|
135
143
|
}
|
|
136
|
-
if (allDependencies['@capacitor/android'] &&
|
|
144
|
+
if (allDependencies['@capacitor/android'] &&
|
|
145
|
+
(0, utils_fs_1.existsSync)(config.android.platformDirAbs)) {
|
|
137
146
|
const gradleWrapperVersion = getGradleWrapperVersion((0, path_1.join)(config.android.platformDirAbs, 'gradle', 'wrapper', 'gradle-wrapper.properties'));
|
|
138
147
|
if (!installFailed && (0, semver_1.gt)(gradleVersion, gradleWrapperVersion)) {
|
|
139
148
|
try {
|
|
@@ -192,9 +201,11 @@ async function migrateCommand(config, noprompt, packagemanager) {
|
|
|
192
201
|
if (txt.includes(replaceStart)) {
|
|
193
202
|
const first = txt.indexOf(replaceStart) + replaceStart.length;
|
|
194
203
|
const value = txt.substring(first, txt.indexOf(replaceEnd, first));
|
|
195
|
-
if ((typeof variablesAndClasspaths.variables[variable] ===
|
|
204
|
+
if ((typeof variablesAndClasspaths.variables[variable] ===
|
|
205
|
+
'number' &&
|
|
196
206
|
value <= variablesAndClasspaths.variables[variable]) ||
|
|
197
|
-
(typeof variablesAndClasspaths.variables[variable] ===
|
|
207
|
+
(typeof variablesAndClasspaths.variables[variable] ===
|
|
208
|
+
'string' &&
|
|
198
209
|
(0, semver_1.lt)(value, variablesAndClasspaths.variables[variable]))) {
|
|
199
210
|
await updateFile(config, variablesPath, replaceStart, replaceEnd, variablesAndClasspaths.variables[variable].toString(), true);
|
|
200
211
|
}
|
|
@@ -332,8 +343,10 @@ async function getAndroidVariablesAndClasspaths(config) {
|
|
|
332
343
|
(0, fs_1.deleteFolderRecursive)(tempAndroidTemplateFolder);
|
|
333
344
|
const firstIndxOfCATBGV = buildGradleFile.indexOf(`classpath 'com.android.tools.build:gradle:`) + 42;
|
|
334
345
|
const firstIndxOfCGGGS = buildGradleFile.indexOf(`com.google.gms:google-services:`) + 31;
|
|
335
|
-
const comAndroidToolsBuildGradleVersion = '' +
|
|
336
|
-
|
|
346
|
+
const comAndroidToolsBuildGradleVersion = '' +
|
|
347
|
+
buildGradleFile.substring(firstIndxOfCATBGV, buildGradleFile.indexOf("'", firstIndxOfCATBGV));
|
|
348
|
+
const comGoogleGmsGoogleServices = '' +
|
|
349
|
+
buildGradleFile.substring(firstIndxOfCGGGS, buildGradleFile.indexOf("'", firstIndxOfCGGGS));
|
|
337
350
|
const variablesGradleAsJSON = JSON.parse(variablesGradleFile
|
|
338
351
|
.replace('ext ', '')
|
|
339
352
|
.replace(/=/g, ':')
|
|
@@ -346,7 +359,7 @@ async function getAndroidVariablesAndClasspaths(config) {
|
|
|
346
359
|
.replace(/\s/g, '')
|
|
347
360
|
.replace(/'/g, '"'));
|
|
348
361
|
return {
|
|
349
|
-
variables: variablesGradleAsJSON,
|
|
362
|
+
'variables': variablesGradleAsJSON,
|
|
350
363
|
'com.android.tools.build:gradle': comAndroidToolsBuildGradleVersion,
|
|
351
364
|
'com.google.gms:google-services': comGoogleGmsGoogleServices,
|
|
352
365
|
};
|
|
@@ -374,7 +387,15 @@ function getGradleWrapperVersion(filename) {
|
|
|
374
387
|
return semverVersion ? semverVersion : '0.0.0';
|
|
375
388
|
}
|
|
376
389
|
async function updateGradleWrapperFiles(platformDir) {
|
|
377
|
-
await (0, subprocess_1.runCommand)(`./gradlew`, [
|
|
390
|
+
await (0, subprocess_1.runCommand)(`./gradlew`, [
|
|
391
|
+
'wrapper',
|
|
392
|
+
'--distribution-type',
|
|
393
|
+
'all',
|
|
394
|
+
'--gradle-version',
|
|
395
|
+
gradleVersion,
|
|
396
|
+
'--warning-mode',
|
|
397
|
+
'all',
|
|
398
|
+
], {
|
|
378
399
|
cwd: platformDir,
|
|
379
400
|
});
|
|
380
401
|
}
|
|
@@ -497,7 +518,10 @@ function setAllStringIn(data, start, end, replacement) {
|
|
|
497
518
|
else {
|
|
498
519
|
const idx = foundIdx + start.length;
|
|
499
520
|
position = idx + replacement.length;
|
|
500
|
-
result =
|
|
521
|
+
result =
|
|
522
|
+
result.substring(0, idx) +
|
|
523
|
+
replacement +
|
|
524
|
+
result.substring(result.indexOf(end, idx));
|
|
501
525
|
}
|
|
502
526
|
}
|
|
503
527
|
return result;
|
|
@@ -534,7 +558,7 @@ async function removeKey(filename, key) {
|
|
|
534
558
|
let lines = txt.split('\n');
|
|
535
559
|
let removed = false;
|
|
536
560
|
let removing = false;
|
|
537
|
-
lines = lines.filter(
|
|
561
|
+
lines = lines.filter(line => {
|
|
538
562
|
if (removing && line.includes('</string>')) {
|
|
539
563
|
removing = false;
|
|
540
564
|
return false;
|
package/dist/tasks/new-plugin.js
CHANGED
|
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const colors_1 = tslib_1.__importDefault(require("../colors"));
|
|
6
6
|
const errors_1 = require("../errors");
|
|
7
7
|
async function newPluginCommand() {
|
|
8
|
-
(0, errors_1.fatal)(`The plugin:generate command has been removed.\n` +
|
|
8
|
+
(0, errors_1.fatal)(`The plugin:generate command has been removed.\n` +
|
|
9
|
+
`Use ${colors_1.default.input('npm init @capacitor/plugin')}`);
|
|
9
10
|
}
|
|
10
11
|
exports.newPluginCommand = newPluginCommand;
|
package/dist/tasks/open.js
CHANGED
|
@@ -41,7 +41,7 @@ async function openCommand(config, selectedPlatformName) {
|
|
|
41
41
|
}
|
|
42
42
|
exports.openCommand = openCommand;
|
|
43
43
|
function createOpenablePlatformFilter(config) {
|
|
44
|
-
return
|
|
44
|
+
return platform => platform === config.ios.name || platform === config.android.name;
|
|
45
45
|
}
|
|
46
46
|
async function open(config, platformName) {
|
|
47
47
|
if (platformName === config.ios.name) {
|