@gjsify/create-app 0.30.0 → 0.32.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 +40 -2
- package/dist-templates/adw-canvas2d/README.md +39 -7
- package/dist-templates/adw-canvas2d/package.json +17 -7
- package/dist-templates/adw-game/README.md +39 -7
- package/dist-templates/adw-game/package.json +18 -8
- package/dist-templates/adw-webgl/README.md +39 -7
- package/dist-templates/adw-webgl/package.json +17 -7
- package/dist-templates/cli/README.md +45 -9
- package/dist-templates/cli/package.json +26 -7
- package/dist-templates/gtk-minimal/README.md +38 -6
- package/dist-templates/gtk-minimal/package.json +15 -5
- package/dist-templates/web-server-express/README.md +45 -9
- package/dist-templates/web-server-express/package.json +26 -7
- package/dist-templates/web-server-hono/README.md +44 -8
- package/dist-templates/web-server-hono/package.json +26 -7
- package/lib/create.d.ts +14 -1
- package/lib/create.js +60 -12
- package/lib/index.d.ts +1 -1
- package/lib/index.js +11 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,18 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
Scaffolding tool for creating new Gjsify projects.
|
|
4
4
|
|
|
5
|
-
Part of the [gjsify](https://github.com/gjsify/gjsify) project — Node.js
|
|
5
|
+
Part of the [gjsify](https://github.com/gjsify/gjsify) project — Node.js, Web and
|
|
6
|
+
DOM APIs for GJS (GNOME JavaScript), plus Node.js, Bun and Deno.
|
|
6
7
|
|
|
7
8
|
## Usage
|
|
8
9
|
|
|
9
10
|
```bash
|
|
10
11
|
gjsify create my-app
|
|
11
12
|
|
|
12
|
-
# npm
|
|
13
|
+
# npm, yarn and pnpm create also work:
|
|
13
14
|
npm create @gjsify/app my-app
|
|
14
15
|
yarn create @gjsify/app my-app
|
|
16
|
+
pnpm create @gjsify/app my-app
|
|
15
17
|
```
|
|
16
18
|
|
|
19
|
+
### Options
|
|
20
|
+
|
|
21
|
+
| | |
|
|
22
|
+
|---|---|
|
|
23
|
+
| `-t, --template <name>` | Template to scaffold from. Required when stdin is not a TTY; otherwise prompted for. |
|
|
24
|
+
| `-f, --force` | Scaffold into a non-empty directory. |
|
|
25
|
+
| `--install` | Install dependencies after scaffolding. |
|
|
26
|
+
| `-p, --package-manager <pm>` | `npm` (default), `yarn`, `pnpm` or `gjsify`. Used for `--install` and for the commands printed in the next steps. |
|
|
27
|
+
|
|
28
|
+
`gjsify` is gjsify's own installer and the only one of the four that works on a
|
|
29
|
+
host with no Node.js at all.
|
|
30
|
+
|
|
31
|
+
## Templates
|
|
32
|
+
|
|
33
|
+
| Template | Runtimes | |
|
|
34
|
+
|---|---|---|
|
|
35
|
+
| `gtk-minimal` | GJS | `Gtk.Window` + `Gtk.Label`; no Adwaita, no Blueprint. |
|
|
36
|
+
| `adw-canvas2d` | GJS | Adwaita app rendering through the HTML Canvas 2D API (Blueprint UI). |
|
|
37
|
+
| `adw-webgl` | GJS | Adwaita app rendering through WebGL + three.js (Blueprint UI). |
|
|
38
|
+
| `adw-game` | GJS | Adwaita game shell on Excalibur.js; WebGL with a Canvas 2D fallback. |
|
|
39
|
+
| `cli` | GJS · Node · Bun · Deno | Command-line tool using yargs. |
|
|
40
|
+
| `web-server-hono` | GJS · Node · Bun · Deno | HTTP server using Hono (Web-standard fetch-style API). |
|
|
41
|
+
| `web-server-express` | GJS · Node · Bun · Deno | HTTP server using Express. |
|
|
42
|
+
|
|
43
|
+
The GTK/Adwaita templates drive libadwaita through `gi://`, so GJS is where they
|
|
44
|
+
belong. The other three ship two bundles — `--app gjs` and `--app node`, the
|
|
45
|
+
latter shared by Node, Bun and Deno, whose common ABI is Node-API. Each template
|
|
46
|
+
declares its own reach in `package.json` as `gjsify.example.runtimes`, and every
|
|
47
|
+
build names its `--app` target explicitly rather than inheriting whichever
|
|
48
|
+
runtime happens to invoke it.
|
|
49
|
+
|
|
50
|
+
## Operating systems
|
|
51
|
+
|
|
52
|
+
gjsify targets Linux, macOS and Windows (ADR 0018). What a scaffolded project
|
|
53
|
+
can do on each depends on the GNOME libraries installed there, not on gjsify.
|
|
54
|
+
|
|
17
55
|
## License
|
|
18
56
|
|
|
19
57
|
MIT
|
|
@@ -1,25 +1,57 @@
|
|
|
1
1
|
# new-gjsify-app
|
|
2
2
|
|
|
3
|
-
An Adwaita app with HTML Canvas 2D
|
|
3
|
+
An Adwaita app rendering with the HTML Canvas 2D API (Blueprint UI), scaffolded from the gjsify `adw-canvas2d` template.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install # or: yarn / pnpm install, or `gjsify install`
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Any of the four works. `gjsify install` is gjsify's own installer and the only
|
|
12
|
+
one that works on a host with no Node.js at all; npm, yarn and pnpm are fine
|
|
13
|
+
everywhere else. Whichever you use, `@gjsify/rolldown-native` — the bundler
|
|
14
|
+
engine the build needs when it runs under GJS — is listed explicitly in
|
|
15
|
+
`devDependencies` so it is installed either way.
|
|
4
16
|
|
|
5
17
|
## Commands
|
|
6
18
|
|
|
7
19
|
```bash
|
|
8
|
-
npm install # or: gjsify install
|
|
9
20
|
npm run dev # build + run
|
|
10
|
-
npm run build # bundle for GJS
|
|
11
|
-
npm start # run the built bundle
|
|
21
|
+
npm run build # bundle for GJS → dist/index.gjs.js
|
|
22
|
+
npm start # run the built bundle on GJS
|
|
12
23
|
npm run check # type-check
|
|
24
|
+
npm run clear # remove build output
|
|
13
25
|
```
|
|
14
26
|
|
|
27
|
+
## Runtimes
|
|
28
|
+
|
|
29
|
+
This template targets **GJS**. It drives GTK/libadwaita through `gi://`, so GJS
|
|
30
|
+
is where it belongs — `package.json` declares that as
|
|
31
|
+
`gjsify.example.runtimes: ["gjs"]`, and the build passes `--app gjs` explicitly
|
|
32
|
+
so the target does not silently follow whichever runtime happens to invoke it.
|
|
33
|
+
|
|
34
|
+
gjsify itself also targets Node.js, Bun and Deno; the `cli`, `web-server-hono`
|
|
35
|
+
and `web-server-express` templates are the ones that ship bundles for all four.
|
|
36
|
+
|
|
37
|
+
## Operating systems
|
|
38
|
+
|
|
39
|
+
gjsify targets Linux, macOS and Windows. What this project can actually do on
|
|
40
|
+
each depends on the GNOME libraries you have installed, not on gjsify — GTK and
|
|
41
|
+
libadwaita are packaged for all three, but Linux is where they are best
|
|
42
|
+
supported and best tested. See
|
|
43
|
+
[Platform support](https://gjsify.github.io/gjsify/platform-support/).
|
|
44
|
+
|
|
15
45
|
## Versioning & compatibility
|
|
16
46
|
|
|
17
47
|
All `@gjsify/*` packages ship as one release train — compatibility between them
|
|
18
|
-
is guaranteed only within the same release version
|
|
19
|
-
|
|
48
|
+
is guaranteed only within the same release version, so upgrade them together
|
|
49
|
+
rather than bumping individual packages:
|
|
20
50
|
|
|
21
51
|
```bash
|
|
22
|
-
gjsify upgrade --latest --filter @gjsify # bump
|
|
52
|
+
gjsify upgrade --latest --filter @gjsify # bump every @gjsify/* dep to the newest train
|
|
53
|
+
gjsify upgrade --align # repair drift back onto one train
|
|
54
|
+
gjsify upgrade --check # fail if the deps straddle two trains
|
|
23
55
|
```
|
|
24
56
|
|
|
25
57
|
See [Versioning & Compatibility](https://gjsify.github.io/gjsify/versioning/)
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "new-gjsify-app",
|
|
3
3
|
"description": "Adwaita app with HTML Canvas 2D rendering (Blueprint UI).",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": true,
|
|
7
7
|
"scripts": {
|
|
8
|
+
"clear": "gjsify clear dist tsconfig.tsbuildinfo",
|
|
8
9
|
"check": "gjsify tsc --noEmit",
|
|
9
|
-
"build": "gjsify build src/index.ts --outfile dist/index.js --globals auto,dom",
|
|
10
|
-
"start": "gjsify run dist/index.js",
|
|
11
|
-
"dev": "gjsify build
|
|
10
|
+
"build": "gjsify build src/index.ts --app gjs --outfile dist/index.gjs.js --globals auto,dom",
|
|
11
|
+
"start": "gjsify run dist/index.gjs.js",
|
|
12
|
+
"dev": "gjsify run build && gjsify run start"
|
|
12
13
|
},
|
|
13
14
|
"devDependencies": {
|
|
14
15
|
"@girs/adw-1": "^4.1.0",
|
|
@@ -16,12 +17,21 @@
|
|
|
16
17
|
"@girs/gjs": "^4.1.0",
|
|
17
18
|
"@girs/gobject-2.0": "^4.1.0",
|
|
18
19
|
"@girs/gtk-4.0": "^4.1.0",
|
|
19
|
-
"@gjsify/cli": "^0.
|
|
20
|
-
"@gjsify/
|
|
20
|
+
"@gjsify/cli": "^0.32.0",
|
|
21
|
+
"@gjsify/rolldown-native": "^0.32.0",
|
|
22
|
+
"@gjsify/vite-plugin-blueprint": "^0.32.0",
|
|
21
23
|
"@types/node": "^25.9.2",
|
|
22
24
|
"typescript": "^6.0.3"
|
|
23
25
|
},
|
|
24
26
|
"dependencies": {
|
|
25
|
-
"@gjsify/canvas2d": "^0.
|
|
27
|
+
"@gjsify/canvas2d": "^0.32.0"
|
|
28
|
+
},
|
|
29
|
+
"gjsify": {
|
|
30
|
+
"main": "dist/index.gjs.js",
|
|
31
|
+
"example": {
|
|
32
|
+
"runtimes": [
|
|
33
|
+
"gjs"
|
|
34
|
+
]
|
|
35
|
+
}
|
|
26
36
|
}
|
|
27
37
|
}
|
|
@@ -1,25 +1,57 @@
|
|
|
1
1
|
# new-gjsify-app
|
|
2
2
|
|
|
3
|
-
An Adwaita game shell
|
|
3
|
+
An Adwaita game shell built on Excalibur.js, WebGL with a Canvas 2D fallback, scaffolded from the gjsify `adw-game` template.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install # or: yarn / pnpm install, or `gjsify install`
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Any of the four works. `gjsify install` is gjsify's own installer and the only
|
|
12
|
+
one that works on a host with no Node.js at all; npm, yarn and pnpm are fine
|
|
13
|
+
everywhere else. Whichever you use, `@gjsify/rolldown-native` — the bundler
|
|
14
|
+
engine the build needs when it runs under GJS — is listed explicitly in
|
|
15
|
+
`devDependencies` so it is installed either way.
|
|
4
16
|
|
|
5
17
|
## Commands
|
|
6
18
|
|
|
7
19
|
```bash
|
|
8
|
-
npm install # or: gjsify install
|
|
9
20
|
npm run dev # build + run
|
|
10
|
-
npm run build # bundle for GJS
|
|
11
|
-
npm start # run the built bundle
|
|
21
|
+
npm run build # bundle for GJS → dist/index.gjs.js
|
|
22
|
+
npm start # run the built bundle on GJS
|
|
12
23
|
npm run check # type-check
|
|
24
|
+
npm run clear # remove build output
|
|
13
25
|
```
|
|
14
26
|
|
|
27
|
+
## Runtimes
|
|
28
|
+
|
|
29
|
+
This template targets **GJS**. It drives GTK/libadwaita through `gi://`, so GJS
|
|
30
|
+
is where it belongs — `package.json` declares that as
|
|
31
|
+
`gjsify.example.runtimes: ["gjs"]`, and the build passes `--app gjs` explicitly
|
|
32
|
+
so the target does not silently follow whichever runtime happens to invoke it.
|
|
33
|
+
|
|
34
|
+
gjsify itself also targets Node.js, Bun and Deno; the `cli`, `web-server-hono`
|
|
35
|
+
and `web-server-express` templates are the ones that ship bundles for all four.
|
|
36
|
+
|
|
37
|
+
## Operating systems
|
|
38
|
+
|
|
39
|
+
gjsify targets Linux, macOS and Windows. What this project can actually do on
|
|
40
|
+
each depends on the GNOME libraries you have installed, not on gjsify — GTK and
|
|
41
|
+
libadwaita are packaged for all three, but Linux is where they are best
|
|
42
|
+
supported and best tested. See
|
|
43
|
+
[Platform support](https://gjsify.github.io/gjsify/platform-support/).
|
|
44
|
+
|
|
15
45
|
## Versioning & compatibility
|
|
16
46
|
|
|
17
47
|
All `@gjsify/*` packages ship as one release train — compatibility between them
|
|
18
|
-
is guaranteed only within the same release version
|
|
19
|
-
|
|
48
|
+
is guaranteed only within the same release version, so upgrade them together
|
|
49
|
+
rather than bumping individual packages:
|
|
20
50
|
|
|
21
51
|
```bash
|
|
22
|
-
gjsify upgrade --latest --filter @gjsify # bump
|
|
52
|
+
gjsify upgrade --latest --filter @gjsify # bump every @gjsify/* dep to the newest train
|
|
53
|
+
gjsify upgrade --align # repair drift back onto one train
|
|
54
|
+
gjsify upgrade --check # fail if the deps straddle two trains
|
|
23
55
|
```
|
|
24
56
|
|
|
25
57
|
See [Versioning & Compatibility](https://gjsify.github.io/gjsify/versioning/)
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "new-gjsify-app",
|
|
3
3
|
"description": "Adwaita game shell using Excalibur.js, WebGL → Canvas2D fallback.",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": true,
|
|
7
7
|
"scripts": {
|
|
8
|
+
"clear": "gjsify clear dist tsconfig.tsbuildinfo",
|
|
8
9
|
"check": "gjsify tsc --noEmit",
|
|
9
|
-
"build": "gjsify build src/index.ts --outfile dist/index.js --globals auto,dom",
|
|
10
|
-
"start": "gjsify run dist/index.js",
|
|
11
|
-
"dev": "gjsify build
|
|
10
|
+
"build": "gjsify build src/index.ts --app gjs --outfile dist/index.gjs.js --globals auto,dom",
|
|
11
|
+
"start": "gjsify run dist/index.gjs.js",
|
|
12
|
+
"dev": "gjsify run build && gjsify run start"
|
|
12
13
|
},
|
|
13
14
|
"devDependencies": {
|
|
14
15
|
"@girs/adw-1": "^4.1.0",
|
|
@@ -16,14 +17,23 @@
|
|
|
16
17
|
"@girs/gjs": "^4.1.0",
|
|
17
18
|
"@girs/gobject-2.0": "^4.1.0",
|
|
18
19
|
"@girs/gtk-4.0": "^4.1.0",
|
|
19
|
-
"@gjsify/canvas2d": "^0.
|
|
20
|
-
"@gjsify/cli": "^0.
|
|
21
|
-
"@gjsify/
|
|
20
|
+
"@gjsify/canvas2d": "^0.32.0",
|
|
21
|
+
"@gjsify/cli": "^0.32.0",
|
|
22
|
+
"@gjsify/rolldown-native": "^0.32.0",
|
|
23
|
+
"@gjsify/vite-plugin-blueprint": "^0.32.0",
|
|
22
24
|
"@types/node": "^25.9.2",
|
|
23
25
|
"typescript": "^6.0.3"
|
|
24
26
|
},
|
|
25
27
|
"dependencies": {
|
|
26
|
-
"@gjsify/webgl": "^0.
|
|
28
|
+
"@gjsify/webgl": "^0.32.0",
|
|
27
29
|
"excalibur": "0.32.0"
|
|
30
|
+
},
|
|
31
|
+
"gjsify": {
|
|
32
|
+
"main": "dist/index.gjs.js",
|
|
33
|
+
"example": {
|
|
34
|
+
"runtimes": [
|
|
35
|
+
"gjs"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
28
38
|
}
|
|
29
39
|
}
|
|
@@ -1,25 +1,57 @@
|
|
|
1
1
|
# new-gjsify-app
|
|
2
2
|
|
|
3
|
-
An Adwaita app with WebGL
|
|
3
|
+
An Adwaita app rendering with WebGL and three.js (Blueprint UI), scaffolded from the gjsify `adw-webgl` template.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install # or: yarn / pnpm install, or `gjsify install`
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Any of the four works. `gjsify install` is gjsify's own installer and the only
|
|
12
|
+
one that works on a host with no Node.js at all; npm, yarn and pnpm are fine
|
|
13
|
+
everywhere else. Whichever you use, `@gjsify/rolldown-native` — the bundler
|
|
14
|
+
engine the build needs when it runs under GJS — is listed explicitly in
|
|
15
|
+
`devDependencies` so it is installed either way.
|
|
4
16
|
|
|
5
17
|
## Commands
|
|
6
18
|
|
|
7
19
|
```bash
|
|
8
|
-
npm install # or: gjsify install
|
|
9
20
|
npm run dev # build + run
|
|
10
|
-
npm run build # bundle for GJS
|
|
11
|
-
npm start # run the built bundle
|
|
21
|
+
npm run build # bundle for GJS → dist/index.gjs.js
|
|
22
|
+
npm start # run the built bundle on GJS
|
|
12
23
|
npm run check # type-check
|
|
24
|
+
npm run clear # remove build output
|
|
13
25
|
```
|
|
14
26
|
|
|
27
|
+
## Runtimes
|
|
28
|
+
|
|
29
|
+
This template targets **GJS**. It drives GTK/libadwaita through `gi://`, so GJS
|
|
30
|
+
is where it belongs — `package.json` declares that as
|
|
31
|
+
`gjsify.example.runtimes: ["gjs"]`, and the build passes `--app gjs` explicitly
|
|
32
|
+
so the target does not silently follow whichever runtime happens to invoke it.
|
|
33
|
+
|
|
34
|
+
gjsify itself also targets Node.js, Bun and Deno; the `cli`, `web-server-hono`
|
|
35
|
+
and `web-server-express` templates are the ones that ship bundles for all four.
|
|
36
|
+
|
|
37
|
+
## Operating systems
|
|
38
|
+
|
|
39
|
+
gjsify targets Linux, macOS and Windows. What this project can actually do on
|
|
40
|
+
each depends on the GNOME libraries you have installed, not on gjsify — GTK and
|
|
41
|
+
libadwaita are packaged for all three, but Linux is where they are best
|
|
42
|
+
supported and best tested. See
|
|
43
|
+
[Platform support](https://gjsify.github.io/gjsify/platform-support/).
|
|
44
|
+
|
|
15
45
|
## Versioning & compatibility
|
|
16
46
|
|
|
17
47
|
All `@gjsify/*` packages ship as one release train — compatibility between them
|
|
18
|
-
is guaranteed only within the same release version
|
|
19
|
-
|
|
48
|
+
is guaranteed only within the same release version, so upgrade them together
|
|
49
|
+
rather than bumping individual packages:
|
|
20
50
|
|
|
21
51
|
```bash
|
|
22
|
-
gjsify upgrade --latest --filter @gjsify # bump
|
|
52
|
+
gjsify upgrade --latest --filter @gjsify # bump every @gjsify/* dep to the newest train
|
|
53
|
+
gjsify upgrade --align # repair drift back onto one train
|
|
54
|
+
gjsify upgrade --check # fail if the deps straddle two trains
|
|
23
55
|
```
|
|
24
56
|
|
|
25
57
|
See [Versioning & Compatibility](https://gjsify.github.io/gjsify/versioning/)
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "new-gjsify-app",
|
|
3
3
|
"description": "Adwaita app with WebGL + three.js (Blueprint UI).",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": true,
|
|
7
7
|
"scripts": {
|
|
8
|
+
"clear": "gjsify clear dist tsconfig.tsbuildinfo",
|
|
8
9
|
"check": "gjsify tsc --noEmit",
|
|
9
|
-
"build": "gjsify build src/index.ts --outfile dist/index.js",
|
|
10
|
-
"start": "gjsify run dist/index.js",
|
|
11
|
-
"dev": "gjsify build
|
|
10
|
+
"build": "gjsify build src/index.ts --app gjs --outfile dist/index.gjs.js",
|
|
11
|
+
"start": "gjsify run dist/index.gjs.js",
|
|
12
|
+
"dev": "gjsify run build && gjsify run start"
|
|
12
13
|
},
|
|
13
14
|
"devDependencies": {
|
|
14
15
|
"@girs/adw-1": "^4.1.0",
|
|
@@ -16,14 +17,23 @@
|
|
|
16
17
|
"@girs/gjs": "^4.1.0",
|
|
17
18
|
"@girs/gobject-2.0": "^4.1.0",
|
|
18
19
|
"@girs/gtk-4.0": "^4.1.0",
|
|
19
|
-
"@gjsify/cli": "^0.
|
|
20
|
-
"@gjsify/
|
|
20
|
+
"@gjsify/cli": "^0.32.0",
|
|
21
|
+
"@gjsify/rolldown-native": "^0.32.0",
|
|
22
|
+
"@gjsify/vite-plugin-blueprint": "^0.32.0",
|
|
21
23
|
"@types/node": "^25.9.2",
|
|
22
24
|
"@types/three": "^0.185.0",
|
|
23
25
|
"typescript": "^6.0.3"
|
|
24
26
|
},
|
|
25
27
|
"dependencies": {
|
|
26
|
-
"@gjsify/webgl": "^0.
|
|
28
|
+
"@gjsify/webgl": "^0.32.0",
|
|
27
29
|
"three": "0.185.1"
|
|
30
|
+
},
|
|
31
|
+
"gjsify": {
|
|
32
|
+
"main": "dist/index.gjs.js",
|
|
33
|
+
"example": {
|
|
34
|
+
"runtimes": [
|
|
35
|
+
"gjs"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
28
38
|
}
|
|
29
39
|
}
|
|
@@ -1,25 +1,61 @@
|
|
|
1
1
|
# new-gjsify-app
|
|
2
2
|
|
|
3
|
-
A command-line tool using yargs,
|
|
3
|
+
A command-line tool using yargs, scaffolded from the gjsify `cli` template.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install # or: yarn / pnpm install, or `gjsify install`
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Any of the four works. `gjsify install` is gjsify's own installer and the only
|
|
12
|
+
one that works on a host with no Node.js at all; npm, yarn and pnpm are fine
|
|
13
|
+
everywhere else. Whichever you use, `@gjsify/rolldown-native` — the bundler
|
|
14
|
+
engine the build needs when it runs under GJS — is listed explicitly in
|
|
15
|
+
`devDependencies` so it is installed either way.
|
|
4
16
|
|
|
5
17
|
## Commands
|
|
6
18
|
|
|
7
19
|
```bash
|
|
8
|
-
npm
|
|
9
|
-
npm run
|
|
10
|
-
npm
|
|
11
|
-
npm start
|
|
12
|
-
npm run
|
|
20
|
+
npm run dev # build for GJS + run
|
|
21
|
+
npm run build # bundle for every runtime (dist/index.gjs.js + dist/index.node.mjs)
|
|
22
|
+
npm start # run on GJS
|
|
23
|
+
npm run start:node # run on Node.js
|
|
24
|
+
npm run start:bun # run on Bun
|
|
25
|
+
npm run start:deno # run on Deno
|
|
26
|
+
npm run check # type-check
|
|
27
|
+
npm run clear # remove build output
|
|
13
28
|
```
|
|
14
29
|
|
|
30
|
+
## Runtimes
|
|
31
|
+
|
|
32
|
+
This template runs on **GJS, Node.js, Bun and Deno**, declared in `package.json`
|
|
33
|
+
as `gjsify.example.runtimes`. Two bundles cover all four: `--app gjs` produces
|
|
34
|
+
`dist/index.gjs.js`, and `--app node` produces `dist/index.node.mjs`, which
|
|
35
|
+
Node, Bun and Deno all consume (Node-API is their common ABI).
|
|
36
|
+
|
|
37
|
+
The build names its target explicitly. Without `--app`, `gjsify build` follows
|
|
38
|
+
the runtime that happens to be invoking it, so the same `npm run build` would
|
|
39
|
+
produce a different artifact on a contributor's machine than in CI.
|
|
40
|
+
|
|
41
|
+
## Operating systems
|
|
42
|
+
|
|
43
|
+
gjsify targets Linux, macOS and Windows. What this project can actually do on
|
|
44
|
+
each depends on the GNOME libraries you have installed, not on gjsify — GTK and
|
|
45
|
+
libadwaita are packaged for all three, but Linux is where they are best
|
|
46
|
+
supported and best tested. See
|
|
47
|
+
[Platform support](https://gjsify.github.io/gjsify/platform-support/).
|
|
48
|
+
|
|
15
49
|
## Versioning & compatibility
|
|
16
50
|
|
|
17
51
|
All `@gjsify/*` packages ship as one release train — compatibility between them
|
|
18
|
-
is guaranteed only within the same release version
|
|
19
|
-
|
|
52
|
+
is guaranteed only within the same release version, so upgrade them together
|
|
53
|
+
rather than bumping individual packages:
|
|
20
54
|
|
|
21
55
|
```bash
|
|
22
|
-
gjsify upgrade --latest --filter @gjsify # bump
|
|
56
|
+
gjsify upgrade --latest --filter @gjsify # bump every @gjsify/* dep to the newest train
|
|
57
|
+
gjsify upgrade --align # repair drift back onto one train
|
|
58
|
+
gjsify upgrade --check # fail if the deps straddle two trains
|
|
23
59
|
```
|
|
24
60
|
|
|
25
61
|
See [Versioning & Compatibility](https://gjsify.github.io/gjsify/versioning/)
|
|
@@ -1,24 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "new-gjsify-app",
|
|
3
3
|
"description": "Command-line tool using yargs (Node.js + GJS).",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": true,
|
|
7
7
|
"scripts": {
|
|
8
|
+
"clear": "gjsify clear dist tsconfig.tsbuildinfo",
|
|
8
9
|
"check": "gjsify tsc --noEmit",
|
|
9
|
-
"build": "gjsify build
|
|
10
|
-
"
|
|
11
|
-
"
|
|
10
|
+
"build": "gjsify run build:gjs && gjsify run build:node",
|
|
11
|
+
"build:gjs": "gjsify build src/index.ts --app gjs --outfile dist/index.gjs.js",
|
|
12
|
+
"build:node": "gjsify build src/index.ts --app node --outfile dist/index.node.mjs",
|
|
13
|
+
"start": "gjsify run dist/index.gjs.js",
|
|
14
|
+
"start:node": "gjsify run dist/index.node.mjs --runtime node",
|
|
15
|
+
"start:bun": "gjsify run dist/index.node.mjs --runtime bun",
|
|
16
|
+
"start:deno": "gjsify run dist/index.node.mjs --runtime deno",
|
|
17
|
+
"dev": "gjsify run build:gjs && gjsify run start"
|
|
12
18
|
},
|
|
13
19
|
"devDependencies": {
|
|
14
|
-
"@gjsify/cli": "^0.
|
|
15
|
-
"@gjsify/node-globals": "^0.
|
|
16
|
-
"@gjsify/
|
|
20
|
+
"@gjsify/cli": "^0.32.0",
|
|
21
|
+
"@gjsify/node-globals": "^0.32.0",
|
|
22
|
+
"@gjsify/rolldown-native": "^0.32.0",
|
|
23
|
+
"@gjsify/runtime": "^0.32.0",
|
|
17
24
|
"@types/node": "^25.9.2",
|
|
18
25
|
"@types/yargs": "^17.0.35",
|
|
19
26
|
"typescript": "^6.0.3"
|
|
20
27
|
},
|
|
21
28
|
"dependencies": {
|
|
22
29
|
"yargs": "^18.0.0"
|
|
30
|
+
},
|
|
31
|
+
"gjsify": {
|
|
32
|
+
"main": "dist/index.gjs.js",
|
|
33
|
+
"example": {
|
|
34
|
+
"runtimes": [
|
|
35
|
+
"gjs",
|
|
36
|
+
"node",
|
|
37
|
+
"bun",
|
|
38
|
+
"deno"
|
|
39
|
+
],
|
|
40
|
+
"node": "dist/index.node.mjs"
|
|
41
|
+
}
|
|
23
42
|
}
|
|
24
43
|
}
|
|
@@ -2,24 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
A minimal GTK 4 app — `Gtk.Window` + `Gtk.Label`, no Adwaita, no Blueprint — scaffolded from the gjsify `gtk-minimal` template.
|
|
4
4
|
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install # or: yarn / pnpm install, or `gjsify install`
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Any of the four works. `gjsify install` is gjsify's own installer and the only
|
|
12
|
+
one that works on a host with no Node.js at all; npm, yarn and pnpm are fine
|
|
13
|
+
everywhere else. Whichever you use, `@gjsify/rolldown-native` — the bundler
|
|
14
|
+
engine the build needs when it runs under GJS — is listed explicitly in
|
|
15
|
+
`devDependencies` so it is installed either way.
|
|
16
|
+
|
|
5
17
|
## Commands
|
|
6
18
|
|
|
7
19
|
```bash
|
|
8
|
-
npm install # or: gjsify install
|
|
9
20
|
npm run dev # build + run
|
|
10
|
-
npm run build # bundle for GJS
|
|
11
|
-
npm start # run the built bundle
|
|
21
|
+
npm run build # bundle for GJS → dist/index.gjs.js
|
|
22
|
+
npm start # run the built bundle on GJS
|
|
12
23
|
npm run check # type-check
|
|
24
|
+
npm run clear # remove build output
|
|
13
25
|
```
|
|
14
26
|
|
|
27
|
+
## Runtimes
|
|
28
|
+
|
|
29
|
+
This template targets **GJS**. It drives GTK/libadwaita through `gi://`, so GJS
|
|
30
|
+
is where it belongs — `package.json` declares that as
|
|
31
|
+
`gjsify.example.runtimes: ["gjs"]`, and the build passes `--app gjs` explicitly
|
|
32
|
+
so the target does not silently follow whichever runtime happens to invoke it.
|
|
33
|
+
|
|
34
|
+
gjsify itself also targets Node.js, Bun and Deno; the `cli`, `web-server-hono`
|
|
35
|
+
and `web-server-express` templates are the ones that ship bundles for all four.
|
|
36
|
+
|
|
37
|
+
## Operating systems
|
|
38
|
+
|
|
39
|
+
gjsify targets Linux, macOS and Windows. What this project can actually do on
|
|
40
|
+
each depends on the GNOME libraries you have installed, not on gjsify — GTK and
|
|
41
|
+
libadwaita are packaged for all three, but Linux is where they are best
|
|
42
|
+
supported and best tested. See
|
|
43
|
+
[Platform support](https://gjsify.github.io/gjsify/platform-support/).
|
|
44
|
+
|
|
15
45
|
## Versioning & compatibility
|
|
16
46
|
|
|
17
47
|
All `@gjsify/*` packages ship as one release train — compatibility between them
|
|
18
|
-
is guaranteed only within the same release version
|
|
19
|
-
|
|
48
|
+
is guaranteed only within the same release version, so upgrade them together
|
|
49
|
+
rather than bumping individual packages:
|
|
20
50
|
|
|
21
51
|
```bash
|
|
22
|
-
gjsify upgrade --latest --filter @gjsify # bump
|
|
52
|
+
gjsify upgrade --latest --filter @gjsify # bump every @gjsify/* dep to the newest train
|
|
53
|
+
gjsify upgrade --align # repair drift back onto one train
|
|
54
|
+
gjsify upgrade --check # fail if the deps straddle two trains
|
|
23
55
|
```
|
|
24
56
|
|
|
25
57
|
See [Versioning & Compatibility](https://gjsify.github.io/gjsify/versioning/)
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "new-gjsify-app",
|
|
3
3
|
"description": "Minimal GTK4 app — Gtk.Window + Gtk.Label (no Adwaita, no Blueprint).",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": true,
|
|
7
7
|
"scripts": {
|
|
8
|
+
"clear": "gjsify clear dist tsconfig.tsbuildinfo",
|
|
8
9
|
"check": "gjsify tsc --noEmit",
|
|
9
|
-
"build": "gjsify build src/index.ts --outfile dist/index.js",
|
|
10
|
-
"start": "gjsify run dist/index.js",
|
|
11
|
-
"dev": "gjsify build
|
|
10
|
+
"build": "gjsify build src/index.ts --app gjs --outfile dist/index.gjs.js",
|
|
11
|
+
"start": "gjsify run dist/index.gjs.js",
|
|
12
|
+
"dev": "gjsify run build && gjsify run start"
|
|
12
13
|
},
|
|
13
14
|
"devDependencies": {
|
|
14
|
-
"@gjsify/cli": "^0.
|
|
15
|
+
"@gjsify/cli": "^0.32.0",
|
|
16
|
+
"@gjsify/rolldown-native": "^0.32.0",
|
|
15
17
|
"@types/node": "^25.9.2",
|
|
16
18
|
"typescript": "^6.0.3"
|
|
17
19
|
},
|
|
@@ -19,5 +21,13 @@
|
|
|
19
21
|
"@girs/gio-2.0": "^4.1.0",
|
|
20
22
|
"@girs/glib-2.0": "^4.1.0",
|
|
21
23
|
"@girs/gtk-4.0": "^4.1.0"
|
|
24
|
+
},
|
|
25
|
+
"gjsify": {
|
|
26
|
+
"main": "dist/index.gjs.js",
|
|
27
|
+
"example": {
|
|
28
|
+
"runtimes": [
|
|
29
|
+
"gjs"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
22
32
|
}
|
|
23
33
|
}
|
|
@@ -1,25 +1,61 @@
|
|
|
1
1
|
# new-gjsify-app
|
|
2
2
|
|
|
3
|
-
An HTTP server using Express (familiar Node.js stack), scaffolded from the gjsify `web-server-express` template.
|
|
3
|
+
An HTTP server using Express (the familiar Node.js stack), scaffolded from the gjsify `web-server-express` template.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install # or: yarn / pnpm install, or `gjsify install`
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Any of the four works. `gjsify install` is gjsify's own installer and the only
|
|
12
|
+
one that works on a host with no Node.js at all; npm, yarn and pnpm are fine
|
|
13
|
+
everywhere else. Whichever you use, `@gjsify/rolldown-native` — the bundler
|
|
14
|
+
engine the build needs when it runs under GJS — is listed explicitly in
|
|
15
|
+
`devDependencies` so it is installed either way.
|
|
4
16
|
|
|
5
17
|
## Commands
|
|
6
18
|
|
|
7
19
|
```bash
|
|
8
|
-
npm
|
|
9
|
-
npm run
|
|
10
|
-
npm
|
|
11
|
-
npm start
|
|
12
|
-
npm run
|
|
20
|
+
npm run dev # build for GJS + run
|
|
21
|
+
npm run build # bundle for every runtime (dist/index.gjs.js + dist/index.node.mjs)
|
|
22
|
+
npm start # run on GJS
|
|
23
|
+
npm run start:node # run on Node.js
|
|
24
|
+
npm run start:bun # run on Bun
|
|
25
|
+
npm run start:deno # run on Deno
|
|
26
|
+
npm run check # type-check
|
|
27
|
+
npm run clear # remove build output
|
|
13
28
|
```
|
|
14
29
|
|
|
30
|
+
## Runtimes
|
|
31
|
+
|
|
32
|
+
This template runs on **GJS, Node.js, Bun and Deno**, declared in `package.json`
|
|
33
|
+
as `gjsify.example.runtimes`. Two bundles cover all four: `--app gjs` produces
|
|
34
|
+
`dist/index.gjs.js`, and `--app node` produces `dist/index.node.mjs`, which
|
|
35
|
+
Node, Bun and Deno all consume (Node-API is their common ABI).
|
|
36
|
+
|
|
37
|
+
The build names its target explicitly. Without `--app`, `gjsify build` follows
|
|
38
|
+
the runtime that happens to be invoking it, so the same `npm run build` would
|
|
39
|
+
produce a different artifact on a contributor's machine than in CI.
|
|
40
|
+
|
|
41
|
+
## Operating systems
|
|
42
|
+
|
|
43
|
+
gjsify targets Linux, macOS and Windows. What this project can actually do on
|
|
44
|
+
each depends on the GNOME libraries you have installed, not on gjsify — GTK and
|
|
45
|
+
libadwaita are packaged for all three, but Linux is where they are best
|
|
46
|
+
supported and best tested. See
|
|
47
|
+
[Platform support](https://gjsify.github.io/gjsify/platform-support/).
|
|
48
|
+
|
|
15
49
|
## Versioning & compatibility
|
|
16
50
|
|
|
17
51
|
All `@gjsify/*` packages ship as one release train — compatibility between them
|
|
18
|
-
is guaranteed only within the same release version
|
|
19
|
-
|
|
52
|
+
is guaranteed only within the same release version, so upgrade them together
|
|
53
|
+
rather than bumping individual packages:
|
|
20
54
|
|
|
21
55
|
```bash
|
|
22
|
-
gjsify upgrade --latest --filter @gjsify # bump
|
|
56
|
+
gjsify upgrade --latest --filter @gjsify # bump every @gjsify/* dep to the newest train
|
|
57
|
+
gjsify upgrade --align # repair drift back onto one train
|
|
58
|
+
gjsify upgrade --check # fail if the deps straddle two trains
|
|
23
59
|
```
|
|
24
60
|
|
|
25
61
|
See [Versioning & Compatibility](https://gjsify.github.io/gjsify/versioning/)
|
|
@@ -1,24 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "new-gjsify-app",
|
|
3
3
|
"description": "HTTP server using Express (familiar Node.js stack).",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": true,
|
|
7
7
|
"scripts": {
|
|
8
|
+
"clear": "gjsify clear dist tsconfig.tsbuildinfo",
|
|
8
9
|
"check": "gjsify tsc --noEmit",
|
|
9
|
-
"build": "gjsify build
|
|
10
|
-
"
|
|
11
|
-
"
|
|
10
|
+
"build": "gjsify run build:gjs && gjsify run build:node",
|
|
11
|
+
"build:gjs": "gjsify build src/index.ts --app gjs --outfile dist/index.gjs.js",
|
|
12
|
+
"build:node": "gjsify build src/index.ts --app node --outfile dist/index.node.mjs",
|
|
13
|
+
"start": "gjsify run dist/index.gjs.js",
|
|
14
|
+
"start:node": "gjsify run dist/index.node.mjs --runtime node",
|
|
15
|
+
"start:bun": "gjsify run dist/index.node.mjs --runtime bun",
|
|
16
|
+
"start:deno": "gjsify run dist/index.node.mjs --runtime deno",
|
|
17
|
+
"dev": "gjsify run build:gjs && gjsify run start"
|
|
12
18
|
},
|
|
13
19
|
"devDependencies": {
|
|
14
|
-
"@gjsify/cli": "^0.
|
|
15
|
-
"@gjsify/node-globals": "^0.
|
|
16
|
-
"@gjsify/
|
|
20
|
+
"@gjsify/cli": "^0.32.0",
|
|
21
|
+
"@gjsify/node-globals": "^0.32.0",
|
|
22
|
+
"@gjsify/rolldown-native": "^0.32.0",
|
|
23
|
+
"@gjsify/runtime": "^0.32.0",
|
|
17
24
|
"@types/express": "^5.0.6",
|
|
18
25
|
"@types/node": "^25.9.2",
|
|
19
26
|
"typescript": "^6.0.3"
|
|
20
27
|
},
|
|
21
28
|
"dependencies": {
|
|
22
29
|
"express": "^5.2.1"
|
|
30
|
+
},
|
|
31
|
+
"gjsify": {
|
|
32
|
+
"main": "dist/index.gjs.js",
|
|
33
|
+
"example": {
|
|
34
|
+
"runtimes": [
|
|
35
|
+
"gjs",
|
|
36
|
+
"node",
|
|
37
|
+
"bun",
|
|
38
|
+
"deno"
|
|
39
|
+
],
|
|
40
|
+
"node": "dist/index.node.mjs"
|
|
41
|
+
}
|
|
23
42
|
}
|
|
24
43
|
}
|
|
@@ -2,24 +2,60 @@
|
|
|
2
2
|
|
|
3
3
|
An HTTP server using Hono (Web-standard fetch-style API), scaffolded from the gjsify `web-server-hono` template.
|
|
4
4
|
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install # or: yarn / pnpm install, or `gjsify install`
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Any of the four works. `gjsify install` is gjsify's own installer and the only
|
|
12
|
+
one that works on a host with no Node.js at all; npm, yarn and pnpm are fine
|
|
13
|
+
everywhere else. Whichever you use, `@gjsify/rolldown-native` — the bundler
|
|
14
|
+
engine the build needs when it runs under GJS — is listed explicitly in
|
|
15
|
+
`devDependencies` so it is installed either way.
|
|
16
|
+
|
|
5
17
|
## Commands
|
|
6
18
|
|
|
7
19
|
```bash
|
|
8
|
-
npm
|
|
9
|
-
npm run
|
|
10
|
-
npm
|
|
11
|
-
npm start
|
|
12
|
-
npm run
|
|
20
|
+
npm run dev # build for GJS + run
|
|
21
|
+
npm run build # bundle for every runtime (dist/index.gjs.js + dist/index.node.mjs)
|
|
22
|
+
npm start # run on GJS
|
|
23
|
+
npm run start:node # run on Node.js
|
|
24
|
+
npm run start:bun # run on Bun
|
|
25
|
+
npm run start:deno # run on Deno
|
|
26
|
+
npm run check # type-check
|
|
27
|
+
npm run clear # remove build output
|
|
13
28
|
```
|
|
14
29
|
|
|
30
|
+
## Runtimes
|
|
31
|
+
|
|
32
|
+
This template runs on **GJS, Node.js, Bun and Deno**, declared in `package.json`
|
|
33
|
+
as `gjsify.example.runtimes`. Two bundles cover all four: `--app gjs` produces
|
|
34
|
+
`dist/index.gjs.js`, and `--app node` produces `dist/index.node.mjs`, which
|
|
35
|
+
Node, Bun and Deno all consume (Node-API is their common ABI).
|
|
36
|
+
|
|
37
|
+
The build names its target explicitly. Without `--app`, `gjsify build` follows
|
|
38
|
+
the runtime that happens to be invoking it, so the same `npm run build` would
|
|
39
|
+
produce a different artifact on a contributor's machine than in CI.
|
|
40
|
+
|
|
41
|
+
## Operating systems
|
|
42
|
+
|
|
43
|
+
gjsify targets Linux, macOS and Windows. What this project can actually do on
|
|
44
|
+
each depends on the GNOME libraries you have installed, not on gjsify — GTK and
|
|
45
|
+
libadwaita are packaged for all three, but Linux is where they are best
|
|
46
|
+
supported and best tested. See
|
|
47
|
+
[Platform support](https://gjsify.github.io/gjsify/platform-support/).
|
|
48
|
+
|
|
15
49
|
## Versioning & compatibility
|
|
16
50
|
|
|
17
51
|
All `@gjsify/*` packages ship as one release train — compatibility between them
|
|
18
|
-
is guaranteed only within the same release version
|
|
19
|
-
|
|
52
|
+
is guaranteed only within the same release version, so upgrade them together
|
|
53
|
+
rather than bumping individual packages:
|
|
20
54
|
|
|
21
55
|
```bash
|
|
22
|
-
gjsify upgrade --latest --filter @gjsify # bump
|
|
56
|
+
gjsify upgrade --latest --filter @gjsify # bump every @gjsify/* dep to the newest train
|
|
57
|
+
gjsify upgrade --align # repair drift back onto one train
|
|
58
|
+
gjsify upgrade --check # fail if the deps straddle two trains
|
|
23
59
|
```
|
|
24
60
|
|
|
25
61
|
See [Versioning & Compatibility](https://gjsify.github.io/gjsify/versioning/)
|
|
@@ -1,24 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "new-gjsify-app",
|
|
3
3
|
"description": "HTTP server using Hono (Web-standard fetch-style API).",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": true,
|
|
7
7
|
"scripts": {
|
|
8
|
+
"clear": "gjsify clear dist tsconfig.tsbuildinfo",
|
|
8
9
|
"check": "gjsify tsc --noEmit",
|
|
9
|
-
"build": "gjsify build
|
|
10
|
-
"
|
|
11
|
-
"
|
|
10
|
+
"build": "gjsify run build:gjs && gjsify run build:node",
|
|
11
|
+
"build:gjs": "gjsify build src/index.ts --app gjs --outfile dist/index.gjs.js",
|
|
12
|
+
"build:node": "gjsify build src/index.ts --app node --outfile dist/index.node.mjs",
|
|
13
|
+
"start": "gjsify run dist/index.gjs.js",
|
|
14
|
+
"start:node": "gjsify run dist/index.node.mjs --runtime node",
|
|
15
|
+
"start:bun": "gjsify run dist/index.node.mjs --runtime bun",
|
|
16
|
+
"start:deno": "gjsify run dist/index.node.mjs --runtime deno",
|
|
17
|
+
"dev": "gjsify run build:gjs && gjsify run start"
|
|
12
18
|
},
|
|
13
19
|
"devDependencies": {
|
|
14
|
-
"@gjsify/cli": "^0.
|
|
15
|
-
"@gjsify/node-globals": "^0.
|
|
16
|
-
"@gjsify/
|
|
20
|
+
"@gjsify/cli": "^0.32.0",
|
|
21
|
+
"@gjsify/node-globals": "^0.32.0",
|
|
22
|
+
"@gjsify/rolldown-native": "^0.32.0",
|
|
23
|
+
"@gjsify/runtime": "^0.32.0",
|
|
17
24
|
"@types/node": "^25.9.2",
|
|
18
25
|
"typescript": "^6.0.3"
|
|
19
26
|
},
|
|
20
27
|
"dependencies": {
|
|
21
28
|
"@hono/node-server": "^2.0.8",
|
|
22
29
|
"hono": "^4.12.27"
|
|
30
|
+
},
|
|
31
|
+
"gjsify": {
|
|
32
|
+
"main": "dist/index.gjs.js",
|
|
33
|
+
"example": {
|
|
34
|
+
"runtimes": [
|
|
35
|
+
"gjs",
|
|
36
|
+
"node",
|
|
37
|
+
"bun",
|
|
38
|
+
"deno"
|
|
39
|
+
],
|
|
40
|
+
"node": "dist/index.node.mjs"
|
|
41
|
+
}
|
|
23
42
|
}
|
|
24
43
|
}
|
package/lib/create.d.ts
CHANGED
|
@@ -1,13 +1,26 @@
|
|
|
1
1
|
export { discoverTemplates, findTemplate } from './discover-templates.js';
|
|
2
2
|
export type { TemplateInfo } from './discover-templates.js';
|
|
3
|
+
/**
|
|
4
|
+
* Package managers a scaffolded project can be installed with. All four work:
|
|
5
|
+
* the templates declare every dependency they need explicitly — including
|
|
6
|
+
* `@gjsify/rolldown-native`, which npm/yarn/pnpm would otherwise skip as an
|
|
7
|
+
* optional peer of `@gjsify/cli`.
|
|
8
|
+
*
|
|
9
|
+
* `gjsify` is gjsify's own installer and the only one of the four that works on
|
|
10
|
+
* a host with no Node.js at all.
|
|
11
|
+
*/
|
|
12
|
+
export declare const PACKAGE_MANAGERS: readonly ["npm", "yarn", "pnpm", "gjsify"];
|
|
13
|
+
export type PackageManager = (typeof PACKAGE_MANAGERS)[number];
|
|
3
14
|
export interface CreateProjectOptions {
|
|
4
15
|
projectName: string;
|
|
5
16
|
/** Template short name, e.g. "gtk-minimal". If omitted, the caller is responsible for providing one via prompt. */
|
|
6
17
|
template: string;
|
|
7
18
|
/** Allow scaffolding into an existing non-empty directory. */
|
|
8
19
|
force?: boolean;
|
|
9
|
-
/**
|
|
20
|
+
/** Install dependencies in the scaffolded directory after writing files. */
|
|
10
21
|
install?: boolean;
|
|
22
|
+
/** Which package manager to install with, and to name in the printed next steps. */
|
|
23
|
+
packageManager?: PackageManager;
|
|
11
24
|
}
|
|
12
25
|
/** npm package names: lowercase, digits, -, _, .; no leading . or _. */
|
|
13
26
|
export declare function sanitizeProjectName(raw: string): string;
|
package/lib/create.js
CHANGED
|
@@ -3,6 +3,23 @@ import { readFileSync, writeFileSync, mkdirSync, existsSync, readdirSync, cpSync
|
|
|
3
3
|
import { resolve, join } from 'node:path';
|
|
4
4
|
import { discoverTemplates, findTemplate } from './discover-templates.js';
|
|
5
5
|
export { discoverTemplates, findTemplate } from './discover-templates.js';
|
|
6
|
+
/**
|
|
7
|
+
* Package managers a scaffolded project can be installed with. All four work:
|
|
8
|
+
* the templates declare every dependency they need explicitly — including
|
|
9
|
+
* `@gjsify/rolldown-native`, which npm/yarn/pnpm would otherwise skip as an
|
|
10
|
+
* optional peer of `@gjsify/cli`.
|
|
11
|
+
*
|
|
12
|
+
* `gjsify` is gjsify's own installer and the only one of the four that works on
|
|
13
|
+
* a host with no Node.js at all.
|
|
14
|
+
*/
|
|
15
|
+
export const PACKAGE_MANAGERS = ['npm', 'yarn', 'pnpm', 'gjsify'];
|
|
16
|
+
/** The `install` argv for each package manager. */
|
|
17
|
+
const INSTALL_ARGV = {
|
|
18
|
+
npm: ['install', '--no-audit', '--no-fund'],
|
|
19
|
+
yarn: ['install'],
|
|
20
|
+
pnpm: ['install'],
|
|
21
|
+
gjsify: ['install'],
|
|
22
|
+
};
|
|
6
23
|
/** Sentinel replaced by the user's project name in every text file under the template. */
|
|
7
24
|
const PROJECT_NAME_SENTINEL = 'new-gjsify-app';
|
|
8
25
|
/** File extensions we treat as text and scan for the sentinel. */
|
|
@@ -43,7 +60,7 @@ function isDirEmpty(path) {
|
|
|
43
60
|
}
|
|
44
61
|
export async function createProject(options) {
|
|
45
62
|
const projectName = sanitizeProjectName(options.projectName);
|
|
46
|
-
const { template, force = false, install = false } = options;
|
|
63
|
+
const { template, force = false, install = false, packageManager = 'npm' } = options;
|
|
47
64
|
const info = findTemplate(template);
|
|
48
65
|
if (!info) {
|
|
49
66
|
const available = discoverTemplates()
|
|
@@ -64,7 +81,8 @@ export async function createProject(options) {
|
|
|
64
81
|
cpSync(info.path, targetDir, { recursive: true });
|
|
65
82
|
substituteProjectName(targetDir, projectName);
|
|
66
83
|
if (install) {
|
|
67
|
-
|
|
84
|
+
const argv = INSTALL_ARGV[packageManager];
|
|
85
|
+
console.log(`Running ${packageManager} ${argv[0]}...`);
|
|
68
86
|
// `shell: true` is what makes this work on Windows, where `npm` is
|
|
69
87
|
// `npm.cmd`: `CreateProcess` appends only `.exe` when it searches PATH
|
|
70
88
|
// for a bare name, so `spawnSync('npm', …)` is ENOENT there — and
|
|
@@ -72,23 +90,24 @@ export async function createProject(options) {
|
|
|
72
90
|
// below fired and told the user npm had failed. `npm create gjsify
|
|
73
91
|
// my-app` therefore scaffolded a project, never installed anything, and
|
|
74
92
|
// blamed npm for it. `shell: true` is the exemption the invariant in
|
|
75
|
-
// `@gjsify/cli`'s `utils/spawn.ts` sanctions for exactly this case.
|
|
76
|
-
|
|
93
|
+
// `@gjsify/cli`'s `utils/spawn.ts` sanctions for exactly this case. It
|
|
94
|
+
// applies to all four managers, which all ship as `.cmd` shims there.
|
|
95
|
+
const result = spawnSync(packageManager, argv, {
|
|
77
96
|
cwd: targetDir,
|
|
78
97
|
stdio: 'inherit',
|
|
79
98
|
shell: true,
|
|
80
99
|
});
|
|
81
100
|
// Report the spawn error itself when there is one. Without it a failure
|
|
82
|
-
// to START
|
|
83
|
-
// Windows case stayed invisible.
|
|
101
|
+
// to START the package manager and a failure OF it read identically,
|
|
102
|
+
// which is how the Windows case stayed invisible.
|
|
84
103
|
if (result.error) {
|
|
85
|
-
console.warn(
|
|
104
|
+
console.warn(`${packageManager} install could not start (${result.error.message}); re-run it manually.`);
|
|
86
105
|
}
|
|
87
106
|
else if (result.status !== 0) {
|
|
88
|
-
console.warn(
|
|
107
|
+
console.warn(`${packageManager} install failed; re-run it manually in the project directory.`);
|
|
89
108
|
}
|
|
90
109
|
}
|
|
91
|
-
printNextSteps(projectName, info, install);
|
|
110
|
+
printNextSteps(projectName, info, install, packageManager);
|
|
92
111
|
}
|
|
93
112
|
/**
|
|
94
113
|
* Walk the scaffolded tree and replace the sentinel in every text file.
|
|
@@ -119,14 +138,43 @@ function substituteProjectName(rootDir, projectName) {
|
|
|
119
138
|
}
|
|
120
139
|
}
|
|
121
140
|
}
|
|
122
|
-
function printNextSteps(projectName, template, installed) {
|
|
141
|
+
function printNextSteps(projectName, template, installed, packageManager) {
|
|
142
|
+
// `npm run <script>` / `yarn <script>` / `pnpm <script>` / `gjsify run
|
|
143
|
+
// <script>` — the same script, four spellings. Printing the one that
|
|
144
|
+
// matches the manager the user actually chose is the whole point of
|
|
145
|
+
// threading it this far.
|
|
146
|
+
const run = packageManager === 'npm' ? 'npm run' : packageManager === 'gjsify' ? 'gjsify run' : packageManager;
|
|
123
147
|
console.log('');
|
|
124
148
|
console.log(`Project created from template "${template.name}".`);
|
|
125
149
|
console.log('');
|
|
126
150
|
console.log('Next steps:');
|
|
127
151
|
console.log(` cd ${projectName}`);
|
|
128
152
|
if (!installed)
|
|
129
|
-
console.log(
|
|
130
|
-
console.log(
|
|
153
|
+
console.log(` ${packageManager} install`);
|
|
154
|
+
console.log(` ${run} dev`);
|
|
131
155
|
console.log('');
|
|
156
|
+
// The runtimes the template DECLARES, not a fixed list: a GJS-only template
|
|
157
|
+
// must not advertise `start:node`, and a portable one must not hide it.
|
|
158
|
+
const runtimes = declaredRuntimes(template);
|
|
159
|
+
if (runtimes.length > 1) {
|
|
160
|
+
console.log(`Runs on ${runtimes.join(', ')}:`);
|
|
161
|
+
console.log(` ${run} build`);
|
|
162
|
+
for (const runtime of runtimes) {
|
|
163
|
+
console.log(` ${run} ${runtime === 'gjs' ? 'start' : `start:${runtime}`}`);
|
|
164
|
+
}
|
|
165
|
+
console.log('');
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
/** `gjsify.example.runtimes` from the template's manifest; `[]` when unstated. */
|
|
169
|
+
function declaredRuntimes(template) {
|
|
170
|
+
try {
|
|
171
|
+
const pkg = JSON.parse(readFileSync(join(template.path, 'package.json'), 'utf-8'));
|
|
172
|
+
const runtimes = pkg.gjsify?.example?.runtimes;
|
|
173
|
+
return Array.isArray(runtimes) ? runtimes.filter((r) => typeof r === 'string') : [];
|
|
174
|
+
}
|
|
175
|
+
catch {
|
|
176
|
+
// A template with no readable manifest cannot be scaffolded at all —
|
|
177
|
+
// `createProject` already failed by here. Nothing to advertise.
|
|
178
|
+
return [];
|
|
179
|
+
}
|
|
132
180
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export { createProject, sanitizeProjectName, type CreateProjectOptions } from './create.js';
|
|
2
|
+
export { createProject, sanitizeProjectName, PACKAGE_MANAGERS, type CreateProjectOptions, type PackageManager, } from './create.js';
|
|
3
3
|
export { discoverTemplates, findTemplate, type TemplateInfo } from './discover-templates.js';
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import yargs from 'yargs';
|
|
3
3
|
import { hideBin } from 'yargs/helpers';
|
|
4
|
-
import { createProject } from './create.js';
|
|
4
|
+
import { createProject, PACKAGE_MANAGERS } from './create.js';
|
|
5
5
|
import { discoverTemplates } from './discover-templates.js';
|
|
6
6
|
import { promptTemplate } from './prompt-template.js';
|
|
7
7
|
const templates = discoverTemplates();
|
|
@@ -28,9 +28,16 @@ void yargs(hideBin(process.argv))
|
|
|
28
28
|
default: false,
|
|
29
29
|
})
|
|
30
30
|
.option('install', {
|
|
31
|
-
describe: '
|
|
31
|
+
describe: 'Install dependencies after scaffolding',
|
|
32
32
|
type: 'boolean',
|
|
33
33
|
default: false,
|
|
34
|
+
})
|
|
35
|
+
.option('package-manager', {
|
|
36
|
+
alias: 'p',
|
|
37
|
+
describe: 'Package manager to install with, and to name in the printed next steps. `gjsify` is the only one that works on a host with no Node.js.',
|
|
38
|
+
type: 'string',
|
|
39
|
+
choices: PACKAGE_MANAGERS,
|
|
40
|
+
default: 'npm',
|
|
34
41
|
});
|
|
35
42
|
}, async (argv) => {
|
|
36
43
|
const projectName = argv['project-name'];
|
|
@@ -51,8 +58,9 @@ void yargs(hideBin(process.argv))
|
|
|
51
58
|
template,
|
|
52
59
|
force: argv['force'],
|
|
53
60
|
install: argv['install'],
|
|
61
|
+
packageManager: argv['package-manager'],
|
|
54
62
|
});
|
|
55
63
|
})
|
|
56
64
|
.help().argv;
|
|
57
|
-
export { createProject, sanitizeProjectName } from './create.js';
|
|
65
|
+
export { createProject, sanitizeProjectName, PACKAGE_MANAGERS, } from './create.js';
|
|
58
66
|
export { discoverTemplates, findTemplate } from './discover-templates.js';
|