UNPKG

run-script-cli

Version:

<p align="center"> <a href="https://www.npmjs.com/package/run-script-cli" target="_blank" rel="noopener noreferrer"> <img src="https://github.com/hunghg255/run-script-cli/blob/main/assets/icon.png?raw=true" alt="logo" width='100'/></a> </p>

66 lines (60 loc) 1.96 kB
'use strict'; const process = require('node:process'); const index = require('./shared/run-script-cli.23752879.cjs'); require('node:fs'); require('node:path'); require('node:util'); require('node:child_process'); require('node:buffer'); require('child_process'); require('path'); require('fs'); require('node:url'); require('node:os'); require('node:timers/promises'); require('stream'); require('tty'); require('node:readline'); require('node:tty'); require('events'); function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; } const process__default = /*#__PURE__*/_interopDefaultCompat(process); const nuCli = async (cwd = process__default.cwd(), argv = process__default.argv) => { try { const agent = await index.detectAgent(cwd); let scriptValue = ""; if (!agent?.name) { return process__default.exit(0); } if (argv?.length > 2) { scriptValue = argv.slice(2).join(" "); } if (!scriptValue) { index.oe(index.$.bold(index.$.yellow("Please enter a package name\n"))); return; } if (agent.name === "bun") { index.oe(index.$.bold(index.$.green(`bun remove ${scriptValue} `))); await index.execaCommand(`bun remove ${scriptValue}`, { stdio: "inherit", cwd }); } if (agent.name === "pnpm") { index.oe(index.$.bold(index.$.green(`pnpm remove ${scriptValue} `))); await index.execaCommand(`pnpm remove ${scriptValue}`, { stdio: "inherit", cwd }); } if (agent.name === "npm") { index.oe(index.$.bold(index.$.green(`npm uninstall ${scriptValue} `))); await index.execaCommand(`npm uninstall ${scriptValue}`, { stdio: "inherit", cwd }); } if (agent.name === "yarn") { index.oe(index.$.bold(index.$.green(`yarn remove ${scriptValue} `))); await index.execaCommand(`yarn remove ${scriptValue}`, { stdio: "inherit", cwd }); } } catch { } }; nuCli(); exports.nuCli = nuCli;