@capacitor/cli 6.2.0 → 7.0.0-alpha.2

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