expo-desktop 0.1.23 → 0.1.24
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.
|
@@ -224,9 +224,6 @@ async function renameCppAppPathsAsync(windowsRoot, filesafeName) {
|
|
|
224
224
|
});
|
|
225
225
|
const chosen = candidates[0];
|
|
226
226
|
const newRelWin = cppAppRelativePathTransform(chosen.rel, filesafeName);
|
|
227
|
-
if (newRelWin === chosen.rel) {
|
|
228
|
-
throw new Error(`Windows cpp-app rename: expected path containing MyApp to change: "${chosen.rel}"`);
|
|
229
|
-
}
|
|
230
227
|
const newAbs = path.join(windowsRoot, newRelWin);
|
|
231
228
|
if (newAbs === chosen.abs) {
|
|
232
229
|
continue;
|
|
@@ -39,7 +39,7 @@ function runPromisifiedSpawn({ command, args, options, logLine, debugLogDir, })
|
|
|
39
39
|
stdio: stdioEffective,
|
|
40
40
|
env: envWithForcedColorIfPiped({ ...options, stdio: stdioEffective }),
|
|
41
41
|
};
|
|
42
|
-
const cp = spawn(command
|
|
42
|
+
const cp = spawn(`${command} ${args.join(" ")}`, spawnOptions);
|
|
43
43
|
/** Interleaved stdout/stderr lines in arrival order (tagged for readability). */
|
|
44
44
|
const lineBuffer = [];
|
|
45
45
|
const pushLine = (stream, line) => {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Shescape } from "shescape";
|
|
2
|
+
const defaultShell = Symbol("Default shell");
|
|
3
|
+
const shescapes = {};
|
|
4
|
+
export function getShescape(shell) {
|
|
5
|
+
const resolvedShell = shell ?? defaultShell;
|
|
6
|
+
if (shescapes[resolvedShell]) {
|
|
7
|
+
return shescapes[resolvedShell];
|
|
8
|
+
}
|
|
9
|
+
const shescapeOptions = {};
|
|
10
|
+
if (typeof resolvedShell === "string") {
|
|
11
|
+
shescapeOptions.shell = resolvedShell;
|
|
12
|
+
}
|
|
13
|
+
let shescape;
|
|
14
|
+
try {
|
|
15
|
+
shescape = new Shescape(shescapeOptions);
|
|
16
|
+
}
|
|
17
|
+
catch (cause) {
|
|
18
|
+
if (!(cause instanceof Error) || cause.message !== "Shescape does not support the shell sh") {
|
|
19
|
+
throw new Error("Unable to spawn child process due to error being thrown when constructing Shescape instance", { cause });
|
|
20
|
+
}
|
|
21
|
+
// Can't escape for the meta-shell `/bin/sh`. Let's try falling back to a
|
|
22
|
+
// typical Unix shell and hoping for the best.
|
|
23
|
+
// https://github.com/ericcornelissen/shescape/issues/2009
|
|
24
|
+
try {
|
|
25
|
+
shescapeOptions.shell = process.platform === "darwin" ? "zsh" : "bash";
|
|
26
|
+
shescape = new Shescape(shescapeOptions);
|
|
27
|
+
}
|
|
28
|
+
catch (cause) {
|
|
29
|
+
throw new Error("Unable to spawn child process due to error being thrown when constructing fallback Shescape instance", { cause });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
shescapes[resolvedShell] = shescape;
|
|
33
|
+
return shescape;
|
|
34
|
+
}
|
package/build/common/template.js
CHANGED
|
@@ -14,6 +14,7 @@ import { pathToFileURL } from "node:url";
|
|
|
14
14
|
import { applyWindowsCppAppTemplateAsync } from "./apply-windows-cpp-app-template.js";
|
|
15
15
|
import { promisifiedSpawnTask } from "./child-process.js";
|
|
16
16
|
import { getTemplateFilesToRenameAsync, renameTemplateAppNameAsync, } from "./rename-template-app-name.js";
|
|
17
|
+
import { getShescape } from "./shescape.js";
|
|
17
18
|
export async function applySelectedTemplatesAsync({ projectRoot, selection, enabledPlatforms, name, respectTemplateConfig, }) {
|
|
18
19
|
const descriptors = getOrderedTemplateDescriptors(selection, enabledPlatforms);
|
|
19
20
|
if (!descriptors.length) {
|
|
@@ -112,6 +113,8 @@ function parseTemplateSource(template) {
|
|
|
112
113
|
return { type: "npm", spec: template };
|
|
113
114
|
}
|
|
114
115
|
async function prepareTemplateSourceAsync(taskTitle, source) {
|
|
116
|
+
// We make sure there are no spaces in the path so that we don't need to
|
|
117
|
+
// quote/escape the shell command.
|
|
115
118
|
const tempRoot = await fs.mkdtemp(path.join(os.tmpdir(), "expo-desktop-template-"));
|
|
116
119
|
const archivePath = path.join(tempRoot, "template.tgz");
|
|
117
120
|
switch (source.type) {
|
|
@@ -119,6 +122,8 @@ async function prepareTemplateSourceAsync(taskTitle, source) {
|
|
|
119
122
|
await fs.copyFile(source.path, archivePath);
|
|
120
123
|
break;
|
|
121
124
|
case "github": {
|
|
125
|
+
// Don't think it's possible to have spaces in the owner/repo/ref, so no
|
|
126
|
+
// percent-encoding or quoting needed.
|
|
122
127
|
const tarballUrl = `https://codeload.github.com/${source.owner}/${source.repo}/tar.gz/${source.ref}`;
|
|
123
128
|
const response = await fetch(tarballUrl);
|
|
124
129
|
if (!response.ok || !response.body) {
|
|
@@ -129,11 +134,12 @@ async function prepareTemplateSourceAsync(taskTitle, source) {
|
|
|
129
134
|
break;
|
|
130
135
|
}
|
|
131
136
|
case "npm": {
|
|
137
|
+
const shescape = getShescape();
|
|
132
138
|
await tasks([
|
|
133
139
|
promisifiedSpawnTask({
|
|
134
140
|
title: `npm pack (${source.spec})`,
|
|
135
141
|
command: "npm",
|
|
136
|
-
args: ["pack", source.spec, "--silent"],
|
|
142
|
+
args: ["pack", shescape.quote(source.spec), "--silent"],
|
|
137
143
|
options: { cwd: tempRoot },
|
|
138
144
|
}),
|
|
139
145
|
]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-desktop",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.24",
|
|
4
4
|
"description": "Best-effort desktop support for Expo",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"android",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"glob": "^10.5.0",
|
|
43
43
|
"kleur": "^4.1.5",
|
|
44
44
|
"mustache": "^4.2.0",
|
|
45
|
+
"shescape": "^2.1.12",
|
|
45
46
|
"toml": "^4.1.1"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|