@capacitor/cli 3.3.2 → 3.4.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/CHANGELOG.md CHANGED
@@ -3,6 +3,49 @@
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.1](https://github.com/ionic-team/capacitor/compare/3.4.0...3.4.1) (2022-02-09)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **cli:** Better error on gradlew permission problems ([#5405](https://github.com/ionic-team/capacitor/issues/5405)) ([9420f08](https://github.com/ionic-team/capacitor/commit/9420f08dedad78cfaa5500cccf8bdbf1a9140684))
12
+
13
+
14
+
15
+
16
+
17
+ # [3.4.0](https://github.com/ionic-team/capacitor/compare/3.3.4...3.4.0) (2022-01-19)
18
+
19
+ **Note:** Version bump only for package @capacitor/cli
20
+
21
+
22
+
23
+
24
+
25
+ ## [3.3.4](https://github.com/ionic-team/capacitor/compare/3.3.3...3.3.4) (2022-01-05)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * **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))
31
+ * **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))
32
+
33
+
34
+
35
+
36
+
37
+ ## [3.3.3](https://github.com/ionic-team/capacitor/compare/3.3.2...3.3.3) (2021-12-08)
38
+
39
+
40
+ ### Bug Fixes
41
+
42
+ * **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))
43
+ * **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))
44
+
45
+
46
+
47
+
48
+
6
49
  ## [3.3.2](https://github.com/ionic-team/capacitor/compare/3.3.1...3.3.2) (2021-11-17)
7
50
 
8
51
 
Binary file
Binary file
@@ -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,12 +10,24 @@ 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
- await common_1.runTask('Running Gradle build', async () => subprocess_1.runCommand('./gradlew', gradleArgs, {
17
- cwd: config.android.platformDirAbs,
18
- }));
18
+ try {
19
+ await common_1.runTask('Running Gradle build', async () => subprocess_1.runCommand('./gradlew', gradleArgs, {
20
+ cwd: config.android.platformDirAbs,
21
+ }));
22
+ }
23
+ catch (e) {
24
+ if (e.includes('EACCES')) {
25
+ throw `gradlew file does not have executable permissions. This can happen if the Android platform was added on a Windows machine. Please run ${colors_1.default.strong(`chmod +x ./${config.android.platformDir}/gradlew`)} and try again.`;
26
+ }
27
+ else {
28
+ throw e;
29
+ }
30
+ }
19
31
  const apkPath = path_1.resolve(config.android.buildOutputDirAbs, config.android.apkName);
20
32
  const nativeRunArgs = ['android', '--app', apkPath, '--target', target.id];
21
33
  debug('Invoking native-run with args: %O', nativeRunArgs);
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);
@@ -388,7 +396,11 @@ function getIncompatibleCordovaPlugins(platform) {
388
396
  exports.getIncompatibleCordovaPlugins = getIncompatibleCordovaPlugins;
389
397
  function needsStaticPod(plugin, config) {
390
398
  var _a, _b, _c, _d;
391
- let pluginList = ['phonegap-plugin-push', '@batch.com/cordova-plugin'];
399
+ let pluginList = [
400
+ 'phonegap-plugin-push',
401
+ '@batch.com/cordova-plugin',
402
+ 'onesignal-cordova-plugin',
403
+ ];
392
404
  if ((_b = (_a = config.app.extConfig) === null || _a === void 0 ? void 0 : _a.cordova) === null || _b === void 0 ? void 0 : _b.staticPlugins) {
393
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);
394
406
  }
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/cli",
3
- "version": "3.3.2",
3
+ "version": "3.4.1",
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": "3158cd9a293ac79de801c833bb937d2df54e0d96"
88
+ "gitHead": "bc7b49ff2ad242fecff7bcb3900c627ff6880f7b"
89
89
  }