From a3ca9c7739b3d64c048dc0dde99c185f643e029b Mon Sep 17 00:00:00 2001 From: KONFeature Date: Sun, 18 Aug 2024 21:06:25 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20Pure=20js=20CLI=20op,=20better?= =?UTF-8?q?=20info=20in=20console?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/lovely-turtles-know.md | 5 +++++ bun.lockb | Bin 134793 -> 134825 bytes package.json | 1 + src/cli/commands/generate.ts | 31 +++++++++++++++++------------- src/cli/utils/config.ts | 3 ++- 5 files changed, 26 insertions(+), 14 deletions(-) create mode 100644 .changeset/lovely-turtles-know.md diff --git a/.changeset/lovely-turtles-know.md b/.changeset/lovely-turtles-know.md new file mode 100644 index 0000000..afc11ea --- /dev/null +++ b/.changeset/lovely-turtles-know.md @@ -0,0 +1,5 @@ +--- +"@konfeature/erpc-config-generator": patch +--- + +Setup a simple CLI to ease the generation using the `generate` command (and passing config typescript file and output yml file) diff --git a/bun.lockb b/bun.lockb index e62a9cb280dd9e4ff3bd61581eaaa1432ea56395..c45d790bce4cf475310668da57fad26b6c3dbd0d 100755 GIT binary patch delta 16194 zcmeHOd0bRSw!YQSLaQhs0?i_eD<~+7GzO(b4N<{`B&J0r+9C>yfZztApvDMl7E_5O z?j*)7Mq`W;*Ace}8Y6CTS7u`3Hby5VCX=Y|JNH%#FXNlvy!U=@{&~4SzWVB%I(2G0 zRek$5w{*GV`sI#q_tzPlEF9RInHHA$74@`J6oaA^=UX!~Gx8=Xp*l^@&b2CZ4X{^~ zCMfR-ZVZkFHv*@oTQkR@e5_tk+#nAFlU=$sFJyG4bxaauvMXtzC{Ez7!41Kos85{i zpt5UmE2+2$1vv=eeOSjLUv$F-k`ve&{D^7%J(#S%0h9aFQh!i#1(=#!2W|>pD&>V> zYPJ|mesjR&cZB4DlHeuA797)5`M@#xE=EE=b9tDqV{&h}Z3Za@ zOg-obrU}cjPD~FOmzLjB$}w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6 +59,7 @@ "tsup": "^8.2.4" }, "dependencies": { + "bundle-require": "^5.0.0", "gluegun": "^5.2.0", "yaml": "^2.5.0" } diff --git a/src/cli/commands/generate.ts b/src/cli/commands/generate.ts index 3dc2cb0..5b570d1 100644 --- a/src/cli/commands/generate.ts +++ b/src/cli/commands/generate.ts @@ -1,5 +1,6 @@ import { existsSync } from "node:fs"; import path from "node:path"; +import { bundleRequire } from "bundle-require"; import type { GluegunToolbox } from "gluegun"; import type { Config } from "../../generatedTypes/erpcTypes"; import { writeErpcConfig } from "../utils/config"; @@ -8,10 +9,9 @@ import { writeErpcConfig } from "../utils/config"; * The command to generate the eRPC config */ export async function generate({ print, parameters }: GluegunToolbox) { - // Header - print.info("=============================="); - print.info("== eRPC Config Generator =="); - print.info("=============================="); + const spinner = print.spin({ text: "Generating eRPC config file" }); + spinner.start(); + print.newline(); // Extract the arguments const configFile = parameters.options.config ?? "./erpc-config.ts"; @@ -25,20 +25,25 @@ export async function generate({ print, parameters }: GluegunToolbox) { } // Log a few stuff - print.info(" - Parmaeters:"); - print.info(` - Configuration file: ${configFile}`); - print.info(` - Output file: ${outputFile}`); + print.info("Parmaeters:"); + print.info(` - Configuration file: ${configFile}`); + print.info(` - Output file: ${outputFile}`); // Load the user config + spinner.text = "Loading typescript eRPC config"; const config = await loadConfigFromFile(configFile); - // Start the file writing - print.info("Generating the eRPC config file..."); + // Log a few info + print.info("Config:"); + print.info(` - Projects: ${config.projects.length}`); + print.info( + ` - Rate limiters: ${config.rateLimiters?.budgets?.length ?? 0}` + ); // Write the erpc config + spinner.text = "Writing eRPC config file"; writeErpcConfig({ config, outputPath: outputFile }); - - print.success("eRPC config file generated!"); + spinner.succeed("eRPC config file written!"); } /** @@ -63,10 +68,10 @@ async function loadConfigFromFile(configFile: string): Promise { } // Find the exported config stuff - const userConfig = await import(absoluteConfigPath); + const userConfig = await bundleRequire({ filepath: absoluteConfigPath }); // Check if there's a default export - const config = userConfig.default; + const config = userConfig.mod.default; if (!config) { throw new Error( `No default export found in config file at: ${configFile}` diff --git a/src/cli/utils/config.ts b/src/cli/utils/config.ts index 5255bc6..ccb8d08 100644 --- a/src/cli/utils/config.ts +++ b/src/cli/utils/config.ts @@ -1,3 +1,4 @@ +import { writeFileSync } from "node:fs"; import { stringify } from "yaml"; import type { Config } from "../../generatedTypes/erpcTypes"; @@ -24,5 +25,5 @@ export function writeErpcConfig({ const finalString = `${header}\n${yamlStr}`; // Write it to the file - Bun.write(outputPath, finalString); + writeFileSync(outputPath, finalString); }