create-cubing-app 0.35.6-rc3 → 0.35.6-rc4
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/bin/create-cubing-app.js +22 -11
- package/package.json +2 -1
package/bin/create-cubing-app.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { exec } from "child_process";
|
|
2
|
-
import { writeFile } from "fs";
|
|
3
|
-
import { mkdir, readFile } from "fs/promises";
|
|
2
|
+
import { mkdir, readFile, writeFile } from "fs/promises";
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
function execPromise(cmd, options) {
|
|
6
5
|
return new Promise((resolve, reject) => {
|
|
7
6
|
const childProcess = exec(cmd, options, (error, stdout, stderr) => {
|
|
8
7
|
if (error) {
|
|
@@ -11,21 +10,33 @@ export function execPromise(cmd, options) {
|
|
|
11
10
|
// console.log(stdout);
|
|
12
11
|
resolve(stdout ? stdout : stderr);
|
|
13
12
|
});
|
|
14
|
-
childProcesses.push(childProcess);
|
|
15
13
|
});
|
|
16
14
|
}
|
|
17
15
|
|
|
16
|
+
const initialPackageJSON = {
|
|
17
|
+
scripts: {
|
|
18
|
+
build:
|
|
19
|
+
'node -e \'import("barely-a-dev-server").then(s => s.barelyServe({entryRoot: "src", dev: false, outDir: "dist/web"}))\'',
|
|
20
|
+
dev: 'node -e \'import("barely-a-dev-server").then(s => s.barelyServe({entryRoot: "src"}))\'',
|
|
21
|
+
clean: "rm -rf ./dist",
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
await writeFile(
|
|
25
|
+
"./package.json",
|
|
26
|
+
JSON.stringify(initialPackageJSON, null, " "),
|
|
27
|
+
);
|
|
28
|
+
|
|
18
29
|
await execPromise("npm install --save cubing");
|
|
19
30
|
await execPromise("npm install --save-dev barely-a-dev-server");
|
|
20
31
|
|
|
21
32
|
await mkdir("./src", { recursive: true });
|
|
22
|
-
async function transferFile(
|
|
33
|
+
async function transferFile(rootedPath) {
|
|
23
34
|
const indexHTML = await readFile(
|
|
24
|
-
new URL(
|
|
25
|
-
import.meta.url,
|
|
35
|
+
new URL(`../${rootedPath}`, import.meta.url),
|
|
26
36
|
);
|
|
27
|
-
writeFile(
|
|
37
|
+
await writeFile(`./${rootedPath}`, indexHTML);
|
|
28
38
|
}
|
|
29
|
-
await transferFile("index.html");
|
|
30
|
-
await transferFile("
|
|
31
|
-
await transferFile("index.css");
|
|
39
|
+
await transferFile("src/index.html");
|
|
40
|
+
await transferFile("src/main.ts");
|
|
41
|
+
await transferFile("src/index.css");
|
|
42
|
+
await transferFile(".gitignore");
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-cubing-app",
|
|
3
|
-
"version": "0.35.6-
|
|
3
|
+
"version": "0.35.6-rc4",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"bin": "./bin/create-cubing-app.js",
|
|
5
6
|
"scripts": {
|
|
6
7
|
"build": "node -e 'import(\"barely-a-dev-server\").then(s => s.barelyServe({entryRoot: \"src\", dev: false, outDir: \"dist/web\"}))'",
|