create-cubing-app 0.35.6-rc6 → 0.35.6-rc8

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.
@@ -31,13 +31,78 @@ await execPromise("npm install --save cubing");
31
31
  await execPromise("npm install --save-dev barely-a-dev-server");
32
32
 
33
33
  await mkdir("./src", { recursive: true });
34
- async function transferFile(rootedPath) {
35
- const indexHTML = await readFile(
36
- new URL(`../${rootedPath}`, import.meta.url),
37
- );
34
+ async function transferFile(rootedPath, contents) {
35
+ const indexHTML = await readFile(new URL(`./${rootedPath}`, import.meta.url));
38
36
  await writeFile(`./${rootedPath}`, indexHTML);
39
37
  }
40
- await transferFile("src/index.html");
41
- await transferFile("src/main.ts");
42
- await transferFile("src/index.css");
43
- await transferFile(".gitignore");
38
+ await transferFile(
39
+ "src/index.html",
40
+ `<!DOCTYPE html>
41
+ <html>
42
+
43
+ <head>
44
+ <meta charset="utf8">
45
+ <title>My Cubing App</title>
46
+ <link rel="stylesheet" href="./index.css">
47
+ <!-- Note: the source file is \`main.ts\`, but here we use the transpiled file name it will have on the web server. -->
48
+ <script src="./main.js" type="module"></script>
49
+ </head>
50
+
51
+ <body>
52
+ <h1>My Cubing App</h1>
53
+ <twisty-player id="main-player"></twisty-player>
54
+ </body>
55
+
56
+ </html>
57
+ `,
58
+ );
59
+ await transferFile(
60
+ "src/main.ts",
61
+ `// Always keep the following line if you are using any twisty players on your page.
62
+ import "cubing/twisty";
63
+ // Use the following line for specific imports from \`cubing/twisty\`.
64
+ import { TwistyAlgViewer, type TwistyPlayer } from "cubing/twisty";
65
+
66
+ // Import from other modules as usual.
67
+ import { randomScrambleForEvent } from "cubing/scramble";
68
+
69
+ class App {
70
+ // Example of getting an element from the page.
71
+ twistyPlayer: TwistyPlayer = document.querySelector("#main-player")!;
72
+ // Example of creating a new element and adding it to the page.
73
+ twistyAlgViewer = document.body.appendChild(
74
+ new TwistyAlgViewer({ twistyPlayer: this.twistyPlayer })
75
+ );
76
+ constructor() {
77
+ this.updateScramble();
78
+ }
79
+
80
+ async updateScramble() {
81
+ this.twistyPlayer.alg = await randomScrambleForEvent("333");
82
+ }
83
+ }
84
+
85
+ // Make the app object available in the console for debugging.
86
+ // Try running: app.updateScramble()
87
+ globalThis.app = new App();
88
+ `,
89
+ );
90
+ await transferFile(
91
+ "src/index.css",
92
+ `/* Center everything on the page. */
93
+ html, body {
94
+ height: 100%;
95
+ margin: 0;
96
+ display: grid;
97
+ place-content: center;
98
+ gap: 1em;
99
+ font-family: sans-serif;
100
+ }
101
+ `,
102
+ );
103
+ await transferFile(
104
+ ".gitignore",
105
+ `/dist
106
+ /node_modules
107
+ `,
108
+ );
File without changes
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-cubing-app",
3
- "version": "0.35.6-rc6",
3
+ "version": "0.35.6-rc8",
4
4
  "type": "module",
5
5
  "bin": "./bin/create-cubing-app.js",
6
6
  "scripts": {