Skip to content

Commit

Permalink
feat: rename nx to nix (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
joaosamouco committed Feb 10, 2023
1 parent 5265818 commit d17eb4c
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 20 deletions.
12 changes: 10 additions & 2 deletions README.md
Expand Up @@ -94,10 +94,10 @@ nr -

<br>

### `nx` - execute
### `nix` - execute (previously `nx`)

```bash
nx vitest
nix vitest

# npx vitest
# yarn dlx vitest
Expand Down Expand Up @@ -254,3 +254,11 @@ if ($profileContent -notcontains $profileEntry) {
$profileEntry | Out-File $profile -Append -Force
}
```

#### `nx` 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).

```bash
alias nx="nix"
```
2 changes: 1 addition & 1 deletion bin/nx.mjs → bin/nix.mjs
100644 → 100755
@@ -1,3 +1,3 @@
#!/usr/bin/env node
'use strict'
import '../dist/nx.mjs'
import '../dist/nix.mjs'
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -28,7 +28,7 @@
"nci": "bin/nci.mjs",
"nr": "bin/nr.mjs",
"nu": "bin/nu.mjs",
"nx": "bin/nx.mjs",
"nix": "bin/nix.mjs",
"na": "bin/na.mjs",
"nun": "bin/nun.mjs"
},
Expand Down
4 changes: 4 additions & 0 deletions src/commands/nix.ts
@@ -0,0 +1,4 @@
import { parseNix } from '../parse'
import { runCli } from '../runner'

runCli(parseNix)
4 changes: 0 additions & 4 deletions src/commands/nx.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/parse.ts
Expand Up @@ -68,7 +68,7 @@ export const parseNun = <Runner>((agent, args) => {
return getCommand(agent, 'uninstall', args)
})

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

Expand Down
2 changes: 1 addition & 1 deletion src/runner.ts
Expand Up @@ -48,7 +48,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(`nx ${dash} execute`)
console.log(`nix ${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
@@ -1,10 +1,10 @@
import { expect, test } from 'vitest'
import { parseNx } from '../../src/commands'
import { parseNix } from '../../src/commands'

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

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

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

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

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

0 comments on commit d17eb4c

Please sign in to comment.