create-cubing-app 0.26.1 → 0.35.6-rc2

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.
@@ -0,0 +1,31 @@
1
+ import { exec } from "child_process";
2
+ import { writeFile } from "fs";
3
+ import { mkdir, readFile } from "fs/promises";
4
+
5
+ export function execPromise(cmd, options) {
6
+ return new Promise((resolve, reject) => {
7
+ const childProcess = exec(cmd, options, (error, stdout, stderr) => {
8
+ if (error) {
9
+ reject(error);
10
+ }
11
+ // console.log(stdout);
12
+ resolve(stdout ? stdout : stderr);
13
+ });
14
+ childProcesses.push(childProcess);
15
+ });
16
+ }
17
+
18
+ execPromise("npm install --save cubing");
19
+ execPromise("npm install --save-dev barely-a-dev-server");
20
+
21
+ await mkdir("./src", { recursive: true });
22
+ async function transferFile(basename) {
23
+ const indexHTML = await readFile(
24
+ new URL(`../src/${basename}`),
25
+ import.meta.url,
26
+ );
27
+ writeFile(`./src/${basename}`, indexHTML);
28
+ }
29
+ await transferFile("index.html");
30
+ await transferFile("index.ts");
31
+ await transferFile("index.css");
package/package.json CHANGED
@@ -1,15 +1,17 @@
1
1
  {
2
2
  "name": "create-cubing-app",
3
- "version": "0.26.1",
3
+ "version": "0.35.6-rc2",
4
+ "bin": "./bin/create-cubing-app.js",
4
5
  "scripts": {
5
6
  "build": "node -e 'import(\"barely-a-dev-server\").then(s => s.barelyServe({entryRoot: \"src\", dev: false, outDir: \"dist/web\"}))'",
6
7
  "dev": "node -e 'import(\"barely-a-dev-server\").then(s => s.barelyServe({entryRoot: \"src\"}))'",
7
8
  "clean": "rm -rf ./dist"
8
9
  },
9
10
  "dependencies": {
10
- "cubing": "^0.26.1"
11
+ "cubing": "^0.35.6"
11
12
  },
12
13
  "devDependencies": {
13
- "barely-a-dev-server": "^0.2.6"
14
+ "barely-a-dev-server": "^0.4.8",
15
+ "esbuild": "^0.16.16"
14
16
  }
15
17
  }
package/src/main.ts CHANGED
@@ -1,9 +1,14 @@
1
- import { TwistyAlgViewer, TwistyPlayer } from "cubing/twisty";
1
+ // Always keep the following line if you are using any twisty players on your page.
2
+ import "cubing/twisty";
3
+ // Use the following line for specific imports from `cubing/twisty`.
4
+ import { TwistyAlgViewer, type TwistyPlayer } from "cubing/twisty";
5
+
6
+ // Import from other modules as usual.
2
7
  import { randomScrambleForEvent } from "cubing/scramble";
3
8
 
4
9
  class App {
5
10
  // Example of getting an element from the page.
6
- twistyPlayer: TwistyPlayer = document.querySelector("#main-player");
11
+ twistyPlayer: TwistyPlayer = document.querySelector("#main-player")!;
7
12
  // Example of creating a new element and adding it to the page.
8
13
  twistyAlgViewer = document.body.appendChild(
9
14
  new TwistyAlgViewer({ twistyPlayer: this.twistyPlayer })