@gjsify/cli 0.41.0 → 0.43.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 +79 -33
- package/dist/cli.gjs.mjs +1068 -405
- package/lib/actions/build.d.ts +20 -0
- package/lib/actions/build.js +118 -15
- package/lib/bundler-pick.js +10 -2
- package/lib/cli-app.js +2 -1
- package/lib/commands/browse.js +1 -1
- package/lib/commands/debug.js +1 -1
- package/lib/commands/dev.d.ts +13 -0
- package/lib/commands/dev.js +132 -0
- package/lib/commands/dlx.js +1 -1
- package/lib/commands/index.d.ts +1 -0
- package/lib/commands/index.js +1 -0
- package/lib/commands/run.js +38 -85
- package/lib/commands/ship.d.ts +2 -0
- package/lib/commands/ship.js +285 -88
- package/lib/commands/showcase.js +1 -1
- package/lib/commands/storybook.js +17 -74
- package/lib/commands/test.js +12 -16
- package/lib/commands/tsc.js +96 -45
- package/lib/config.js +4 -0
- package/lib/types/config-data.d.ts +59 -0
- package/lib/utils/app-metadata.js +27 -6
- package/lib/utils/check-system-deps.js +49 -7
- package/lib/utils/daemon-command.d.ts +7 -0
- package/lib/utils/daemon-command.js +30 -0
- package/lib/utils/dev-plan.d.ts +52 -0
- package/lib/utils/dev-plan.js +117 -0
- package/lib/utils/gi-runtime-paths.d.ts +27 -0
- package/lib/utils/gi-runtime-paths.js +84 -0
- package/lib/utils/gi-typelib.d.ts +49 -0
- package/lib/utils/gi-typelib.js +160 -0
- package/lib/utils/gjs-bundle-guard.d.ts +57 -3
- package/lib/utils/gjs-bundle-guard.js +122 -13
- package/lib/utils/jsx-config.d.ts +45 -0
- package/lib/utils/jsx-config.js +98 -0
- package/lib/utils/node-script.d.ts +4 -1
- package/lib/utils/node-script.js +27 -3
- package/lib/utils/npm-oidc.js +8 -5
- package/lib/utils/onboard-probe.d.ts +23 -0
- package/lib/utils/onboard-probe.js +65 -0
- package/lib/utils/run-gjs.d.ts +12 -1
- package/lib/utils/run-gjs.js +24 -31
- package/lib/utils/run-node.d.ts +9 -4
- package/lib/utils/run-node.js +34 -41
- package/lib/utils/ship/deb.d.ts +3 -3
- package/lib/utils/ship/deb.js +6 -2
- package/lib/utils/ship/depends.d.ts +14 -6
- package/lib/utils/ship/depends.js +45 -4
- package/lib/utils/ship/discover.js +178 -7
- package/lib/utils/ship/formats.js +9 -1
- package/lib/utils/ship/launcher.js +27 -4
- package/lib/utils/ship/mime.d.ts +19 -0
- package/lib/utils/ship/mime.js +89 -0
- package/lib/utils/ship/payload.d.ts +111 -0
- package/lib/utils/ship/payload.js +174 -0
- package/lib/utils/ship/plan.d.ts +30 -1
- package/lib/utils/ship/plan.js +74 -2
- package/lib/utils/ship/rpm.d.ts +3 -3
- package/lib/utils/ship/rpm.js +20 -3
- package/lib/utils/ship/scripts.d.ts +14 -4
- package/lib/utils/ship/scripts.js +26 -8
- package/lib/utils/ship/settings.d.ts +8 -1
- package/lib/utils/ship/settings.js +26 -1
- package/lib/utils/ship/stage-manifest.d.ts +154 -0
- package/lib/utils/ship/stage-manifest.js +408 -0
- package/lib/utils/ship/stage-writer.d.ts +30 -3
- package/lib/utils/ship/stage-writer.js +76 -9
- package/lib/utils/ship/types.d.ts +110 -18
- package/lib/utils/ship/types.js +5 -0
- package/lib/utils/simple-command.d.ts +16 -0
- package/lib/utils/simple-command.js +77 -0
- package/lib/utils/spawn.d.ts +7 -1
- package/lib/utils/spawn.js +34 -7
- package/lib/utils/system-gi.d.ts +24 -0
- package/lib/utils/system-gi.js +14 -3
- package/lib/utils/watch-loop.d.ts +91 -0
- package/lib/utils/watch-loop.js +207 -0
- package/package.json +19 -18
- package/lib/templates/app/desktop.tmpl +0 -10
package/README.md
CHANGED
|
@@ -1,58 +1,104 @@
|
|
|
1
1
|
# @gjsify/cli
|
|
2
2
|
|
|
3
|
-
CLI tool for building and running GJS applications. Bundles TypeScript/JavaScript
|
|
3
|
+
CLI tool for building and running GJS applications. Bundles TypeScript/JavaScript with
|
|
4
|
+
[Rolldown](https://rolldown.rs/), resolving each `node:*` import onto gjsify's
|
|
5
|
+
GNOME-backed implementation for a GJS target and onto the runtime's own for a Node,
|
|
6
|
+
Bun or Deno one — from unchanged source.
|
|
4
7
|
|
|
5
8
|
Part of the [gjsify](https://github.com/gjsify/gjsify) project — Node.js and Web APIs for GJS (GNOME JavaScript).
|
|
6
9
|
|
|
7
10
|
## Installation
|
|
8
11
|
|
|
12
|
+
The CLI runs on GJS, Node.js, Bun and Deno, and it installs on all four. On a GNOME box
|
|
13
|
+
`gjs` ≥ 1.86 and `curl` are enough — no Node.js at install time or ever after:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
curl -fsSL https://github.com/gjsify/gjsify/releases/latest/download/install.mjs \
|
|
17
|
+
-o /tmp/g.mjs && gjs -m /tmp/g.mjs && rm /tmp/g.mjs
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
That lays the CLI down under `~/.local/share/gjsify/global/` with a launcher at
|
|
21
|
+
`~/.local/bin/gjsify`; `gjsify self-update` refreshes it in place. Windows has no `gjs`
|
|
22
|
+
binary, so take one of the other three there. Pick a single route — each of them puts its
|
|
23
|
+
own `gjsify` launcher on your PATH:
|
|
24
|
+
|
|
25
|
+
**npm**
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install -g @gjsify/cli
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Bun**
|
|
32
|
+
|
|
9
33
|
```bash
|
|
10
|
-
|
|
34
|
+
bun add -g @gjsify/cli
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Deno**
|
|
11
38
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
yarn add @gjsify/cli
|
|
39
|
+
```bash
|
|
40
|
+
deno install -g -A -n gjsify npm:@gjsify/cli
|
|
15
41
|
```
|
|
16
42
|
|
|
43
|
+
Whichever route you pick you get the same `gjsify` command, and the runtime you installed
|
|
44
|
+
with becomes the one it builds for by default. To pin the CLI per project instead of
|
|
45
|
+
globally, add it as a dev dependency (`npm install -D @gjsify/cli`) — that is how every
|
|
46
|
+
scaffolded template is wired. PATH notes and the update command for each route:
|
|
47
|
+
[Install & Update](https://gjsify.github.io/gjsify/guides/install/).
|
|
48
|
+
|
|
17
49
|
## Usage
|
|
18
50
|
|
|
19
51
|
```bash
|
|
20
|
-
#
|
|
21
|
-
|
|
52
|
+
gjsify create my-app --template gtk-minimal # scaffold a GTK 4 + TypeScript app
|
|
53
|
+
cd my-app
|
|
54
|
+
gjsify install # resolve npm deps, no npm required
|
|
55
|
+
gjsify run dev # watch, rebuild and relaunch on change
|
|
56
|
+
```
|
|
22
57
|
|
|
23
|
-
|
|
24
|
-
|
|
58
|
+
`create` writes the build scripts too, so `gjsify run build`, `run start` and `run check`
|
|
59
|
+
work from there on. Reaching for the underlying commands directly:
|
|
25
60
|
|
|
26
|
-
|
|
27
|
-
|
|
61
|
+
```bash
|
|
62
|
+
gjsify build src/index.ts --app gjs --outfile dist/index.gjs.js
|
|
63
|
+
gjsify run dist/index.gjs.js # launch it, with the native-prebuild environment set
|
|
64
|
+
gjsify info dist/index.gjs.js # print that environment instead of launching
|
|
65
|
+
gjsify ship # package the built app as a .deb and an .rpm
|
|
28
66
|
```
|
|
29
67
|
|
|
68
|
+
`ship` runs the project's own `build` script, stages one payload and wraps it per format,
|
|
69
|
+
with no manifest to maintain — see [Ship your app](https://gjsify.github.io/gjsify/ship/).
|
|
70
|
+
Every command and flag is in the
|
|
71
|
+
[CLI Reference](https://gjsify.github.io/gjsify/cli-reference/).
|
|
72
|
+
|
|
73
|
+
Without a global install, reach the CLI through your runtime's package runner instead:
|
|
74
|
+
`npx @gjsify/cli@latest …`, `bunx @gjsify/cli@latest …` or
|
|
75
|
+
`deno run -A --reload --min-dep-age=0 npm:@gjsify/cli@latest …`. Keep the `@latest` tag,
|
|
76
|
+
and on Deno those two extra flags: all three runners reuse a cached copy of an unpinned
|
|
77
|
+
bin, and Deno adds a second rule that refuses anything published in the last 24 hours.
|
|
78
|
+
Neither one tells you it happened — the
|
|
79
|
+
[measurement](https://gjsify.github.io/gjsify/guides/install/#which-version-do-npx-bunx-and-deno-run-give-you)
|
|
80
|
+
is in the install guide.
|
|
81
|
+
|
|
30
82
|
## Native prebuilds
|
|
31
83
|
|
|
32
84
|
Packages that ship compiled artifacts declare them with
|
|
33
85
|
`"gjsify": { "prebuilds": "prebuilds", "platforms": ["linux-x64", "darwin-arm64", …] }`
|
|
34
|
-
and stage them under `prebuilds/<os>-<arch
|
|
35
|
-
`install` writes all resolve that directory for the running host
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
| macOS | `DYLD_LIBRARY_PATH` (`dyld` ignores `LD_LIBRARY_PATH`) | `:` |
|
|
51
|
-
| Windows | `PATH` (`LoadLibrary` has no dedicated variable) | `;` |
|
|
52
|
-
|
|
53
|
-
A package with no artifact for your host is skipped — every native bridge is optional at
|
|
54
|
-
runtime. Which artifacts exist per package is tracked in
|
|
55
|
-
[Platform Support](https://gjsify.github.io/gjsify/platform-support/).
|
|
86
|
+
and stage them under `prebuilds/<os>-<arch>[-musl]/`. `run`, `info`, `tsc` and the bin
|
|
87
|
+
launchers `install` writes all resolve that directory for the running host, and export
|
|
88
|
+
`GI_TYPELIB_PATH` plus the library-search variable the host's dynamic loader actually
|
|
89
|
+
reads — `LD_LIBRARY_PATH` on Linux, `DYLD_LIBRARY_PATH` on macOS (dyld ignores the Linux
|
|
90
|
+
one), `PATH` on Windows (`LoadLibrary` has no dedicated variable).
|
|
91
|
+
|
|
92
|
+
The target is spelled `${process.platform}-${process.arch}`, which is what a running
|
|
93
|
+
process can compute about itself, so locating the directory needs no translation step. The
|
|
94
|
+
resolver still probes a package's own declared spelling first and the retired uname one
|
|
95
|
+
(`linux-x86_64`) last, so a tarball published before the rename keeps loading. A package
|
|
96
|
+
with no artifact for your host is skipped — every native bridge is optional at runtime.
|
|
97
|
+
|
|
98
|
+
- How the lookup works, and how to set the same environment by hand:
|
|
99
|
+
[How It Works](https://gjsify.github.io/gjsify/how-it-works/#native-prebuilds-and-gjsify-run)
|
|
100
|
+
- Which artifacts exist per package:
|
|
101
|
+
[Platform Support](https://gjsify.github.io/gjsify/platform-support/)
|
|
56
102
|
|
|
57
103
|
## License
|
|
58
104
|
|