@crustjs/crust 0.2.1 → 0.3.1
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 +1 -1
- package/bin/crust.js +26 -31
- package/package.json +11 -10
- package/schema/package.json +43 -0
package/README.md
CHANGED
package/bin/crust.js
CHANGED
|
@@ -1,50 +1,59 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// Auto-generated by crust build --
|
|
2
|
+
// Auto-generated by crust build -- do not edit
|
|
3
3
|
import { spawn } from "node:child_process";
|
|
4
4
|
import { chmodSync, existsSync } from "node:fs";
|
|
5
5
|
import { dirname, resolve } from "node:path";
|
|
6
6
|
import process from "node:process";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
8
|
|
|
9
|
+
const NAME = "crust";
|
|
9
10
|
const PLATFORMS = {
|
|
10
11
|
"linux-x64": {
|
|
11
12
|
"packagePathSegment": "crust-linux-x64",
|
|
12
13
|
"packageName": "@crustjs/crust-linux-x64",
|
|
14
|
+
"targetAlias": "linux-x64",
|
|
13
15
|
"binaryFilename": "crust-bun-linux-x64"
|
|
14
16
|
},
|
|
15
17
|
"linux-arm64": {
|
|
16
18
|
"packagePathSegment": "crust-linux-arm64",
|
|
17
19
|
"packageName": "@crustjs/crust-linux-arm64",
|
|
20
|
+
"targetAlias": "linux-arm64",
|
|
18
21
|
"binaryFilename": "crust-bun-linux-arm64"
|
|
19
22
|
},
|
|
20
23
|
"linux-x64-musl": {
|
|
21
24
|
"packagePathSegment": "crust-linux-x64-musl",
|
|
22
25
|
"packageName": "@crustjs/crust-linux-x64-musl",
|
|
26
|
+
"targetAlias": "linux-x64-musl",
|
|
23
27
|
"binaryFilename": "crust-bun-linux-x64-musl"
|
|
24
28
|
},
|
|
25
29
|
"linux-arm64-musl": {
|
|
26
30
|
"packagePathSegment": "crust-linux-arm64-musl",
|
|
27
31
|
"packageName": "@crustjs/crust-linux-arm64-musl",
|
|
32
|
+
"targetAlias": "linux-arm64-musl",
|
|
28
33
|
"binaryFilename": "crust-bun-linux-arm64-musl"
|
|
29
34
|
},
|
|
30
35
|
"darwin-x64": {
|
|
31
36
|
"packagePathSegment": "crust-darwin-x64",
|
|
32
37
|
"packageName": "@crustjs/crust-darwin-x64",
|
|
38
|
+
"targetAlias": "darwin-x64",
|
|
33
39
|
"binaryFilename": "crust-bun-darwin-x64"
|
|
34
40
|
},
|
|
35
41
|
"darwin-arm64": {
|
|
36
42
|
"packagePathSegment": "crust-darwin-arm64",
|
|
37
43
|
"packageName": "@crustjs/crust-darwin-arm64",
|
|
44
|
+
"targetAlias": "darwin-arm64",
|
|
38
45
|
"binaryFilename": "crust-bun-darwin-arm64"
|
|
39
46
|
},
|
|
40
47
|
"win32-x64": {
|
|
41
48
|
"packagePathSegment": "crust-windows-x64",
|
|
42
49
|
"packageName": "@crustjs/crust-windows-x64",
|
|
50
|
+
"targetAlias": "windows-x64",
|
|
43
51
|
"binaryFilename": "crust-bun-windows-x64.exe"
|
|
44
52
|
},
|
|
45
53
|
"win32-arm64": {
|
|
46
54
|
"packagePathSegment": "crust-windows-arm64",
|
|
47
55
|
"packageName": "@crustjs/crust-windows-arm64",
|
|
56
|
+
"targetAlias": "windows-arm64",
|
|
48
57
|
"binaryFilename": "crust-bun-windows-arm64.exe"
|
|
49
58
|
}
|
|
50
59
|
};
|
|
@@ -64,41 +73,27 @@ const platformKey =
|
|
|
64
73
|
const target = PLATFORMS[platformKey];
|
|
65
74
|
|
|
66
75
|
if (!target) {
|
|
67
|
-
console.error("[
|
|
68
|
-
console.error("[
|
|
76
|
+
console.error("[" + NAME + "] Unsupported platform: " + platformKey);
|
|
77
|
+
console.error("[" + NAME + "] Supported platforms: linux-x64, linux-arm64, linux-x64-musl, linux-arm64-musl, darwin-x64, darwin-arm64, windows-x64, windows-arm64");
|
|
69
78
|
process.exit(1);
|
|
70
79
|
}
|
|
71
80
|
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
"..",
|
|
75
|
-
|
|
76
|
-
target.
|
|
77
|
-
|
|
78
|
-
target.binaryFilename,
|
|
79
|
-
|
|
80
|
-
const
|
|
81
|
-
dir,
|
|
82
|
-
"..",
|
|
83
|
-
"node_modules",
|
|
84
|
-
target.packageName,
|
|
85
|
-
"bin",
|
|
86
|
-
target.binaryFilename,
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
const binPath = existsSync(candidateOne)
|
|
90
|
-
? candidateOne
|
|
91
|
-
: existsSync(candidateTwo)
|
|
92
|
-
? candidateTwo
|
|
93
|
-
: null;
|
|
81
|
+
const candidates = [
|
|
82
|
+
// Hoisted install: the platform package beside this one in node_modules.
|
|
83
|
+
resolve(dir, "..", "..", target.packagePathSegment, "bin", target.binaryFilename),
|
|
84
|
+
// Nested install: the platform package under this package's node_modules.
|
|
85
|
+
resolve(dir, "..", "node_modules", target.packageName, "bin", target.binaryFilename),
|
|
86
|
+
// In place: the .crust/ tree crust build staged, before any install.
|
|
87
|
+
resolve(dir, "..", "..", target.targetAlias, "bin", target.binaryFilename),
|
|
88
|
+
];
|
|
89
|
+
const binPath = candidates.find((candidate) => existsSync(candidate));
|
|
94
90
|
|
|
95
91
|
if (!binPath) {
|
|
96
|
-
console.error("[
|
|
97
|
-
console.error("[
|
|
98
|
-
console.error(" " +
|
|
99
|
-
console.error(" " + candidateTwo);
|
|
92
|
+
console.error("[" + NAME + "] Missing platform package for " + platformKey);
|
|
93
|
+
console.error("[" + NAME + "] Tried:");
|
|
94
|
+
for (const candidate of candidates) console.error(" " + candidate);
|
|
100
95
|
console.error(
|
|
101
|
-
"[
|
|
96
|
+
"[" + NAME + "] Reinstall dependencies on this platform and ensure optional dependencies are enabled.",
|
|
102
97
|
);
|
|
103
98
|
process.exit(1);
|
|
104
99
|
}
|
|
@@ -116,7 +111,7 @@ const child = spawn(binPath, process.argv.slice(2), {
|
|
|
116
111
|
});
|
|
117
112
|
|
|
118
113
|
child.on("error", (error) => {
|
|
119
|
-
console.error("[
|
|
114
|
+
console.error("[" + NAME + "] Failed to launch binary: " + error.message);
|
|
120
115
|
process.exit(1);
|
|
121
116
|
});
|
|
122
117
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crustjs/crust",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "CLI tooling for the Crust framework",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "chenxin-yan",
|
|
@@ -29,19 +29,20 @@
|
|
|
29
29
|
},
|
|
30
30
|
"type": "module",
|
|
31
31
|
"files": [
|
|
32
|
-
"bin"
|
|
32
|
+
"bin",
|
|
33
|
+
"schema"
|
|
33
34
|
],
|
|
34
35
|
"bin": {
|
|
35
36
|
"crust": "bin/crust.js"
|
|
36
37
|
},
|
|
37
38
|
"optionalDependencies": {
|
|
38
|
-
"@crustjs/crust-linux-x64": "0.
|
|
39
|
-
"@crustjs/crust-linux-arm64": "0.
|
|
40
|
-
"@crustjs/crust-linux-x64-musl": "0.
|
|
41
|
-
"@crustjs/crust-linux-arm64-musl": "0.
|
|
42
|
-
"@crustjs/crust-darwin-x64": "0.
|
|
43
|
-
"@crustjs/crust-darwin-arm64": "0.
|
|
44
|
-
"@crustjs/crust-windows-x64": "0.
|
|
45
|
-
"@crustjs/crust-windows-arm64": "0.
|
|
39
|
+
"@crustjs/crust-linux-x64": "0.3.1",
|
|
40
|
+
"@crustjs/crust-linux-arm64": "0.3.1",
|
|
41
|
+
"@crustjs/crust-linux-x64-musl": "0.3.1",
|
|
42
|
+
"@crustjs/crust-linux-arm64-musl": "0.3.1",
|
|
43
|
+
"@crustjs/crust-darwin-x64": "0.3.1",
|
|
44
|
+
"@crustjs/crust-darwin-arm64": "0.3.1",
|
|
45
|
+
"@crustjs/crust-windows-x64": "0.3.1",
|
|
46
|
+
"@crustjs/crust-windows-arm64": "0.3.1"
|
|
46
47
|
}
|
|
47
48
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "package.json with a Crust build configuration",
|
|
4
|
+
"description": "package.json schema for CLIs built with Crust. Point \"$schema\" at ./node_modules/@crustjs/crust/schema/package.json to get completion for the \"crust\" block alongside the standard package.json fields.",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"allOf": [
|
|
7
|
+
{
|
|
8
|
+
"$ref": "https://json.schemastore.org/package.json"
|
|
9
|
+
}
|
|
10
|
+
],
|
|
11
|
+
"properties": {
|
|
12
|
+
"crust": {
|
|
13
|
+
"description": "Build configuration read by `crust build`. Every key is optional; unknown keys fail the build. Command names and their source entries come from the standard `bin` field.",
|
|
14
|
+
"type": "object",
|
|
15
|
+
"additionalProperties": false,
|
|
16
|
+
"properties": {
|
|
17
|
+
"runtime": {
|
|
18
|
+
"description": "Runtime the CLI is built for. Without it: deno.json/deno.jsonc selects deno; @types/node without @types/bun selects node; otherwise bun.",
|
|
19
|
+
"type": "string",
|
|
20
|
+
"enum": [
|
|
21
|
+
"bun",
|
|
22
|
+
"deno",
|
|
23
|
+
"node"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"bunPlugins": {
|
|
27
|
+
"description": "Bun bundler plugin modules applied to Bun and Node builds, in order: bare names resolve from node_modules, paths from the project root; each must default-export the plugin. Rejected for Deno.",
|
|
28
|
+
"type": "array",
|
|
29
|
+
"items": {
|
|
30
|
+
"type": "string"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"include": {
|
|
34
|
+
"description": "Directories relative to the project root that `crust build` copies into .crust/root/ and into each platform package's bin/.",
|
|
35
|
+
"type": "array",
|
|
36
|
+
"items": {
|
|
37
|
+
"type": "string"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|