chore: 修复部分问题

This commit is contained in:
winixt 2025-09-10 09:48:01 +08:00
parent 77b651c50b
commit 8297d91004
5 changed files with 57 additions and 5 deletions

View File

@ -1 +1 @@
Used in bin/create-fes-app.js to determine if it is in the local debug state. Used in bin/create-fes-app.mjs to determine if it is in the local debug state.

View File

@ -40,6 +40,7 @@
"fs-extra": "^11.3.1", "fs-extra": "^11.3.1",
"glob": "^11.0.3", "glob": "^11.0.3",
"mustache": "^4.2.0", "mustache": "^4.2.0",
"ora": "^8.2.0",
"semver": "^7.7.2", "semver": "^7.7.2",
"validate-npm-package-name": "^6.0.2" "validate-npm-package-name": "^6.0.2"
}, },

View File

@ -2,6 +2,7 @@ import { join, relative, resolve } from 'node:path';
import process from 'node:process'; import process from 'node:process';
import { defineCommand } from 'citty'; import { defineCommand } from 'citty';
import consola from 'consola'; import consola from 'consola';
import ora from 'ora';
import validate from 'validate-npm-package-name'; import validate from 'validate-npm-package-name';
import pkg from '../package.json' assert { type: 'json' }; import pkg from '../package.json' assert { type: 'json' };
@ -80,6 +81,7 @@ export const main = defineCommand({
const targetDir = resolve(cwd, projectName || '.'); const targetDir = resolve(cwd, projectName || '.');
if (template === 'pc' || template === 'h5') { if (template === 'pc' || template === 'h5') {
const spinner = ora('项目生成中加载中...').start();
copyDirectory({ copyDirectory({
context: { context: {
version: pkg.version, version: pkg.version,
@ -87,7 +89,7 @@ export const main = defineCommand({
path: join(__dirname, `../templates/app/${template}`), path: join(__dirname, `../templates/app/${template}`),
target: targetDir, target: targetDir,
}); });
consola.success(`Project ${projectName} created successfully!`); spinner.succeed('项目创建成功');
consola.box([ consola.box([
`cd ${projectName}`, `cd ${projectName}`,
'pnpm i', 'pnpm i',

View File

@ -1,6 +1,5 @@
import { readFileSync, statSync } from 'node:fs'; import { readFileSync, statSync } from 'node:fs';
import { join, relative } from 'node:path'; import { join, relative } from 'node:path';
import consola from 'consola';
import { copySync, outputFileSync } from 'fs-extra/esm'; import { copySync, outputFileSync } from 'fs-extra/esm';
import { globSync } from 'glob'; import { globSync } from 'glob';
import Mustache from 'mustache'; import Mustache from 'mustache';
@ -15,7 +14,6 @@ function copyTpl(opts: {
const tpl = readFileSync(opts.templatePath, 'utf-8'); const tpl = readFileSync(opts.templatePath, 'utf-8');
const content = Mustache.render(tpl, opts.context); const content = Mustache.render(tpl, opts.context);
consola.success(`Write: ${relative(getWorkPath(), opts.target)}`);
outputFileSync(opts.target, content, 'utf-8'); outputFileSync(opts.target, content, 'utf-8');
} }
@ -42,7 +40,6 @@ export function copyDirectory(opts: {
}); });
} }
consola.success(`Copy: ${file}`);
const absTarget = join(opts.target, file); const absTarget = join(opts.target, file);
copySync(absFile, absTarget); copySync(absFile, absTarget);
}); });

52
pnpm-lock.yaml generated
View File

@ -340,6 +340,9 @@ importers:
mustache: mustache:
specifier: ^4.2.0 specifier: ^4.2.0
version: 4.2.0 version: 4.2.0
ora:
specifier: ^8.2.0
version: 8.2.0
semver: semver:
specifier: ^7.7.2 specifier: ^7.7.2
version: 7.7.2 version: 7.7.2
@ -5540,6 +5543,10 @@ packages:
resolution: {integrity: sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==} resolution: {integrity: sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==}
engines: {node: '>=8'} engines: {node: '>=8'}
is-interactive@2.0.0:
resolution: {integrity: sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==}
engines: {node: '>=12'}
is-map@2.0.3: is-map@2.0.3:
resolution: {integrity: sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==} resolution: {integrity: sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
@ -5616,6 +5623,14 @@ packages:
resolution: {integrity: sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==} resolution: {integrity: sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==}
engines: {node: '>=10'} engines: {node: '>=10'}
is-unicode-supported@1.3.0:
resolution: {integrity: sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==}
engines: {node: '>=12'}
is-unicode-supported@2.1.0:
resolution: {integrity: sha512-mE00Gnza5EEB3Ds0HfMyllZzbBrmLOX3vfWoj9A9PEnTfratQ/BcaJOuMhnkhjXvb2+FkY3VuHqtAGpTPmglFQ==}
engines: {node: '>=18'}
is-utf8@0.2.1: is-utf8@0.2.1:
resolution: {integrity: sha512-rMYPYvCzsXywIsldgLaSoPlw5PfoB/ssr7hY4pLfcodrA5M/eArza1a9VmTiNIBNMjOGr1Ow9mTyU2o69U6U9Q==} resolution: {integrity: sha512-rMYPYvCzsXywIsldgLaSoPlw5PfoB/ssr7hY4pLfcodrA5M/eArza1a9VmTiNIBNMjOGr1Ow9mTyU2o69U6U9Q==}
@ -5985,6 +6000,10 @@ packages:
resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==} resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==}
engines: {node: '>=10'} engines: {node: '>=10'}
log-symbols@6.0.0:
resolution: {integrity: sha512-i24m8rpwhmPIS4zscNzK6MSEhk0DUWa/8iYQWxhffV8jkI4Phvs3F+quL5xvS0gdQR0FyTCMMH33Y78dDTzzIw==}
engines: {node: '>=18'}
log-update@6.1.0: log-update@6.1.0:
resolution: {integrity: sha512-9ie8ItPR6tjY5uYJh8K/Zrv/RMZ5VOlOWvtZdEHYSTFKZfIBPQa9tOAEeAWhd+AnIneLJ22w5fjOYtoutpWq5w==} resolution: {integrity: sha512-9ie8ItPR6tjY5uYJh8K/Zrv/RMZ5VOlOWvtZdEHYSTFKZfIBPQa9tOAEeAWhd+AnIneLJ22w5fjOYtoutpWq5w==}
engines: {node: '>=18'} engines: {node: '>=18'}
@ -6504,6 +6523,10 @@ packages:
resolution: {integrity: sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==} resolution: {integrity: sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==}
engines: {node: '>=10'} engines: {node: '>=10'}
ora@8.2.0:
resolution: {integrity: sha512-weP+BZ8MVNnlCm8c0Qdc1WSWq4Qn7I+9CJGm7Qali6g44e/PUzbjNqJX5NJ9ljlNMosfJvg1fKEGILklK9cwnw==}
engines: {node: '>=18'}
os-tmpdir@1.0.2: os-tmpdir@1.0.2:
resolution: {integrity: sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==} resolution: {integrity: sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
@ -7719,6 +7742,10 @@ packages:
std-env@3.9.0: std-env@3.9.0:
resolution: {integrity: sha512-UGvjygr6F6tpH7o2qyqR6QYpwraIjKSdtzyBdyytFOHmPZY917kwdwLG0RbOjWOnKmnm3PeHjaoLLMie7kPLQw==} resolution: {integrity: sha512-UGvjygr6F6tpH7o2qyqR6QYpwraIjKSdtzyBdyytFOHmPZY917kwdwLG0RbOjWOnKmnm3PeHjaoLLMie7kPLQw==}
stdin-discarder@0.2.2:
resolution: {integrity: sha512-UhDfHmA92YAlNnCfhmq0VeNL5bDbiZGg7sZ2IvPsXubGkiNa9EC+tUTsjBRsYUAz87btI6/1wf4XoVvQ3uRnmQ==}
engines: {node: '>=18'}
stickybits@3.7.11: stickybits@3.7.11:
resolution: {integrity: sha512-WO+ns7BYZqGS4jWVTg5JNhIvNV4LGbUtNTSck4zAkWRQzA1IfxwIkMGc0BbdGy4PGIjK7kKo5CZcN6Sd5dHVlw==} resolution: {integrity: sha512-WO+ns7BYZqGS4jWVTg5JNhIvNV4LGbUtNTSck4zAkWRQzA1IfxwIkMGc0BbdGy4PGIjK7kKo5CZcN6Sd5dHVlw==}
@ -13838,6 +13865,8 @@ snapshots:
is-interactive@1.0.0: {} is-interactive@1.0.0: {}
is-interactive@2.0.0: {}
is-map@2.0.3: {} is-map@2.0.3: {}
is-negative-zero@2.0.3: {} is-negative-zero@2.0.3: {}
@ -13899,6 +13928,10 @@ snapshots:
is-unicode-supported@0.1.0: {} is-unicode-supported@0.1.0: {}
is-unicode-supported@1.3.0: {}
is-unicode-supported@2.1.0: {}
is-utf8@0.2.1: {} is-utf8@0.2.1: {}
is-weakmap@2.0.2: {} is-weakmap@2.0.2: {}
@ -14249,6 +14282,11 @@ snapshots:
chalk: 4.1.2 chalk: 4.1.2
is-unicode-supported: 0.1.0 is-unicode-supported: 0.1.0
log-symbols@6.0.0:
dependencies:
chalk: 5.6.0
is-unicode-supported: 1.3.0
log-update@6.1.0: log-update@6.1.0:
dependencies: dependencies:
ansi-escapes: 7.0.0 ansi-escapes: 7.0.0
@ -14937,6 +14975,18 @@ snapshots:
strip-ansi: 6.0.1 strip-ansi: 6.0.1
wcwidth: 1.0.1 wcwidth: 1.0.1
ora@8.2.0:
dependencies:
chalk: 5.6.0
cli-cursor: 5.0.0
cli-spinners: 2.9.2
is-interactive: 2.0.0
is-unicode-supported: 2.1.0
log-symbols: 6.0.0
stdin-discarder: 0.2.2
string-width: 7.2.0
strip-ansi: 7.1.0
os-tmpdir@1.0.2: {} os-tmpdir@1.0.2: {}
own-keys@1.0.1: own-keys@1.0.1:
@ -16150,6 +16200,8 @@ snapshots:
std-env@3.9.0: {} std-env@3.9.0: {}
stdin-discarder@0.2.2: {}
stickybits@3.7.11: {} stickybits@3.7.11: {}
stop-iteration-iterator@1.1.0: stop-iteration-iterator@1.1.0: