@dforge-core/dforge-cli 0.1.0-rc.1 → 0.1.0-test.5
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 +19 -0
- package/index.js +44 -5
- package/package.json +29 -25
package/README.md
CHANGED
|
@@ -77,3 +77,22 @@ The validate/pack/install pipeline is the same code that runs on the dForge
|
|
|
77
77
|
server, packaged as a single-file binary per platform via `dotnet publish
|
|
78
78
|
--self-contained`. Avoids drift between author-time validation and server-side
|
|
79
79
|
install validation: same parser, same validators, same error messages.
|
|
80
|
+
|
|
81
|
+
## For maintainers
|
|
82
|
+
|
|
83
|
+
C# source lives in [`iash44/dForge-core`](https://github.com/iash44/dForge-core)
|
|
84
|
+
under `server/src/dForge.Cli/`. This repo only ships the npm wrapper + 6
|
|
85
|
+
platform sidecars. Release flow:
|
|
86
|
+
|
|
87
|
+
1. Tag `cli-vX.Y.Z` in `dForge-core` → `.github/workflows/release-cli.yml`
|
|
88
|
+
cross-compiles 6 binaries and attaches them to a GitHub Release.
|
|
89
|
+
2. Run `gh workflow run publish.yml -f source_tag=cli-vX.Y.Z -f npm_version=X.Y.Z -f npm_tag=next`
|
|
90
|
+
in this repo. `scripts/fetch-binaries.sh` pulls binaries from the source
|
|
91
|
+
release; `scripts/publish.sh` aligns versions and publishes 7 packages.
|
|
92
|
+
3. After smoke-testing `npx -y @dforge-core/dforge-cli@next --version`, promote
|
|
93
|
+
with another workflow run using `-f npm_tag=latest`.
|
|
94
|
+
|
|
95
|
+
To test a freshly-built binary without going through the publish pipeline,
|
|
96
|
+
set `DFORGE_CLI_BINARY=/path/to/dforge-cli` and `node index.js` will exec
|
|
97
|
+
that path directly, skipping require.resolve and the sibling-packages
|
|
98
|
+
fallback.
|
package/index.js
CHANGED
|
@@ -19,6 +19,18 @@ const platformMap = {
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
function resolveBinary() {
|
|
22
|
+
// Escape hatch for source-repo / dist-repo maintainers who want to test a
|
|
23
|
+
// freshly-built binary without going through the publish pipeline.
|
|
24
|
+
// Honored before anything else.
|
|
25
|
+
const override = process.env.DFORGE_CLI_BINARY;
|
|
26
|
+
if (override) {
|
|
27
|
+
if (!fs.existsSync(override)) {
|
|
28
|
+
console.error(`dforge-cli: DFORGE_CLI_BINARY points at non-existent path: ${override}`);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
return override;
|
|
32
|
+
}
|
|
33
|
+
|
|
22
34
|
const key = `${process.platform}-${process.arch}`;
|
|
23
35
|
const pkg = platformMap[key];
|
|
24
36
|
if (!pkg) {
|
|
@@ -32,11 +44,23 @@ function resolveBinary() {
|
|
|
32
44
|
try {
|
|
33
45
|
pkgJsonPath = require.resolve(`${pkg}/package.json`);
|
|
34
46
|
} catch {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
47
|
+
// Dist-repo dev fallback: after running scripts/fetch-binaries.sh the
|
|
48
|
+
// sidecars sit under ./packages/<shortName>/ at the repo root, but
|
|
49
|
+
// they're not in node_modules (no `pnpm install` to symlink them).
|
|
50
|
+
// Check that path before bailing. Consumers of the published package
|
|
51
|
+
// never hit this branch — require.resolve succeeds via npm-installed
|
|
52
|
+
// node_modules.
|
|
53
|
+
const shortName = pkg.split("/").pop();
|
|
54
|
+
const siblingPkgJson = path.join(__dirname, "packages", shortName, "package.json");
|
|
55
|
+
if (fs.existsSync(siblingPkgJson)) {
|
|
56
|
+
pkgJsonPath = siblingPkgJson;
|
|
57
|
+
} else {
|
|
58
|
+
console.error(
|
|
59
|
+
`dforge-cli: platform package "${pkg}" not installed. ` +
|
|
60
|
+
`Re-run \`npm install\` without --no-optional, or install it explicitly.`,
|
|
61
|
+
);
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
40
64
|
}
|
|
41
65
|
|
|
42
66
|
const pkgDir = path.dirname(pkgJsonPath);
|
|
@@ -46,6 +70,21 @@ function resolveBinary() {
|
|
|
46
70
|
console.error(`dforge-cli: binary missing at ${binPath}`);
|
|
47
71
|
process.exit(1);
|
|
48
72
|
}
|
|
73
|
+
|
|
74
|
+
// Ensure the binary is executable. pnpm/npm tarball-packing has dropped the
|
|
75
|
+
// +x bit on files outside `bin` fields in some versions, so a freshly-
|
|
76
|
+
// downloaded sidecar can land as 0644 even though the local checkout was
|
|
77
|
+
// 0755. chmod is idempotent — no-op when already executable — and skipped
|
|
78
|
+
// on Windows where it has no effect on .exe invocation.
|
|
79
|
+
if (process.platform !== "win32") {
|
|
80
|
+
try {
|
|
81
|
+
const mode = fs.statSync(binPath).mode;
|
|
82
|
+
if ((mode & 0o111) === 0) fs.chmodSync(binPath, mode | 0o755);
|
|
83
|
+
} catch (e) {
|
|
84
|
+
// Non-fatal: spawnSync below will surface EACCES with a clear message
|
|
85
|
+
// if chmod failed for an unexpected reason (read-only fs, perms).
|
|
86
|
+
}
|
|
87
|
+
}
|
|
49
88
|
return binPath;
|
|
50
89
|
}
|
|
51
90
|
|
package/package.json
CHANGED
|
@@ -1,26 +1,30 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
2
|
+
"name": "@dforge-core/dforge-cli",
|
|
3
|
+
"version": "0.1.0-test.5",
|
|
4
|
+
"description": "dForge CLI \u2014 validate, pack, publish, and install dForge modules. Distributes a single-file native binary per platform via optionalDependencies (esbuild-style).",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://github.com/iash44/dForge-core",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dforge-core/dforge-cli.git"
|
|
10
|
+
},
|
|
11
|
+
"bin": {
|
|
12
|
+
"dforge-cli": "index.js"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"index.js",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"main": "index.js",
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=18"
|
|
21
|
+
},
|
|
22
|
+
"optionalDependencies": {
|
|
23
|
+
"@dforge-core/dforge-cli-darwin-arm64": "0.1.0-test.5",
|
|
24
|
+
"@dforge-core/dforge-cli-darwin-x64": "0.1.0-test.5",
|
|
25
|
+
"@dforge-core/dforge-cli-linux-x64": "0.1.0-test.5",
|
|
26
|
+
"@dforge-core/dforge-cli-linux-arm64": "0.1.0-test.5",
|
|
27
|
+
"@dforge-core/dforge-cli-win32-x64": "0.1.0-test.5",
|
|
28
|
+
"@dforge-core/dforge-cli-win32-arm64": "0.1.0-test.5"
|
|
29
|
+
}
|
|
30
|
+
}
|