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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-browserpod-quickstart",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
4
4
  "description": "Create a new BrowserPod project quickly",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -19,11 +19,13 @@ pod.onPortal(({ url, port }) => {
19
19
  });
20
20
 
21
21
  // Copy our project files
22
- await pod.createDirectory("/project");
23
- await copyFile(pod, "project/main.js");
24
- await copyFile(pod, "project/package.json");
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: "/project"});
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: "/project"});
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 f = await pod.createFile("/"+path, "binary");
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);