create-cubing-app 0.47.1 → 0.50.0
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/README.md +6 -1
- package/app-template/package-lock.json +30 -23
- package/app-template/package.json +1 -1
- package/app-template/script/build.js +4 -7
- package/app-template/src/main.ts +1 -1
- package/bin/create-cubing-app.js +9 -10
- package/package.json +7 -7
- package/script/auto-publish.ts +17 -0
- package/script/roll-cubing-commit.bash +0 -20
- package/src/index.css +0 -9
- package/src/index.html +0 -17
- package/src/main.ts +0 -27
package/README.md
CHANGED
|
@@ -6,7 +6,8 @@ See <https://js.cubing.net/cubing/> for (in-progress) documentation on `cubing.j
|
|
|
6
6
|
|
|
7
7
|
## Getting started
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
1. Install `node` (which will also install `npm`): <https://nodejs.org/en/download/>
|
|
10
|
+
2. Run:
|
|
10
11
|
|
|
11
12
|
```shell
|
|
12
13
|
npm create --yes cubing-app@latest my-cubing-project
|
|
@@ -14,6 +15,10 @@ cd my-cubing-project
|
|
|
14
15
|
npm run dev
|
|
15
16
|
```
|
|
16
17
|
|
|
18
|
+
### Windows
|
|
19
|
+
|
|
20
|
+
We recommend using [WSL](https://learn.microsoft.com/en-us/windows/wsl/install) on Windows.
|
|
21
|
+
|
|
17
22
|
## Building the site for the web
|
|
18
23
|
|
|
19
24
|
```shell
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"packages": {
|
|
6
6
|
"": {
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"cubing": "^0.
|
|
8
|
+
"cubing": "^0.50.0"
|
|
9
9
|
},
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"barely-a-dev-server": "^0.6.1"
|
|
@@ -402,19 +402,25 @@
|
|
|
402
402
|
"node": ">=12"
|
|
403
403
|
}
|
|
404
404
|
},
|
|
405
|
+
"node_modules/@tweenjs/tween.js": {
|
|
406
|
+
"version": "23.1.2",
|
|
407
|
+
"resolved": "https://registry.npmjs.org/@tweenjs/tween.js/-/tween.js-23.1.2.tgz",
|
|
408
|
+
"integrity": "sha512-kMCNaZCJugWI86xiEHaY338CU5JpD0B97p1j1IKNn/Zto8PgACjQx0UxbHjmOcLl/dDOBnItwD07KmCs75pxtQ=="
|
|
409
|
+
},
|
|
405
410
|
"node_modules/@types/stats.js": {
|
|
406
411
|
"version": "0.17.3",
|
|
407
412
|
"resolved": "https://registry.npmjs.org/@types/stats.js/-/stats.js-0.17.3.tgz",
|
|
408
413
|
"integrity": "sha512-pXNfAD3KHOdif9EQXZ9deK82HVNaXP5ZIF5RP2QG6OQFNTaY2YIetfrE9t528vEreGQvEPRDDc8muaoYeK0SxQ=="
|
|
409
414
|
},
|
|
410
415
|
"node_modules/@types/three": {
|
|
411
|
-
"version": "0.
|
|
412
|
-
"resolved": "https://registry.npmjs.org/@types/three/-/three-0.
|
|
413
|
-
"integrity": "sha512-
|
|
416
|
+
"version": "0.165.0",
|
|
417
|
+
"resolved": "https://registry.npmjs.org/@types/three/-/three-0.165.0.tgz",
|
|
418
|
+
"integrity": "sha512-AJK8JZAFNBF0kBXiAIl5pggYlzAGGA8geVYQXAcPCEDRbyA+oEjkpUBcJJrtNz6IiALwzGexFJGZG2yV3WsYBw==",
|
|
414
419
|
"dependencies": {
|
|
420
|
+
"@tweenjs/tween.js": "~23.1.1",
|
|
415
421
|
"@types/stats.js": "*",
|
|
416
422
|
"@types/webxr": "*",
|
|
417
|
-
"fflate": "~0.
|
|
423
|
+
"fflate": "~0.8.2",
|
|
418
424
|
"meshoptimizer": "~0.18.1"
|
|
419
425
|
}
|
|
420
426
|
},
|
|
@@ -424,9 +430,9 @@
|
|
|
424
430
|
"integrity": "sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow=="
|
|
425
431
|
},
|
|
426
432
|
"node_modules/@types/webxr": {
|
|
427
|
-
"version": "0.5.
|
|
428
|
-
"resolved": "https://registry.npmjs.org/@types/webxr/-/webxr-0.5.
|
|
429
|
-
"integrity": "sha512-
|
|
433
|
+
"version": "0.5.19",
|
|
434
|
+
"resolved": "https://registry.npmjs.org/@types/webxr/-/webxr-0.5.19.tgz",
|
|
435
|
+
"integrity": "sha512-4hxA+NwohSgImdTSlPXEqDqqFktNgmTXQ05ff1uWam05tNGroCMp4G+4XVl6qWm1p7GQ/9oD41kAYsSssF6Mzw=="
|
|
430
436
|
},
|
|
431
437
|
"node_modules/barely-a-dev-server": {
|
|
432
438
|
"version": "0.6.1",
|
|
@@ -447,20 +453,21 @@
|
|
|
447
453
|
"integrity": "sha512-+1dlx0aY5Jo1vHy/tSsIGpSkN4tS9rZSW8FIhG0JH/crs9wwweswIo/POr451r7bZww3hFbPAKnTpimzL/mm4Q=="
|
|
448
454
|
},
|
|
449
455
|
"node_modules/cubing": {
|
|
450
|
-
"version": "0.
|
|
451
|
-
"resolved": "https://registry.npmjs.org/cubing/-/cubing-0.
|
|
452
|
-
"integrity": "sha512-
|
|
456
|
+
"version": "0.50.0",
|
|
457
|
+
"resolved": "https://registry.npmjs.org/cubing/-/cubing-0.50.0.tgz",
|
|
458
|
+
"integrity": "sha512-7m9zHdB1+c2PrKei4Bq+7ViAVk3OTgu91LdAvoyef/oCOTaYV9I5WrWbUzN+hHtDHIfHEOh6/TBVYhMWbaErfg==",
|
|
453
459
|
"dependencies": {
|
|
454
|
-
"@types/three": "^0.
|
|
460
|
+
"@types/three": "^0.165.0",
|
|
455
461
|
"@types/web-bluetooth": "^0.0.20",
|
|
456
462
|
"comlink": "^4.4.1",
|
|
457
|
-
"random-uint-below": "
|
|
458
|
-
"three": "^0.
|
|
463
|
+
"random-uint-below": "v3.3.0",
|
|
464
|
+
"three": "^0.165.0"
|
|
459
465
|
},
|
|
460
466
|
"bin": {
|
|
461
467
|
"scramble": "dist/bin/scramble.js"
|
|
462
468
|
},
|
|
463
469
|
"engines": {
|
|
470
|
+
"bun": ">=1.0.30",
|
|
464
471
|
"node": ">=19"
|
|
465
472
|
}
|
|
466
473
|
},
|
|
@@ -504,9 +511,9 @@
|
|
|
504
511
|
}
|
|
505
512
|
},
|
|
506
513
|
"node_modules/fflate": {
|
|
507
|
-
"version": "0.
|
|
508
|
-
"resolved": "https://registry.npmjs.org/fflate/-/fflate-0.
|
|
509
|
-
"integrity": "sha512-
|
|
514
|
+
"version": "0.8.2",
|
|
515
|
+
"resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.2.tgz",
|
|
516
|
+
"integrity": "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A=="
|
|
510
517
|
},
|
|
511
518
|
"node_modules/meshoptimizer": {
|
|
512
519
|
"version": "0.18.1",
|
|
@@ -514,17 +521,17 @@
|
|
|
514
521
|
"integrity": "sha512-ZhoIoL7TNV4s5B6+rx5mC//fw8/POGyNxS/DZyCJeiZ12ScLfVwRE/GfsxwiTkMYYD5DmK2/JXnEVXqL4rF+Sw=="
|
|
515
522
|
},
|
|
516
523
|
"node_modules/random-uint-below": {
|
|
517
|
-
"version": "
|
|
518
|
-
"resolved": "https://registry.npmjs.org/random-uint-below/-/random-uint-below-
|
|
519
|
-
"integrity": "sha512-
|
|
524
|
+
"version": "3.3.0",
|
|
525
|
+
"resolved": "https://registry.npmjs.org/random-uint-below/-/random-uint-below-3.3.0.tgz",
|
|
526
|
+
"integrity": "sha512-5x3lft1bn5gev9qA9iVFcmd0+t10j3eDl/QKB56T/3v/bdrM7WsfO2D0rb1JYcQdkcV0/Bs5iydgQmkTE6rczA==",
|
|
520
527
|
"engines": {
|
|
521
528
|
"node": ">=19"
|
|
522
529
|
}
|
|
523
530
|
},
|
|
524
531
|
"node_modules/three": {
|
|
525
|
-
"version": "0.
|
|
526
|
-
"resolved": "https://registry.npmjs.org/three/-/three-0.
|
|
527
|
-
"integrity": "sha512-
|
|
532
|
+
"version": "0.165.0",
|
|
533
|
+
"resolved": "https://registry.npmjs.org/three/-/three-0.165.0.tgz",
|
|
534
|
+
"integrity": "sha512-cc96IlVYGydeceu0e5xq70H8/yoVT/tXBxV/W8A/U6uOq7DXc4/s1Mkmnu6SqoYGhSRWWYFOhVwvq6V0VtbplA=="
|
|
528
535
|
}
|
|
529
536
|
}
|
|
530
537
|
}
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {barelyServe} from "barely-a-dev-server";
|
|
3
|
+
import { barelyServe } from "barely-a-dev-server";
|
|
4
4
|
|
|
5
5
|
export const COMMON_BUILD_OPTIONS = {
|
|
6
6
|
entryRoot: "./src",
|
|
7
|
-
esbuildOptions: {chunkNames: "chunks/[name]-[hash]"}
|
|
8
|
-
}
|
|
7
|
+
esbuildOptions: { chunkNames: "chunks/[name]-[hash]" },
|
|
8
|
+
};
|
|
9
9
|
|
|
10
10
|
if (process.argv.at(-1) === "--dev") {
|
|
11
|
-
|
|
12
11
|
barelyServe(COMMON_BUILD_OPTIONS);
|
|
13
|
-
|
|
14
12
|
} else {
|
|
15
|
-
|
|
16
13
|
const outDir = "./dist/web";
|
|
17
14
|
await barelyServe({
|
|
18
15
|
...COMMON_BUILD_OPTIONS,
|
|
@@ -22,5 +19,5 @@ if (process.argv.at(-1) === "--dev") {
|
|
|
22
19
|
|
|
23
20
|
console.log(`
|
|
24
21
|
Your app has been built in: ${outDir}
|
|
25
|
-
`)
|
|
22
|
+
`);
|
|
26
23
|
}
|
package/app-template/src/main.ts
CHANGED
|
@@ -11,7 +11,7 @@ class App {
|
|
|
11
11
|
twistyPlayer: TwistyPlayer = document.querySelector("#main-player")!;
|
|
12
12
|
// Example of creating a new element and adding it to the page.
|
|
13
13
|
twistyAlgViewer = document.body.appendChild(
|
|
14
|
-
new TwistyAlgViewer({ twistyPlayer: this.twistyPlayer })
|
|
14
|
+
new TwistyAlgViewer({ twistyPlayer: this.twistyPlayer }),
|
|
15
15
|
);
|
|
16
16
|
constructor() {
|
|
17
17
|
this.updateScramble();
|
package/bin/create-cubing-app.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { exec } from "child_process";
|
|
3
|
-
import { exists } from "fs";
|
|
4
|
-
import { cp, mkdir, readFile, stat, writeFile } from "fs/promises";
|
|
5
|
-
import { join, resolve } from "path";
|
|
6
|
-
import { exit, stderr } from "process";
|
|
7
|
-
import { createInterface } from "readline";
|
|
8
|
-
import { promisify } from "util";
|
|
2
|
+
import { exec } from "node:child_process";
|
|
3
|
+
import { exists } from "node:fs";
|
|
4
|
+
import { cp, mkdir, readFile, stat, writeFile } from "node:fs/promises";
|
|
5
|
+
import { join, resolve } from "node:path";
|
|
6
|
+
import { exit, stderr } from "node:process";
|
|
7
|
+
import { createInterface } from "node:readline";
|
|
8
|
+
import { promisify } from "node:util";
|
|
9
9
|
|
|
10
10
|
const CREATE_CUBING_APP_PACKAGE_JSON = JSON.parse(
|
|
11
11
|
await readFile(new URL("../package.json", import.meta.url), "utf-8"),
|
|
@@ -18,8 +18,7 @@ function printHelpAndExit() {
|
|
|
18
18
|
|
|
19
19
|
npm create cubing-app <project folder name>
|
|
20
20
|
|
|
21
|
-
The project folder name should consist of only letters, numbers, dashes, and
|
|
22
|
-
nderscores.
|
|
21
|
+
The project folder name should consist of only letters, numbers, dashes, and underscores.
|
|
23
22
|
`);
|
|
24
23
|
exit(1);
|
|
25
24
|
}
|
|
@@ -56,7 +55,7 @@ Creating a cubing project in the following folder:
|
|
|
56
55
|
${projectPath}
|
|
57
56
|
`);
|
|
58
57
|
|
|
59
|
-
// We could
|
|
58
|
+
// We could use `stat` from `"fs/promises"`, but I'm not too enthused about
|
|
60
59
|
// catching an error in the "expected" path. So we use `exists`.
|
|
61
60
|
if (await promisify(exists)(projectPath)) {
|
|
62
61
|
process.stderr.write(`Project already exists in the current folder: ${projectPath}
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-cubing-app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.50.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"bin":
|
|
5
|
+
"bin": {
|
|
6
|
+
"create-cubing-app": "bin/create-cubing-app.js"
|
|
7
|
+
},
|
|
6
8
|
"engines": {
|
|
7
9
|
"node": ">=19"
|
|
8
10
|
},
|
|
9
11
|
"scripts": {
|
|
10
|
-
"prepublish-only": "prepublish-only"
|
|
11
|
-
},
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"cubing": "^0.47.1"
|
|
12
|
+
"prepublish-only": "make prepublish-only"
|
|
14
13
|
},
|
|
15
14
|
"devDependencies": {
|
|
16
|
-
"@biomejs/biome": "^1.
|
|
15
|
+
"@biomejs/biome": "^1.8.0",
|
|
16
|
+
"@types/bun": "^1.1.3",
|
|
17
17
|
"@types/validate-npm-package-name": "^4.0.2",
|
|
18
18
|
"barely-a-dev-server": "^0.6.1",
|
|
19
19
|
"esbuild": "^0.20.1",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { exit } from "node:process";
|
|
2
|
+
import { $ } from "bun";
|
|
3
|
+
|
|
4
|
+
if ((await $`git status --porcelain`).stdout.toString().trim()) {
|
|
5
|
+
console.error("git status must be clean.");
|
|
6
|
+
exit(1);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const version = (await $`npm show cubing version`).stdout.toString().trim();
|
|
10
|
+
|
|
11
|
+
await $`npm install --prefix ${new URL(import.meta.resolve("../app-template/")).pathname} "cubing@v${version}"`;
|
|
12
|
+
await $`npm version --no-git-tag-version "v${version}"`;
|
|
13
|
+
await $`git commit --all --message "v${version}"`;
|
|
14
|
+
await $`git push`;
|
|
15
|
+
await $`git tag "v${version}"`;
|
|
16
|
+
await $`git push origin "v${version}"`;
|
|
17
|
+
await $`npm publish`;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
# This is simplified `bash` version of: https://github.com/lgarron/scripts/blob/9aa4a016c7853b7a7588dd11bacd327156251b1e/web/npm-roll
|
|
4
|
-
|
|
5
|
-
if [ ! -z "$(git status --porcelain)" ]
|
|
6
|
-
then
|
|
7
|
-
echo "git status must be clean"
|
|
8
|
-
echo ""
|
|
9
|
-
git status
|
|
10
|
-
exit 1
|
|
11
|
-
fi
|
|
12
|
-
|
|
13
|
-
cd app-template || exit
|
|
14
|
-
|
|
15
|
-
VERSION=$(npm show cubing version)
|
|
16
|
-
echo "Rolling \`cubing\` to version: v${VERSION}"
|
|
17
|
-
|
|
18
|
-
npm install "cubing@v${VERSION}"
|
|
19
|
-
git stage package*
|
|
20
|
-
git commit -m "\`npm install cubing@v${VERSION}\`"
|
package/src/index.css
DELETED
package/src/index.html
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="utf8">
|
|
6
|
-
<title>My Cubing App</title>
|
|
7
|
-
<link rel="stylesheet" href="./index.css">
|
|
8
|
-
<!-- Note: the source file is `main.ts`, but here we use the transpiled file name it will have on the web server. -->
|
|
9
|
-
<script src="./main.js" type="module"></script>
|
|
10
|
-
</head>
|
|
11
|
-
|
|
12
|
-
<body>
|
|
13
|
-
<h1>My Cubing App</h1>
|
|
14
|
-
<twisty-player id="main-player"></twisty-player>
|
|
15
|
-
</body>
|
|
16
|
-
|
|
17
|
-
</html>
|
package/src/main.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
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.
|
|
7
|
-
import { randomScrambleForEvent } from "cubing/scramble";
|
|
8
|
-
|
|
9
|
-
class App {
|
|
10
|
-
// Example of getting an element from the page.
|
|
11
|
-
twistyPlayer: TwistyPlayer = document.querySelector("#main-player")!;
|
|
12
|
-
// Example of creating a new element and adding it to the page.
|
|
13
|
-
twistyAlgViewer = document.body.appendChild(
|
|
14
|
-
new TwistyAlgViewer({ twistyPlayer: this.twistyPlayer })
|
|
15
|
-
);
|
|
16
|
-
constructor() {
|
|
17
|
-
this.updateScramble();
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
async updateScramble() {
|
|
21
|
-
this.twistyPlayer.alg = await randomScrambleForEvent("333");
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Make the app object available in the console for debugging.
|
|
26
|
-
// Try running: app.updateScramble()
|
|
27
|
-
globalThis.app = new App();
|