@expo/repack-app 0.1.8 → 0.1.9

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.
@@ -12,6 +12,7 @@ const glob_1 = require("glob");
12
12
  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
+ const slugify_1 = __importDefault(require("slugify"));
15
16
  const utils_1 = require("../utils");
16
17
  /**
17
18
  * Extract the given iOS artifact and return the path to the .app directory.
@@ -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 = 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
  /**
@@ -106,3 +108,16 @@ end
106
108
  `;
107
109
  return fastfileContents.replace(/^\s*[\r\n]/gm, '');
108
110
  }
111
+ /**
112
+ * Synchronous logic as prebuild to sanitize the name of the app.
113
+ */
114
+ function sanitizedName(name) {
115
+ // Default to the name `app` when every safe character has been sanitized
116
+ return sanitizedNameForProjects(name) || sanitizedNameForProjects((0, slugify_1.default)(name)) || 'app';
117
+ }
118
+ function sanitizedNameForProjects(name) {
119
+ return name
120
+ .replace(/[\W_]+/g, '')
121
+ .normalize('NFD')
122
+ .replace(/[\u0300-\u036f]/g, '');
123
+ }
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.9",
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
  },