Skip to content

Commit 596bcb0

Browse files
committed
fix: add .exe for windows
1 parent 9d785e2 commit 596bcb0

File tree

17 files changed

+183
-192
lines changed

17 files changed

+183
-192
lines changed

npm/darwin-arm64/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"name": "@rslint/darwin-arm64",
33
"version": "0.1.7",
44
"license": "MIT",
5+
"exports": {
6+
"./bin": "./rslint"
7+
},
58
"description": "binary for rslint",
69
"homepage": "https://rslint.rs",
710
"bugs": "https://github.com/web-infra-dev/rslint/issues",

npm/darwin-x64/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"name": "@rslint/darwin-x64",
33
"version": "0.1.7",
44
"license": "MIT",
5+
"exports": {
6+
"./bin": "./rslint"
7+
},
58
"description": "binary for rslint",
69
"bugs": "https://github.com/web-infra-dev/rslint/issues",
710
"repository": {

npm/linux-arm64/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"name": "@rslint/linux-arm64",
33
"version": "0.1.7",
44
"license": "MIT",
5+
"exports": {
6+
"./bin": "./rslint"
7+
},
58
"description": "binary for rslint",
69
"bugs": "https://github.com/web-infra-dev/rslint/issues",
710
"repository": {

npm/linux-x64/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"name": "@rslint/linux-x64",
33
"version": "0.1.7",
44
"license": "MIT",
5+
"exports": {
6+
"./bin": "./rslint"
7+
},
58
"description": "binary for rslint",
69
"bugs": "https://github.com/web-infra-dev/rslint/issues",
710
"repository": {

npm/win32-arm64/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"name": "@rslint/win32-arm64",
33
"version": "0.1.7",
44
"license": "MIT",
5+
"exports": {
6+
"./bin": "./rslint.exe"
7+
},
58
"description": "binary for rslint",
69
"bugs": "https://github.com/web-infra-dev/rslint/issues",
710
"repository": {

npm/win32-x64/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"name": "@rslint/win32-x64",
33
"version": "0.1.7",
44
"license": "MIT",
5+
"exports": {
6+
"./bin": "./rslint.exe"
7+
},
58
"description": "binary for rslint",
69
"bugs": "https://github.com/web-infra-dev/rslint/issues",
710
"repository": {

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
"license": "MIT",
1515
"scripts": {
1616
"build": "pnpm -r build",
17-
"build:npm": "zx scripts/build-npm.mjs",
1817
"check-spell": "pnpx cspell",
18+
"build:npm:all": "zx scripts/build-npm.mjs all",
19+
"build:npm:current": "zx scripts/build-npm.mjs current",
1920
"version": "zx scripts/version.mjs",
2021
"release": "pnpm publish -r --no-git-checks",
2122
"publish:vsce": "zx scripts/publish-marketplace.mjs",

packages/rslint/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

packages/rslint/bin/rslint.cjs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,9 @@
11
#!/usr/bin/env node
2-
const path = require('node:path');
32
const os = require('node:os');
4-
const fs = require('node:fs');
5-
function getBinPath() {
6-
if (fs.existsSync(path.resolve(__dirname, './rslint'))) {
7-
return path.resolve(__dirname, './rslint');
8-
}
9-
if (fs.existsSync(path.resolve(__dirname, './rslint.exe'))) {
10-
return path.resolve(__dirname, './rslint.exe');
11-
}
12-
let platformKey = `${process.platform}-${os.arch()}`;
133

14-
return require.resolve(
15-
`@rslint/${platformKey}/rslint${process.platform === 'win32' ? '.exe' : ''}`,
16-
);
17-
}
184
function main() {
19-
const binPath = getBinPath();
5+
const binPath = require.resolve(`@rslint/${os.platform()}-${os.arch()}/bin`);
6+
207
try {
218
require('child_process').execFileSync(binPath, process.argv.slice(2), {
229
stdio: 'inherit',
@@ -31,4 +18,5 @@ function main() {
3118
}
3219
}
3320
}
21+
3422
main();

packages/rslint/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"url": "https://github.com/web-infra-dev/rslint"
1313
},
1414
"scripts": {
15-
"build:bin": "go build -v -o bin/rslint ../../cmd/rslint",
15+
"build:bin": "zx ../../scripts/build-npm.mjs current",
1616
"build:debug": "GOEXPERIMENT=noregabi go build -v -gcflags='all=-N -l' -o bin/rslint ../../cmd/rslint ",
1717
"build:js": "tsc -b tsconfig.build.json --force",
1818
"dev": "tsc -b tsconfig.build.json --force --watch",

0 commit comments

Comments
 (0)