create-vee-vue 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/index.js +39 -0
- package/package.json +17 -4
- package/templates/vue-ts/.editorconfig +8 -0
- package/templates/vue-ts/.gitattributes +1 -0
- package/templates/vue-ts/.oxlintrc.json +10 -0
- package/templates/vue-ts/.prettierrc.json +6 -0
- package/templates/vue-ts/README.md +48 -0
- package/templates/vue-ts/env.d.ts +1 -0
- package/templates/vue-ts/eslint.config.ts +26 -0
- package/templates/vue-ts/index.html +13 -0
- package/templates/vue-ts/package.json +43 -0
- package/templates/vue-ts/public/favicon.ico +0 -0
- package/templates/vue-ts/src/App.vue +5 -0
- package/templates/vue-ts/src/main.ts +4 -0
- package/templates/vue-ts/tsconfig.app.json +18 -0
- package/templates/vue-ts/tsconfig.json +11 -0
- package/templates/vue-ts/tsconfig.node.json +28 -0
- package/templates/vue-ts/vite.config.ts +18 -0
- package/README.md +0 -3
package/bin/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
|
|
6
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
|
|
8
|
+
const program = new Command();
|
|
9
|
+
|
|
10
|
+
program
|
|
11
|
+
.name("create-vee-vue")
|
|
12
|
+
.description("Create a Vue 3 project using my template")
|
|
13
|
+
.argument("<project-name>", "项目名称")
|
|
14
|
+
.action((projectName) => {
|
|
15
|
+
// 用户要创建的项目目录
|
|
16
|
+
const targetDir = path.resolve(process.cwd(), projectName);
|
|
17
|
+
|
|
18
|
+
// CLI 内部的 Vue 模板目录
|
|
19
|
+
const templateDir = path.resolve(__dirname, "../templates/vue-ts");
|
|
20
|
+
|
|
21
|
+
// 判断项目目录是否存在
|
|
22
|
+
if (fs.existsSync(targetDir)) {
|
|
23
|
+
console.error(`目录已存在:${targetDir}`);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// 复制整个 Vue 模板
|
|
28
|
+
fs.cpSync(templateDir, targetDir, {
|
|
29
|
+
recursive: true,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
console.log("Vue 项目创建成功!");
|
|
33
|
+
console.log("");
|
|
34
|
+
console.log(`cd ${projectName}`);
|
|
35
|
+
console.log("pnpm install");
|
|
36
|
+
console.log("pnpm dev");
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
program.parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-vee-vue",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "My custom Vue 3 scaffolding",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"create-vee-vue": "./bin/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin",
|
|
11
|
+
"templates"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"dev": "node ./bin/index.js"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"commander": "^14.0.0"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* text=auto eol=lf
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# vee-vue-template
|
|
2
|
+
|
|
3
|
+
This template should help get you started developing with Vue 3 in Vite.
|
|
4
|
+
|
|
5
|
+
## Recommended IDE Setup
|
|
6
|
+
|
|
7
|
+
[VS Code](https://code.visualstudio.com/) + [Vue (Official)](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
|
|
8
|
+
|
|
9
|
+
## Recommended Browser Setup
|
|
10
|
+
|
|
11
|
+
- Chromium-based browsers (Chrome, Edge, Brave, etc.):
|
|
12
|
+
- [Vue.js devtools](https://chromewebstore.google.com/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd)
|
|
13
|
+
- [Turn on Custom Object Formatter in Chrome DevTools](http://bit.ly/object-formatters)
|
|
14
|
+
- Firefox:
|
|
15
|
+
- [Vue.js devtools](https://addons.mozilla.org/en-US/firefox/addon/vue-js-devtools/)
|
|
16
|
+
- [Turn on Custom Object Formatter in Firefox DevTools](https://fxdx.dev/firefox-devtools-custom-object-formatters/)
|
|
17
|
+
|
|
18
|
+
## Type Support for `.vue` Imports in TS
|
|
19
|
+
|
|
20
|
+
TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types.
|
|
21
|
+
|
|
22
|
+
## Customize configuration
|
|
23
|
+
|
|
24
|
+
See [Vite Configuration Reference](https://vite.dev/config/).
|
|
25
|
+
|
|
26
|
+
## Project Setup
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
pnpm install
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Compile and Hot-Reload for Development
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
pnpm dev
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Type-Check, Compile and Minify for Production
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
pnpm build
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Lint with [ESLint](https://eslint.org/)
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
pnpm lint
|
|
48
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { globalIgnores } from 'eslint/config'
|
|
2
|
+
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
|
|
3
|
+
import pluginVue from 'eslint-plugin-vue'
|
|
4
|
+
import pluginOxlint from 'eslint-plugin-oxlint'
|
|
5
|
+
import skipFormatting from 'eslint-config-prettier/flat'
|
|
6
|
+
|
|
7
|
+
// To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
|
|
8
|
+
// import { configureVueProject } from '@vue/eslint-config-typescript'
|
|
9
|
+
// configureVueProject({ scriptLangs: ['ts', 'tsx'] })
|
|
10
|
+
// More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setup
|
|
11
|
+
|
|
12
|
+
export default defineConfigWithVueTs(
|
|
13
|
+
{
|
|
14
|
+
name: 'app/files-to-lint',
|
|
15
|
+
files: ['**/*.{vue,ts,mts,tsx}'],
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
globalIgnores(['**/dist/**', '**/dist-ssr/**', '**/coverage/**']),
|
|
19
|
+
|
|
20
|
+
...pluginVue.configs['flat/essential'],
|
|
21
|
+
vueTsConfigs.recommended,
|
|
22
|
+
|
|
23
|
+
...pluginOxlint.buildFromOxlintConfigFile('.oxlintrc.json'),
|
|
24
|
+
|
|
25
|
+
skipFormatting,
|
|
26
|
+
)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<link rel="icon" href="/favicon.ico">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<title>Vite App</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
<script type="module" src="/src/main.ts"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vee-vue-template",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "run-p type-check \"build-only {@}\" --",
|
|
9
|
+
"preview": "vite preview",
|
|
10
|
+
"build-only": "vite build",
|
|
11
|
+
"type-check": "vue-tsc --build",
|
|
12
|
+
"lint": "run-s \"lint:*\"",
|
|
13
|
+
"lint:oxlint": "oxlint . --fix",
|
|
14
|
+
"lint:eslint": "eslint . --fix --cache",
|
|
15
|
+
"format": "prettier --write --experimental-cli src/"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"vue": "^3.5.42"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@tsconfig/node24": "^24.0.5",
|
|
22
|
+
"@types/node": "^24.13.4",
|
|
23
|
+
"@vitejs/plugin-vue": "^6.0.8",
|
|
24
|
+
"@vue/eslint-config-typescript": "^14.9.0",
|
|
25
|
+
"@vue/tsconfig": "^0.9.1",
|
|
26
|
+
"eslint": "^10.10.0",
|
|
27
|
+
"eslint-config-prettier": "^10.1.8",
|
|
28
|
+
"eslint-plugin-oxlint": "~1.82.0",
|
|
29
|
+
"eslint-plugin-vue": "~10.11.0",
|
|
30
|
+
"jiti": "^2.7.0",
|
|
31
|
+
"npm-run-all2": "^9.0.3",
|
|
32
|
+
"oxlint": "~1.82.0",
|
|
33
|
+
"prettier": "3.9.6",
|
|
34
|
+
"typescript": "~6.0.0",
|
|
35
|
+
"vite": "^8.2.2",
|
|
36
|
+
"vite-plugin-vue-devtools": "^8.2.1",
|
|
37
|
+
"vue-eslint-parser": "^10.4.1",
|
|
38
|
+
"vue-tsc": "^3.3.11"
|
|
39
|
+
},
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": "^22.18.0 || >=24.12.0"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
|
3
|
+
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
|
|
4
|
+
"exclude": ["src/**/__tests__/*"],
|
|
5
|
+
"compilerOptions": {
|
|
6
|
+
// Extra safety for array and object lookups, but may have false positives.
|
|
7
|
+
"noUncheckedIndexedAccess": true,
|
|
8
|
+
|
|
9
|
+
// Path mapping for cleaner imports.
|
|
10
|
+
"paths": {
|
|
11
|
+
"@/*": ["./src/*"]
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
// `vue-tsc --build` produces a .tsbuildinfo file for incremental type-checking.
|
|
15
|
+
// Specified here to keep it out of the root directory.
|
|
16
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// TSConfig for modules that run in Node.js environment via either transpilation or type-stripping.
|
|
2
|
+
{
|
|
3
|
+
"extends": "@tsconfig/node24/tsconfig.json",
|
|
4
|
+
"include": [
|
|
5
|
+
"vite.config.*",
|
|
6
|
+
"vitest.config.*",
|
|
7
|
+
"cypress.config.*",
|
|
8
|
+
"playwright.config.*",
|
|
9
|
+
"eslint.config.*"
|
|
10
|
+
],
|
|
11
|
+
"compilerOptions": {
|
|
12
|
+
// Most tools use transpilation instead of Node.js's native type-stripping.
|
|
13
|
+
// Bundler mode provides a smoother developer experience.
|
|
14
|
+
"module": "preserve",
|
|
15
|
+
"moduleResolution": "bundler",
|
|
16
|
+
"allowImportingTsExtensions": true,
|
|
17
|
+
|
|
18
|
+
// Include Node.js types and avoid accidentally including other `@types/*` packages.
|
|
19
|
+
"types": ["node"],
|
|
20
|
+
|
|
21
|
+
// Disable emitting output during `vue-tsc --build`, which is used for type-checking only.
|
|
22
|
+
"noEmit": true,
|
|
23
|
+
|
|
24
|
+
// `vue-tsc --build` produces a .tsbuildinfo file for incremental type-checking.
|
|
25
|
+
// Specified here to keep it out of the root directory.
|
|
26
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { fileURLToPath, URL } from 'node:url'
|
|
2
|
+
|
|
3
|
+
import { defineConfig } from 'vite'
|
|
4
|
+
import vue from '@vitejs/plugin-vue'
|
|
5
|
+
import vueDevTools from 'vite-plugin-vue-devtools'
|
|
6
|
+
|
|
7
|
+
// https://vite.dev/config/
|
|
8
|
+
export default defineConfig({
|
|
9
|
+
plugins: [
|
|
10
|
+
vue(),
|
|
11
|
+
vueDevTools(),
|
|
12
|
+
],
|
|
13
|
+
resolve: {
|
|
14
|
+
alias: {
|
|
15
|
+
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
})
|
package/README.md
DELETED