@expo/repack-app 0.1.8 → 0.1.10

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.
@@ -13,6 +13,7 @@ const node_assert_1 = __importDefault(require("node:assert"));
13
13
  const promises_1 = __importDefault(require("node:fs/promises"));
14
14
  const node_path_1 = __importDefault(require("node:path"));
15
15
  const utils_1 = require("../utils");
16
+ const xcode_utils_1 = require("./xcode-utils");
16
17
  /**
17
18
  * Extract the given iOS artifact and return the path to the .app directory.
18
19
  */
@@ -46,11 +47,12 @@ async function extractIosArtifactAsync(options) {
46
47
  */
47
48
  async function updateFilesAsync(config, appWorkingDirectory) {
48
49
  const { dir: parentDir, name } = node_path_1.default.parse(appWorkingDirectory);
49
- const newAppWorkingDirectory = node_path_1.default.join(parentDir, `${config.name}.app`);
50
+ const sanitizedAppName = (0, xcode_utils_1.sanitizedName)(config.name);
51
+ const newAppWorkingDirectory = node_path_1.default.join(parentDir, `${sanitizedAppName}.app`);
50
52
  // [0] Update the .app directory
51
53
  await promises_1.default.rename(node_path_1.default.join(parentDir, `${name}.app`), newAppWorkingDirectory);
52
54
  // [1] Rename the executable
53
- await promises_1.default.rename(node_path_1.default.join(newAppWorkingDirectory, name), node_path_1.default.join(newAppWorkingDirectory, config.name));
55
+ await promises_1.default.rename(node_path_1.default.join(newAppWorkingDirectory, name), node_path_1.default.join(newAppWorkingDirectory, sanitizedAppName));
54
56
  return newAppWorkingDirectory;
55
57
  }
56
58
  /**
@@ -12,6 +12,7 @@ const node_assert_1 = __importDefault(require("node:assert"));
12
12
  const promises_1 = __importDefault(require("node:fs/promises"));
13
13
  const node_path_1 = __importDefault(require("node:path"));
14
14
  const utils_1 = require("../utils");
15
+ const xcode_utils_1 = require("./xcode-utils");
15
16
  /**
16
17
  * Update the Info.plist file.
17
18
  */
@@ -42,7 +43,7 @@ async function updateInfoPlistAsync({ config, infoPlistPath, originalAppId, opti
42
43
  ...data,
43
44
  CFBundleDisplayName: config.name,
44
45
  CFBundleName: config.name,
45
- CFBundleExecutable: config.name,
46
+ CFBundleExecutable: (0, xcode_utils_1.sanitizedName)(config.name),
46
47
  CFBundleIdentifier: bundleIdentifier,
47
48
  };
48
49
  const userActivityTypes = data.NSUserActivityTypes?.map((activityType) => activityType.replace(originalAppId, bundleIdentifier));
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Synchronous logic as prebuild to sanitize the name of the app.
3
+ */
4
+ export declare function sanitizedName(name: string): string;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.sanitizedName = sanitizedName;
7
+ const slugify_1 = __importDefault(require("slugify"));
8
+ /**
9
+ * Synchronous logic as prebuild to sanitize the name of the app.
10
+ */
11
+ function sanitizedName(name) {
12
+ // Default to the name `app` when every safe character has been sanitized
13
+ return sanitizedNameForProjects(name) || sanitizedNameForProjects((0, slugify_1.default)(name)) || 'app';
14
+ }
15
+ function sanitizedNameForProjects(name) {
16
+ return name
17
+ .replace(/[\W_]+/g, '')
18
+ .normalize('NFD')
19
+ .replace(/[\u0300-\u036f]/g, '');
20
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo/repack-app",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "Repacking tool for Expo apps",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -31,6 +31,7 @@
31
31
  "glob": "^11.0.0",
32
32
  "picocolors": "^1.1.1",
33
33
  "resolve-from": "^5.0.0",
34
+ "slugify": "^1.6.6",
34
35
  "temp-dir": "^2.0.0",
35
36
  "xml2js": "^0.6.2"
36
37
  },