diff --git a/README.md b/README.md
index ad68265e..89b69b66 100644
--- a/README.md
+++ b/README.md
@@ -163,6 +163,26 @@ if the corresponding node manager is not present, this command will install it g
+### `na` - agent alias
+
+```bash
+na
+
+# npm
+# yarn
+# pnpm
+```
+
+```bash
+na run foo
+
+# npm run foo
+# yarn run foo
+# pnpm run foo
+```
+
+
+
### Change Directory
```bash
diff --git a/bin/na.js b/bin/na.js
new file mode 100755
index 00000000..eea9ce4e
--- /dev/null
+++ b/bin/na.js
@@ -0,0 +1,3 @@
+#!/usr/bin/env node
+'use strict'
+require('../dist/na')
diff --git a/package.json b/package.json
index e5cefc68..3732f8b2 100644
--- a/package.json
+++ b/package.json
@@ -21,6 +21,7 @@
"nr": "bin/nr.js",
"nu": "bin/nu.js",
"nx": "bin/nx.js",
+ "na": "bin/na.js",
"nun": "bin/nun.js"
},
"bugs": {
@@ -38,7 +39,7 @@
"nx": "esno src/nx.ts",
"nun": "esno src/nun.ts",
"dev": "esno src/ni.ts",
- "build": "rimraf dist && tsup src/ni.ts src/nci.ts src/nr.ts src/nu.ts src/nx.ts src/nun.ts src/index.ts --format cjs,esm --dts",
+ "build": "rimraf dist && tsup src/ni.ts src/nci.ts src/nr.ts src/nu.ts src/nx.ts src/nun.ts src/na.ts src/index.ts --format cjs,esm --dts",
"release": "npx bumpp --commit --push --tag",
"lint": "eslint \"**/*.ts\"",
"lint:fix": "npm run lint -- --fix",
diff --git a/src/agents.ts b/src/agents.ts
index 7bed22bb..61e2484a 100644
--- a/src/agents.ts
+++ b/src/agents.ts
@@ -6,6 +6,7 @@ const npmRun = (agent: string) => (args: string[]) => {
export const AGENTS = {
'npm': {
+ 'agent': 'npm {0}',
'run': npmRun('npm'),
'install': 'npm i {0}',
'frozen': 'npm ci',
@@ -18,6 +19,7 @@ export const AGENTS = {
'global_uninstall': 'npm uninstall -g {0}',
},
'yarn': {
+ 'agent': 'yarn {0}',
'run': 'yarn run {0}',
'install': 'yarn install {0}',
'frozen': 'yarn install --frozen-lockfile',
@@ -30,6 +32,7 @@ export const AGENTS = {
'global_uninstall': 'yarn global remove {0}',
},
'yarn@berry': {
+ 'agent': 'yarn {0}',
'run': 'yarn run {0}',
'install': 'yarn install {0}',
'frozen': 'yarn install --immutable',
@@ -43,6 +46,7 @@ export const AGENTS = {
'global_uninstall': 'npm uninstall -g {0}',
},
'pnpm': {
+ 'agent': 'pnpm {0}',
'run': npmRun('pnpm'),
'install': 'pnpm i {0}',
'frozen': 'pnpm i --frozen-lockfile',
diff --git a/src/commands.ts b/src/commands.ts
index 782f2018..25974c68 100644
--- a/src/commands.ts
+++ b/src/commands.ts
@@ -74,3 +74,7 @@ export const parseNun = ((agent, args) => {
export const parseNx = ((agent, args) => {
return getCommand(agent, 'execute', args)
})
+
+export const parseNa = ((agent, args) => {
+ return getCommand(agent, 'agent', args)
+})
diff --git a/src/na.ts b/src/na.ts
new file mode 100644
index 00000000..d6f44df2
--- /dev/null
+++ b/src/na.ts
@@ -0,0 +1,4 @@
+import { parseNa } from './commands'
+import { runCli } from './runner'
+
+runCli(parseNa)
diff --git a/test/na/npm.spec.ts b/test/na/npm.spec.ts
new file mode 100644
index 00000000..ea6c4383
--- /dev/null
+++ b/test/na/npm.spec.ts
@@ -0,0 +1,15 @@
+import { expect, test } from 'vitest'
+import { parseNa } from '../../src/commands'
+
+const agent = 'npm'
+const _ = (arg: string, expected: string) => () => {
+ expect(
+ parseNa(agent, arg.split(' ').filter(Boolean)),
+ ).toBe(
+ expected,
+ )
+}
+
+test('empty', _('', 'npm'))
+test('foo', _('foo', 'npm foo'))
+test('run test', _('run test', 'npm run test'))
diff --git a/test/na/pnpm.spec.ts b/test/na/pnpm.spec.ts
new file mode 100644
index 00000000..202fd128
--- /dev/null
+++ b/test/na/pnpm.spec.ts
@@ -0,0 +1,15 @@
+import { expect, test } from 'vitest'
+import { parseNa } from '../../src/commands'
+
+const agent = 'pnpm'
+const _ = (arg: string, expected: string) => () => {
+ expect(
+ parseNa(agent, arg.split(' ').filter(Boolean)),
+ ).toBe(
+ expected,
+ )
+}
+
+test('empty', _('', 'pnpm'))
+test('foo', _('foo', 'pnpm foo'))
+test('run test', _('run test', 'pnpm run test'))
diff --git a/test/na/yarn.spec.ts b/test/na/yarn.spec.ts
new file mode 100644
index 00000000..83936f15
--- /dev/null
+++ b/test/na/yarn.spec.ts
@@ -0,0 +1,15 @@
+import { expect, test } from 'vitest'
+import { parseNa } from '../../src/commands'
+
+const agent = 'yarn'
+const _ = (arg: string, expected: string) => () => {
+ expect(
+ parseNa(agent, arg.split(' ').filter(Boolean)),
+ ).toBe(
+ expected,
+ )
+}
+
+test('empty', _('', 'yarn'))
+test('foo', _('foo', 'yarn foo'))
+test('run test', _('run test', 'yarn run test'))