Skip to content

Commit a6ef494

Browse files
committed
feat: release vite-plus cli
1 parent 1b3cc67 commit a6ef494

18 files changed

Lines changed: 119 additions & 61 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ jobs:
108108

109109
- name: Print help for built-in commands
110110
run: |
111+
cp packages/cli/binding/*.node packages/cli/dist
111112
export PATH="$PATH:$(pwd)/packages/cli/bin"
112113
vite-plus -h
113114
vite-plus run -h

.github/workflows/release.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ jobs:
8282
run: pnpm install
8383

8484
- name: Build
85-
run: pnpm --filter=vite-plus build:binding --target ${{ matrix.target }} -x
85+
run: pnpm --filter=@voidzero-dev/vite-plus build:binding --target ${{ matrix.target }} -x
8686
env:
8787
XWIN_CACHE_DIR: ${{ github.workspace }}/.xwin-cache
8888

@@ -121,7 +121,7 @@ jobs:
121121
merge-multiple: true
122122

123123
- name: Build
124-
run: vp run vite-plus#build:ts @voidzero-dev/global#build
124+
run: vp run @voidzero-dev/vite-plus#build:ts @voidzero-dev/global#build
125125

126126
# Download again because `@voidzero-dev/global#build` will cleanup the dist dir first
127127
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
@@ -130,14 +130,21 @@ jobs:
130130
pattern: bindings-*
131131
merge-multiple: true
132132

133+
- name: Copy *.node to cli/dist
134+
run: |
135+
cp -r packages/global/dist/*.node packages/cli/dist
136+
ls -alh packages/cli/dist
137+
133138
- name: Set version
134139
run: |
135140
sed -i '' 's/"version": "0.0.0"/"version": "0.0.0-${{ github.sha }}"/' packages/global/package.json
141+
sed -i '' 's/"version": "0.0.0"/"version": "0.0.0-${{ github.sha }}"/' packages/cli/package.json
136142
137143
- name: Publish
138144
run: |
139145
echo "//npm.pkg.github.com/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
140146
echo "@voidzero-dev:registry=https://npm.pkg.github.com/" >> ~/.npmrc
141147
pnpm publish --filter=./packages/global --registry https://npm.pkg.github.com --no-git-checks
148+
pnpm publish --filter=./packages/cli --registry https://npm.pkg.github.com --no-git-checks
142149
env:
143150
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ Create a fine-grained personal access token with the `read:packages` scope, foll
1414
Use this token to install the global cli:
1515

1616
```
17-
GITHUB_TOKEN=<your-token> npm install -g @voidzero-dev/vite-cli
17+
GITHUB_TOKEN=<your-token> npm install -g @voidzero-dev/global
1818
```
1919

2020
Use 1Password cli:
2121

2222
```
23-
GITHUB_TOKEN=$(op read "op://YOUR_GITHUB_TOKEN_PATH") npm install -g @voidzero-dev/vite-cli
23+
GITHUB_TOKEN=$(op read "op://YOUR_GITHUB_TOKEN_PATH") npm install -g @voidzero-dev/global
2424
```

bench/generate-monorepo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ module.exports = { ${pkg.name.replace('-', '_')} };
280280
'lint:all': 'vite-plus run lint',
281281
},
282282
devDependencies: {
283-
'vite-plus': '*',
283+
'@voidzero-dev/vite-plus': '*',
284284
},
285285
};
286286

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"node": "22.17.0"
77
},
88
"scripts": {
9-
"bootstrap-cli": "pnpm --filter=vite-plus build && cp -r ./packages/cli/binding/*.node ./packages/global/dist && pnpm --filter=@voidzero-dev/global build && npm install -g ./packages/global",
10-
"bootstrap-cli:ci": "pnpm --filter=vite-plus build:ts && pnpm --filter=@voidzero-dev/global build && npm install -g ./packages/global",
9+
"bootstrap-cli": "pnpm --filter=@voidzero-dev/vite-plus build && cp -r ./packages/cli/binding/*.node ./packages/global/dist && pnpm --filter=@voidzero-dev/global build && npm install -g ./packages/global",
10+
"bootstrap-cli:ci": "pnpm --filter=@voidzero-dev/vite-plus build:ts && pnpm --filter=@voidzero-dev/global build && npm install -g ./packages/global",
1111
"typecheck": "tsc -b tsconfig.json",
1212
"prepare": "husky"
1313
},
@@ -20,7 +20,7 @@
2020
"oxlint": "catalog:",
2121
"typescript": "catalog:",
2222
"rolldown-vite": "catalog:",
23-
"vite-plus": "workspace:*"
23+
"@voidzero-dev/vite-plus": "workspace:*"
2424
},
2525
"lint-staged": {
2626
"*.@(js|ts|tsx|yml|yaml|md|json|html|toml)": [

packages/cli/README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,62 @@
44

55
This package provides the JavaScript-to-Rust bridge that enables vite-plus to execute JavaScript tooling (like Vite, Vitest, and oxlint) from the Rust core. It uses NAPI-RS to create native Node.js bindings.
66

7+
## Usage
8+
9+
### Install
10+
11+
Add to your project's devDependencies:
12+
13+
```bash
14+
pnpm add -D @voidzero-dev/vite-plus
15+
# or
16+
npm install -D @voidzero-dev/vite-plus
17+
# or
18+
yarn add -D @voidzero-dev/vite-plus
19+
```
20+
21+
### Built-in Commands
22+
23+
#### Build
24+
25+
build command will use `rolldown-vite` to build your project.
26+
27+
```bash
28+
npx vite build
29+
```
30+
31+
#### Test
32+
33+
test command will use `vitest` to test your project.
34+
35+
```bash
36+
npx vite test
37+
```
38+
39+
#### Lint
40+
41+
lint command will use `oxlint` to lint your project.
42+
43+
```bash
44+
npx vite lint
45+
```
46+
47+
#### Task runner
48+
49+
You can use `vite run` to run any task that you want.
50+
51+
Run a task on the current project.
52+
53+
```bash
54+
npx vite run <task-name>
55+
```
56+
57+
Run all task with the same name in monorepo.
58+
59+
```bash
60+
npx vite run -r <task-name>
61+
```
62+
763
## Architecture
864

965
### How It Works

packages/cli/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
{
2-
"name": "vite-plus",
2+
"name": "@voidzero-dev/vite-plus",
33
"version": "0.0.0",
4-
"private": true,
54
"type": "module",
65
"bin": {
6+
"vite": "./bin/vite-plus",
77
"vite-plus": "./bin/vite-plus"
88
},
99
"exports": {
1010
".": {
11-
"import": "./dist/index.js"
11+
"import": "./dist/index.js",
12+
"types": "./dist/index.d.ts"
1213
},
1314
"./bin": {
1415
"import": "./dist/bin.js"
@@ -20,12 +21,11 @@
2021
"scripts": {
2122
"build": "pnpm run build:binding && pnpm run build:ts",
2223
"build:binding": "napi build --package-json-path ../package.json --cwd binding --platform --release --esm",
23-
"build:ts": "tsc -p ./tsconfig.json"
24+
"build:ts": "tsdown"
2425
},
2526
"files": [
2627
"bin",
27-
"index.js",
28-
"index.d.ts"
28+
"dist"
2929
],
3030
"dependencies": {
3131
"oxlint": "catalog:",

packages/cli/tsdown.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { defineConfig } from 'tsdown';
2+
3+
export default defineConfig({
4+
entry: ['./src/bin.ts', './src/index.ts'],
5+
dts: true,
6+
});

packages/global/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
"build": "tsdown"
2121
},
2222
"dependencies": {
23-
"oxlint": "*",
24-
"rolldown-vite": "*",
25-
"vitest": "*"
23+
"oxlint": "catalog:",
24+
"rolldown-vite": "catalog:",
25+
"vitest": "catalog:"
2626
},
2727
"devDependencies": {
28-
"tsdown": "^0.14.1",
29-
"vite-plus": "workspace:*"
28+
"tsdown": "catalog:",
29+
"@voidzero-dev/vite-plus": "workspace:*"
3030
},
3131
"engines": {
3232
"node": ">=20.11.0"

packages/global/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
import 'vite-plus/bin';
1+
import '@voidzero-dev/vite-plus/bin';

0 commit comments

Comments
 (0)