cannwork-rehearsal 0.2.0 → 0.2.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/cannwork.js +18 -6
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ Releases are published manually to <https://registry.npmjs.org/> in two phases:
|
|
|
77
77
|
|
|
78
78
|
### Phase 1 — unscoped trial release (kept live)
|
|
79
79
|
|
|
80
|
-
1. Set `name` to `cannwork-rehearsal` and `version` to `0.
|
|
80
|
+
1. Set `name` to `cannwork-rehearsal` and `version` to `0.2.0` in the root `package.json` (single source of truth).
|
|
81
81
|
2. `npm login` (any account with publish rights).
|
|
82
82
|
3. `bun run release` — runs typecheck + tests, cross-compiles, then publishes the 5 platform packages followed by the main package. Add `--dry-run` to pack and verify without uploading.
|
|
83
83
|
4. Check each package on the registry (`npm view <pkg> version`). A `0.0.0-stage` value means npm staged the version for review; wait for it to go live (or approve it on npmjs.com) before smoke-testing.
|
package/bin/cannwork.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { spawn } from "node:child_process";
|
|
4
|
-
import { accessSync, chmodSync, constants } from "node:fs";
|
|
4
|
+
import { accessSync, chmodSync, constants, realpathSync } from "node:fs";
|
|
5
5
|
import { resolve } from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
|
|
@@ -110,17 +110,29 @@ export async function run(argv = process.argv.slice(2)) {
|
|
|
110
110
|
return await spawnBinary(binaryPath, argv);
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
export
|
|
114
|
-
|
|
113
|
+
export const ENTRYPOINT_UNDETERMINED_MESSAGE =
|
|
114
|
+
"cannwork: 无法确认启动器入口,已跳过执行。\n";
|
|
115
|
+
|
|
116
|
+
export function entrypointStatus(metaUrl, argv1) {
|
|
117
|
+
if (typeof argv1 !== "string" || argv1.length === 0) return "not-entrypoint";
|
|
115
118
|
try {
|
|
116
|
-
|
|
119
|
+
const selfPath = realpathSync(fileURLToPath(metaUrl));
|
|
120
|
+
const argvPath = realpathSync(resolve(argv1));
|
|
121
|
+
return selfPath === argvPath ? "entrypoint" : "not-entrypoint";
|
|
117
122
|
} catch {
|
|
118
|
-
return
|
|
123
|
+
return "undetermined";
|
|
119
124
|
}
|
|
120
125
|
}
|
|
121
126
|
|
|
122
|
-
|
|
127
|
+
export function isEntrypoint(metaUrl, argv1) {
|
|
128
|
+
return entrypointStatus(metaUrl, argv1) === "entrypoint";
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const entryStatus = entrypointStatus(import.meta.url, process.argv[1]);
|
|
132
|
+
if (entryStatus === "entrypoint") {
|
|
123
133
|
run().then((code) => {
|
|
124
134
|
process.exit(code);
|
|
125
135
|
});
|
|
136
|
+
} else if (entryStatus === "undetermined") {
|
|
137
|
+
process.stderr.write(ENTRYPOINT_UNDETERMINED_MESSAGE);
|
|
126
138
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cannwork-rehearsal",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"cannwork": "bin/cannwork.js"
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"README.md"
|
|
11
11
|
],
|
|
12
12
|
"optionalDependencies": {
|
|
13
|
-
"cannwork-rehearsal-win32-x64": "0.2.
|
|
14
|
-
"cannwork-rehearsal-linux-x64": "0.2.
|
|
15
|
-
"cannwork-rehearsal-linux-arm64": "0.2.
|
|
16
|
-
"cannwork-rehearsal-darwin-x64": "0.2.
|
|
17
|
-
"cannwork-rehearsal-darwin-arm64": "0.2.
|
|
13
|
+
"cannwork-rehearsal-win32-x64": "0.2.1",
|
|
14
|
+
"cannwork-rehearsal-linux-x64": "0.2.1",
|
|
15
|
+
"cannwork-rehearsal-linux-arm64": "0.2.1",
|
|
16
|
+
"cannwork-rehearsal-darwin-x64": "0.2.1",
|
|
17
|
+
"cannwork-rehearsal-darwin-arm64": "0.2.1"
|
|
18
18
|
},
|
|
19
19
|
"publishConfig": {
|
|
20
20
|
"registry": "https://registry.npmjs.org/",
|