@gjsify/cli 0.42.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/dist/cli.gjs.mjs +238 -210
- package/lib/actions/build.d.ts +6 -0
- package/lib/actions/build.js +64 -8
- package/lib/commands/ship.d.ts +2 -0
- package/lib/commands/ship.js +285 -93
- package/lib/types/config-data.d.ts +32 -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/onboard-probe.d.ts +23 -0
- package/lib/utils/onboard-probe.js +65 -0
- package/lib/utils/ship/deb.d.ts +3 -3
- package/lib/utils/ship/deb.js +6 -2
- package/lib/utils/ship/depends.d.ts +9 -6
- package/lib/utils/ship/depends.js +25 -3
- package/lib/utils/ship/discover.js +72 -6
- package/lib/utils/ship/formats.js +9 -1
- package/lib/utils/ship/mime.d.ts +19 -0
- package/lib/utils/ship/mime.js +89 -0
- package/lib/utils/ship/payload.d.ts +76 -0
- package/lib/utils/ship/payload.js +91 -1
- package/lib/utils/ship/plan.d.ts +30 -1
- package/lib/utils/ship/plan.js +54 -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.js +13 -0
- 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 +91 -18
- package/lib/utils/ship/types.js +5 -0
- package/package.json +19 -19
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
/** One
|
|
2
|
-
export interface
|
|
1
|
+
/** One planned path and the mode the PLAN gives it. */
|
|
2
|
+
export interface StagedMode {
|
|
3
3
|
/** Prefix-relative path, e.g. `bin/learn6502`, `share/applications/x.desktop`. */
|
|
4
4
|
path: string;
|
|
5
5
|
/** POSIX mode bits. */
|
|
6
6
|
mode: number;
|
|
7
|
+
}
|
|
8
|
+
/** One file in the payload, addressed relative to the install prefix. */
|
|
9
|
+
export interface StagedFile extends StagedMode {
|
|
7
10
|
/** Where the bytes come from. */
|
|
8
11
|
source: {
|
|
9
12
|
kind: 'text';
|
|
@@ -13,6 +16,18 @@ export interface StagedFile {
|
|
|
13
16
|
path: string;
|
|
14
17
|
};
|
|
15
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* What {@link readStage} checks a staged tree against.
|
|
21
|
+
*
|
|
22
|
+
* `bytes` is present only when the plan came from a stage manifest, i.e. when
|
|
23
|
+
* the tree travelled between hosts and there is something to compare against.
|
|
24
|
+
* The single-host run plans and writes in one process, so there is no transfer
|
|
25
|
+
* to check and no second opinion to check it with.
|
|
26
|
+
*/
|
|
27
|
+
export interface StagePlanEntry extends StagedMode {
|
|
28
|
+
/** Size the manifest recorded for this path, when one was recorded. */
|
|
29
|
+
bytes?: number;
|
|
30
|
+
}
|
|
16
31
|
/** A packed artifact on disk. */
|
|
17
32
|
export interface ShipArtifact {
|
|
18
33
|
format: FormatId;
|
|
@@ -49,17 +64,61 @@ export interface FormatDescriptor {
|
|
|
49
64
|
* arm64 machine it runs on perfectly. One `.so` in the payload flips it.
|
|
50
65
|
*/
|
|
51
66
|
archName: (arch: string, archIndependent: boolean) => string;
|
|
52
|
-
/** Artifact filename, given the
|
|
53
|
-
fileName: (settings:
|
|
67
|
+
/** Artifact filename, given the pack-time settings and the resolved arch label. */
|
|
68
|
+
fileName: (settings: PackSettings, archLabel: string) => string;
|
|
54
69
|
}
|
|
55
|
-
/**
|
|
56
|
-
export interface
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
70
|
+
/** One shared-mime-info type definition (`gjsify.ship.mimeTypes`). */
|
|
71
|
+
export interface ShipMimeType {
|
|
72
|
+
type: string;
|
|
73
|
+
comment: string;
|
|
74
|
+
globs?: string[];
|
|
75
|
+
subClassOf?: string;
|
|
76
|
+
genericIcon?: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The half of the configuration that survives the host boundary.
|
|
80
|
+
*
|
|
81
|
+
* `gjsify ship --from-stage` runs on a machine that has the staged tree and
|
|
82
|
+
* NOTHING else: no project directory, no `package.json`, no built bundle. So
|
|
83
|
+
* the two phases exchange exactly this object, serialised into the stage's
|
|
84
|
+
* `.gjsify-ship-stage.json`, and that is why the split is a TYPE rather than a
|
|
85
|
+
* convention — the packers take a `PackSettings`, so a `settings.bundlePath`
|
|
86
|
+
* read added to `deb.ts` or `rpm.ts` is a compile error until the field is
|
|
87
|
+
* moved here, and moving it here is what puts it in the manifest.
|
|
88
|
+
*
|
|
89
|
+
* Every field below has a MEASURED reader in the pack path
|
|
90
|
+
* (`deb.ts`, `rpm.ts`, `depends.ts`, `formats.ts#fileName`). Nothing is here
|
|
91
|
+
* "because ship needs it": a settings dump is what ADR 0024 § A2 rejects, and
|
|
92
|
+
* a dumped field that happens to be an absolute path is a path the packing host
|
|
93
|
+
* cannot open.
|
|
94
|
+
*
|
|
95
|
+
* NOT here, deliberately, and each with the reason it is not:
|
|
96
|
+
* - `projectDir`, `outDir` — nothing in the pack path reads either; the
|
|
97
|
+
* finishing host has its own output root.
|
|
98
|
+
* - `bundlePath`, `bundleDir` — build-tree paths. Their three readers are all
|
|
99
|
+
* phase 1: the build stamp (carried as the manifest's `mtime`), the
|
|
100
|
+
* launcher's exec target (already rendered into the staged `bin/<name>`),
|
|
101
|
+
* and the GI-namespace scan (carried as the manifest's `namespaces`).
|
|
102
|
+
* - `iconFiles`, `schemaFiles`, `typelibFiles` — the pack path reads them only
|
|
103
|
+
* to ask what the PAYLOAD contains, which the payload answers itself; see
|
|
104
|
+
* `readPayloadFacts`.
|
|
105
|
+
* - `licenseFile`, `extraFiles` — phase 1 reads their bytes into the plan.
|
|
106
|
+
* - `localeFiles` — same, and the reason is worth stating because the field
|
|
107
|
+
* arrived (#1263) AFTER this split was written and carries a build-host
|
|
108
|
+
* `abs` path: `planStage` reads each catalogue into the staged tree at
|
|
109
|
+
* `share/locale/<rel>`, and no packer reads the field. So translations
|
|
110
|
+
* cross in the payload, where they belong, and the `abs` path does not
|
|
111
|
+
* cross at all. This list being explicit is what caught that.
|
|
112
|
+
* - `appId`, `name`, `kind`, `execArgs` — read by the planner and the metadata
|
|
113
|
+
* renderers, all of which have run by the time a stage exists.
|
|
114
|
+
* - `arch` — carried by the manifest's `target`, which is also the value a
|
|
115
|
+
* mismatched stage is refused on, so it lives in exactly one place.
|
|
116
|
+
* - `mimeTypes` — phase 1 renders the shared-mime-info document into the
|
|
117
|
+
* staged tree, and the one pack-time reader asks whether that FILE is in the
|
|
118
|
+
* payload (`readPayloadFacts#hasMimeTypes`), which is the same question one
|
|
119
|
+
* host later. Carrying the declarations would put the answer in two places.
|
|
120
|
+
*/
|
|
121
|
+
export interface PackSettings {
|
|
63
122
|
/** Package name: the `bin/` entry, the deb `Package:`, the rpm `Name:`. */
|
|
64
123
|
binaryName: string;
|
|
65
124
|
/** Upstream version, normalised for package managers. */
|
|
@@ -74,15 +133,11 @@ export interface ShipSettings {
|
|
|
74
133
|
description: string[];
|
|
75
134
|
/** SPDX identifier of the project licence. */
|
|
76
135
|
license: string;
|
|
77
|
-
/** Absolute path to the licence file, when one was found. */
|
|
78
|
-
licenseFile?: string;
|
|
79
136
|
homepage?: string;
|
|
80
137
|
/** deb `Section:`. */
|
|
81
138
|
section: string;
|
|
82
139
|
/** rpm `Group:`. */
|
|
83
140
|
group: string;
|
|
84
|
-
/** `'app'` stages a desktop entry and an icon; `'cli'` stages neither. */
|
|
85
|
-
kind: 'app' | 'cli';
|
|
86
141
|
/** Extra runtime dependencies per format, appended to the derived set. */
|
|
87
142
|
extraDepends: {
|
|
88
143
|
deb: string[];
|
|
@@ -93,6 +148,21 @@ export interface ShipSettings {
|
|
|
93
148
|
deb: string;
|
|
94
149
|
rpm: string;
|
|
95
150
|
}>;
|
|
151
|
+
/** Minimum GJS the emitted dependency asks for. */
|
|
152
|
+
minGjsVersion: string;
|
|
153
|
+
}
|
|
154
|
+
/** The resolved, fully defaulted configuration for one `gjsify ship` run. */
|
|
155
|
+
export interface ShipSettings extends PackSettings {
|
|
156
|
+
/** Absolute path to the project being shipped. */
|
|
157
|
+
projectDir: string;
|
|
158
|
+
/** Reverse-DNS application id — desktop entry, metainfo and icon basename. */
|
|
159
|
+
appId: string;
|
|
160
|
+
/** Human-readable display name. */
|
|
161
|
+
name: string;
|
|
162
|
+
/** Absolute path to the licence file, when one was found. */
|
|
163
|
+
licenseFile?: string;
|
|
164
|
+
/** `'app'` stages a desktop entry and an icon; `'cli'` stages neither. */
|
|
165
|
+
kind: 'app' | 'cli';
|
|
96
166
|
/** Absolute path to the built bundle that `bin/<binaryName>` executes. */
|
|
97
167
|
bundlePath: string;
|
|
98
168
|
/** Absolute path of the directory staged wholesale into `lib/<binaryName>/`. */
|
|
@@ -101,6 +171,11 @@ export interface ShipSettings {
|
|
|
101
171
|
iconFiles: string[];
|
|
102
172
|
/** Absolute paths of `*.gschema.xml` files to install. */
|
|
103
173
|
schemaFiles: string[];
|
|
174
|
+
/**
|
|
175
|
+
* File types this package defines system-wide (shared-mime-info). Empty for a package that only
|
|
176
|
+
* HANDLES existing types — that needs no document of its own.
|
|
177
|
+
*/
|
|
178
|
+
mimeTypes: ShipMimeType[];
|
|
104
179
|
/**
|
|
105
180
|
* Typelibs + shared libraries the package carries itself (`gjsify.ship.bundledTypelibs`).
|
|
106
181
|
*
|
|
@@ -128,6 +203,4 @@ export interface ShipSettings {
|
|
|
128
203
|
outDir: string;
|
|
129
204
|
/** Target architecture in `process.arch` spelling. */
|
|
130
205
|
arch: string;
|
|
131
|
-
/** Minimum GJS the emitted dependency asks for. */
|
|
132
|
-
minGjsVersion: string;
|
|
133
206
|
}
|
package/lib/utils/ship/types.js
CHANGED
|
@@ -7,4 +7,9 @@
|
|
|
7
7
|
// (`refs/gtkx`, MPL-2.0, reimplemented not copied) expresses the same
|
|
8
8
|
// distinction as `if (target === 'deb')` inside its stager, and pays for it:
|
|
9
9
|
// adding a fifth target there means editing six files.
|
|
10
|
+
//
|
|
11
|
+
// ADR 0024 § A2 splits the command in two — `--stage` assembles anywhere,
|
|
12
|
+
// `--from-stage` packs on the host that owns the format — and that split shows
|
|
13
|
+
// up here as the {@link PackSettings} / {@link ShipSettings} pair. Read the
|
|
14
|
+
// comment on {@link PackSettings} before adding a field to either.
|
|
10
15
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.43.0",
|
|
4
4
|
"description": "CLI for Gjsify",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -142,21 +142,21 @@
|
|
|
142
142
|
"cli"
|
|
143
143
|
],
|
|
144
144
|
"dependencies": {
|
|
145
|
-
"@gjsify/buffer": "^0.
|
|
146
|
-
"@gjsify/create-app": "^0.
|
|
147
|
-
"@gjsify/node-globals": "^0.
|
|
148
|
-
"@gjsify/node-polyfills": "^0.
|
|
149
|
-
"@gjsify/npm-registry": "^0.
|
|
150
|
-
"@gjsify/resolve-npm": "^0.
|
|
151
|
-
"@gjsify/rolldown-plugin-gjsify": "^0.
|
|
152
|
-
"@gjsify/vite-plugin-blueprint": "^0.
|
|
153
|
-
"@gjsify/rolldown-plugin-pnp": "^0.
|
|
154
|
-
"@gjsify/semver": "^0.
|
|
155
|
-
"@gjsify/tar": "^0.
|
|
156
|
-
"@gjsify/tsc": "^0.
|
|
157
|
-
"@gjsify/utils": "^0.
|
|
158
|
-
"@gjsify/web-polyfills": "^0.
|
|
159
|
-
"@gjsify/workspace": "^0.
|
|
145
|
+
"@gjsify/buffer": "^0.43.0",
|
|
146
|
+
"@gjsify/create-app": "^0.43.0",
|
|
147
|
+
"@gjsify/node-globals": "^0.43.0",
|
|
148
|
+
"@gjsify/node-polyfills": "^0.43.0",
|
|
149
|
+
"@gjsify/npm-registry": "^0.43.0",
|
|
150
|
+
"@gjsify/resolve-npm": "^0.43.0",
|
|
151
|
+
"@gjsify/rolldown-plugin-gjsify": "^0.43.0",
|
|
152
|
+
"@gjsify/vite-plugin-blueprint": "^0.43.0",
|
|
153
|
+
"@gjsify/rolldown-plugin-pnp": "^0.43.0",
|
|
154
|
+
"@gjsify/semver": "^0.43.0",
|
|
155
|
+
"@gjsify/tar": "^0.43.0",
|
|
156
|
+
"@gjsify/tsc": "^0.43.0",
|
|
157
|
+
"@gjsify/utils": "^0.43.0",
|
|
158
|
+
"@gjsify/web-polyfills": "^0.43.0",
|
|
159
|
+
"@gjsify/workspace": "^0.43.0",
|
|
160
160
|
"acorn": "^8.17.0",
|
|
161
161
|
"cosmiconfig": "^9.0.2",
|
|
162
162
|
"get-tsconfig": "^4.14.0",
|
|
@@ -165,13 +165,13 @@
|
|
|
165
165
|
"yargs": "^18.0.0"
|
|
166
166
|
},
|
|
167
167
|
"devDependencies": {
|
|
168
|
-
"@gjsify/unit": "^0.
|
|
168
|
+
"@gjsify/unit": "^0.43.0",
|
|
169
169
|
"@types/yargs": "^17.0.35",
|
|
170
170
|
"typescript": "^6.0.3"
|
|
171
171
|
},
|
|
172
172
|
"peerDependencies": {
|
|
173
|
-
"@gjsify/oxfmt-native": "^0.
|
|
174
|
-
"@gjsify/rolldown-native": "^0.
|
|
173
|
+
"@gjsify/oxfmt-native": "^0.43.0",
|
|
174
|
+
"@gjsify/rolldown-native": "^0.43.0"
|
|
175
175
|
},
|
|
176
176
|
"peerDependenciesMeta": {
|
|
177
177
|
"@gjsify/oxfmt-native": {
|