Comparing version 0.8.1 to 0.9.0
@@ -42,8 +42,18 @@ declare const AGENTS: { | ||
interface DetectOptions { | ||
autoInstall?: boolean; | ||
cwd?: string; | ||
} | ||
declare function detect({ autoInstall, cwd }: DetectOptions): Promise<"npm" | "pnpm" | "yarn" | null>; | ||
declare type Runner = (agent: Agent, args: string[], hasLock?: boolean) => Promise<string | undefined> | string | undefined; | ||
declare function runCli(fn: Runner, options?: DetectOptions): Promise<void>; | ||
declare function run(fn: Runner, args: string[], options?: DetectOptions): Promise<void>; | ||
declare function getCommand(agent: Agent, command: Command, args?: string[]): string; | ||
declare function parseNi(agent: Agent, args: string[], hasLock?: boolean): string; | ||
declare function parseNr(agent: Agent, args: string[]): string; | ||
declare function parseNu(agent: Agent, args: string[]): string; | ||
declare function parseNrm(agent: Agent, args: string[]): string; | ||
declare function parseNx(agent: Agent, args: string[]): string; | ||
declare const parseNi: Runner; | ||
declare const parseNr: Runner; | ||
declare const parseNu: Runner; | ||
declare const parseNrm: Runner; | ||
declare const parseNx: Runner; | ||
@@ -58,11 +68,2 @@ interface Config { | ||
interface DetectOptions { | ||
autoInstall?: boolean; | ||
} | ||
declare function detect({ autoInstall }: DetectOptions): Promise<"npm" | "pnpm" | "yarn" | null>; | ||
declare type Runner = (agent: Agent, args: string[], hasLock?: boolean) => Promise<string | undefined> | string | undefined; | ||
declare function runCli(fn: Runner, options?: DetectOptions): Promise<void>; | ||
declare function run(fn: Runner, args: string[], options?: DetectOptions): Promise<void>; | ||
declare function remove<T>(arr: T[], v: T): T[]; | ||
@@ -69,0 +70,0 @@ declare function exclude<T>(arr: T[], v: T): T[]; |
@@ -17,3 +17,3 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunkHCK5S7ZMjs = require('./chunk-HCK5S7ZM.js'); | ||
var _chunkSEQUNACUjs = require('./chunk-SEQUNACU.js'); | ||
@@ -35,2 +35,2 @@ | ||
exports.cmdExists = _chunkHCK5S7ZMjs.cmdExists; exports.detect = _chunkHCK5S7ZMjs.detect; exports.exclude = _chunkHCK5S7ZMjs.exclude; exports.getCommand = _chunkHCK5S7ZMjs.getCommand; exports.getConfig = _chunkHCK5S7ZMjs.getConfig; exports.getDefaultAgent = _chunkHCK5S7ZMjs.getDefaultAgent; exports.getGlobalAgent = _chunkHCK5S7ZMjs.getGlobalAgent; exports.parseNi = _chunkHCK5S7ZMjs.parseNi; exports.parseNr = _chunkHCK5S7ZMjs.parseNr; exports.parseNrm = _chunkHCK5S7ZMjs.parseNrm; exports.parseNu = _chunkHCK5S7ZMjs.parseNu; exports.parseNx = _chunkHCK5S7ZMjs.parseNx; exports.remove = _chunkHCK5S7ZMjs.remove; exports.run = _chunkHCK5S7ZMjs.run; exports.runCli = _chunkHCK5S7ZMjs.runCli; | ||
exports.cmdExists = _chunkSEQUNACUjs.cmdExists; exports.detect = _chunkSEQUNACUjs.detect; exports.exclude = _chunkSEQUNACUjs.exclude; exports.getCommand = _chunkSEQUNACUjs.getCommand; exports.getConfig = _chunkSEQUNACUjs.getConfig; exports.getDefaultAgent = _chunkSEQUNACUjs.getDefaultAgent; exports.getGlobalAgent = _chunkSEQUNACUjs.getGlobalAgent; exports.parseNi = _chunkSEQUNACUjs.parseNi; exports.parseNr = _chunkSEQUNACUjs.parseNr; exports.parseNrm = _chunkSEQUNACUjs.parseNrm; exports.parseNu = _chunkSEQUNACUjs.parseNu; exports.parseNx = _chunkSEQUNACUjs.parseNx; exports.remove = _chunkSEQUNACUjs.remove; exports.run = _chunkSEQUNACUjs.run; exports.runCli = _chunkSEQUNACUjs.runCli; |
"use strict"; | ||
var _chunkHCK5S7ZMjs = require('./chunk-HCK5S7ZM.js'); | ||
var _chunkSEQUNACUjs = require('./chunk-SEQUNACU.js'); | ||
// src/nci.ts | ||
_chunkHCK5S7ZMjs.runCli.call(void 0, (agent, _, hasLock) => _chunkHCK5S7ZMjs.parseNi.call(void 0, agent, ["--frozen-if-present"], hasLock), { autoInstall: true }); | ||
_chunkSEQUNACUjs.runCli.call(void 0, (agent, _, hasLock) => _chunkSEQUNACUjs.parseNi.call(void 0, agent, ["--frozen-if-present"], hasLock), { autoInstall: true }); |
"use strict"; | ||
var _chunkHCK5S7ZMjs = require('./chunk-HCK5S7ZM.js'); | ||
var _chunkSEQUNACUjs = require('./chunk-SEQUNACU.js'); | ||
// src/ni.ts | ||
_chunkHCK5S7ZMjs.runCli.call(void 0, _chunkHCK5S7ZMjs.parseNi); | ||
_chunkSEQUNACUjs.runCli.call(void 0, _chunkSEQUNACUjs.parseNi); |
@@ -6,6 +6,6 @@ "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _chunkHCK5S7ZMjs = require('./chunk-HCK5S7ZM.js'); | ||
var _chunkSEQUNACUjs = require('./chunk-SEQUNACU.js'); | ||
// src/nr.ts | ||
var import_prompts = _chunkHCK5S7ZMjs.__toModule.call(void 0, _chunkHCK5S7ZMjs.require_prompts.call(void 0, )); | ||
var import_prompts = _chunkSEQUNACUjs.__toModule.call(void 0, _chunkSEQUNACUjs.require_prompts.call(void 0, )); | ||
@@ -50,3 +50,11 @@ // src/storage.ts | ||
// src/nr.ts | ||
_chunkHCK5S7ZMjs.runCli.call(void 0, async (agent, args) => { | ||
_chunkSEQUNACUjs.runCli.call(void 0, async (agent, args) => { | ||
const storage2 = await load(); | ||
if (args[0] === "-") { | ||
if (!storage2.lastRunCommand) { | ||
console.error("No last command found"); | ||
process.exit(1); | ||
} | ||
args[0] = storage2.lastRunCommand; | ||
} | ||
if (args.length === 0) { | ||
@@ -58,3 +66,2 @@ const scripts = getPackageJSON().scripts || {}; | ||
return; | ||
const storage2 = await load(); | ||
const choices = names.filter((i) => !i[0].startsWith("?")).map(([value, cmd]) => ({ | ||
@@ -79,6 +86,2 @@ title: value, | ||
return; | ||
if (storage2.lastRunCommand !== fn) { | ||
storage2.lastRunCommand = fn; | ||
dump(); | ||
} | ||
args.push(fn); | ||
@@ -90,3 +93,7 @@ } catch (e) { | ||
} | ||
return _chunkHCK5S7ZMjs.parseNr.call(void 0, agent, args); | ||
if (storage2.lastRunCommand !== args[0]) { | ||
storage2.lastRunCommand = args[0]; | ||
dump(); | ||
} | ||
return _chunkSEQUNACUjs.parseNr.call(void 0, agent, args); | ||
}); |
"use strict"; | ||
var _chunkHCK5S7ZMjs = require('./chunk-HCK5S7ZM.js'); | ||
var _chunkSEQUNACUjs = require('./chunk-SEQUNACU.js'); | ||
// src/nrm.ts | ||
_chunkHCK5S7ZMjs.runCli.call(void 0, _chunkHCK5S7ZMjs.parseNrm); | ||
_chunkSEQUNACUjs.runCli.call(void 0, _chunkSEQUNACUjs.parseNrm); |
"use strict"; | ||
var _chunkHCK5S7ZMjs = require('./chunk-HCK5S7ZM.js'); | ||
var _chunkSEQUNACUjs = require('./chunk-SEQUNACU.js'); | ||
// src/nu.ts | ||
_chunkHCK5S7ZMjs.runCli.call(void 0, _chunkHCK5S7ZMjs.parseNu); | ||
_chunkSEQUNACUjs.runCli.call(void 0, _chunkSEQUNACUjs.parseNu); |
"use strict"; | ||
var _chunkHCK5S7ZMjs = require('./chunk-HCK5S7ZM.js'); | ||
var _chunkSEQUNACUjs = require('./chunk-SEQUNACU.js'); | ||
// src/nx.ts | ||
_chunkHCK5S7ZMjs.runCli.call(void 0, _chunkHCK5S7ZMjs.parseNx); | ||
_chunkSEQUNACUjs.runCli.call(void 0, _chunkSEQUNACUjs.parseNx); |
{ | ||
"name": "@antfu/ni", | ||
"version": "0.8.1", | ||
"version": "0.9.0", | ||
"description": "Use the right package manager", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -84,2 +84,8 @@ # ni | ||
```bash | ||
nr - | ||
# rerun the last command | ||
``` | ||
<br> | ||
@@ -163,2 +169,9 @@ | ||
### Change Directory | ||
```bash | ||
ni -C packages/foo vite | ||
nr -C playground dev | ||
``` | ||
### Config | ||
@@ -165,0 +178,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
540411
16134
194