Skip to content

Commit e48078e

Browse files
committed
🔧 chore(app): 更新 script 支持&&命令,更新 clear 日志输出,更新 gituser 日志输出,增加测试模板
1 parent d3b6496 commit e48078e

24 files changed

+4566
-10
lines changed

src/command/clear.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import enquirer from "enquirer";
55
import fs from "fs-extra";
66

77
import { ACTIVATION, clearGlob } from "@/config";
8-
import { execCommand, loggerInfo } from "@/helper";
8+
import { execCommand, loggerInfo, printInfo } from "@/helper";
99
import { ClearOptions } from "@/types";
1010

1111
const generateEnquirer = async (): Promise<ClearOptions> => {
@@ -46,6 +46,7 @@ export const clear = async (paths: string[]) => {
4646
await execCommand("npx", ["rimraf", "--glob", ...paths], {
4747
stdio: "inherit",
4848
});
49+
printInfo("清理结束");
4950
};
5051

5152
export default function clearInstaller(cli: CAC) {

src/command/git-user.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ export async function checkGitUserName(ruleName: string) {
6464
if (!nameRegExp.test(username)) {
6565
printError(`${username} 不符合 ${ruleName} 规范`);
6666
process.exit(1);
67+
} else {
68+
printInfo(`${username} 符合规范`);
6769
}
6870
}
6971

@@ -80,6 +82,8 @@ export async function checkGitUserEmail(ruleEmail: string) {
8082
if (!emailRegExp.test(useremail)) {
8183
printError(`${useremail} 不符合 ${ruleEmail} 规范`);
8284
process.exit(1);
85+
} else {
86+
printInfo(`${useremail} 符合规范`);
8387
}
8488
}
8589

src/command/script.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@ export async function scriptRun() {
3131
]);
3232

3333
if (result.script) {
34-
const script = result.script;
35-
if (script.startsWith("npx")) {
36-
const cmd = script.split(" ")[0];
37-
const args = script.split(" ").slice(1);
38-
execCommand(cmd, args, { stdio: "inherit" });
39-
} else {
40-
execCommand("npx", script.split(" "), { stdio: "inherit" });
34+
const scripts = result.script.split("&&").map((v) => v.trim());
35+
for (const script of scripts) {
36+
if (script.startsWith("npx")) {
37+
const cmd = script.split(" ")[0];
38+
const args = script.split(" ").slice(1);
39+
await execCommand(cmd, args, { stdio: "inherit" });
40+
} else {
41+
await execCommand("npx", script.split(" "), { stdio: "inherit" });
42+
}
4143
}
4244
}
4345
}

src/command/template.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@ export const template = async (options: TemplateOptions) => {
9898
}),
9999
});
100100

101-
console.log(projectName, framework, variant, overwrite, packageName);
102-
103101
const root = path.join(process.cwd(), projectName);
104102
if (overwrite) emptyDir(root);
105103
const template: string = variant || framework;

src/config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,12 @@ export const FRAMEWORKS: Framework[] = [
175175
display: "TypeScript",
176176
color: blue,
177177
},
178+
{
179+
framework: "vue",
180+
name: "vue-ts-codeg",
181+
display: "TypeScriptForCodeG",
182+
color: yellow,
183+
},
178184
],
179185
},
180186
];
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"ignores": [
3+
"simple-git-hooks",
4+
"eslint-plugin-simple-import-sort"
5+
],
6+
"skip-missing": false
7+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
src/vite-env.d.ts
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es2021": true
5+
},
6+
"extends": [
7+
"eslint:recommended",
8+
"plugin:@typescript-eslint/recommended",
9+
"plugin:vue/vue3-essential"
10+
],
11+
"parserOptions": {
12+
"ecmaVersion": "latest",
13+
"parser": "@typescript-eslint/parser",
14+
"sourceType": "module"
15+
},
16+
"plugins": ["@typescript-eslint", "vue"],
17+
"rules": {}
18+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Vue 3 + TypeScript + Vite
2+
3+
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
4+
5+
## Recommended IDE Setup
6+
7+
- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar)
8+
9+
## Type Support For `.vue` Imports in TS
10+
11+
Since TypeScript cannot handle type information for `.vue` imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in `.vue` imports (for example to get props validation when using manual `h(...)` calls), you can enable Volar's Take Over mode by following these steps:
12+
13+
1. Run `Extensions: Show Built-in Extensions` from VS Code's command palette, look for `TypeScript and JavaScript Language Features`, then right click and select `Disable (Workspace)`. By default, Take Over mode will enable itself if the default TypeScript extension is disabled.
14+
2. Reload the VS Code window by running `Developer: Reload Window` from the command palette.
15+
16+
You can learn more about Take Over mode [here](https://github.com/johnsoncodehk/volar/discussions/471).
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

0 commit comments

Comments
 (0)