@gjsify/cli 0.4.25 → 0.4.27
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 +124 -125
- package/lib/actions/build.d.ts +8 -5
- package/lib/actions/build.js +17 -13
- package/lib/commands/build.js +1 -1
- package/package.json +15 -15
package/lib/actions/build.d.ts
CHANGED
|
@@ -27,11 +27,14 @@ export declare class BuildAction {
|
|
|
27
27
|
private resolveGlobalsInject;
|
|
28
28
|
/**
|
|
29
29
|
* Post-processing: prepend the resolved shebang line and mark the
|
|
30
|
-
* output executable.
|
|
31
|
-
* The
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
30
|
+
* output executable. Runs for GJS and Node app builds with a single
|
|
31
|
+
* outfile. The default line depends on the target — `gjs -m` for
|
|
32
|
+
* `--app gjs`, `node` for `--app node` — so a single `shebang: true`
|
|
33
|
+
* config produces a directly-executable bin for whichever target is
|
|
34
|
+
* built. For GJS the shebang plugin already injects during bundling;
|
|
35
|
+
* this hook is the safety net for anything that bypassed it (e.g.
|
|
36
|
+
* user-supplied banners that out-ordered it) plus the chmod. For Node
|
|
37
|
+
* there is no in-bundle plugin, so this hook is the sole injection point.
|
|
35
38
|
*/
|
|
36
39
|
private applyShebang;
|
|
37
40
|
/** Application mode */
|
package/lib/actions/build.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { runBundle, runWatch, bundleToChunks } from "../bundler-pick.js";
|
|
2
|
-
import { gjsifyPlugin, textLoaderPlugin, resolveShebangLine } from "@gjsify/rolldown-plugin-gjsify";
|
|
2
|
+
import { gjsifyPlugin, textLoaderPlugin, resolveShebangLine, NODE_SHEBANG } from "@gjsify/rolldown-plugin-gjsify";
|
|
3
3
|
import { resolveUserPlugins } from "../utils/resolve-plugin-by-name.js";
|
|
4
4
|
import { resolveGlobalsList, writeRegisterInjectFile, detectAutoGlobals, } from "@gjsify/rolldown-plugin-gjsify/globals";
|
|
5
5
|
import { pnpPlugin } from "@gjsify/rolldown-plugin-pnp";
|
|
@@ -152,19 +152,23 @@ export class BuildAction {
|
|
|
152
152
|
}
|
|
153
153
|
/**
|
|
154
154
|
* Post-processing: prepend the resolved shebang line and mark the
|
|
155
|
-
* output executable.
|
|
156
|
-
* The
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
155
|
+
* output executable. Runs for GJS and Node app builds with a single
|
|
156
|
+
* outfile. The default line depends on the target — `gjs -m` for
|
|
157
|
+
* `--app gjs`, `node` for `--app node` — so a single `shebang: true`
|
|
158
|
+
* config produces a directly-executable bin for whichever target is
|
|
159
|
+
* built. For GJS the shebang plugin already injects during bundling;
|
|
160
|
+
* this hook is the safety net for anything that bypassed it (e.g.
|
|
161
|
+
* user-supplied banners that out-ordered it) plus the chmod. For Node
|
|
162
|
+
* there is no in-bundle plugin, so this hook is the sole injection point.
|
|
160
163
|
*/
|
|
161
|
-
async applyShebang(outfile, verbose) {
|
|
164
|
+
async applyShebang(app, outfile, verbose) {
|
|
162
165
|
if (!outfile) {
|
|
163
166
|
if (verbose)
|
|
164
|
-
console.warn("[gjsify] --shebang skipped: no single outfile (use --outfile for
|
|
167
|
+
console.warn("[gjsify] --shebang skipped: no single outfile (use --outfile for executables)");
|
|
165
168
|
return;
|
|
166
169
|
}
|
|
167
|
-
const
|
|
170
|
+
const defaultLine = app === "node" ? NODE_SHEBANG : DEFAULT_GJS_SHEBANG;
|
|
171
|
+
const line = resolveShebangLine(this.configData.shebang, defaultLine) ?? defaultLine;
|
|
168
172
|
const content = await readFile(outfile, "utf-8");
|
|
169
173
|
if (content.startsWith("#!")) {
|
|
170
174
|
if (verbose)
|
|
@@ -293,8 +297,8 @@ export class BuildAction {
|
|
|
293
297
|
return [];
|
|
294
298
|
}
|
|
295
299
|
const writeResult = await runBundle(finalOpts);
|
|
296
|
-
if (app === "gjs" && this.configData.shebang) {
|
|
297
|
-
await this.applyShebang(outfile, verbose);
|
|
300
|
+
if ((app === "gjs" || app === "node") && this.configData.shebang) {
|
|
301
|
+
await this.applyShebang(app, outfile, verbose);
|
|
298
302
|
}
|
|
299
303
|
return [writeResult];
|
|
300
304
|
}
|
|
@@ -336,8 +340,8 @@ export class BuildAction {
|
|
|
336
340
|
case "BUNDLE_END":
|
|
337
341
|
console.log(`[gjsify build --watch] built in ${event.duration}ms`);
|
|
338
342
|
try {
|
|
339
|
-
if (app === "gjs" && this.configData.shebang) {
|
|
340
|
-
await this.applyShebang(outfile, verbose);
|
|
343
|
+
if ((app === "gjs" || app === "node") && this.configData.shebang) {
|
|
344
|
+
await this.applyShebang(app, outfile, verbose);
|
|
341
345
|
}
|
|
342
346
|
}
|
|
343
347
|
finally {
|
package/lib/commands/build.js
CHANGED
|
@@ -102,7 +102,7 @@ export const buildCommand = {
|
|
|
102
102
|
default: 'auto'
|
|
103
103
|
})
|
|
104
104
|
.option('shebang', {
|
|
105
|
-
description: "Prepend a `#!/usr/bin/env -S gjs -m`
|
|
105
|
+
description: "Prepend a target-appropriate shebang to the output and mark it executable (chmod 755): `#!/usr/bin/env -S gjs -m` for --app gjs, `#!/usr/bin/env node` for --app node. Applies to GJS and Node app builds with a single --outfile. Default: false (use --shebang to enable, or set `shebang: true` in `.gjsifyrc.js`).",
|
|
106
106
|
type: 'boolean',
|
|
107
107
|
normalize: true
|
|
108
108
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.27",
|
|
4
4
|
"description": "CLI for Gjsify",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -120,18 +120,18 @@
|
|
|
120
120
|
"cli"
|
|
121
121
|
],
|
|
122
122
|
"dependencies": {
|
|
123
|
-
"@gjsify/buffer": "^0.4.
|
|
124
|
-
"@gjsify/create-app": "^0.4.
|
|
125
|
-
"@gjsify/node-globals": "^0.4.
|
|
126
|
-
"@gjsify/node-polyfills": "^0.4.
|
|
127
|
-
"@gjsify/npm-registry": "^0.4.
|
|
128
|
-
"@gjsify/resolve-npm": "^0.4.
|
|
129
|
-
"@gjsify/rolldown-plugin-gjsify": "^0.4.
|
|
130
|
-
"@gjsify/rolldown-plugin-pnp": "^0.4.
|
|
131
|
-
"@gjsify/semver": "^0.4.
|
|
132
|
-
"@gjsify/tar": "^0.4.
|
|
133
|
-
"@gjsify/web-polyfills": "^0.4.
|
|
134
|
-
"@gjsify/workspace": "^0.4.
|
|
123
|
+
"@gjsify/buffer": "^0.4.27",
|
|
124
|
+
"@gjsify/create-app": "^0.4.27",
|
|
125
|
+
"@gjsify/node-globals": "^0.4.27",
|
|
126
|
+
"@gjsify/node-polyfills": "^0.4.27",
|
|
127
|
+
"@gjsify/npm-registry": "^0.4.27",
|
|
128
|
+
"@gjsify/resolve-npm": "^0.4.27",
|
|
129
|
+
"@gjsify/rolldown-plugin-gjsify": "^0.4.27",
|
|
130
|
+
"@gjsify/rolldown-plugin-pnp": "^0.4.27",
|
|
131
|
+
"@gjsify/semver": "^0.4.27",
|
|
132
|
+
"@gjsify/tar": "^0.4.27",
|
|
133
|
+
"@gjsify/web-polyfills": "^0.4.27",
|
|
134
|
+
"@gjsify/workspace": "^0.4.27",
|
|
135
135
|
"cosmiconfig": "^9.0.1",
|
|
136
136
|
"get-tsconfig": "^4.14.0",
|
|
137
137
|
"pkg-types": "^2.3.1",
|
|
@@ -139,12 +139,12 @@
|
|
|
139
139
|
"yargs": "^18.0.0"
|
|
140
140
|
},
|
|
141
141
|
"devDependencies": {
|
|
142
|
-
"@gjsify/unit": "^0.4.
|
|
142
|
+
"@gjsify/unit": "^0.4.27",
|
|
143
143
|
"@types/yargs": "^17.0.35",
|
|
144
144
|
"typescript": "^6.0.3"
|
|
145
145
|
},
|
|
146
146
|
"peerDependencies": {
|
|
147
|
-
"@gjsify/rolldown-native": "^0.4.
|
|
147
|
+
"@gjsify/rolldown-native": "^0.4.27"
|
|
148
148
|
},
|
|
149
149
|
"peerDependenciesMeta": {
|
|
150
150
|
"@gjsify/rolldown-native": {
|