@capacitor/cli 4.7.3 → 5.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 (55) 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-template.tar.gz +0 -0
  5. package/dist/android/add.js +6 -6
  6. package/dist/android/build.js +12 -9
  7. package/dist/android/common.js +27 -29
  8. package/dist/android/doctor.js +24 -24
  9. package/dist/android/open.js +3 -3
  10. package/dist/android/run.js +9 -6
  11. package/dist/android/update.js +53 -53
  12. package/dist/common.js +23 -23
  13. package/dist/config.js +67 -61
  14. package/dist/cordova.js +75 -75
  15. package/dist/declarations.d.ts +17 -1
  16. package/dist/index.js +32 -29
  17. package/dist/ios/add.js +2 -2
  18. package/dist/ios/build.js +9 -9
  19. package/dist/ios/common.js +12 -12
  20. package/dist/ios/doctor.js +6 -6
  21. package/dist/ios/open.js +2 -2
  22. package/dist/ios/run.js +7 -7
  23. package/dist/ios/update.js +58 -62
  24. package/dist/ipc.js +6 -6
  25. package/dist/log.js +2 -2
  26. package/dist/plugin.js +11 -11
  27. package/dist/sysconfig.js +6 -6
  28. package/dist/tasks/add.js +27 -27
  29. package/dist/tasks/build.js +7 -6
  30. package/dist/tasks/copy.js +42 -42
  31. package/dist/tasks/create.js +1 -1
  32. package/dist/tasks/doctor.js +10 -10
  33. package/dist/tasks/init.js +30 -27
  34. package/dist/tasks/list.js +12 -12
  35. package/dist/tasks/migrate.js +189 -407
  36. package/dist/tasks/new-plugin.js +1 -1
  37. package/dist/tasks/open.js +10 -10
  38. package/dist/tasks/run.js +13 -13
  39. package/dist/tasks/serve.js +1 -1
  40. package/dist/tasks/sourcemaps.js +9 -9
  41. package/dist/tasks/sync.js +15 -15
  42. package/dist/tasks/telemetry.js +4 -4
  43. package/dist/tasks/update.js +14 -14
  44. package/dist/telemetry.js +8 -8
  45. package/dist/util/cli.js +2 -2
  46. package/dist/util/fs.js +7 -7
  47. package/dist/util/native-run.js +3 -3
  48. package/dist/util/node.js +2 -2
  49. package/dist/util/subprocess.js +1 -1
  50. package/dist/util/template.js +1 -1
  51. package/dist/util/term.js +1 -1
  52. package/dist/util/xml.js +1 -1
  53. package/dist/web/copy.js +4 -4
  54. package/package.json +12 -11
  55. package/CHANGELOG.md +0 -805
package/dist/tasks/add.js CHANGED
@@ -15,17 +15,17 @@ const log_1 = require("../log");
15
15
  const sync_1 = require("./sync");
16
16
  async function addCommand(config, selectedPlatformName) {
17
17
  var _a;
18
- if (selectedPlatformName && !(await common_2.isValidPlatform(selectedPlatformName))) {
19
- const platformDir = common_2.resolvePlatform(config, selectedPlatformName);
18
+ if (selectedPlatformName && !(await (0, common_2.isValidPlatform)(selectedPlatformName))) {
19
+ const platformDir = (0, common_2.resolvePlatform)(config, selectedPlatformName);
20
20
  if (platformDir) {
21
- await common_2.runPlatformHook(config, selectedPlatformName, platformDir, 'capacitor:add');
21
+ await (0, common_2.runPlatformHook)(config, selectedPlatformName, platformDir, 'capacitor:add');
22
22
  }
23
23
  else {
24
24
  let msg = `Platform ${colors_1.default.input(selectedPlatformName)} not found.`;
25
- if (await common_2.isValidCommunityPlatform(selectedPlatformName)) {
25
+ if (await (0, common_2.isValidCommunityPlatform)(selectedPlatformName)) {
26
26
  msg += `\nTry installing ${colors_1.default.strong(`@capacitor-community/${selectedPlatformName}`)} and adding the platform again.`;
27
27
  }
28
- if (await common_2.isValidEnterprisePlatform(selectedPlatformName)) {
28
+ if (await (0, common_2.isValidEnterprisePlatform)(selectedPlatformName)) {
29
29
  msg +=
30
30
  `\nThis is an enterprise platform and @ionic-enterprise/capacitor-${selectedPlatformName} is not installed.\n` +
31
31
  `To learn how to use this platform, visit https://ionic.io/docs/${selectedPlatformName}`;
@@ -34,31 +34,31 @@ async function addCommand(config, selectedPlatformName) {
34
34
  }
35
35
  }
36
36
  else {
37
- const knownPlatforms = await common_2.getKnownPlatforms();
38
- const platformName = await common_2.promptForPlatform(knownPlatforms, `Please choose a platform to add:`, selectedPlatformName);
37
+ const knownPlatforms = await (0, common_2.getKnownPlatforms)();
38
+ const platformName = await (0, common_2.promptForPlatform)(knownPlatforms, `Please choose a platform to add:`, selectedPlatformName);
39
39
  if (platformName === config.web.name) {
40
40
  webWarning();
41
41
  return;
42
42
  }
43
- const existingPlatformDir = await common_2.getProjectPlatformDirectory(config, platformName);
43
+ const existingPlatformDir = await (0, common_2.getProjectPlatformDirectory)(config, platformName);
44
44
  if (existingPlatformDir) {
45
- errors_1.fatal(`${colors_1.default.input(platformName)} platform already exists.\n` +
46
- `To re-add this platform, first remove ${colors_1.default.strong(utils_terminal_1.prettyPath(existingPlatformDir))}, then run this command again.\n` +
45
+ (0, errors_1.fatal)(`${colors_1.default.input(platformName)} platform already exists.\n` +
46
+ `To re-add this platform, first remove ${colors_1.default.strong((0, utils_terminal_1.prettyPath)(existingPlatformDir))}, then run this command again.\n` +
47
47
  `${colors_1.default.strong('WARNING')}: Your native project will be completely removed.`);
48
48
  }
49
49
  try {
50
- await common_2.check([
51
- () => common_2.checkPackage(),
52
- () => common_2.checkAppConfig(config),
50
+ await (0, common_2.check)([
51
+ () => (0, common_2.checkPackage)(),
52
+ () => (0, common_2.checkAppConfig)(config),
53
53
  ...addChecks(config, platformName),
54
54
  ]);
55
55
  await doAdd(config, platformName);
56
56
  await editPlatforms(config, platformName);
57
- if (await utils_fs_1.pathExists(config.app.webDirAbs)) {
58
- await sync_1.sync(config, platformName, false, false);
57
+ if (await (0, utils_fs_1.pathExists)(config.app.webDirAbs)) {
58
+ await (0, sync_1.sync)(config, platformName, false, false);
59
59
  if (platformName === config.android.name) {
60
- await common_2.runTask('Syncing Gradle', async () => {
61
- return add_1.createLocalProperties(config.android.platformDirAbs);
60
+ await (0, common_2.runTask)('Syncing Gradle', async () => {
61
+ return (0, add_1.createLocalProperties)(config.android.platformDirAbs);
62
62
  });
63
63
  }
64
64
  }
@@ -68,8 +68,8 @@ async function addCommand(config, selectedPlatformName) {
68
68
  printNextSteps(platformName);
69
69
  }
70
70
  catch (e) {
71
- if (!errors_1.isFatal(e)) {
72
- errors_1.fatal((_a = e.stack) !== null && _a !== void 0 ? _a : e);
71
+ if (!(0, errors_1.isFatal)(e)) {
72
+ (0, errors_1.fatal)((_a = e.stack) !== null && _a !== void 0 ? _a : e);
73
73
  }
74
74
  throw e;
75
75
  }
@@ -77,15 +77,15 @@ async function addCommand(config, selectedPlatformName) {
77
77
  }
78
78
  exports.addCommand = addCommand;
79
79
  function printNextSteps(platformName) {
80
- log_1.logSuccess(`${colors_1.default.strong(platformName)} platform added!`);
80
+ (0, log_1.logSuccess)(`${colors_1.default.strong(platformName)} platform added!`);
81
81
  log_1.output.write(`Follow the Developer Workflow guide to get building:\n${colors_1.default.strong(`https://capacitorjs.com/docs/basics/workflow`)}\n`);
82
82
  }
83
83
  function addChecks(config, platformName) {
84
84
  if (platformName === config.ios.name) {
85
- return [() => common_3.checkIOSPackage(config), () => common_3.checkCocoaPods(config)];
85
+ return [() => (0, common_3.checkIOSPackage)(config), () => (0, common_3.checkCocoaPods)(config)];
86
86
  }
87
87
  else if (platformName === config.android.name) {
88
- return [() => common_1.checkAndroidPackage(config)];
88
+ return [() => (0, common_1.checkAndroidPackage)(config)];
89
89
  }
90
90
  else if (platformName === config.web.name) {
91
91
  return [];
@@ -95,21 +95,21 @@ function addChecks(config, platformName) {
95
95
  }
96
96
  }
97
97
  async function doAdd(config, platformName) {
98
- await common_2.runTask(colors_1.default.success(colors_1.default.strong('add')), async () => {
98
+ await (0, common_2.runTask)(colors_1.default.success(colors_1.default.strong('add')), async () => {
99
99
  if (platformName === config.ios.name) {
100
- await add_2.addIOS(config);
100
+ await (0, add_2.addIOS)(config);
101
101
  }
102
102
  else if (platformName === config.android.name) {
103
- await add_1.addAndroid(config);
103
+ await (0, add_1.addAndroid)(config);
104
104
  }
105
105
  });
106
106
  }
107
107
  async function editPlatforms(config, platformName) {
108
108
  if (platformName === config.ios.name) {
109
- await common_3.editProjectSettingsIOS(config);
109
+ await (0, common_3.editProjectSettingsIOS)(config);
110
110
  }
111
111
  else if (platformName === config.android.name) {
112
- await common_1.editProjectSettingsAndroid(config);
112
+ await (0, common_1.editProjectSettingsAndroid)(config);
113
113
  }
114
114
  }
115
115
  function webWarning() {
@@ -7,16 +7,17 @@ const errors_1 = require("../errors");
7
7
  const build_2 = require("../ios/build");
8
8
  async function buildCommand(config, selectedPlatformName, buildOptions) {
9
9
  var _a;
10
- const platforms = await common_1.selectPlatforms(config, selectedPlatformName);
10
+ const platforms = await (0, common_1.selectPlatforms)(config, selectedPlatformName);
11
11
  let platformName;
12
12
  if (platforms.length === 1) {
13
13
  platformName = platforms[0];
14
14
  }
15
15
  else {
16
- platformName = await common_1.promptForPlatform(platforms.filter(createBuildablePlatformFilter(config)), `Please choose a platform to build for:`);
16
+ platformName = await (0, common_1.promptForPlatform)(platforms.filter(createBuildablePlatformFilter(config)), `Please choose a platform to build for:`);
17
17
  }
18
18
  const buildCommandOptions = {
19
19
  scheme: buildOptions.scheme || config.ios.scheme,
20
+ flavor: buildOptions.flavor || config.android.flavor,
20
21
  keystorepath: buildOptions.keystorepath || config.android.buildOptions.keystorePath,
21
22
  keystorepass: buildOptions.keystorepass || config.android.buildOptions.keystorePassword,
22
23
  keystorealias: buildOptions.keystorealias || config.android.buildOptions.keystoreAlias,
@@ -30,8 +31,8 @@ async function buildCommand(config, selectedPlatformName, buildOptions) {
30
31
  await build(config, platformName, buildCommandOptions);
31
32
  }
32
33
  catch (e) {
33
- if (!errors_1.isFatal(e)) {
34
- errors_1.fatal((_a = e.stack) !== null && _a !== void 0 ? _a : e);
34
+ if (!(0, errors_1.isFatal)(e)) {
35
+ (0, errors_1.fatal)((_a = e.stack) !== null && _a !== void 0 ? _a : e);
35
36
  }
36
37
  throw e;
37
38
  }
@@ -39,10 +40,10 @@ async function buildCommand(config, selectedPlatformName, buildOptions) {
39
40
  exports.buildCommand = buildCommand;
40
41
  async function build(config, platformName, buildOptions) {
41
42
  if (platformName == config.ios.name) {
42
- await build_2.buildiOS(config, buildOptions);
43
+ await (0, build_2.buildiOS)(config, buildOptions);
43
44
  }
44
45
  else if (platformName === config.android.name) {
45
- await build_1.buildAndroid(config, buildOptions);
46
+ await (0, build_1.buildAndroid)(config, buildOptions);
46
47
  }
47
48
  else if (platformName === config.web.name) {
48
49
  throw `Platform "${platformName}" is not available in the build command.`;
@@ -15,22 +15,22 @@ const copy_1 = require("../web/copy");
15
15
  const sourcemaps_1 = require("./sourcemaps");
16
16
  async function copyCommand(config, selectedPlatformName, inline = false) {
17
17
  var _a;
18
- if (selectedPlatformName && !(await common_1.isValidPlatform(selectedPlatformName))) {
19
- const platformDir = common_1.resolvePlatform(config, selectedPlatformName);
18
+ if (selectedPlatformName && !(await (0, common_1.isValidPlatform)(selectedPlatformName))) {
19
+ const platformDir = (0, common_1.resolvePlatform)(config, selectedPlatformName);
20
20
  if (platformDir) {
21
- await common_1.runPlatformHook(config, selectedPlatformName, platformDir, 'capacitor:copy');
21
+ await (0, common_1.runPlatformHook)(config, selectedPlatformName, platformDir, 'capacitor:copy');
22
22
  }
23
23
  else {
24
24
  log_1.logger.error(`Platform ${colors_1.default.input(selectedPlatformName)} not found.`);
25
25
  }
26
26
  }
27
27
  else {
28
- const platforms = await common_1.selectPlatforms(config, selectedPlatformName);
28
+ const platforms = await (0, common_1.selectPlatforms)(config, selectedPlatformName);
29
29
  try {
30
- await promise_1.allSerial(platforms.map(platformName => () => copy(config, platformName, inline)));
30
+ await (0, promise_1.allSerial)(platforms.map(platformName => () => copy(config, platformName, inline)));
31
31
  }
32
32
  catch (e) {
33
- if (errors_1.isFatal(e)) {
33
+ if ((0, errors_1.isFatal)(e)) {
34
34
  throw e;
35
35
  }
36
36
  log_1.logger.error((_a = e.stack) !== null && _a !== void 0 ? _a : e);
@@ -39,14 +39,14 @@ async function copyCommand(config, selectedPlatformName, inline = false) {
39
39
  }
40
40
  exports.copyCommand = copyCommand;
41
41
  async function copy(config, platformName, inline = false) {
42
- await common_1.runTask(colors_1.default.success(colors_1.default.strong(`copy ${platformName}`)), async () => {
42
+ await (0, common_1.runTask)(colors_1.default.success(colors_1.default.strong(`copy ${platformName}`)), async () => {
43
43
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
44
- const result = await common_1.checkWebDir(config);
44
+ const result = await (0, common_1.checkWebDir)(config);
45
45
  if (result) {
46
46
  throw result;
47
47
  }
48
- await common_1.runPlatformHook(config, platformName, config.app.rootDir, 'capacitor:copy:before');
49
- const allPlugins = await plugin_1.getPlugins(config, platformName);
48
+ await (0, common_1.runPlatformHook)(config, platformName, config.app.rootDir, 'capacitor:copy:before');
49
+ const allPlugins = await (0, plugin_1.getPlugins)(config, platformName);
50
50
  let usesCapacitorPortals = false;
51
51
  if (allPlugins.filter(plugin => plugin.id === '@ionic-enterprise/capacitor-portals').length > 0) {
52
52
  usesCapacitorPortals = true;
@@ -78,8 +78,8 @@ async function copy(config, platformName, inline = false) {
78
78
  await copySSLCert((_k = config.app.extConfig.plugins.SSLPinning) === null || _k === void 0 ? void 0 : _k.certs, config.app.rootDir, await config.ios.webDirAbs);
79
79
  }
80
80
  await copyCapacitorConfig(config, config.ios.nativeTargetDirAbs);
81
- const cordovaPlugins = await cordova_1.getCordovaPlugins(config, platformName);
82
- await cordova_1.handleCordovaPluginsJS(cordovaPlugins, config, platformName);
81
+ const cordovaPlugins = await (0, cordova_1.getCordovaPlugins)(config, platformName);
82
+ await (0, cordova_1.handleCordovaPluginsJS)(cordovaPlugins, config, platformName);
83
83
  }
84
84
  else if (platformName === config.android.name) {
85
85
  if (usesCapacitorPortals) {
@@ -98,52 +98,52 @@ async function copy(config, platformName, inline = false) {
98
98
  await copySSLCert((_v = config.app.extConfig.plugins.SSLPinning) === null || _v === void 0 ? void 0 : _v.certs, config.app.rootDir, config.android.assetsDirAbs);
99
99
  }
100
100
  await copyCapacitorConfig(config, config.android.assetsDirAbs);
101
- const cordovaPlugins = await cordova_1.getCordovaPlugins(config, platformName);
102
- await cordova_1.handleCordovaPluginsJS(cordovaPlugins, config, platformName);
103
- await cordova_1.writeCordovaAndroidManifest(cordovaPlugins, config, platformName);
101
+ const cordovaPlugins = await (0, cordova_1.getCordovaPlugins)(config, platformName);
102
+ await (0, cordova_1.handleCordovaPluginsJS)(cordovaPlugins, config, platformName);
103
+ await (0, cordova_1.writeCordovaAndroidManifest)(cordovaPlugins, config, platformName);
104
104
  }
105
105
  else if (platformName === config.web.name) {
106
106
  if (usesCapacitorPortals) {
107
107
  log_1.logger.info('Capacitor Portals Plugin installed, skipping web bundling...');
108
108
  }
109
109
  else {
110
- await copy_1.copyWeb(config);
110
+ await (0, copy_1.copyWeb)(config);
111
111
  }
112
112
  }
113
113
  else {
114
114
  throw `Platform ${platformName} is not valid.`;
115
115
  }
116
116
  if (inline) {
117
- await sourcemaps_1.inlineSourceMaps(config, platformName);
117
+ await (0, sourcemaps_1.inlineSourceMaps)(config, platformName);
118
118
  }
119
119
  });
120
- await common_1.runPlatformHook(config, platformName, config.app.rootDir, 'capacitor:copy:after');
120
+ await (0, common_1.runPlatformHook)(config, platformName, config.app.rootDir, 'capacitor:copy:after');
121
121
  }
122
122
  exports.copy = copy;
123
123
  async function copyCapacitorConfig(config, nativeAbsDir) {
124
- const nativeRelDir = path_1.relative(config.app.rootDir, nativeAbsDir);
124
+ const nativeRelDir = (0, path_1.relative)(config.app.rootDir, nativeAbsDir);
125
125
  const nativeConfigFile = 'capacitor.config.json';
126
- const nativeConfigFilePath = path_1.join(nativeAbsDir, nativeConfigFile);
127
- await common_1.runTask(`Creating ${colors_1.default.strong(nativeConfigFile)} in ${nativeRelDir}`, async () => {
126
+ const nativeConfigFilePath = (0, path_1.join)(nativeAbsDir, nativeConfigFile);
127
+ await (0, common_1.runTask)(`Creating ${colors_1.default.strong(nativeConfigFile)} in ${nativeRelDir}`, async () => {
128
128
  var _a;
129
129
  (_a = config.app.extConfig.android) === null || _a === void 0 ? true : delete _a.buildOptions;
130
- await utils_fs_1.writeJSON(nativeConfigFilePath, config.app.extConfig, {
130
+ await (0, utils_fs_1.writeJSON)(nativeConfigFilePath, config.app.extConfig, {
131
131
  spaces: '\t',
132
132
  });
133
133
  });
134
134
  }
135
135
  async function copyWebDir(config, nativeAbsDir, webAbsDir) {
136
136
  var _a;
137
- const webRelDir = path_1.basename(webAbsDir);
138
- const nativeRelDir = path_1.relative(config.app.rootDir, nativeAbsDir);
139
- if (((_a = config.app.extConfig.server) === null || _a === void 0 ? void 0 : _a.url) && !(await utils_fs_1.pathExists(webAbsDir))) {
137
+ const webRelDir = (0, path_1.basename)(webAbsDir);
138
+ const nativeRelDir = (0, path_1.relative)(config.app.rootDir, nativeAbsDir);
139
+ if (((_a = config.app.extConfig.server) === null || _a === void 0 ? void 0 : _a.url) && !(await (0, utils_fs_1.pathExists)(webAbsDir))) {
140
140
  log_1.logger.warn(`Cannot copy web assets from ${colors_1.default.strong(webRelDir)} to ${nativeRelDir}\n` +
141
141
  `Web asset directory specified by ${colors_1.default.input('webDir')} does not exist. This is not an error because ${colors_1.default.input('server.url')} is set in config.`);
142
142
  return;
143
143
  }
144
- await common_1.runTask(`Copying web assets from ${colors_1.default.strong(webRelDir)} to ${nativeRelDir}`, async () => {
145
- await utils_fs_1.remove(nativeAbsDir);
146
- return utils_fs_1.copy(webAbsDir, nativeAbsDir);
144
+ await (0, common_1.runTask)(`Copying web assets from ${colors_1.default.strong(webRelDir)} to ${nativeRelDir}`, async () => {
145
+ await (0, utils_fs_1.remove)(nativeAbsDir);
146
+ return (0, utils_fs_1.copy)(webAbsDir, nativeAbsDir);
147
147
  });
148
148
  }
149
149
  async function copyFederatedWebDirs(config, nativeAbsDir) {
@@ -160,8 +160,8 @@ async function copyFederatedWebDirs(config, nativeAbsDir) {
160
160
  throw `Capacitor Portals plugin is present but there is a problem with the apps defined in the config.`;
161
161
  }
162
162
  await Promise.all([...portalsConfig.apps, portalsConfig.shell].map(app => {
163
- const appDir = path_1.resolve(config.app.rootDir, app.webDir);
164
- return copyWebDir(config, path_1.resolve(nativeAbsDir, app.name), appDir);
163
+ const appDir = (0, path_1.resolve)(config.app.rootDir, app.webDir);
164
+ return copyWebDir(config, (0, path_1.resolve)(nativeAbsDir, app.name), appDir);
165
165
  }));
166
166
  }
167
167
  function isPortal(config) {
@@ -169,40 +169,40 @@ function isPortal(config) {
169
169
  config.name !== undefined);
170
170
  }
171
171
  async function copySecureLiveUpdatesKey(secureLiveUpdatesKeyFile, rootDir, nativeAbsDir) {
172
- const keyAbsFromPath = path_1.join(rootDir, secureLiveUpdatesKeyFile);
173
- const keyAbsToPath = path_1.join(nativeAbsDir, path_1.basename(keyAbsFromPath));
174
- const keyRelToDir = path_1.relative(rootDir, nativeAbsDir);
175
- if (!(await utils_fs_1.pathExists(keyAbsFromPath))) {
172
+ const keyAbsFromPath = (0, path_1.join)(rootDir, secureLiveUpdatesKeyFile);
173
+ const keyAbsToPath = (0, path_1.join)(nativeAbsDir, (0, path_1.basename)(keyAbsFromPath));
174
+ const keyRelToDir = (0, path_1.relative)(rootDir, nativeAbsDir);
175
+ if (!(await (0, utils_fs_1.pathExists)(keyAbsFromPath))) {
176
176
  log_1.logger.warn(`Cannot copy Secure Live Updates signature file from ${colors_1.default.strong(keyAbsFromPath)} to ${keyRelToDir}\n` +
177
177
  `Signature file does not exist at specified key path.`);
178
178
  return;
179
179
  }
180
- await common_1.runTask(`Copying Secure Live Updates key from ${colors_1.default.strong(secureLiveUpdatesKeyFile)} to ${keyRelToDir}`, async () => {
181
- return utils_fs_1.copy(keyAbsFromPath, keyAbsToPath);
180
+ await (0, common_1.runTask)(`Copying Secure Live Updates key from ${colors_1.default.strong(secureLiveUpdatesKeyFile)} to ${keyRelToDir}`, async () => {
181
+ return (0, utils_fs_1.copy)(keyAbsFromPath, keyAbsToPath);
182
182
  });
183
183
  }
184
184
  async function copySSLCert(sslCertPaths, rootDir, targetDir) {
185
185
  const validCertPaths = [];
186
186
  for (const sslCertPath of sslCertPaths) {
187
- const certAbsFromPath = path_1.join(rootDir, sslCertPath);
187
+ const certAbsFromPath = (0, path_1.join)(rootDir, sslCertPath);
188
188
  if (!/^.+\.(cer)$/.test(certAbsFromPath)) {
189
189
  log_1.logger.warn(`Cannot copy file from ${colors_1.default.strong(certAbsFromPath)}\n` +
190
190
  `The file is not a .cer SSL Certificate file.`);
191
191
  return;
192
192
  }
193
- if (!(await utils_fs_1.pathExists(certAbsFromPath))) {
193
+ if (!(await (0, utils_fs_1.pathExists)(certAbsFromPath))) {
194
194
  log_1.logger.warn(`Cannot copy SSL Certificate file from ${colors_1.default.strong(certAbsFromPath)}\n` +
195
195
  `SSL Certificate does not exist at specified path.`);
196
196
  return;
197
197
  }
198
198
  validCertPaths.push(certAbsFromPath);
199
199
  }
200
- const certsDirAbsToPath = path_1.join(targetDir, 'certs');
201
- const certsDirRelToDir = path_1.relative(rootDir, targetDir);
202
- await common_1.runTask(`Copying SSL Certificates from to ${certsDirRelToDir}`, async () => {
200
+ const certsDirAbsToPath = (0, path_1.join)(targetDir, 'certs');
201
+ const certsDirRelToDir = (0, path_1.relative)(rootDir, targetDir);
202
+ await (0, common_1.runTask)(`Copying SSL Certificates from to ${certsDirRelToDir}`, async () => {
203
203
  const promises = [];
204
204
  for (const certPath of validCertPaths) {
205
- promises.push(utils_fs_1.copy(certPath, path_1.join(certsDirAbsToPath, path_1.basename(certPath))));
205
+ promises.push((0, utils_fs_1.copy)(certPath, (0, path_1.join)(certsDirAbsToPath, (0, path_1.basename)(certPath))));
206
206
  }
207
207
  return Promise.all(promises);
208
208
  });
@@ -5,7 +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
- errors_1.fatal(`The create command has been removed.\n` +
8
+ (0, errors_1.fatal)(`The create command has been removed.\n` +
9
9
  `Use ${colors_1.default.input('npm init @capacitor/app')}`);
10
10
  }
11
11
  exports.createCommand = createCommand;
@@ -12,9 +12,9 @@ const emoji_1 = require("../util/emoji");
12
12
  const node_1 = require("../util/node");
13
13
  const subprocess_1 = require("../util/subprocess");
14
14
  async function doctorCommand(config, selectedPlatformName) {
15
- log_1.output.write(`${emoji_1.emoji('💊', '')} ${colors_1.default.strong('Capacitor Doctor')} ${emoji_1.emoji('💊', '')} \n\n`);
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
- const platforms = await common_1.selectPlatforms(config, selectedPlatformName);
17
+ const platforms = await (0, common_1.selectPlatforms)(config, selectedPlatformName);
18
18
  await Promise.all(platforms.map(platformName => {
19
19
  return doctor(config, platformName);
20
20
  }));
@@ -22,10 +22,10 @@ async function doctorCommand(config, selectedPlatformName) {
22
22
  exports.doctorCommand = doctorCommand;
23
23
  async function doctorCore(config) {
24
24
  const [cliVersion, coreVersion, androidVersion, iosVersion] = await Promise.all([
25
- subprocess_1.getCommandOutput('npm', ['info', '@capacitor/cli', 'version']),
26
- subprocess_1.getCommandOutput('npm', ['info', '@capacitor/core', 'version']),
27
- subprocess_1.getCommandOutput('npm', ['info', '@capacitor/android', 'version']),
28
- subprocess_1.getCommandOutput('npm', ['info', '@capacitor/ios', 'version']),
25
+ (0, subprocess_1.getCommandOutput)('npm', ['info', '@capacitor/cli', 'version']),
26
+ (0, subprocess_1.getCommandOutput)('npm', ['info', '@capacitor/core', 'version']),
27
+ (0, subprocess_1.getCommandOutput)('npm', ['info', '@capacitor/android', 'version']),
28
+ (0, subprocess_1.getCommandOutput)('npm', ['info', '@capacitor/ios', 'version']),
29
29
  ]);
30
30
  log_1.output.write(`${colors_1.default.strong('Latest Dependencies:')}\n\n` +
31
31
  ` @capacitor/cli: ${colors_1.default.weak(cliVersion !== null && cliVersion !== void 0 ? cliVersion : 'unknown')}\n` +
@@ -45,23 +45,23 @@ async function printInstalledPackages(config) {
45
45
  '@capacitor/ios',
46
46
  ];
47
47
  await Promise.all(packageNames.map(async (packageName) => {
48
- const packagePath = node_1.resolveNode(config.app.rootDir, packageName, 'package.json');
48
+ const packagePath = (0, node_1.resolveNode)(config.app.rootDir, packageName, 'package.json');
49
49
  await printPackageVersion(packageName, packagePath);
50
50
  }));
51
51
  }
52
52
  async function printPackageVersion(packageName, packagePath) {
53
53
  let version;
54
54
  if (packagePath) {
55
- version = (await utils_fs_1.readJSON(packagePath)).version;
55
+ version = (await (0, utils_fs_1.readJSON)(packagePath)).version;
56
56
  }
57
57
  log_1.output.write(` ${packageName}: ${colors_1.default.weak(version || 'not installed')}\n`);
58
58
  }
59
59
  async function doctor(config, platformName) {
60
60
  if (platformName === config.ios.name) {
61
- await doctor_2.doctorIOS(config);
61
+ await (0, doctor_2.doctorIOS)(config);
62
62
  }
63
63
  else if (platformName === config.android.name) {
64
- await doctor_1.doctorAndroid(config);
64
+ await (0, doctor_1.doctorAndroid)(config);
65
65
  }
66
66
  else if (platformName === config.web.name) {
67
67
  return Promise.resolve();
@@ -15,40 +15,43 @@ const sysconfig_1 = require("../sysconfig");
15
15
  const node_1 = require("../util/node");
16
16
  const term_1 = require("../util/term");
17
17
  async function initCommand(config, name, id, webDirFromCLI) {
18
- var _a, _b;
18
+ var _a, _b, _c, _d;
19
19
  try {
20
- if (!term_1.checkInteractive(name, id)) {
20
+ if (!(0, term_1.checkInteractive)(name, id)) {
21
21
  return;
22
22
  }
23
23
  if (config.app.extConfigType !== 'json') {
24
- errors_1.fatal(`Cannot run ${colors_1.default.input('init')} for a project using a non-JSON configuration file.\n` +
24
+ (0, errors_1.fatal)(`Cannot run ${colors_1.default.input('init')} for a project using a non-JSON configuration file.\n` +
25
25
  `Delete ${colors_1.default.strong(config.app.extConfigName)} and try again.`);
26
26
  }
27
27
  const isNewConfig = Object.keys(config.app.extConfig).length === 0;
28
- const tsInstalled = !!node_1.resolveNode(config.app.rootDir, 'typescript');
28
+ const tsInstalled = !!(0, node_1.resolveNode)(config.app.rootDir, 'typescript');
29
29
  const appName = await getName(config, name);
30
30
  const appId = await getAppId(config, id);
31
- const webDir = term_1.isInteractive()
31
+ const webDir = (0, term_1.isInteractive)()
32
32
  ? await getWebDir(config, webDirFromCLI)
33
33
  : (_a = webDirFromCLI !== null && webDirFromCLI !== void 0 ? webDirFromCLI : config.app.extConfig.webDir) !== null && _a !== void 0 ? _a : 'www';
34
- await common_1.check([
35
- () => common_1.checkAppName(config, appName),
36
- () => common_1.checkAppId(config, appId),
34
+ await (0, common_1.check)([
35
+ () => (0, common_1.checkAppName)(config, appName),
36
+ () => (0, common_1.checkAppId)(config, appId),
37
37
  ]);
38
- const cordova = await cordova_1.getCordovaPreferences(config);
38
+ const androidScheme = (_c = (_b = config.app.extConfig.server) === null || _b === void 0 ? void 0 : _b.androidScheme) !== null && _c !== void 0 ? _c : 'https';
39
+ const cordova = await (0, cordova_1.getCordovaPreferences)(config);
39
40
  await runMergeConfig(config, {
40
41
  appId,
41
42
  appName,
42
43
  webDir,
43
- bundledWebRuntime: false,
44
+ server: {
45
+ androidScheme: androidScheme,
46
+ },
44
47
  cordova,
45
48
  }, isNewConfig && tsInstalled ? 'ts' : 'json');
46
49
  }
47
50
  catch (e) {
48
- if (!errors_1.isFatal(e)) {
51
+ if (!(0, errors_1.isFatal)(e)) {
49
52
  log_1.output.write('Usage: npx cap init appName appId\n' +
50
53
  'Example: npx cap init "My App" "com.example.myapp"\n\n');
51
- errors_1.fatal((_b = e.stack) !== null && _b !== void 0 ? _b : e);
54
+ (0, errors_1.fatal)((_d = e.stack) !== null && _d !== void 0 ? _d : e);
52
55
  }
53
56
  throw e;
54
57
  }
@@ -57,7 +60,7 @@ exports.initCommand = initCommand;
57
60
  async function getName(config, name) {
58
61
  var _a;
59
62
  if (!name) {
60
- const answers = await log_1.logPrompt(`${colors_1.default.strong(`What is the name of your app?`)}\n` +
63
+ const answers = await (0, log_1.logPrompt)(`${colors_1.default.strong(`What is the name of your app?`)}\n` +
61
64
  `This should be a human-friendly app name, like what you'd see in the App Store.`, {
62
65
  type: 'text',
63
66
  name: 'name',
@@ -72,7 +75,7 @@ async function getName(config, name) {
72
75
  }
73
76
  async function getAppId(config, id) {
74
77
  if (!id) {
75
- const answers = await log_1.logPrompt(`${colors_1.default.strong(`What should be the Package ID for your app?`)}\n` +
78
+ const answers = await (0, log_1.logPrompt)(`${colors_1.default.strong(`What should be the Package ID for your app?`)}\n` +
76
79
  `Package IDs (aka Bundle ID in iOS and Application ID in Android) are unique identifiers for apps. They must be in reverse domain name notation, generally representing a domain name that you or your company owns.`, {
77
80
  type: 'text',
78
81
  name: 'id',
@@ -85,11 +88,11 @@ async function getAppId(config, id) {
85
88
  }
86
89
  async function getWebDir(config, webDir) {
87
90
  if (!webDir) {
88
- const framework = framework_configs_1.detectFramework(config);
91
+ const framework = (0, framework_configs_1.detectFramework)(config);
89
92
  if (framework === null || framework === void 0 ? void 0 : framework.webDir) {
90
93
  return framework.webDir;
91
94
  }
92
- const answers = await log_1.logPrompt(`${colors_1.default.strong(`What is the web asset directory for your app?`)}\n` +
95
+ const answers = await (0, log_1.logPrompt)(`${colors_1.default.strong(`What is the web asset directory for your app?`)}\n` +
93
96
  `This directory should contain the final ${colors_1.default.strong('index.html')} of your app.`, {
94
97
  type: 'text',
95
98
  name: 'webDir',
@@ -101,32 +104,32 @@ async function getWebDir(config, webDir) {
101
104
  return webDir;
102
105
  }
103
106
  async function runMergeConfig(config, extConfig, type) {
104
- const configDirectory = path_1.dirname(config.app.extConfigFilePath);
105
- const newConfigPath = path_1.resolve(configDirectory, type === 'ts' ? config_1.CONFIG_FILE_NAME_TS : config_1.CONFIG_FILE_NAME_JSON);
106
- await common_1.runTask(`Creating ${colors_1.default.strong(path_1.basename(newConfigPath))} in ${colors_1.default.input(config.app.rootDir)}`, async () => {
107
+ const configDirectory = (0, path_1.dirname)(config.app.extConfigFilePath);
108
+ const newConfigPath = (0, path_1.resolve)(configDirectory, type === 'ts' ? config_1.CONFIG_FILE_NAME_TS : config_1.CONFIG_FILE_NAME_JSON);
109
+ await (0, common_1.runTask)(`Creating ${colors_1.default.strong((0, path_1.basename)(newConfigPath))} in ${colors_1.default.input(config.app.rootDir)}`, async () => {
107
110
  await mergeConfig(config, extConfig, newConfigPath);
108
111
  });
109
- printNextSteps(path_1.basename(newConfigPath));
110
- if (term_1.isInteractive()) {
111
- let sysconfig = await sysconfig_1.readConfig();
112
+ printNextSteps((0, path_1.basename)(newConfigPath));
113
+ if ((0, term_1.isInteractive)()) {
114
+ let sysconfig = await (0, sysconfig_1.readConfig)();
112
115
  if (typeof sysconfig.signup === 'undefined') {
113
116
  const signup = await promptToSignup();
114
117
  sysconfig = { ...sysconfig, signup };
115
- await sysconfig_1.writeConfig(sysconfig);
118
+ await (0, sysconfig_1.writeConfig)(sysconfig);
116
119
  }
117
120
  }
118
121
  }
119
122
  async function mergeConfig(config, extConfig, newConfigPath) {
120
123
  const oldConfig = { ...config.app.extConfig };
121
124
  const newConfig = { ...oldConfig, ...extConfig };
122
- await config_1.writeConfig(newConfig, newConfigPath);
125
+ await (0, config_1.writeConfig)(newConfig, newConfigPath);
123
126
  }
124
127
  function printNextSteps(newConfigName) {
125
- log_1.logSuccess(`${colors_1.default.strong(newConfigName)} created!`);
128
+ (0, log_1.logSuccess)(`${colors_1.default.strong(newConfigName)} created!`);
126
129
  log_1.output.write(`\nNext steps: \n${colors_1.default.strong(`https://capacitorjs.com/docs/getting-started#where-to-go-next`)}\n`);
127
130
  }
128
131
  async function promptToSignup() {
129
- const answers = await log_1.logPrompt(`Join the Ionic Community! 💙\n` +
132
+ const answers = await (0, log_1.logPrompt)(`Join the Ionic Community! 💙\n` +
130
133
  `Connect with millions of developers on the Ionic Forum and get access to live events, news updates, and more.`, {
131
134
  type: 'confirm',
132
135
  name: 'create',
@@ -134,7 +137,7 @@ async function promptToSignup() {
134
137
  initial: true,
135
138
  });
136
139
  if (answers.create) {
137
- open_1.default(`http://ionicframework.com/signup?source=capacitor`);
140
+ (0, open_1.default)(`http://ionicframework.com/signup?source=capacitor`);
138
141
  }
139
142
  return answers.create;
140
143
  }
@@ -12,12 +12,12 @@ const plugin_1 = require("../plugin");
12
12
  const promise_1 = require("../util/promise");
13
13
  async function listCommand(config, selectedPlatformName) {
14
14
  var _a;
15
- const platforms = await common_2.selectPlatforms(config, selectedPlatformName);
15
+ const platforms = await (0, common_2.selectPlatforms)(config, selectedPlatformName);
16
16
  try {
17
- await 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
- if (errors_1.isFatal(e)) {
20
+ if ((0, errors_1.isFatal)(e)) {
21
21
  throw e;
22
22
  }
23
23
  log_1.logger.error((_a = e.stack) !== null && _a !== void 0 ? _a : e);
@@ -25,13 +25,13 @@ async function listCommand(config, selectedPlatformName) {
25
25
  }
26
26
  exports.listCommand = listCommand;
27
27
  async function list(config, platform) {
28
- const allPlugins = await plugin_1.getPlugins(config, platform);
28
+ const allPlugins = await (0, plugin_1.getPlugins)(config, platform);
29
29
  let plugins = [];
30
30
  if (platform === config.ios.name) {
31
- plugins = await common_3.getIOSPlugins(allPlugins);
31
+ plugins = await (0, common_3.getIOSPlugins)(allPlugins);
32
32
  }
33
33
  else if (platform === config.android.name) {
34
- plugins = await common_1.getAndroidPlugins(allPlugins);
34
+ plugins = await (0, common_1.getAndroidPlugins)(allPlugins);
35
35
  }
36
36
  else if (platform === config.web.name) {
37
37
  log_1.logger.info(`Listing plugins for ${colors_1.default.input(platform)} is not possible.`);
@@ -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 => plugin_1.getPluginType(p, platform) === 0 /* Core */);
44
- plugin_1.printPlugins(capacitorPlugins, platform);
45
- const cordovaPlugins = plugins.filter(p => plugin_1.getPluginType(p, platform) === 1 /* Cordova */);
46
- plugin_1.printPlugins(cordovaPlugins, platform, 'cordova');
47
- const incompatibleCordovaPlugins = plugins.filter(p => plugin_1.getPluginType(p, platform) === 2 /* Incompatible */);
48
- plugin_1.printPlugins(incompatibleCordovaPlugins, platform, 'incompatible');
43
+ const capacitorPlugins = plugins.filter(p => (0, plugin_1.getPluginType)(p, platform) === 0 /* PluginType.Core */);
44
+ (0, plugin_1.printPlugins)(capacitorPlugins, platform);
45
+ const cordovaPlugins = plugins.filter(p => (0, plugin_1.getPluginType)(p, platform) === 1 /* PluginType.Cordova */);
46
+ (0, plugin_1.printPlugins)(cordovaPlugins, platform, 'cordova');
47
+ const incompatibleCordovaPlugins = plugins.filter(p => (0, plugin_1.getPluginType)(p, platform) === 2 /* PluginType.Incompatible */);
48
+ (0, plugin_1.printPlugins)(incompatibleCordovaPlugins, platform, 'incompatible');
49
49
  }
50
50
  exports.list = list;