create-browserpod-quickstart 1.3.3 → 1.3.5
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/package.json
CHANGED
|
@@ -19,11 +19,13 @@ pod.onPortal(({ url, port }) => {
|
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
// Copy our project files
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
await
|
|
22
|
+
const homePath = "/home/user";
|
|
23
|
+
const projectPath = `${homePath}/project`;
|
|
24
|
+
await pod.createDirectory(projectPath);
|
|
25
|
+
await copyFile(pod, "project/main.js", homePath);
|
|
26
|
+
await copyFile(pod, "project/package.json", homePath);
|
|
25
27
|
|
|
26
28
|
// Install dependencies
|
|
27
|
-
await pod.run("npm", ["install"], {echo:true, terminal:terminal, cwd:
|
|
29
|
+
await pod.run("npm", ["install"], {echo:true, terminal:terminal, cwd: projectPath});
|
|
28
30
|
// Run the web server
|
|
29
|
-
await pod.run("node", ["main.js"], {echo:true, terminal:terminal, cwd:
|
|
31
|
+
await pod.run("node", ["main.js"], {echo:true, terminal:terminal, cwd: projectPath});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export async function copyFile(pod, path) {
|
|
2
|
-
const
|
|
1
|
+
export async function copyFile(pod, path, prefix) {
|
|
2
|
+
const normalizedPrefix = prefix.endsWith("/") ? prefix.slice(0, -1) : prefix;
|
|
3
|
+
const f = await pod.createFile(`${normalizedPrefix}/${path}`, "binary");
|
|
3
4
|
const resp = await fetch(path);
|
|
4
5
|
const buf = await resp.arrayBuffer();
|
|
5
6
|
await f.write(buf);
|