@univerkit/verso 1.0.0-alpha.0
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/LICENSE +21 -0
- package/bin/verso.js +2 -0
- package/dist/bin.d.ts +2 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +37 -0
- package/dist/resolve.d.ts +8 -0
- package/dist/resolve.d.ts.map +1 -0
- package/dist/resolve.js +35 -0
- package/package.json +56 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DreamNum Co., Ltd. <developer@univer.ai>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/bin/verso.js
ADDED
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
|
package/dist/bin.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import { resolvePlatformBinary } from './resolve.js';
|
|
4
|
+
const require = createRequire(import.meta.url);
|
|
5
|
+
function resolveInstalledBinaryPath({ packageName, binaryName }) {
|
|
6
|
+
try {
|
|
7
|
+
return require.resolve(`${packageName}/bin/${binaryName}`);
|
|
8
|
+
}
|
|
9
|
+
catch (cause) {
|
|
10
|
+
throw new Error(`Could not find Verso platform binary ${packageName}/bin/${binaryName}. ` +
|
|
11
|
+
`The optional dependency ${packageName} may not be installed for this platform.`, { cause });
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function main() {
|
|
15
|
+
const platformBinary = resolvePlatformBinary();
|
|
16
|
+
const binaryPath = resolveInstalledBinaryPath(platformBinary);
|
|
17
|
+
const result = spawnSync(binaryPath, process.argv.slice(2), {
|
|
18
|
+
stdio: 'inherit',
|
|
19
|
+
});
|
|
20
|
+
if (result.error !== undefined) {
|
|
21
|
+
throw new Error(`Failed to launch Verso binary at ${binaryPath}.`, {
|
|
22
|
+
cause: result.error,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
if (result.signal !== null) {
|
|
26
|
+
process.kill(process.pid, result.signal);
|
|
27
|
+
}
|
|
28
|
+
process.exit(result.status ?? 1);
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
main();
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
35
|
+
console.error(message);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface PlatformBinary {
|
|
2
|
+
packageName: string;
|
|
3
|
+
binaryName: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function packageForPlatform(platform: string, arch: string): string;
|
|
6
|
+
export declare function binaryName(platform: string): string;
|
|
7
|
+
export declare function resolvePlatformBinary(platform?: string, arch?: string): PlatformBinary;
|
|
8
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../src/resolve.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAsBD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAczE;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,wBAAgB,qBAAqB,CACnC,QAAQ,GAAE,MAAyB,EACnC,IAAI,GAAE,MAAqB,GAC1B,cAAc,CAKhB"}
|
package/dist/resolve.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const supportedPackages = {
|
|
2
|
+
darwin: {
|
|
3
|
+
arm64: '@univerkit/verso-darwin-arm64',
|
|
4
|
+
x64: '@univerkit/verso-darwin-x64',
|
|
5
|
+
},
|
|
6
|
+
linux: {
|
|
7
|
+
arm64: '@univerkit/verso-linux-arm64',
|
|
8
|
+
x64: '@univerkit/verso-linux-x64',
|
|
9
|
+
},
|
|
10
|
+
win32: {
|
|
11
|
+
x64: '@univerkit/verso-win32-x64',
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
function isSupportedPlatform(platform) {
|
|
15
|
+
return platform in supportedPackages;
|
|
16
|
+
}
|
|
17
|
+
export function packageForPlatform(platform, arch) {
|
|
18
|
+
if (!isSupportedPlatform(platform)) {
|
|
19
|
+
throw new Error(`Unsupported platform: ${platform} ${arch}`);
|
|
20
|
+
}
|
|
21
|
+
const packageName = supportedPackages[platform][arch];
|
|
22
|
+
if (packageName === undefined) {
|
|
23
|
+
throw new Error(`Unsupported platform: ${platform} ${arch}`);
|
|
24
|
+
}
|
|
25
|
+
return packageName;
|
|
26
|
+
}
|
|
27
|
+
export function binaryName(platform) {
|
|
28
|
+
return platform === 'win32' ? 'verso.exe' : 'verso';
|
|
29
|
+
}
|
|
30
|
+
export function resolvePlatformBinary(platform = process.platform, arch = process.arch) {
|
|
31
|
+
return {
|
|
32
|
+
packageName: packageForPlatform(platform, arch),
|
|
33
|
+
binaryName: binaryName(platform),
|
|
34
|
+
};
|
|
35
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@univerkit/verso",
|
|
3
|
+
"version": "1.0.0-alpha.0",
|
|
4
|
+
"description": "A focused release CLI for JavaScript workspace packages.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "DreamNum Co., Ltd. <developer@univer.ai>",
|
|
7
|
+
"homepage": "https://github.com/dream-num/verso#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/dream-num/verso.git",
|
|
11
|
+
"directory": "packages/verso"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/dream-num/verso/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"release",
|
|
18
|
+
"changelog",
|
|
19
|
+
"semver",
|
|
20
|
+
"workspace",
|
|
21
|
+
"monorepo",
|
|
22
|
+
"cli"
|
|
23
|
+
],
|
|
24
|
+
"type": "module",
|
|
25
|
+
"bin": {
|
|
26
|
+
"verso": "bin/verso.js"
|
|
27
|
+
},
|
|
28
|
+
"exports": {
|
|
29
|
+
"./resolve": {
|
|
30
|
+
"types": "./dist/resolve.d.ts",
|
|
31
|
+
"default": "./dist/resolve.js"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"bin",
|
|
36
|
+
"dist",
|
|
37
|
+
"package.json",
|
|
38
|
+
"README.md"
|
|
39
|
+
],
|
|
40
|
+
"optionalDependencies": {
|
|
41
|
+
"@univerkit/verso-darwin-arm64": "1.0.0-alpha.0",
|
|
42
|
+
"@univerkit/verso-darwin-x64": "1.0.0-alpha.0",
|
|
43
|
+
"@univerkit/verso-linux-arm64": "1.0.0-alpha.0",
|
|
44
|
+
"@univerkit/verso-linux-x64": "1.0.0-alpha.0",
|
|
45
|
+
"@univerkit/verso-win32-x64": "1.0.0-alpha.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/node": "^26.0.0",
|
|
49
|
+
"typescript": "^6.0.3"
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "tsc -p tsconfig.json && node scripts/build-bin.mts",
|
|
53
|
+
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json --noEmit",
|
|
54
|
+
"test": "pnpm run build && tsc -p tsconfig.test.json && node --test test-dist/**/*.test.js"
|
|
55
|
+
}
|
|
56
|
+
}
|