@pergel/cli
Advanced tools
| import { | ||
| definePergelLoadConfig | ||
| } from "./chunk-ZFO3AWCZ.js"; | ||
| // src/commands/install.ts | ||
| import { readFileSync } from "node:fs"; | ||
| import { join, resolve } from "node:path"; | ||
| import { defineCommand } from "citty"; | ||
| import { consola } from "consola"; | ||
| import { parseNi, run } from "@antfu/ni"; | ||
| var install_default = defineCommand({ | ||
| meta: { | ||
| name: "Pergel Install", | ||
| description: "Install dependencies from README.json", | ||
| version: "0.2.0" | ||
| }, | ||
| async run() { | ||
| const args = process.argv.slice(2).filter((arg) => arg !== "install" && arg !== "pergel"); | ||
| try { | ||
| const file = await definePergelLoadConfig(); | ||
| if (!file.config) { | ||
| consola.error("No config file found"); | ||
| return; | ||
| } | ||
| const readmeString = readFileSync(resolve(join(file.config.dir?.pergel, "README.json")), "utf-8"); | ||
| const jsonData = JSON.parse(readmeString); | ||
| const dependencies = /* @__PURE__ */ new Set(); | ||
| const devDependencies = /* @__PURE__ */ new Set(); | ||
| for (const [_moduleName, moduleData] of Object.entries(jsonData)) { | ||
| if (!moduleData) | ||
| continue; | ||
| for (const [_projectName, projectData] of Object.entries(moduleData)) { | ||
| if (!projectData) { | ||
| consola.error(`No project data found for ${_projectName}`); | ||
| continue; | ||
| } | ||
| if (projectData.packageJson) { | ||
| if (projectData.packageJson.dependencies) { | ||
| const debs = Object.keys(projectData.packageJson.dependencies); | ||
| if (debs.length) { | ||
| for (const item of debs) { | ||
| if (item) | ||
| dependencies.add(`${item}@${projectData.packageJson.dependencies[item]}`); | ||
| } | ||
| } | ||
| } | ||
| if (projectData.packageJson.devDependencies) { | ||
| const debs = Object.keys(projectData.packageJson.devDependencies); | ||
| if (debs.length) { | ||
| for (const item of debs) { | ||
| if (item) | ||
| devDependencies.add(`${item}@${projectData.packageJson.devDependencies[item]}`); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| if (dependencies.size) { | ||
| await run(parseNi, [...dependencies.values(), ...args]).then(() => { | ||
| consola.success("Dependencies installed", dependencies.values()); | ||
| }); | ||
| } | ||
| if (devDependencies.size) { | ||
| await run(parseNi, [...devDependencies.values(), "-D", ...args]).then(() => { | ||
| consola.success("Dev dependencies installed", devDependencies.values()); | ||
| }); | ||
| } | ||
| } catch (error) { | ||
| consola.log(error); | ||
| } | ||
| } | ||
| }); | ||
| export { | ||
| install_default as default | ||
| }; |
+2
-2
@@ -13,3 +13,3 @@ import { | ||
| type: "module", | ||
| version: "0.6.1", | ||
| version: "0.6.2", | ||
| packageManager: "pnpm@8.10.0", | ||
@@ -136,3 +136,3 @@ description: "Full Stack Nuxt Application. It contains the necessary toolkits for a software developer and a fast, clean, tested toolkit.", | ||
| init: () => import("./init-AL3HDDW6.js").then((m) => m.default), | ||
| install: () => import("./install-DVILQPC3.js").then((m) => m.default), | ||
| install: () => import("./install-LUMLSFJB.js").then((m) => m.default), | ||
| module: () => import("./module-5VMCAOPO.js").then((m) => m.default), | ||
@@ -139,0 +139,0 @@ download: () => import("./download-4FGI6T2M.js").then((m) => m.default) |
+1
-1
| { | ||
| "name": "@pergel/cli", | ||
| "type": "module", | ||
| "version": "0.6.1", | ||
| "version": "0.6.2", | ||
| "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-ZFO3AWCZ.js"; | ||
| // src/commands/install.ts | ||
| import { readFileSync } from "node:fs"; | ||
| import { join, resolve } from "node:path"; | ||
| import { defineCommand } from "citty"; | ||
| import { consola } from "consola"; | ||
| import { parseNi, run } from "@antfu/ni"; | ||
| var install_default = defineCommand({ | ||
| meta: { | ||
| name: "Pergel Install", | ||
| description: "Install dependencies from README.json", | ||
| version: "0.1.0" | ||
| }, | ||
| async run() { | ||
| const args = process.argv.slice(2).filter((arg) => arg !== "install" && arg !== "pergel"); | ||
| try { | ||
| const file = await definePergelLoadConfig(); | ||
| if (!file.config) { | ||
| consola.error("No config file found"); | ||
| return; | ||
| } | ||
| const readmeString = readFileSync(resolve(join(file.config.dir?.pergel, "README.json")), "utf-8"); | ||
| const jsonData = JSON.parse(readmeString); | ||
| const dependencies = /* @__PURE__ */ new Set(); | ||
| const devDependencies = /* @__PURE__ */ new Set(); | ||
| for (const [_moduleName, moduleData] of Object.entries(jsonData)) { | ||
| if (!moduleData) | ||
| continue; | ||
| for (const [_projectName, projectData] of Object.entries(moduleData)) { | ||
| if (!projectData) { | ||
| consola.error(`No project data found for ${_projectName}`); | ||
| continue; | ||
| } | ||
| if (projectData.packageJson) { | ||
| if (projectData.packageJson.dependencies) { | ||
| const debs = Object.keys(projectData.packageJson.dependencies); | ||
| debs.forEach((item) => { | ||
| if (item) | ||
| dependencies.add(item); | ||
| }); | ||
| } | ||
| if (projectData.packageJson.devDependencies) { | ||
| const debs = Object.keys(projectData.packageJson.devDependencies); | ||
| debs.forEach((item) => { | ||
| if (item) | ||
| devDependencies.add(item); | ||
| }); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| if (dependencies.size) { | ||
| await run(parseNi, [...dependencies.values(), ...args]).then(() => { | ||
| consola.success("Dependencies installed", dependencies.values()); | ||
| }); | ||
| } | ||
| if (devDependencies.size) { | ||
| await run(parseNi, [...devDependencies.values(), "-D", ...args]).then(() => { | ||
| consola.success("Dev dependencies installed", devDependencies.values()); | ||
| }); | ||
| } | ||
| } catch (error) { | ||
| consola.log(error); | ||
| } | ||
| } | ||
| }); | ||
| export { | ||
| install_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
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
52462
0.42%1400
0.29%