@pergel/cli
Advanced tools
| import { | ||
| definePergelLoadConfig | ||
| } from "./chunk-ZFO3AWCZ.js"; | ||
| // src/commands/select.ts | ||
| import { readFileSync } from "node:fs"; | ||
| import { join, resolve } from "node:path"; | ||
| import { execSync } from "node:child_process"; | ||
| import { intro, select } from "@clack/prompts"; | ||
| import { defineCommand } from "citty"; | ||
| import consola from "consola"; | ||
| var select_default = defineCommand({ | ||
| meta: { | ||
| name: "Pergel Upgrade", | ||
| description: "Upgrade Pergel CLI", | ||
| version: "0.0.1" | ||
| }, | ||
| async run() { | ||
| try { | ||
| const file = await definePergelLoadConfig(); | ||
| if (!file.config) { | ||
| consola.error("No config file found"); | ||
| return; | ||
| } | ||
| intro("Oku Pergel Select CLI"); | ||
| const readmeString = readFileSync(resolve(join(file.config.dir?.pergel, "README.json")), "utf-8"); | ||
| const jsonData = JSON.parse(readmeString); | ||
| const projectNames = Object.keys(jsonData).filter((i) => { | ||
| const project = jsonData[i]; | ||
| if (!project) | ||
| return false; | ||
| for (const key in project) { | ||
| if (project[key].cli) | ||
| return true; | ||
| } | ||
| return false; | ||
| }); | ||
| if (!projectNames.length) { | ||
| consola.error("No projects found"); | ||
| return; | ||
| } | ||
| const selectedProject = await select({ | ||
| message: "Select a project", | ||
| options: projectNames.map((i) => ({ | ||
| label: i, | ||
| value: i | ||
| })) | ||
| }); | ||
| const selectedProjectData = jsonData[selectedProject]; | ||
| const cliModules = Object.keys(selectedProjectData).filter((i) => { | ||
| const cli = selectedProjectData[i].cli; | ||
| if (cli) | ||
| return true; | ||
| return false; | ||
| }); | ||
| const selectedModule = await select({ | ||
| message: "Select a module", | ||
| options: cliModules.map((i) => ({ | ||
| label: i, | ||
| value: i | ||
| })) | ||
| }); | ||
| if (selectedModule) { | ||
| const selectedCli = await select({ | ||
| message: "Select a cli command", | ||
| options: Object.keys(selectedProjectData[selectedModule].cli).map((i) => ({ | ||
| label: i, | ||
| value: i | ||
| })) | ||
| }); | ||
| const cliData = selectedProjectData[selectedModule].cli[selectedCli]; | ||
| if (cliData) { | ||
| consola.info(`Running ${cliData}`); | ||
| execSync( | ||
| cliData, | ||
| { | ||
| stdio: "inherit" | ||
| } | ||
| ); | ||
| } | ||
| } | ||
| } catch (error) { | ||
| consola.error(error); | ||
| } | ||
| } | ||
| }); | ||
| export { | ||
| select_default as default | ||
| }; |
+3
-2
@@ -13,3 +13,3 @@ import { | ||
| type: "module", | ||
| version: "0.6.6", | ||
| version: "0.7.0", | ||
| packageManager: "pnpm@8.10.0", | ||
@@ -138,3 +138,4 @@ description: "Full Stack Nuxt Application. It contains the necessary toolkits for a software developer and a fast, clean, tested toolkit.", | ||
| module: () => import("./module-5VMCAOPO.js").then((m) => m.default), | ||
| download: () => import("./download-4FGI6T2M.js").then((m) => m.default) | ||
| download: () => import("./download-4FGI6T2M.js").then((m) => m.default), | ||
| select: () => import("./select-23J2FHOD.js").then((m) => m.default) | ||
| }, | ||
@@ -141,0 +142,0 @@ run({ args }) { |
+5
-2
@@ -60,4 +60,4 @@ interface Pergel { | ||
| interface PergelReadme { | ||
| [moduleName: string]: { | ||
| [projectName: string]: { | ||
| [projectName: string]: { | ||
| [moduleName: string]: { | ||
| packageJson?: { | ||
@@ -73,2 +73,5 @@ dependencies?: string; | ||
| }; | ||
| cli?: { | ||
| [cliName: string]: string; | ||
| }; | ||
| }; | ||
@@ -75,0 +78,0 @@ }; |
+1
-1
| { | ||
| "name": "@pergel/cli", | ||
| "type": "module", | ||
| "version": "0.6.6", | ||
| "version": "0.7.0", | ||
| "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.", |
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
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
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
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
55781
5%36
2.86%1505
6.51%