From 55bce2060c27120ca2d21e35fcd06de43c1f9564 Mon Sep 17 00:00:00 2001 From: Shimpei Iwamaru Date: Tue, 20 Feb 2024 17:25:02 +0900 Subject: [PATCH 1/4] refactor(add): fix to check the arg.name extensions --- src/commands/add.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/commands/add.ts b/src/commands/add.ts index 515b23ce..41715be1 100644 --- a/src/commands/add.ts +++ b/src/commands/add.ts @@ -1,5 +1,5 @@ import { existsSync, promises as fsp } from 'node:fs' -import { dirname, resolve } from 'pathe' +import { dirname, resolve, extname } from 'pathe' import { consola } from 'consola' import { loadKit } from '../utils/kit' import { templates } from '../utils/templates' @@ -33,7 +33,12 @@ export default defineCommand({ const cwd = resolve(ctx.args.cwd || '.') const template = ctx.args.template - const name = ctx.args.name + const name = + extname(ctx.args.name) === '.vue' + ? ctx.args.name.replace('.vue', '') + : extname(ctx.args.name) === '.ts' + ? ctx.args.name.replace('.ts', '') + : ctx.args.name // Validate template name if (!templates[template]) { From 8c0d26167951e38d6e3362532b2b28ec073cf9d4 Mon Sep 17 00:00:00 2001 From: Shimpei Iwamaru Date: Tue, 20 Feb 2024 17:26:50 +0900 Subject: [PATCH 2/4] fix: update required Node version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b44f78ad..3f12e7f5 100644 --- a/package.json +++ b/package.json @@ -80,6 +80,6 @@ }, "packageManager": "pnpm@8.15.2", "engines": { - "node": "^14.18.0 || >=16.10.0" + "node": "^16.10.0 || >=18.0.0" } } \ No newline at end of file From 43cc5e2949eaf16474c97d65c43203add470abe0 Mon Sep 17 00:00:00 2001 From: Shimpei Iwamaru Date: Sun, 10 Mar 2024 12:10:12 +0900 Subject: [PATCH 3/4] Revert "fix: update required Node version" This reverts commit 8c0d26167951e38d6e3362532b2b28ec073cf9d4. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3f12e7f5..b44f78ad 100644 --- a/package.json +++ b/package.json @@ -80,6 +80,6 @@ }, "packageManager": "pnpm@8.15.2", "engines": { - "node": "^16.10.0 || >=18.0.0" + "node": "^14.18.0 || >=16.10.0" } } \ No newline at end of file From 7f5213edeb3ee95e84ac96ee3c1fca782882455e Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Mon, 18 Mar 2024 14:36:58 +0100 Subject: [PATCH 4/4] refactor --- src/commands/add.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/commands/add.ts b/src/commands/add.ts index 41715be1..0db8d617 100644 --- a/src/commands/add.ts +++ b/src/commands/add.ts @@ -33,12 +33,11 @@ export default defineCommand({ const cwd = resolve(ctx.args.cwd || '.') const template = ctx.args.template + const ext = extname(ctx.args.name) const name = - extname(ctx.args.name) === '.vue' - ? ctx.args.name.replace('.vue', '') - : extname(ctx.args.name) === '.ts' - ? ctx.args.name.replace('.ts', '') - : ctx.args.name + ext === '.vue' || ext === '.ts' + ? ctx.args.name.replace(ext, '') + : ctx.args.name // Validate template name if (!templates[template]) {