@capacitor/cli 3.3.1 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,51 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.4.0](https://github.com/ionic-team/capacitor/compare/3.3.4...3.4.0) (2022-01-19)
7
+
8
+ **Note:** Version bump only for package @capacitor/cli
9
+
10
+
11
+
12
+
13
+
14
+ ## [3.3.4](https://github.com/ionic-team/capacitor/compare/3.3.3...3.3.4) (2022-01-05)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * **cli:** Escape appName from invalid characters on add ([#5325](https://github.com/ionic-team/capacitor/issues/5325)) ([033f4ee](https://github.com/ionic-team/capacitor/commit/033f4eef59fdb7cc32018b162114511448bc46a6))
20
+ * **cli:** sync failing if Info.plist is localized ([#5333](https://github.com/ionic-team/capacitor/issues/5333)) ([df7a104](https://github.com/ionic-team/capacitor/commit/df7a1041c4e2d9a5a1ceef247ed00f9f8467df76))
21
+
22
+
23
+
24
+
25
+
26
+ ## [3.3.3](https://github.com/ionic-team/capacitor/compare/3.3.2...3.3.3) (2021-12-08)
27
+
28
+
29
+ ### Bug Fixes
30
+
31
+ * **android:** restrict android run command to configured flavour ([#5256](https://github.com/ionic-team/capacitor/issues/5256)) ([ba84443](https://github.com/ionic-team/capacitor/commit/ba84443dce9c81e09140def57a60018b527b5bb5))
32
+ * **cli:** Add onesignal-cordova-plugin to the static list again ([#5262](https://github.com/ionic-team/capacitor/issues/5262)) ([e67ca99](https://github.com/ionic-team/capacitor/commit/e67ca9964c5a923d35f5cf41eb802c665563726f))
33
+
34
+
35
+
36
+
37
+
38
+ ## [3.3.2](https://github.com/ionic-team/capacitor/compare/3.3.1...3.3.2) (2021-11-17)
39
+
40
+
41
+ ### Bug Fixes
42
+
43
+ * **cli:** add cordova-plugin-google-analytics to static list ([#5220](https://github.com/ionic-team/capacitor/issues/5220)) ([67a996c](https://github.com/ionic-team/capacitor/commit/67a996c0a6896e32c41ea01822d6435fdd706b84))
44
+ * **cli:** Add plugin to static list if pod has use-frameworks ([#5232](https://github.com/ionic-team/capacitor/issues/5232)) ([8a0518b](https://github.com/ionic-team/capacitor/commit/8a0518be9f6f6a4be4a9f1366cb8dcb191225b9d))
45
+ * **cli:** sync gradle from android folder ([#5233](https://github.com/ionic-team/capacitor/issues/5233)) ([cd779c4](https://github.com/ionic-team/capacitor/commit/cd779c4b6ed4ffc96777be7c94a0af4baca6d6d5))
46
+
47
+
48
+
49
+
50
+
6
51
  ## [3.3.1](https://github.com/ionic-team/capacitor/compare/3.3.0...3.3.1) (2021-11-05)
7
52
 
8
53
 
Binary file
Binary file
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addAndroid = void 0;
3
+ exports.createLocalProperties = exports.addAndroid = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const utils_fs_1 = require("@ionic/utils-fs");
6
6
  const os_1 = require("os");
@@ -13,9 +13,6 @@ async function addAndroid(config) {
13
13
  await common_1.runTask(`Adding native android project in ${colors_1.default.strong(config.android.platformDir)}`, async () => {
14
14
  return template_1.extractTemplate(config.cli.assets.android.platformTemplateArchiveAbs, config.android.platformDirAbs);
15
15
  });
16
- await common_1.runTask('Syncing Gradle', async () => {
17
- return createLocalProperties(config.android.platformDirAbs);
18
- });
19
16
  }
20
17
  exports.addAndroid = addAndroid;
21
18
  async function createLocalProperties(platformDir) {
@@ -47,6 +44,9 @@ sdk.dir=${defaultAndroidPath}
47
44
  }
48
45
  }
49
46
  }
47
+ exports.createLocalProperties = createLocalProperties;
50
48
  async function gradleSync(platformDir) {
51
- await subprocess_1.runCommand(`${platformDir}/gradlew`, []);
49
+ await subprocess_1.runCommand(`./gradlew`, [], {
50
+ cwd: platformDir,
51
+ });
52
52
  }
@@ -56,7 +56,11 @@ exports.resolvePlugin = resolvePlugin;
56
56
  */
57
57
  async function editProjectSettingsAndroid(config) {
58
58
  const appId = config.app.appId;
59
- const appName = config.app.appName;
59
+ const appName = config.app.appName
60
+ .replace(/&/g, '&')
61
+ .replace(/</g, '&lt;')
62
+ .replace(/"/g, '\\"')
63
+ .replace(/'/g, "\\'");
60
64
  const manifestPath = path_1.resolve(config.android.srcMainDirAbs, 'AndroidManifest.xml');
61
65
  const buildGradlePath = path_1.resolve(config.android.appDirAbs, 'build.gradle');
62
66
  let manifestContent = await utils_fs_1.readFile(manifestPath, { encoding: 'utf-8' });
@@ -89,7 +93,7 @@ async function editProjectSettingsAndroid(config) {
89
93
  const stringsPath = path_1.resolve(config.android.resDirAbs, 'values/strings.xml');
90
94
  let stringsContent = await utils_fs_1.readFile(stringsPath, { encoding: 'utf-8' });
91
95
  stringsContent = stringsContent.replace(/com.getcapacitor.myapp/g, appId);
92
- stringsContent = stringsContent.replace(/My App/g, appName.replace(/'/g, `\\'`));
96
+ stringsContent = stringsContent.replace(/My App/g, appName);
93
97
  await utils_fs_1.writeFile(stringsPath, stringsContent);
94
98
  }
95
99
  exports.editProjectSettingsAndroid = editProjectSettingsAndroid;
@@ -10,8 +10,10 @@ const native_run_1 = require("../util/native-run");
10
10
  const subprocess_1 = require("../util/subprocess");
11
11
  const debug = debug_1.default('capacitor:android:run');
12
12
  async function runAndroid(config, { target: selectedTarget }) {
13
+ var _a;
13
14
  const target = await common_1.promptForPlatformTarget(await native_run_1.getPlatformTargets('android'), selectedTarget);
14
- const gradleArgs = ['assembleDebug'];
15
+ const arg = `assemble${((_a = config.android) === null || _a === void 0 ? void 0 : _a.flavor) || ''}Debug`;
16
+ const gradleArgs = [arg];
15
17
  debug('Invoking ./gradlew with args: %O', gradleArgs);
16
18
  await common_1.runTask('Running Gradle build', async () => subprocess_1.runCommand('./gradlew', gradleArgs, {
17
19
  cwd: config.android.platformDirAbs,
package/dist/config.js CHANGED
@@ -148,7 +148,7 @@ async function loadCLIConfig(rootDir) {
148
148
  };
149
149
  }
150
150
  async function loadAndroidConfig(rootDir, extConfig, cliConfig) {
151
- var _a, _b, _c, _d, _e;
151
+ var _a, _b, _c, _d, _e, _f;
152
152
  const name = 'android';
153
153
  const platformDir = (_b = (_a = extConfig.android) === null || _a === void 0 ? void 0 : _a.path) !== null && _b !== void 0 ? _b : 'android';
154
154
  const platformDirAbs = path_1.resolve(rootDir, platformDir);
@@ -160,9 +160,10 @@ async function loadAndroidConfig(rootDir, extConfig, cliConfig) {
160
160
  const resDir = `${srcMainDir}/res`;
161
161
  let apkPath = `${appDir}/build/outputs/apk/`;
162
162
  let flavorPrefix = '';
163
- if ((_c = extConfig.android) === null || _c === void 0 ? void 0 : _c.flavor) {
164
- apkPath = `${apkPath}/${(_d = extConfig.android) === null || _d === void 0 ? void 0 : _d.flavor}`;
165
- flavorPrefix = `-${(_e = extConfig.android) === null || _e === void 0 ? void 0 : _e.flavor}`;
163
+ const flavor = ((_c = extConfig.android) === null || _c === void 0 ? void 0 : _c.flavor) || '';
164
+ if ((_d = extConfig.android) === null || _d === void 0 ? void 0 : _d.flavor) {
165
+ apkPath = `${apkPath}/${(_e = extConfig.android) === null || _e === void 0 ? void 0 : _e.flavor}`;
166
+ flavorPrefix = `-${(_f = extConfig.android) === null || _f === void 0 ? void 0 : _f.flavor}`;
166
167
  }
167
168
  const apkName = `app${flavorPrefix}-debug.apk`;
168
169
  const buildOutputDir = `${apkPath}/debug`;
@@ -191,6 +192,7 @@ async function loadAndroidConfig(rootDir, extConfig, cliConfig) {
191
192
  apkName,
192
193
  buildOutputDir,
193
194
  buildOutputDirAbs: path_1.resolve(platformDirAbs, buildOutputDir),
195
+ flavor,
194
196
  };
195
197
  }
196
198
  async function loadIOSConfig(rootDir, extConfig) {
package/dist/cordova.js CHANGED
@@ -263,39 +263,47 @@ async function logCordovaManualSteps(cordovaPlugins, config, platform) {
263
263
  }
264
264
  exports.logCordovaManualSteps = logCordovaManualSteps;
265
265
  async function logiOSPlist(configElement, config, plugin) {
266
- const plistPath = path_1.resolve(config.ios.nativeTargetDirAbs, 'Info.plist');
267
- const xmlMeta = await xml_1.readXML(plistPath);
268
- const data = await utils_fs_1.readFile(plistPath, { encoding: 'utf-8' });
269
- const plistData = plist_1.default.parse(data);
270
- const dict = xmlMeta.plist.dict.pop();
271
- if (!dict.key.includes(configElement.$.parent)) {
272
- let xml = buildConfigFileXml(configElement);
273
- xml = `<key>${configElement.$.parent}</key>${getConfigFileTagContent(xml)}`;
274
- log_1.logger.warn(`Configuration required for ${colors_1.default.strong(plugin.id)}.\n` +
275
- `Add the following to Info.plist:\n` +
276
- xml);
266
+ let plistPath = path_1.resolve(config.ios.nativeTargetDirAbs, 'Info.plist');
267
+ if (!(await utils_fs_1.pathExists(plistPath))) {
268
+ plistPath = path_1.resolve(config.ios.nativeTargetDirAbs, 'Base.lproj', 'Info.plist');
277
269
  }
278
- else if (configElement.array || configElement.dict) {
279
- if (configElement.array &&
280
- configElement.array.length > 0 &&
281
- configElement.array[0].string) {
282
- let xml = '';
283
- configElement.array[0].string.map((element) => {
284
- const d = plistData[configElement.$.parent];
285
- if (Array.isArray(d) && !d.includes(element)) {
286
- xml = xml.concat(`<string>${element}</string>\n`);
270
+ if (await utils_fs_1.pathExists(plistPath)) {
271
+ const xmlMeta = await xml_1.readXML(plistPath);
272
+ const data = await utils_fs_1.readFile(plistPath, { encoding: 'utf-8' });
273
+ const plistData = plist_1.default.parse(data);
274
+ const dict = xmlMeta.plist.dict.pop();
275
+ if (!dict.key.includes(configElement.$.parent)) {
276
+ let xml = buildConfigFileXml(configElement);
277
+ xml = `<key>${configElement.$.parent}</key>${getConfigFileTagContent(xml)}`;
278
+ log_1.logger.warn(`Configuration required for ${colors_1.default.strong(plugin.id)}.\n` +
279
+ `Add the following to Info.plist:\n` +
280
+ xml);
281
+ }
282
+ else if (configElement.array || configElement.dict) {
283
+ if (configElement.array &&
284
+ configElement.array.length > 0 &&
285
+ configElement.array[0].string) {
286
+ let xml = '';
287
+ configElement.array[0].string.map((element) => {
288
+ const d = plistData[configElement.$.parent];
289
+ if (Array.isArray(d) && !d.includes(element)) {
290
+ xml = xml.concat(`<string>${element}</string>\n`);
291
+ }
292
+ });
293
+ if (xml.length > 0) {
294
+ log_1.logger.warn(`Configuration required for ${colors_1.default.strong(plugin.id)}.\n` +
295
+ `Add the following in the existing ${colors_1.default.strong(configElement.$.parent)} array of your Info.plist:\n` +
296
+ xml);
287
297
  }
288
- });
289
- if (xml.length > 0) {
290
- log_1.logger.warn(`Configuration required for ${colors_1.default.strong(plugin.id)}.\n` +
291
- `Add the following in the existing ${colors_1.default.strong(configElement.$.parent)} array of your Info.plist:\n` +
292
- xml);
293
298
  }
294
- }
295
- else {
296
- logPossibleMissingItem(configElement, plugin);
299
+ else {
300
+ logPossibleMissingItem(configElement, plugin);
301
+ }
297
302
  }
298
303
  }
304
+ else {
305
+ logPossibleMissingItem(configElement, plugin);
306
+ }
299
307
  }
300
308
  function logPossibleMissingItem(configElement, plugin) {
301
309
  let xml = buildConfigFileXml(configElement);
@@ -390,17 +398,20 @@ function needsStaticPod(plugin, config) {
390
398
  var _a, _b, _c, _d;
391
399
  let pluginList = [
392
400
  'phonegap-plugin-push',
393
- '@havesource/cordova-plugin-push',
394
- 'cordova-plugin-firebasex',
395
401
  '@batch.com/cordova-plugin',
396
402
  'onesignal-cordova-plugin',
397
403
  ];
398
404
  if ((_b = (_a = config.app.extConfig) === null || _a === void 0 ? void 0 : _a.cordova) === null || _b === void 0 ? void 0 : _b.staticPlugins) {
399
405
  pluginList = pluginList.concat((_d = (_c = config.app.extConfig) === null || _c === void 0 ? void 0 : _c.cordova) === null || _d === void 0 ? void 0 : _d.staticPlugins);
400
406
  }
401
- return pluginList.includes(plugin.id);
407
+ return pluginList.includes(plugin.id) || useFrameworks(plugin);
402
408
  }
403
409
  exports.needsStaticPod = needsStaticPod;
410
+ function useFrameworks(plugin) {
411
+ const podspecs = plugin_1.getPlatformElement(plugin, 'ios', 'podspec');
412
+ const frameworkPods = podspecs.filter((podspec) => podspec.pods.filter((pods) => pods.$ && pods.$['use-frameworks'] === 'true').length > 0);
413
+ return frameworkPods.length > 0;
414
+ }
404
415
  async function getCordovaPreferences(config) {
405
416
  var _a, _b, _c, _d, _e;
406
417
  const configXml = path_1.join(config.app.rootDir, 'config.xml');
@@ -58,7 +58,10 @@ exports.resolvePlugin = resolvePlugin;
58
58
  */
59
59
  async function editProjectSettingsIOS(config) {
60
60
  const appId = config.app.appId;
61
- const appName = config.app.appName;
61
+ const appName = config.app.appName
62
+ .replace(/&/g, '&amp;')
63
+ .replace(/</g, '&lt;')
64
+ .replace(/>/g, '&gt;');
62
65
  const pbxPath = `${config.ios.nativeXcodeProjDirAbs}/project.pbxproj`;
63
66
  const plistPath = path_1.resolve(config.ios.nativeTargetDirAbs, 'Info.plist');
64
67
  let plistContent = await utils_fs_1.readFile(plistPath, { encoding: 'utf-8' });
package/dist/tasks/add.js CHANGED
@@ -56,6 +56,11 @@ async function addCommand(config, selectedPlatformName) {
56
56
  await editPlatforms(config, platformName);
57
57
  if (await utils_fs_1.pathExists(config.app.webDirAbs)) {
58
58
  await sync_1.sync(config, platformName, false);
59
+ if (platformName === config.android.name) {
60
+ await common_2.runTask('Syncing Gradle', async () => {
61
+ return add_1.createLocalProperties(config.android.platformDirAbs);
62
+ });
63
+ }
59
64
  }
60
65
  else {
61
66
  log_1.logger.warn(`${colors_1.default.success(colors_1.default.strong('sync'))} could not run--missing ${colors_1.default.strong(config.app.webDir)} directory.`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/cli",
3
- "version": "3.3.1",
3
+ "version": "3.4.0",
4
4
  "description": "Capacitor: Cross-platform apps with JavaScript and the web",
5
5
  "homepage": "https://capacitorjs.com",
6
6
  "author": "Ionic Team <hi@ionic.io> (https://ionic.io)",
@@ -85,5 +85,5 @@
85
85
  "publishConfig": {
86
86
  "access": "public"
87
87
  },
88
- "gitHead": "8ff7434e9b775e6acb05efae23771ee1b18e26c9"
88
+ "gitHead": "4e84c04251167ea8212969fead84b6a1d694b561"
89
89
  }