Skip to content

Commit

Permalink
fix!: rename nix to nlx
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Mar 29, 2023
1 parent 4cd9e65 commit ee46d5c
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 23 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ nr -

<br>

### `nix` - execute
### `nlx` - download & execute

```bash
nix vitest
nlx vitest

# npx vitest
# yarn dlx vitest
Expand Down Expand Up @@ -255,10 +255,12 @@ if ($profileContent -notcontains $profileEntry) {
}
```

#### `nx` is no longer available
#### `nx` and `nix` is no longer available

We renamed `nx` to `nix` to avoid conflicts with the other existing tool - [nx](https://nx.dev/). If you don't use [nx](https://nx.dev/) and still want the old `nx` behavior you can create an alias on your shell configuration file (`.zshrc`, `.bashrc`, etc).
We renamed `nx`/`nix` to `nlx` to avoid conflicts with the other existing tools - [nx](https://nx.dev/) and [nix](https://nixos.org/). You can always alias them back on your shell configuration file (`.zshrc`, `.bashrc`, etc).

```bash
alias nx="nix"
alias nx="nlx"
# or
alias nix="nlx"
```
2 changes: 1 addition & 1 deletion bin/nix.mjs → bin/nlx.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env node
'use strict'
import '../dist/nix.mjs'
import '../dist/nlx.mjs'
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"nci": "bin/nci.mjs",
"nr": "bin/nr.mjs",
"nu": "bin/nu.mjs",
"nix": "bin/nix.mjs",
"nlx": "bin/nlx.mjs",
"na": "bin/na.mjs",
"nun": "bin/nun.mjs"
},
Expand Down
4 changes: 0 additions & 4 deletions src/commands/nix.ts

This file was deleted.

4 changes: 4 additions & 0 deletions src/commands/nlx.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { parseNlx } from '../parse'
import { runCli } from '../runner'

runCli(parseNlx)
2 changes: 1 addition & 1 deletion src/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const parseNun = <Runner>((agent, args) => {
return getCommand(agent, 'uninstall', args)
})

export const parseNix = <Runner>((agent, args) => {
export const parseNlx = <Runner>((agent, args) => {
return getCommand(agent, 'execute', args)
})

Expand Down
2 changes: 1 addition & 1 deletion src/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export async function run(fn: Runner, args: string[], options: DetectOptions = {
console.log(c.green(c.bold('@antfu/ni')) + c.dim(` use the right package manager v${version}\n`))
console.log(`ni ${dash} install`)
console.log(`nr ${dash} run`)
console.log(`nix ${dash} execute`)
console.log(`nlx ${dash} execute`)
console.log(`nu ${dash} upgrade`)
console.log(`nun ${dash} uninstall`)
console.log(`nci ${dash} clean install`)
Expand Down
4 changes: 2 additions & 2 deletions test/nx/bun.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { expect, test } from 'vitest'
import { parseNix } from '../../src/commands'
import { parseNlx } from '../../src/commands'

const agent = 'bun'
const _ = (arg: string, expected: string) => () => {
expect(
parseNix(agent, arg.split(' ').filter(Boolean)),
parseNlx(agent, arg.split(' ').filter(Boolean)),
).toBe(
expected,
)
Expand Down
4 changes: 2 additions & 2 deletions test/nx/npm.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { expect, test } from 'vitest'
import { parseNix } from '../../src/commands'
import { parseNlx } from '../../src/commands'

const agent = 'npm'
const _ = (arg: string, expected: string) => () => {
expect(
parseNix(agent, arg.split(' ').filter(Boolean)),
parseNlx(agent, arg.split(' ').filter(Boolean)),
).toBe(
expected,
)
Expand Down
4 changes: 2 additions & 2 deletions test/nx/pnpm.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { expect, test } from 'vitest'
import { parseNix } from '../../src/commands'
import { parseNlx } from '../../src/commands'

const agent = 'pnpm'
const _ = (arg: string, expected: string) => () => {
expect(
parseNix(agent, arg.split(' ').filter(Boolean)),
parseNlx(agent, arg.split(' ').filter(Boolean)),
).toBe(
expected,
)
Expand Down
4 changes: 2 additions & 2 deletions test/nx/yarn.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { expect, test } from 'vitest'
import { parseNix } from '../../src/commands'
import { parseNlx } from '../../src/commands'

const agent = 'yarn'
const _ = (arg: string, expected: string) => () => {
expect(
parseNix(agent, arg.split(' ').filter(Boolean)),
parseNlx(agent, arg.split(' ').filter(Boolean)),
).toBe(
expected,
)
Expand Down
4 changes: 2 additions & 2 deletions test/nx/[email protected]
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { expect, test } from 'vitest'
import { parseNix } from '../../src/commands'
import { parseNlx } from '../../src/commands'

const agent = 'yarn@berry'
const _ = (arg: string, expected: string) => () => {
expect(
parseNix(agent, arg.split(' ').filter(Boolean)),
parseNlx(agent, arg.split(' ').filter(Boolean)),
).toBe(
expected,
)
Expand Down

0 comments on commit ee46d5c

Please sign in to comment.