From 8fe9df5ff38e4683f2cb314df0ae9e2d1133e74a Mon Sep 17 00:00:00 2001 From: Richard Zampieri Date: Sun, 17 Nov 2024 19:32:18 -0800 Subject: [PATCH] feat: update package dependencies and enhance CLI command handling --- package.json | 2 +- src/cli.ts | 2 +- src/commands/project.commands.ts | 19 ++++--------------- src/new/form.ts | 14 ++++++-------- 4 files changed, 12 insertions(+), 25 deletions(-) diff --git a/package.json b/package.json index e6beb6a..408aa1f 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "release-it": "16.3.0", "shx": "0.3.4", "ts-jest": "^29.2.5", - "ts-node-dev": "2.0.0", + "tsx": "^4.19.2", "typescript": "5.2.2" }, "release-it": { diff --git a/src/cli.ts b/src/cli.ts index dffe835..56aaa19 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -22,7 +22,7 @@ import { scriptsCommand } from "./scripts"; * The current version of the ExpressoTS Bundle. * core, adapters, and cli. */ -export const BUNDLE_VERSION = "2.16.2"; +export const BUNDLE_VERSION = "3.0.0-beta.1"; stdout.write(`\n${[chalk.bold.green("🐎 Expressots")]}\n\n`); diff --git a/src/commands/project.commands.ts b/src/commands/project.commands.ts index 500d109..41c001d 100644 --- a/src/commands/project.commands.ts +++ b/src/commands/project.commands.ts @@ -45,22 +45,13 @@ function getOutDir(): string { * @returns The configuration */ const opinionatedConfig: Array = [ - "--transpile-only", - "--clear", - "-r", - "dotenv/config", + "--watch", "-r", "tsconfig-paths/register", "./src/main.ts", ]; -const nonOpinionatedConfig: Array = [ - "--transpile-only", - "--clear", - "-r", - "dotenv/config", - "./src/main.ts", -]; +const nonOpinionatedConfig: Array = ["--watch", "./src/main.ts"]; /** * Dev command module @@ -191,7 +182,7 @@ export const runCommand = async ({ switch (command) { case "dev": execCmd( - "tsnd", + "tsx", opinionated ? opinionatedConfig : nonOpinionatedConfig, ); break; @@ -219,14 +210,12 @@ export const runCommand = async ({ let config: Array = []; if (opinionated) { config = [ - "-r", - "dotenv/config", "-r", `./${outDir}/register-path.js`, `./${outDir}/src/main.js`, ]; } else { - config = ["-r", "dotenv/config", `./${outDir}/main.js`]; + config = [`./${outDir}/main.js`]; } clearScreen(); execCmd("node", config); diff --git a/src/new/form.ts b/src/new/form.ts index d8a0aa6..2b72c5e 100644 --- a/src/new/form.ts +++ b/src/new/form.ts @@ -28,11 +28,9 @@ async function packageManagerInstall({ let installCommand: string = "install --prefer-offline"; if (packageManager === "yarn") { installCommand = "install --ignore-engines"; - } else if ( - packageManager === "bun" || - packageManager === "pnpm" || - packageManager === "yarn" - ) { + } else if (packageManager === "pnpm") { + installCommand = "install --silent"; + } else if (packageManager === "bun" || packageManager === "yarn") { installCommand = "install"; } @@ -243,9 +241,11 @@ const projectForm = async ( const [_, template] = answer.template.match(/(.*) ::/) as Array; + const repo: string = `expressots/templates/${templates[template]}#${BUNDLE_VERSION}`; + try { const emitter = degit( - `expressots/templates/${templates[template]}#${BUNDLE_VERSION}`, + `expressots/templates/${templates[template]}`, ); await emitter.clone(answer.name); @@ -275,8 +275,6 @@ const projectForm = async ( name: projectName, }); - renameEnvFile(answer.name); - progressBar.update(100); progressBar.stop();