@pergel/cli
Advanced tools
| import { | ||
| definePergelLoadConfig | ||
| } from "./chunk-H36PPSPN.js"; | ||
| // src/commands/module.ts | ||
| import { readFileSync } from "node:fs"; | ||
| import { resolve } from "node:path"; | ||
| import { execSync } from "node:child_process"; | ||
| import { defineCommand } from "citty"; | ||
| import { consola } from "consola"; | ||
| import { parseNa, run } from "@antfu/ni"; | ||
| var module_default = defineCommand({ | ||
| meta: { | ||
| name: "Module Command", | ||
| description: "Module Command", | ||
| version: "0.0.0" | ||
| }, | ||
| args: { | ||
| project: { | ||
| type: "string", | ||
| description: "Name of the project", | ||
| alias: "p" | ||
| }, | ||
| module: { | ||
| type: "string", | ||
| description: "Name of the module", | ||
| alias: "m" | ||
| }, | ||
| script: { | ||
| type: "string", | ||
| description: "Name of the script", | ||
| alias: "s" | ||
| }, | ||
| customScript: { | ||
| type: "boolean", | ||
| description: "Custom script", | ||
| alias: "cs" | ||
| } | ||
| }, | ||
| async run({ args }) { | ||
| try { | ||
| const file = await definePergelLoadConfig(); | ||
| if (!file.config) { | ||
| consola.error("No config file found"); | ||
| return; | ||
| } | ||
| const readmeString = readFileSync(resolve(file.config.dir.pergel, "README.json")).toString(); | ||
| const project = JSON.parse(readmeString)[args.project ?? ""]?.[args.module ?? ""]; | ||
| const script = project?.scripts ?? {}; | ||
| if (Object.keys(script).length === 0) | ||
| consola.error("No script found"); | ||
| const selectedScript = script[args.script ?? ""]; | ||
| if (!selectedScript) | ||
| consola.error("No script found"); | ||
| if (!args.customScript) { | ||
| try { | ||
| await run(async (agent, args2, ctx) => { | ||
| const command = await parseNa(agent, args2, ctx); | ||
| return command ? command.replace(/"/g, "") : void 0; | ||
| }, [selectedScript], { programmatic: true }).then(() => { | ||
| consola.success("Script executed successfully"); | ||
| }).catch((error) => { | ||
| consola.error(error); | ||
| }); | ||
| } catch (error) { | ||
| consola.error(error); | ||
| } | ||
| } else { | ||
| execSync(selectedScript, { | ||
| stdio: "inherit", | ||
| cwd: file.config.dir.pergel | ||
| }); | ||
| } | ||
| } catch (error) { | ||
| consola.log(error); | ||
| } | ||
| } | ||
| }); | ||
| export { | ||
| module_default as default | ||
| }; |
+2
-2
@@ -13,3 +13,3 @@ import { | ||
| type: "module", | ||
| version: "0.9.0", | ||
| version: "0.9.1", | ||
| packageManager: "pnpm@8.10.0", | ||
@@ -137,3 +137,3 @@ description: "Full Stack Nuxt Application. It contains the necessary toolkits for a software developer and a fast, clean, tested toolkit.", | ||
| install: () => import("./install-BFB3G2IX.js").then((m) => m.default), | ||
| module: () => import("./module-C7BIYIOL.js").then((m) => m.default), | ||
| module: () => import("./module-EURVWB6A.js").then((m) => m.default), | ||
| download: () => import("./download-TXZWEWUB.js").then((m) => m.default), | ||
@@ -140,0 +140,0 @@ select: () => import("./select-JZE7F6LA.js").then((m) => m.default) |
+1
-1
| { | ||
| "name": "@pergel/cli", | ||
| "type": "module", | ||
| "version": "0.9.0", | ||
| "version": "0.9.1", | ||
| "packageManager": "pnpm@8.10.0", | ||
@@ -6,0 +6,0 @@ "description": "Full Stack Nuxt Application. It contains the necessary toolkits for a software developer and a fast, clean, tested toolkit.", |
| import { | ||
| definePergelLoadConfig | ||
| } from "./chunk-H36PPSPN.js"; | ||
| // src/commands/module.ts | ||
| import { readFileSync } from "node:fs"; | ||
| import { resolve } from "node:path"; | ||
| import { execSync } from "node:child_process"; | ||
| import { defineCommand } from "citty"; | ||
| import { consola } from "consola"; | ||
| import { parseNa, run } from "@antfu/ni"; | ||
| var module_default = defineCommand({ | ||
| meta: { | ||
| name: "Module Command", | ||
| description: "Module Command", | ||
| version: "0.0.0" | ||
| }, | ||
| args: { | ||
| project: { | ||
| type: "string", | ||
| description: "Name of the project", | ||
| alias: "p" | ||
| }, | ||
| module: { | ||
| type: "string", | ||
| description: "Name of the module", | ||
| alias: "m" | ||
| }, | ||
| script: { | ||
| type: "string", | ||
| description: "Name of the script", | ||
| alias: "s" | ||
| }, | ||
| customScript: { | ||
| type: "boolean", | ||
| description: "Custom script", | ||
| alias: "cs" | ||
| } | ||
| }, | ||
| async run({ args }) { | ||
| try { | ||
| const file = await definePergelLoadConfig(); | ||
| if (!file.config) { | ||
| consola.error("No config file found"); | ||
| return; | ||
| } | ||
| const readmeString = readFileSync(resolve(file.config.dir.pergel, "README.json")).toString(); | ||
| const project = JSON.parse(readmeString)[args.project ?? ""]?.[args.module ?? ""]; | ||
| const script = project?.scripts ?? {}; | ||
| if (Object.keys(script).length === 0) | ||
| consola.error("No script found"); | ||
| const selectedScript = script[args.script ?? ""]; | ||
| if (!selectedScript) | ||
| consola.error("No script found"); | ||
| if (!args.npx) { | ||
| try { | ||
| await run(async (agent, args2, ctx) => { | ||
| const command = await parseNa(agent, args2, ctx); | ||
| return command ? command.replace(/"/g, "") : void 0; | ||
| }, [selectedScript], { programmatic: true }).then(() => { | ||
| consola.success("Script executed successfully"); | ||
| }).catch((error) => { | ||
| consola.error(error); | ||
| }); | ||
| } catch (error) { | ||
| consola.error(error); | ||
| } | ||
| } else { | ||
| execSync(selectedScript, { | ||
| stdio: "inherit", | ||
| cwd: file.config.dir.pergel | ||
| }); | ||
| } | ||
| } catch (error) { | ||
| consola.log(error); | ||
| } | ||
| } | ||
| }); | ||
| export { | ||
| module_default as default | ||
| }; |
Unpublished package
Supply chain riskPackage version was not found on the registry. It may exist on a different registry and need to be configured to pull from that registry.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Unpublished package
Supply chain riskPackage version was not found on the registry. It may exist on a different registry and need to be configured to pull from that registry.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
56906
0.02%