@happytoolin/alur 0.0.3 → 0.0.4
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 +286 -222
- package/npm-shrinkwrap.json +2 -2
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -11,31 +11,82 @@
|
|
|
11
11
|

|
|
12
12
|

|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Website: [`alur.happytoolin.com`](https://alur.happytoolin.com)
|
|
15
15
|
|
|
16
|
-
`alur` is
|
|
16
|
+
`alur` is a native package-manager command router for `npm`, `yarn`, `pnpm`, `bun`, and `deno`.
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
The supported interface is the CLI; the Rust crate modules are internal and do not carry a stable API guarantee.
|
|
18
|
+
It has three main jobs:
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
1. Fast mode runs eligible scripts and local bins directly, skipping package-manager CLI startup.
|
|
21
|
+
2. The `ni` command family gives you one set of commands across every package manager.
|
|
22
|
+
3. The optional `node` shim lets you type `node install`, `node run`, and `node exec` like Node had Bun-style package commands.
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
`alur` is beta software. The supported interface is the CLI; Rust crate modules are internal and do not carry a stable API guarantee.
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
Install it on macOS / Linux:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
curl -fsSL https://bin.happytoolin.com/alur | sh
|
|
32
|
+
alur --version
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Install it with PowerShell:
|
|
36
|
+
|
|
37
|
+
```powershell
|
|
38
|
+
irm https://bin.happytoolin.com/alur.ps1 | iex
|
|
39
|
+
alur --version
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Or install from npm:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm install -g @happytoolin/alur
|
|
46
|
+
alur --version
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Use the short commands:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
ni vite # add vite with the detected package manager
|
|
53
|
+
nr dev # run the dev script, using fast mode when safe
|
|
54
|
+
nlx eslint . # run a local bin directly when possible
|
|
55
|
+
nci # clean install from the lockfile
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Or use the explicit `alur` commands:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
alur install vite
|
|
62
|
+
alur run dev
|
|
63
|
+
alur exec eslint .
|
|
64
|
+
alur ci
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Enable the optional `node` shim when you want Node to behave like an all-in-one package command:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
eval "$(alur init zsh)"
|
|
71
|
+
node install vite
|
|
72
|
+
node run dev
|
|
73
|
+
node exec vitest
|
|
74
|
+
```
|
|
26
75
|
|
|
27
76
|
## Install
|
|
28
77
|
|
|
29
|
-
### npm
|
|
78
|
+
### npm
|
|
30
79
|
|
|
31
80
|
```bash
|
|
32
81
|
npm install -g @happytoolin/alur
|
|
33
82
|
alur --version
|
|
34
83
|
```
|
|
35
84
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
85
|
+
The npm package installs `alur` plus the multicall aliases: `ni`, `nr`, `nlx`, `nun`, `nci`, `np`, and `ns`.
|
|
86
|
+
|
|
87
|
+
The `node` shim is not enabled by npm install. It is always opt-in through `alur init <shell>`.
|
|
88
|
+
|
|
89
|
+
Under the hood, npm postinstall downloads the matching native `alur` binary from the GitHub release.
|
|
39
90
|
|
|
40
91
|
### Homebrew
|
|
41
92
|
|
|
@@ -45,104 +96,137 @@ brew install alur
|
|
|
45
96
|
alur --version
|
|
46
97
|
```
|
|
47
98
|
|
|
48
|
-
### Script
|
|
99
|
+
### Script Install
|
|
100
|
+
|
|
101
|
+
macOS / Linux:
|
|
49
102
|
|
|
50
103
|
```bash
|
|
51
|
-
curl
|
|
104
|
+
curl -fsSL https://bin.happytoolin.com/alur | sh
|
|
52
105
|
```
|
|
53
106
|
|
|
54
|
-
|
|
107
|
+
Shell script alias:
|
|
55
108
|
|
|
56
109
|
```bash
|
|
57
|
-
curl
|
|
110
|
+
curl -fsSL https://bin.happytoolin.com/alur.sh | sh
|
|
58
111
|
```
|
|
59
112
|
|
|
60
|
-
|
|
113
|
+
PowerShell:
|
|
61
114
|
|
|
62
115
|
```powershell
|
|
63
|
-
|
|
116
|
+
irm https://bin.happytoolin.com/alur.ps1 | iex
|
|
64
117
|
```
|
|
65
118
|
|
|
66
|
-
|
|
119
|
+
Direct GitHub release URLs are available too:
|
|
67
120
|
|
|
68
121
|
```bash
|
|
69
|
-
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/happytoolin/alur/releases/download/
|
|
70
|
-
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> "$GITHUB_ENV"
|
|
122
|
+
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/happytoolin/alur/releases/latest/download/alur-installer.sh | sh
|
|
71
123
|
```
|
|
72
124
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
## Enable the `node` shim
|
|
125
|
+
Pin a specific version:
|
|
76
126
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
Add the output to the **end** of your shell rc file (after nvm / mise / asdf / fnm / volta init):
|
|
127
|
+
```bash
|
|
128
|
+
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/happytoolin/alur/releases/download/v0.0.4/alur-installer.sh | sh
|
|
129
|
+
```
|
|
81
130
|
|
|
82
|
-
|
|
131
|
+
CI example:
|
|
83
132
|
|
|
84
133
|
```bash
|
|
85
|
-
|
|
134
|
+
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/happytoolin/alur/releases/download/v0.0.4/alur-installer.sh | sh
|
|
135
|
+
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> "$GITHUB_ENV"
|
|
86
136
|
```
|
|
87
137
|
|
|
88
|
-
|
|
138
|
+
Use `releases/latest/download` to follow the latest release. Use a versioned release URL for repeatable automation.
|
|
139
|
+
|
|
140
|
+
## Feature 1: Fast Mode
|
|
141
|
+
|
|
142
|
+
Fast mode is the default for eligible `nr`, `alur run`, `nlx`, `alur exec`, and matching `node` shim commands.
|
|
143
|
+
|
|
144
|
+
Instead of starting `npm run`, `pnpm exec`, or another package-manager CLI, `alur` resolves the script or local executable itself and launches it directly.
|
|
89
145
|
|
|
90
146
|
```bash
|
|
91
|
-
|
|
147
|
+
nr dev
|
|
148
|
+
alur run test -- --watch
|
|
149
|
+
nlx eslint .
|
|
150
|
+
node run dev
|
|
151
|
+
node exec vitest
|
|
92
152
|
```
|
|
93
153
|
|
|
94
|
-
|
|
154
|
+
Fast mode currently targets common local work:
|
|
95
155
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
156
|
+
- `package.json` scripts, including `pre<script>` and `post<script>` lifecycle hooks
|
|
157
|
+
- nearest `deno.json` / `deno.jsonc` tasks in Deno projects
|
|
158
|
+
- local bins in `node_modules/.bin`
|
|
159
|
+
- pnpm hoisted bins under `node_modules/.pnpm/node_modules/.bin`
|
|
160
|
+
- package-local `bin` entries
|
|
99
161
|
|
|
100
|
-
|
|
162
|
+
If `alur` cannot prove the fast path is correct, it falls back to package-manager mode.
|
|
101
163
|
|
|
102
|
-
|
|
103
|
-
|
|
164
|
+
Common fallback cases include Yarn Plug'n'Play, Deno workspaces, remote package exec, and scripts that depend on package-manager-specific env expansion.
|
|
165
|
+
|
|
166
|
+
Control it per command:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
nr --fast dev # prefer fast mode
|
|
170
|
+
nr --pm dev # force package-manager mode
|
|
171
|
+
nlx --pm create-vite@latest
|
|
172
|
+
node run --pm dev
|
|
104
173
|
```
|
|
105
174
|
|
|
106
|
-
|
|
175
|
+
Inspect what happened:
|
|
107
176
|
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
|
|
177
|
+
```bash
|
|
178
|
+
nr dev --print-command
|
|
179
|
+
nr dev --explain
|
|
180
|
+
alur doctor
|
|
111
181
|
```
|
|
112
182
|
|
|
113
|
-
|
|
114
|
-
(`node install vite` → `ni vite`) and pass everything else through to the real Node.js.
|
|
183
|
+
Latest tracked fast benchmark snapshot: fast mode averaged `4.59x` faster than package-manager mode, with local-bin exec cases like `nlx hello --flag` reaching `47.43x`.
|
|
115
184
|
|
|
116
|
-
|
|
185
|
+
See [`benchmark/LATEST.md`](benchmark/LATEST.md) for the current snapshot and [`docs/fast-compat.md`](docs/fast-compat.md) for the exact compatibility rules.
|
|
117
186
|
|
|
118
|
-
|
|
187
|
+
## Feature 2: Short Commands
|
|
119
188
|
|
|
120
|
-
|
|
121
|
-
alur install vite
|
|
122
|
-
alur uninstall lodash
|
|
123
|
-
alur run dev
|
|
124
|
-
alur exec vitest
|
|
125
|
-
alur ci
|
|
126
|
-
alur parallel "pnpm dev" "pnpm test"
|
|
127
|
-
alur sequential "pnpm lint" "pnpm test"
|
|
128
|
-
```
|
|
189
|
+
Use one command vocabulary and let `alur` pick the right package manager from the project.
|
|
129
190
|
|
|
130
|
-
|
|
191
|
+
| Task | Short command | Explicit command |
|
|
192
|
+
| ------------------------------------ | ------------- | ----------------- |
|
|
193
|
+
| Install dependencies or add packages | `ni` | `alur install` |
|
|
194
|
+
| Run scripts | `nr` | `alur run` |
|
|
195
|
+
| Execute package binaries | `nlx` | `alur exec` |
|
|
196
|
+
| Uninstall packages | `nun` | `alur uninstall` |
|
|
197
|
+
| Clean install | `nci` | `alur ci` |
|
|
198
|
+
| Run shell commands in parallel | `np` | `alur parallel` |
|
|
199
|
+
| Run shell commands sequentially | `ns` | `alur sequential` |
|
|
131
200
|
|
|
132
|
-
Install
|
|
201
|
+
### Install / Add
|
|
202
|
+
|
|
203
|
+
`ni` installs dependencies when called with no package names. It adds packages when package names are present.
|
|
133
204
|
|
|
134
205
|
```bash
|
|
135
206
|
ni
|
|
136
207
|
ni vite
|
|
208
|
+
ni react react-dom
|
|
137
209
|
ni -D vitest
|
|
138
210
|
ni -g eslint
|
|
139
211
|
ni --frozen
|
|
140
212
|
ni --frozen-if-present
|
|
141
213
|
```
|
|
142
214
|
|
|
143
|
-
|
|
215
|
+
Examples by detected package manager:
|
|
216
|
+
|
|
217
|
+
| Project | `ni` | `ni vite` |
|
|
218
|
+
| ------- | -------------- | --------------- |
|
|
219
|
+
| npm | `npm i` | `npm i vite` |
|
|
220
|
+
| yarn | `yarn install` | `yarn add vite` |
|
|
221
|
+
| pnpm | `pnpm i` | `pnpm add vite` |
|
|
222
|
+
| bun | `bun install` | `bun add vite` |
|
|
223
|
+
| deno | `deno install` | `deno add vite` |
|
|
224
|
+
|
|
225
|
+
Global installs use `global_package_manager`, which defaults to `npm`.
|
|
144
226
|
|
|
145
|
-
Run
|
|
227
|
+
### Run Scripts
|
|
228
|
+
|
|
229
|
+
`nr` runs package scripts. With no script name, it runs `start`.
|
|
146
230
|
|
|
147
231
|
```bash
|
|
148
232
|
nr
|
|
@@ -152,9 +236,11 @@ nr test -- --watch
|
|
|
152
236
|
nr --if-present lint
|
|
153
237
|
```
|
|
154
238
|
|
|
155
|
-
|
|
239
|
+
In fast mode, `nr` can skip the package manager and run the script directly. Use `--pm` when you need exact package-manager behavior.
|
|
240
|
+
|
|
241
|
+
### Execute Binaries
|
|
156
242
|
|
|
157
|
-
|
|
243
|
+
`nlx` runs package binaries.
|
|
158
244
|
|
|
159
245
|
```bash
|
|
160
246
|
nlx vitest
|
|
@@ -162,83 +248,132 @@ nlx eslint .
|
|
|
162
248
|
nlx create-vite@latest
|
|
163
249
|
```
|
|
164
250
|
|
|
165
|
-
|
|
251
|
+
When a local executable can be resolved confidently, `nlx` runs it directly. Remote or ambiguous cases fall back to the detected package manager.
|
|
166
252
|
|
|
167
|
-
Uninstall
|
|
253
|
+
### Uninstall / Clean Install
|
|
168
254
|
|
|
169
255
|
```bash
|
|
170
256
|
nun lodash
|
|
171
257
|
nun react react-dom
|
|
172
258
|
nun -g typescript
|
|
173
|
-
```
|
|
174
259
|
|
|
175
|
-
### `nci`
|
|
176
|
-
|
|
177
|
-
Run a clean install. If a lockfile exists, `alur` uses the package-manager-specific frozen install command.
|
|
178
|
-
|
|
179
|
-
```bash
|
|
180
260
|
nci
|
|
261
|
+
nci --prefer-offline
|
|
181
262
|
```
|
|
182
263
|
|
|
183
|
-
|
|
264
|
+
`nci` uses a package-manager-specific frozen install when a lockfile exists. Without a lockfile, it falls back to normal install behavior.
|
|
265
|
+
|
|
266
|
+
### Parallel / Sequential Shell Commands
|
|
184
267
|
|
|
185
|
-
|
|
268
|
+
Each argument is a separate shell command.
|
|
186
269
|
|
|
187
270
|
```bash
|
|
188
271
|
np "pnpm dev" "pnpm test"
|
|
189
272
|
ns "pnpm lint" "pnpm test"
|
|
190
273
|
```
|
|
191
274
|
|
|
192
|
-
|
|
275
|
+
`np` runs all commands concurrently and returns the first non-zero exit code. `ns` runs commands in order and stops on the first failure.
|
|
193
276
|
|
|
194
|
-
|
|
195
|
-
|
|
277
|
+
## Feature 3: Node Shim
|
|
278
|
+
|
|
279
|
+
The `node` shim is for people who want package commands to feel built into Node.
|
|
280
|
+
|
|
281
|
+
After init, these work:
|
|
196
282
|
|
|
197
283
|
```bash
|
|
284
|
+
node install
|
|
198
285
|
node install vite
|
|
286
|
+
node add react
|
|
199
287
|
node uninstall lodash
|
|
288
|
+
node remove lodash
|
|
200
289
|
node run dev
|
|
201
290
|
node exec vitest
|
|
291
|
+
node x eslint .
|
|
202
292
|
node ci
|
|
203
293
|
node p "echo one" "echo two"
|
|
294
|
+
node s "pnpm lint" "pnpm test"
|
|
204
295
|
```
|
|
205
296
|
|
|
206
|
-
|
|
297
|
+
That gives Node a Bun-like command surface, while still using your project's real package manager.
|
|
298
|
+
|
|
299
|
+
The shim routes known alur shim verbs and aliases:
|
|
300
|
+
|
|
301
|
+
| `node` input | Routes to |
|
|
302
|
+
| --------------------------------- | ------------------------- |
|
|
303
|
+
| `node install`, `node i` | install or add behavior |
|
|
304
|
+
| `node add` | add behavior |
|
|
305
|
+
| `node uninstall`, `node remove` | uninstall behavior |
|
|
306
|
+
| `node run` | script runner |
|
|
307
|
+
| `node exec`, `node x`, `node dlx` | binary executor |
|
|
308
|
+
| `node ci` | clean install |
|
|
309
|
+
| `node p` | parallel shell commands |
|
|
310
|
+
| `node s` | sequential shell commands |
|
|
311
|
+
|
|
312
|
+
Everything else passes through to the real Node.js binary:
|
|
207
313
|
|
|
208
314
|
```bash
|
|
209
315
|
node script.js
|
|
210
316
|
node -v
|
|
317
|
+
node --run dev
|
|
318
|
+
node --watch server.js
|
|
211
319
|
node -- --trace-warnings
|
|
212
320
|
```
|
|
213
321
|
|
|
214
|
-
###
|
|
322
|
+
### Enable It
|
|
323
|
+
|
|
324
|
+
Run `alur init` for your shell and put the output at the end of your shell config, after tools like `nvm`, `mise`, `asdf`, `fnm`, or `volta`.
|
|
325
|
+
|
|
326
|
+
zsh (`~/.zshrc`):
|
|
215
327
|
|
|
216
328
|
```bash
|
|
217
|
-
alur
|
|
218
|
-
alur completion zsh
|
|
219
|
-
alur init bash
|
|
220
|
-
alur doctor
|
|
329
|
+
eval "$(alur init zsh)"
|
|
221
330
|
```
|
|
222
331
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
These work across `alur` and the multicall aliases:
|
|
332
|
+
bash (`~/.bashrc`):
|
|
226
333
|
|
|
227
334
|
```bash
|
|
228
|
-
|
|
229
|
-
--explain
|
|
230
|
-
-C <dir>
|
|
231
|
-
-v --version
|
|
232
|
-
-h --help
|
|
335
|
+
eval "$(alur init bash)"
|
|
233
336
|
```
|
|
234
337
|
|
|
235
|
-
|
|
338
|
+
fish (`~/.config/fish/config.fish`):
|
|
236
339
|
|
|
237
|
-
```
|
|
238
|
-
alur
|
|
239
|
-
|
|
340
|
+
```fish
|
|
341
|
+
alur init fish | source
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
PowerShell (`$PROFILE`):
|
|
345
|
+
|
|
346
|
+
```powershell
|
|
347
|
+
Invoke-Expression (& alur init powershell)
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
Nushell (`~/.config/nushell/config.nu`):
|
|
351
|
+
|
|
352
|
+
```nu
|
|
353
|
+
alur init nushell | save --force ~/.config/nushell/alur.nu
|
|
354
|
+
source ~/.config/nushell/alur.nu
|
|
240
355
|
```
|
|
241
356
|
|
|
357
|
+
Restart your shell after editing your config.
|
|
358
|
+
|
|
359
|
+
`alur init` creates a managed `node` launcher and prints shell-specific PATH setup. On routed commands, `alur` finds the real Node.js binary and keeps normal Node behavior available.
|
|
360
|
+
|
|
361
|
+
If real Node cannot be found, set `ALUR_REAL_NODE=/absolute/path/to/node`.
|
|
362
|
+
|
|
363
|
+
To disable the shim, remove the `alur init` line from your shell config and restart the shell.
|
|
364
|
+
|
|
365
|
+
## Package Manager Detection
|
|
366
|
+
|
|
367
|
+
`alur` detects the package manager from:
|
|
368
|
+
|
|
369
|
+
1. `packageManager` in `package.json`
|
|
370
|
+
2. lockfiles such as `pnpm-lock.yaml`, `pnpm-workspace.yaml`, `yarn.lock`, `package-lock.json`, `bun.lockb`, or `deno.lock`
|
|
371
|
+
3. `devEngines.packageManager` in `package.json`
|
|
372
|
+
4. install metadata such as `.pnp.cjs`, `node_modules/.pnpm`, or `node_modules/.package-lock.json`
|
|
373
|
+
5. config defaults if detection is unavailable
|
|
374
|
+
|
|
375
|
+
When detection fails, add a `packageManager` field, commit a lockfile, or set `default_package_manager`.
|
|
376
|
+
|
|
242
377
|
## Configuration
|
|
243
378
|
|
|
244
379
|
Config file:
|
|
@@ -261,29 +396,52 @@ Environment overrides:
|
|
|
261
396
|
- `ALUR_DEFAULT_PACKAGE_MANAGER`
|
|
262
397
|
- `ALUR_GLOBAL_PACKAGE_MANAGER`
|
|
263
398
|
- `ALUR_FAST_MODE`
|
|
399
|
+
- `ALUR_REAL_NODE`
|
|
264
400
|
|
|
265
|
-
##
|
|
401
|
+
## Global Flags
|
|
266
402
|
|
|
267
|
-
`alur`
|
|
403
|
+
These work across `alur`, the `ni` aliases, and routed `node` shim commands:
|
|
268
404
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
405
|
+
```bash
|
|
406
|
+
--fast
|
|
407
|
+
--pm
|
|
408
|
+
--print-command
|
|
409
|
+
--explain
|
|
410
|
+
-C <dir>
|
|
411
|
+
-v --version
|
|
412
|
+
-h --help
|
|
413
|
+
```
|
|
274
414
|
|
|
275
|
-
|
|
415
|
+
For the `node` shim, alur only parses these flags after a routed verb. Normal
|
|
416
|
+
Node.js flags and non-routed first arguments are passed through untouched:
|
|
276
417
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
418
|
+
```bash
|
|
419
|
+
node run --pm dev --print-command
|
|
420
|
+
node --run dev --print-command
|
|
421
|
+
node --conditions=dev script.js
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
Use `--` to forward flags to the underlying package manager or script:
|
|
425
|
+
|
|
426
|
+
```bash
|
|
427
|
+
alur install -- --help
|
|
428
|
+
nr test -- --watch
|
|
429
|
+
node run test -- --watch
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
## Utilities
|
|
433
|
+
|
|
434
|
+
```bash
|
|
435
|
+
alur help
|
|
436
|
+
alur help ni
|
|
437
|
+
alur completion zsh
|
|
438
|
+
alur init bash
|
|
439
|
+
alur doctor
|
|
440
|
+
```
|
|
283
441
|
|
|
284
442
|
## Troubleshooting
|
|
285
443
|
|
|
286
|
-
### PowerShell `ni`
|
|
444
|
+
### PowerShell `ni` Alias Conflict
|
|
287
445
|
|
|
288
446
|
PowerShell ships with a built-in `ni` alias for `New-Item`.
|
|
289
447
|
|
|
@@ -294,53 +452,41 @@ Remove-Item Alias:ni -ErrorAction SilentlyContinue
|
|
|
294
452
|
Invoke-Expression (& alur init powershell)
|
|
295
453
|
```
|
|
296
454
|
|
|
297
|
-
### Check
|
|
455
|
+
### Check What Will Run
|
|
456
|
+
|
|
457
|
+
Use `--print-command` for the resolved command and `--explain` for detection details:
|
|
298
458
|
|
|
299
459
|
```bash
|
|
300
460
|
ni vite --print-command
|
|
301
461
|
nr dev --explain
|
|
302
|
-
|
|
462
|
+
node install vite --print-command
|
|
303
463
|
```
|
|
304
464
|
|
|
305
|
-
|
|
465
|
+
### Skip Fast Mode For Exact PM Behavior
|
|
306
466
|
|
|
307
|
-
|
|
467
|
+
Fast mode intentionally does not emulate every package-manager edge case.
|
|
308
468
|
|
|
309
|
-
|
|
469
|
+
Use `--pm` for Yarn PnP projects, Deno workspaces, package-manager-specific env expansion, or debugging exact package-manager behavior:
|
|
310
470
|
|
|
311
471
|
```bash
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
just ci
|
|
316
|
-
just bench
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
Run the default local benchmark with:
|
|
320
|
-
|
|
321
|
-
```bash
|
|
322
|
-
npm ci
|
|
323
|
-
npm run bench
|
|
324
|
-
just bench
|
|
472
|
+
nr --pm build
|
|
473
|
+
nlx --pm create-vite@latest
|
|
474
|
+
node run --pm dev
|
|
325
475
|
```
|
|
326
476
|
|
|
327
|
-
|
|
477
|
+
## Benchmarking
|
|
328
478
|
|
|
329
|
-
|
|
330
|
-
npm run bench -- --track=compare
|
|
331
|
-
npm run bench -- --track=fast
|
|
332
|
-
npm run bench -- --track=runtime
|
|
333
|
-
npm run bench -- --track=direct
|
|
334
|
-
just bench --track=direct --runs=3 --warmups=1 --no-build
|
|
335
|
-
```
|
|
479
|
+
The benchmark suite lives in [`benchmark/`](benchmark/).
|
|
336
480
|
|
|
337
|
-
|
|
481
|
+
Common local commands:
|
|
338
482
|
|
|
339
483
|
```bash
|
|
340
|
-
npm
|
|
484
|
+
npm ci
|
|
485
|
+
npm run bench
|
|
486
|
+
npm run bench -- --track=all --runs=100 --warmups=10
|
|
341
487
|
```
|
|
342
488
|
|
|
343
|
-
Generate flamegraphs
|
|
489
|
+
Generate flamegraphs:
|
|
344
490
|
|
|
345
491
|
```bash
|
|
346
492
|
./benchmark/profile.sh
|
|
@@ -350,91 +496,9 @@ Tracked benchmark docs:
|
|
|
350
496
|
|
|
351
497
|
- current snapshot: [`benchmark/LATEST.md`](benchmark/LATEST.md)
|
|
352
498
|
- lightweight history: [`benchmark/HISTORY.md`](benchmark/HISTORY.md)
|
|
499
|
+
- benchmark guide: [`benchmark/README.md`](benchmark/README.md)
|
|
353
500
|
- fast-mode compatibility: [`docs/fast-compat.md`](docs/fast-compat.md)
|
|
354
501
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
All numbers below were measured on macOS (Apple Silicon) with the release binary, using `hyperfine` with 10 warmups and 100 measured runs per case. See [`benchmark/LATEST.md`](benchmark/LATEST.md) for the raw tracked snapshot.
|
|
358
|
-
|
|
359
|
-
**Headline:** `alur --fast` is **7.4x faster** than running package managers directly, and **4.6x faster** than `alur` in its own PM fallback mode.
|
|
360
|
-
|
|
361
|
-
#### 1. Fast mode vs PM mode (inside alur)
|
|
362
|
-
|
|
363
|
-
Fast mode bypasses the package manager CLI entirely and runs scripts / local bins natively.
|
|
364
|
-
|
|
365
|
-
| Case | PM mode | Fast mode | Speedup |
|
|
366
|
-
| ------------------------ | ------: | --------: | --------: |
|
|
367
|
-
| `nr noop (npm)` | 246 ms | 37 ms | **6.6x** |
|
|
368
|
-
| `nr noop (pnpm)` | 799 ms | 49 ms | **16.4x** |
|
|
369
|
-
| `nr noop (yarn)` | 348 ms | 38 ms | **9.3x** |
|
|
370
|
-
| `node run noop (pnpm)` | 956 ms | 34 ms | **28.4x** |
|
|
371
|
-
| `nlx hello --flag (npm)` | 288 ms | 17 ms | **17.0x** |
|
|
372
|
-
| `nr noop (bun)` | 70 ms | 37 ms | **1.9x** |
|
|
373
|
-
| `nr noop (deno)` | 80 ms | 35 ms | **2.2x** |
|
|
374
|
-
|
|
375
|
-
_Geometric mean across all package managers: **4.6x**._
|
|
376
|
-
|
|
377
|
-
pnpm and yarn see the biggest wins because their CLIs carry the most startup overhead. Bun and Deno are already fast, so the margin is smaller (but still consistently ahead).
|
|
378
|
-
|
|
379
|
-
#### 2. alur fast vs direct package-manager usage
|
|
380
|
-
|
|
381
|
-
This is the real-world comparison: what users actually type today versus using `alur`.
|
|
382
|
-
|
|
383
|
-
| Case | Direct PM | alur --fast | Speedup |
|
|
384
|
-
| ------------------------ | --------: | ---------: | --------: |
|
|
385
|
-
| `npm run noop` | 320 ms | 53 ms | **6.1x** |
|
|
386
|
-
| `pnpm run noop` | 749 ms | 41 ms | **18.2x** |
|
|
387
|
-
| `yarn run noop` | 443 ms | 34 ms | **13.0x** |
|
|
388
|
-
| `npx hello --flag` | 300 ms | 4.8 ms | **62.0x** |
|
|
389
|
-
| `pnpm exec hello --flag` | 733 ms | 8.9 ms | **82.8x** |
|
|
390
|
-
| `bun run noop` | 79 ms | 34 ms | **2.4x** |
|
|
391
|
-
| `deno task noop` | 50 ms | 34 ms | **1.5x** |
|
|
392
|
-
|
|
393
|
-
_Geometric mean: **7.4x**._
|
|
394
|
-
|
|
395
|
-
Local bin execution is the standout feature: `npx` and `pnpm exec` spend hundreds of milliseconds resolving, validating, and bootstrapping before they even start your binary. `alur` resolves the bin once and runs it directly.
|
|
396
|
-
|
|
397
|
-
#### 3. alur vs Antfu's `ni`
|
|
398
|
-
|
|
399
|
-
For startup/version checks, `alur` is faster:
|
|
400
|
-
|
|
401
|
-
| Case | antfu/ni | alur | Speedup |
|
|
402
|
-
| -------------- | -------: | ----: | -------: |
|
|
403
|
-
| `ni --version` | 149 ms | 92 ms | **1.6x** |
|
|
404
|
-
|
|
405
|
-
_Current compare track keeps only version startup because `alur` no longer carries legacy `?` command-printing compatibility._
|
|
406
|
-
|
|
407
|
-
#### 4. Runtime comparison vs Bun and Deno
|
|
408
|
-
|
|
409
|
-
Even against native runtime task execution, `alur` holds its own:
|
|
410
|
-
|
|
411
|
-
| Case | alur | bun | deno |
|
|
412
|
-
| ------------ | ----: | -----: | ----: |
|
|
413
|
-
| `task noop` | 33 ms | 78 ms | 49 ms |
|
|
414
|
-
| `task hooks` | 90 ms | 210 ms | 77 ms |
|
|
415
|
-
|
|
416
|
-
`alur` is **2.3x faster than bun** for task execution and slightly faster than Deno for simple scripts.
|
|
417
|
-
|
|
418
|
-
### Methodology
|
|
419
|
-
|
|
420
|
-
The benchmark suite lives in [`benchmark/`](benchmark/) and uses `hyperfine` to time the release binary. It covers five angles:
|
|
421
|
-
|
|
422
|
-
- **`direct`** — normal package-manager commands (`npm run`, `pnpm exec`, etc.) vs `alur --fast`
|
|
423
|
-
- **`fast`** — `alur` PM mode vs `alur` fast mode (isolates the native-execution win)
|
|
424
|
-
- **`compare`** — `alur` vs `@antfu/ni` on startup/version overhead
|
|
425
|
-
- **`runtime`** — `alur` vs `bun` vs `deno` on actual task execution time
|
|
426
|
-
- **`fixtures`** — real project fixtures from `tests/fixtures/` across all detection categories
|
|
427
|
-
|
|
428
|
-
Run the full matrix locally:
|
|
429
|
-
|
|
430
|
-
```bash
|
|
431
|
-
npm run bench -- --track=all --runs=100 --warmups=10
|
|
432
|
-
```
|
|
433
|
-
|
|
434
|
-
Or generate flamegraphs:
|
|
435
|
-
|
|
436
|
-
```bash
|
|
437
|
-
./benchmark/profile.sh
|
|
438
|
-
```
|
|
502
|
+
## Acknowledgement
|
|
439
503
|
|
|
440
|
-
|
|
504
|
+
The short command family follows the spirit of Antfu's [`ni`](https://github.com/antfu-collective/ni#readme).
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"hasInstallScript": true,
|
|
31
31
|
"license": "GPL-3.0-only",
|
|
32
32
|
"name": "@happytoolin/alur",
|
|
33
|
-
"version": "0.0.
|
|
33
|
+
"version": "0.0.4"
|
|
34
34
|
},
|
|
35
35
|
"node_modules/@isaacs/cliui": {
|
|
36
36
|
"engines": {
|
|
@@ -549,5 +549,5 @@
|
|
|
549
549
|
}
|
|
550
550
|
},
|
|
551
551
|
"requires": true,
|
|
552
|
-
"version": "0.0.
|
|
552
|
+
"version": "0.0.4"
|
|
553
553
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"artifactDownloadUrls": [
|
|
3
|
-
"https://github.com/happytoolin/alur/releases/download/v0.0.
|
|
3
|
+
"https://github.com/happytoolin/alur/releases/download/v0.0.4"
|
|
4
4
|
],
|
|
5
5
|
"author": "Spark <helllo@kamran.sh>",
|
|
6
6
|
"bin": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"detect-libc": "^2.1.2",
|
|
21
21
|
"rimraf": "^6.1.3"
|
|
22
22
|
},
|
|
23
|
-
"description": "
|
|
23
|
+
"description": "Fast package-manager routing with short commands and an opt-in Node shim",
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"prettier": "^3.8.1"
|
|
26
26
|
},
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"major": 2,
|
|
33
33
|
"series": 31
|
|
34
34
|
},
|
|
35
|
-
"homepage": "https://
|
|
35
|
+
"homepage": "https://alur.happytoolin.com",
|
|
36
36
|
"keywords": [
|
|
37
37
|
"command-line-utilities",
|
|
38
38
|
"development-tools",
|
|
39
39
|
"package-manager",
|
|
40
|
+
"task-runner",
|
|
41
|
+
"node-shim",
|
|
40
42
|
"npm",
|
|
41
|
-
"yarn",
|
|
42
|
-
"pnpm",
|
|
43
43
|
"cli"
|
|
44
44
|
],
|
|
45
45
|
"license": "GPL-3.0-only",
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
"zipExt": ".tar.xz"
|
|
138
138
|
}
|
|
139
139
|
},
|
|
140
|
-
"version": "0.0.
|
|
140
|
+
"version": "0.0.4",
|
|
141
141
|
"volta": {
|
|
142
142
|
"node": "18.14.1",
|
|
143
143
|
"npm": "9.5.0"
|