@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.info("Please run `pergel init` to create a config folder. After that, you can run `pergel install` to install dependencies."); | ||
| const confirm = await consola.prompt("Would you like to run `pergel init` now?", { | ||
| type: "confirm" | ||
| }); | ||
| if (confirm) { | ||
| await run(parseNi, ["pergel", "init"]).then(async () => { | ||
| consola.success("Config folder created"); | ||
| await run(parseNi, ["nuxt", "prepare"]).then(() => { | ||
| consola.success("Nuxt prepared"); | ||
| }); | ||
| }).catch(() => { | ||
| consola.error("Failed to create config folder"); | ||
| }); | ||
| } | ||
| } | ||
| } | ||
| }); | ||
| export { | ||
| install_default as default | ||
| }; |
+3
-3
@@ -13,3 +13,3 @@ import { | ||
| type: "module", | ||
| version: "0.6.2", | ||
| version: "0.6.3", | ||
| packageManager: "pnpm@8.10.0", | ||
@@ -102,3 +102,3 @@ description: "Full Stack Nuxt Application. It contains the necessary toolkits for a software developer and a fast, clean, tested toolkit.", | ||
| globby: "^14.0.0", | ||
| pathe: "^1.1.1", | ||
| pathe: "^1.1.2", | ||
| picocolors: "^1.0.0", | ||
@@ -137,3 +137,3 @@ shelljs: "^0.8.5" | ||
| init: () => import("./init-AL3HDDW6.js").then((m) => m.default), | ||
| install: () => import("./install-LUMLSFJB.js").then((m) => m.default), | ||
| install: () => import("./install-XMYAQEZY.js").then((m) => m.default), | ||
| module: () => import("./module-5VMCAOPO.js").then((m) => m.default), | ||
@@ -140,0 +140,0 @@ download: () => import("./download-4FGI6T2M.js").then((m) => m.default) |
+2
-2
| { | ||
| "name": "@pergel/cli", | ||
| "type": "module", | ||
| "version": "0.6.2", | ||
| "version": "0.6.3", | ||
| "packageManager": "pnpm@8.10.0", | ||
@@ -81,3 +81,3 @@ "description": "Full Stack Nuxt Application. It contains the necessary toolkits for a software developer and a fast, clean, tested toolkit.", | ||
| "globby": "^14.0.0", | ||
| "pathe": "^1.1.1", | ||
| "pathe": "^1.1.2", | ||
| "picocolors": "^1.0.0", | ||
@@ -84,0 +84,0 @@ "shelljs": "^0.8.5" |
| 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 | ||
| }; |
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
53066
1.15%1413
0.93%Updated