@univerkit/verso 1.0.0-alpha.0 → 1.0.0-alpha.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 +83 -0
- package/dist/bin.js +19 -4
- package/dist/launcher.d.ts +6 -0
- package/dist/launcher.d.ts.map +1 -0
- package/dist/launcher.js +33 -0
- package/package.json +13 -6
package/README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# @univerkit/verso
|
|
2
|
+
|
|
3
|
+
Verso is a focused release CLI for JavaScript workspaces that publish multiple
|
|
4
|
+
packages at the same version. It updates package manifests, writes an
|
|
5
|
+
Angular-style changelog, creates a release commit and tag, and pushes with
|
|
6
|
+
`git push --follow-tags`.
|
|
7
|
+
|
|
8
|
+
This npm package is the JavaScript wrapper for the native Verso binary. The
|
|
9
|
+
matching binary is installed through an optional platform package such as
|
|
10
|
+
`@univerkit/verso-darwin-arm64`, `@univerkit/verso-linux-x64`, or
|
|
11
|
+
`@univerkit/verso-win32-x64`.
|
|
12
|
+
|
|
13
|
+
## Supported Platforms
|
|
14
|
+
|
|
15
|
+
| Platform | CPU | Package |
|
|
16
|
+
| --- | --- | --- |
|
|
17
|
+
| macOS | arm64 | `@univerkit/verso-darwin-arm64` |
|
|
18
|
+
| macOS | x64 | `@univerkit/verso-darwin-x64` |
|
|
19
|
+
| Linux | arm64 | `@univerkit/verso-linux-arm64` |
|
|
20
|
+
| Linux | x64 | `@univerkit/verso-linux-x64` |
|
|
21
|
+
| Windows | x64 | `@univerkit/verso-win32-x64` |
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
Requires Node.js 22.18.0 or newer.
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
pnpm add -D @univerkit/verso
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Add a release script:
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"scripts": {
|
|
36
|
+
"release": "verso"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Create `verso.toml` in the project root:
|
|
42
|
+
|
|
43
|
+
```toml
|
|
44
|
+
[workspaces]
|
|
45
|
+
patterns = ["packages/*"]
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Then run:
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
pnpm release
|
|
52
|
+
pnpm release -- --dry-run
|
|
53
|
+
pnpm release -- --version 1.2.3 --yes
|
|
54
|
+
pnpm release -- -V
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Troubleshooting
|
|
58
|
+
|
|
59
|
+
If running `verso` prints `Could not find Verso platform binary`, the native
|
|
60
|
+
optional dependency for your operating system was not installed or is not
|
|
61
|
+
available for your platform.
|
|
62
|
+
|
|
63
|
+
Check these first:
|
|
64
|
+
|
|
65
|
+
- install `@univerkit/verso`, not a platform package directly
|
|
66
|
+
- make sure optional dependencies are enabled in your package manager
|
|
67
|
+
- confirm your machine is one of the supported platform and CPU pairs above
|
|
68
|
+
- reinstall from a fresh lockfile if the lockfile was created on a different
|
|
69
|
+
operating system or with optional dependencies disabled
|
|
70
|
+
|
|
71
|
+
If running `verso` prints `Failed to launch Verso binary`, the platform package
|
|
72
|
+
was found but the native executable could not be started. On macOS and Linux,
|
|
73
|
+
the wrapper repairs missing executable bits before spawning the native binary.
|
|
74
|
+
Upgrade `@univerkit/verso`, reinstall dependencies, and include the error's
|
|
75
|
+
cause line in bug reports if the failure continues.
|
|
76
|
+
|
|
77
|
+
An unsupported platform needs a new native package before the wrapper can run.
|
|
78
|
+
For bug reports, include the output of `pnpm release -- -V`. The wrapper handles
|
|
79
|
+
that command before loading the native binary, so it still works when the
|
|
80
|
+
platform optional dependency is missing.
|
|
81
|
+
|
|
82
|
+
See the repository README for the full configuration reference and release
|
|
83
|
+
workflow details: https://github.com/dream-num/verso
|
package/dist/bin.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { spawnSync } from 'node:child_process';
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
+
import { ensureExecutable, formatLaunchError, isToolVersionRequest, normalizeCliArgs, } from './launcher.js';
|
|
3
4
|
import { resolvePlatformBinary } from './resolve.js';
|
|
4
5
|
const require = createRequire(import.meta.url);
|
|
5
6
|
function resolveInstalledBinaryPath({ packageName, binaryName }) {
|
|
@@ -11,16 +12,27 @@ function resolveInstalledBinaryPath({ packageName, binaryName }) {
|
|
|
11
12
|
`The optional dependency ${packageName} may not be installed for this platform.`, { cause });
|
|
12
13
|
}
|
|
13
14
|
}
|
|
15
|
+
function wrapperVersion() {
|
|
16
|
+
const manifest = require('../package.json');
|
|
17
|
+
if (typeof manifest.version !== 'string') {
|
|
18
|
+
throw new Error('Could not read @univerkit/verso package version.');
|
|
19
|
+
}
|
|
20
|
+
return manifest.version;
|
|
21
|
+
}
|
|
14
22
|
function main() {
|
|
23
|
+
const args = process.argv.slice(2);
|
|
24
|
+
if (isToolVersionRequest(args)) {
|
|
25
|
+
console.log(wrapperVersion());
|
|
26
|
+
process.exit(0);
|
|
27
|
+
}
|
|
15
28
|
const platformBinary = resolvePlatformBinary();
|
|
16
29
|
const binaryPath = resolveInstalledBinaryPath(platformBinary);
|
|
17
|
-
|
|
30
|
+
ensureExecutable(binaryPath);
|
|
31
|
+
const result = spawnSync(binaryPath, normalizeCliArgs(args), {
|
|
18
32
|
stdio: 'inherit',
|
|
19
33
|
});
|
|
20
34
|
if (result.error !== undefined) {
|
|
21
|
-
throw new Error(
|
|
22
|
-
cause: result.error,
|
|
23
|
-
});
|
|
35
|
+
throw new Error(formatLaunchError(binaryPath, result.error));
|
|
24
36
|
}
|
|
25
37
|
if (result.signal !== null) {
|
|
26
38
|
process.kill(process.pid, result.signal);
|
|
@@ -33,5 +45,8 @@ try {
|
|
|
33
45
|
catch (error) {
|
|
34
46
|
const message = error instanceof Error ? error.message : String(error);
|
|
35
47
|
console.error(message);
|
|
48
|
+
if (error instanceof Error && error.cause instanceof Error) {
|
|
49
|
+
console.error(error.cause.message);
|
|
50
|
+
}
|
|
36
51
|
process.exit(1);
|
|
37
52
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function normalizeCliArgs(args: string[]): string[];
|
|
2
|
+
export declare function isToolVersionRequest(args: string[]): boolean;
|
|
3
|
+
export declare function hasExecutableBit(mode: number): boolean;
|
|
4
|
+
export declare function ensureExecutable(binaryPath: string, platform?: NodeJS.Platform): void;
|
|
5
|
+
export declare function formatLaunchError(binaryPath: string, error: Error): string;
|
|
6
|
+
//# sourceMappingURL=launcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAEzD;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAM5D;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAAG,IAAI,CAWvG;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,MAAM,CAc1E"}
|
package/dist/launcher.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { chmodSync, statSync } from 'node:fs';
|
|
2
|
+
export function normalizeCliArgs(args) {
|
|
3
|
+
return args[0] === '--' ? args.slice(1) : args;
|
|
4
|
+
}
|
|
5
|
+
export function isToolVersionRequest(args) {
|
|
6
|
+
const normalizedArgs = normalizeCliArgs(args);
|
|
7
|
+
return (normalizedArgs.length === 1 &&
|
|
8
|
+
(normalizedArgs[0] === '-V' || normalizedArgs[0] === '--tool-version'));
|
|
9
|
+
}
|
|
10
|
+
export function hasExecutableBit(mode) {
|
|
11
|
+
return (mode & 0o111) !== 0;
|
|
12
|
+
}
|
|
13
|
+
export function ensureExecutable(binaryPath, platform = process.platform) {
|
|
14
|
+
if (platform === 'win32') {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const mode = statSync(binaryPath).mode;
|
|
18
|
+
if (hasExecutableBit(mode)) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
chmodSync(binaryPath, mode | 0o111);
|
|
22
|
+
}
|
|
23
|
+
export function formatLaunchError(binaryPath, error) {
|
|
24
|
+
const lines = [`Failed to launch Verso binary at ${binaryPath}.`];
|
|
25
|
+
const reason = error.message.trim();
|
|
26
|
+
if (reason.length > 0) {
|
|
27
|
+
lines.push(`Reason: ${reason}`);
|
|
28
|
+
}
|
|
29
|
+
if (error.code === 'EACCES') {
|
|
30
|
+
lines.push('The binary is not executable. Reinstall @univerkit/verso, then check that your package manager installs optional dependencies and preserves executable file modes.');
|
|
31
|
+
}
|
|
32
|
+
return lines.join('\n');
|
|
33
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerkit/verso",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.1",
|
|
4
4
|
"description": "A focused release CLI for JavaScript workspace packages.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "DreamNum Co., Ltd. <developer@univer.ai>",
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
"bugs": {
|
|
14
14
|
"url": "https://github.com/dream-num/verso/issues"
|
|
15
15
|
},
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=22.18.0"
|
|
18
|
+
},
|
|
16
19
|
"keywords": [
|
|
17
20
|
"release",
|
|
18
21
|
"changelog",
|
|
@@ -37,12 +40,16 @@
|
|
|
37
40
|
"package.json",
|
|
38
41
|
"README.md"
|
|
39
42
|
],
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public",
|
|
45
|
+
"provenance": true
|
|
46
|
+
},
|
|
40
47
|
"optionalDependencies": {
|
|
41
|
-
"@univerkit/verso-darwin-arm64": "1.0.0-alpha.
|
|
42
|
-
"@univerkit/verso-darwin-x64": "1.0.0-alpha.
|
|
43
|
-
"@univerkit/verso-linux-
|
|
44
|
-
"@univerkit/verso-linux-
|
|
45
|
-
"@univerkit/verso-win32-x64": "1.0.0-alpha.
|
|
48
|
+
"@univerkit/verso-darwin-arm64": "1.0.0-alpha.1",
|
|
49
|
+
"@univerkit/verso-darwin-x64": "1.0.0-alpha.1",
|
|
50
|
+
"@univerkit/verso-linux-x64": "1.0.0-alpha.1",
|
|
51
|
+
"@univerkit/verso-linux-arm64": "1.0.0-alpha.1",
|
|
52
|
+
"@univerkit/verso-win32-x64": "1.0.0-alpha.1"
|
|
46
53
|
},
|
|
47
54
|
"devDependencies": {
|
|
48
55
|
"@types/node": "^26.0.0",
|