lins-vue3-base 1.0.0 → 1.0.1

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/cli.js ADDED
@@ -0,0 +1,129 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from 'commander';
3
+ import fs from 'fs-extra';
4
+ import path from 'path';
5
+ import { fileURLToPath } from 'url';
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = path.dirname(__filename);
9
+ const templateDir = path.join(__dirname, '..');
10
+ const excludeDirs = ['node_modules', 'bin', 'test-project', '.git'];
11
+ const excludeFiles = ['.gitignore', 'package-lock.json'];
12
+
13
+ const program = new Command();
14
+
15
+ program
16
+ .name('lins-vue3-base')
17
+ .description('Vue 3 + TypeScript + Vite project template')
18
+ .version('1.0.0');
19
+
20
+ program
21
+ .command('create <project-name>')
22
+ .description('Create a new Vue 3 project')
23
+ .action(async (projectName) => {
24
+ const targetDir = path.join(process.cwd(), projectName);
25
+
26
+ // 检查目标目录是否存在
27
+ if (fs.existsSync(targetDir)) {
28
+ console.error(`Error: Directory ${projectName} already exists`);
29
+ process.exit(1);
30
+ }
31
+
32
+ try {
33
+ console.log(`Creating project ${projectName}...`);
34
+
35
+ // 创建目标目录
36
+ await fs.mkdirp(targetDir);
37
+
38
+ // 自定义复制函数,排除不需要的目录和文件
39
+ async function copyTemplate(src, dest) {
40
+ const entries = await fs.readdir(src, { withFileTypes: true });
41
+
42
+ for (const entry of entries) {
43
+ const srcPath = path.join(src, entry.name);
44
+ const destPath = path.join(dest, entry.name);
45
+
46
+ // 排除不需要的目录
47
+ if (entry.isDirectory()) {
48
+ if (!excludeDirs.includes(entry.name)) {
49
+ await fs.mkdirp(destPath);
50
+ await copyTemplate(srcPath, destPath);
51
+ }
52
+ }
53
+ // 排除不需要的文件
54
+ else if (!excludeFiles.includes(entry.name)) {
55
+ await fs.copyFile(srcPath, destPath);
56
+ }
57
+ }
58
+ }
59
+
60
+ // 复制模板文件
61
+ await copyTemplate(templateDir, targetDir);
62
+
63
+ // 修改创建的项目的 package.json 文件
64
+ const packageJsonPath = path.join(targetDir, 'package.json');
65
+ let packageJsonContent = await fs.readFile(packageJsonPath, 'utf8');
66
+
67
+ // 修改 package.json 中的配置
68
+ const packageJson = JSON.parse(packageJsonContent);
69
+ packageJson.name = projectName;
70
+ packageJson.private = true;
71
+ packageJson.version = '0.0.0';
72
+ delete packageJson.bin;
73
+ delete packageJson.files;
74
+ delete packageJson.dependencies.commander;
75
+ delete packageJson.dependencies['fs-extra'];
76
+
77
+ // 写回修改后的 package.json
78
+ await fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2));
79
+
80
+ // 创建 .gitignore 文件
81
+ const gitignoreContent = `# Logs
82
+ logs
83
+ *.log
84
+ npm-debug.log*
85
+ yarn-debug.log*
86
+ yarn-error.log*
87
+ pnpm-debug.log*
88
+ lerna-debug.log*
89
+
90
+ node_modules
91
+ dist
92
+ dist-ssr
93
+ *.local
94
+
95
+ # Editor directories and files
96
+ .vscode/*
97
+ !.vscode/extensions.json
98
+ .idea
99
+ .DS_Store
100
+ *.suo
101
+ *.ntvs*
102
+ *.njsproj
103
+ *.sln
104
+ *.sw?
105
+ `;
106
+ await fs.writeFile(path.join(targetDir, '.gitignore'), gitignoreContent);
107
+
108
+ console.log(`Project ${projectName} created successfully!`);
109
+ console.log('');
110
+ console.log('To get started:');
111
+ console.log(` cd ${projectName}`);
112
+ console.log(' npm install');
113
+ console.log(' npm run dev');
114
+ } catch (error) {
115
+ console.error('Error creating project:', error);
116
+ // 清理创建的目录
117
+ if (fs.existsSync(targetDir)) {
118
+ await fs.remove(targetDir);
119
+ }
120
+ process.exit(1);
121
+ }
122
+ });
123
+
124
+ // 如果没有参数,显示帮助信息
125
+ if (process.argv.length === 2) {
126
+ program.help();
127
+ }
128
+
129
+ program.parse(process.argv);
package/package.json CHANGED
@@ -1,84 +1,63 @@
1
- {
2
- "name": "lins-vue3-base",
3
- "author": "Lins",
4
- "license": "MIT",
5
- "repository": {
6
- "type": "git",
7
- "url": "https://gitee.com/linjunbin0101/base-vue.git"
8
- },
9
- "bugs": {
10
- "url": "https://gitee.com/linjunbin0101/base-vue/issues"
11
- },
12
- "private": false,
13
- "version": "1.0.0",
14
- "description": "A Vue3 base project with Ant Design Vue, Axios, Pinia, Vue Router, and SCSS",
15
- "main": "src/main.ts",
16
- "types": "src/main.ts",
17
- "type": "module",
18
- "files": [
19
- "src",
20
- "public",
21
- "package.json",
22
- "README.md",
23
- "index.html",
24
- ".gitignore",
25
- ".npmignore",
26
- ".prettierrc",
27
- "eslint.config.js",
28
- "vite.config.ts",
29
- "tsconfig.json",
30
- "tsconfig.app.json",
31
- "tsconfig.node.json",
32
- "tailwind.config.js",
33
- "postcss.config.js"
34
- ],
35
- "scripts": {
36
- "dev": "vite",
37
- "build": "vue-tsc -b && vite build",
38
- "preview": "vite preview",
39
- "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts,.json",
40
- "format": "prettier --write \"**/*.{js,jsx,cjs,mjs,ts,tsx,cts,mts,vue,json}\""
41
- },
42
- "dependencies": {
43
- "ant-design-vue": "^4.2.6",
44
- "axios": "^1.13.3",
45
- "pinia": "^3.0.4",
46
- "reset-css": "^5.0.2",
47
- "vue": "^3.5.24",
48
- "vue-router": "^4.6.4"
49
- },
50
- "devDependencies": {
51
- "@eslint/js": "^9.39.2",
52
- "@types/node": "^24.10.1",
53
- "@typescript-eslint/eslint-plugin": "^8.53.1",
54
- "@typescript-eslint/parser": "^8.53.1",
55
- "@vitejs/plugin-vue": "^6.0.1",
56
- "@vue/eslint-config-typescript": "^14.6.0",
57
- "@vue/tsconfig": "^0.8.1",
58
- "autoprefixer": "^10.4.23",
59
- "eslint": "^9.39.2",
60
- "eslint-plugin-vue": "^10.7.0",
61
- "jsonc-eslint-parser": "^2.4.2",
62
- "postcss": "^8.5.6",
63
- "prettier": "^3.8.1",
64
- "sass-embedded": "^1.97.3",
65
- "tailwindcss": "^3.4.19",
66
- "typescript": "~5.9.3",
67
- "vite": "npm:rolldown-vite@7.2.5",
68
- "vue-eslint-parser": "^10.2.0",
69
- "vue-tsc": "^3.1.4"
70
- },
71
- "overrides": {
72
- "vite": "npm:rolldown-vite@7.2.5"
73
- },
74
- "keywords": [
75
- "vue3",
76
- "base",
77
- "ant-design-vue",
78
- "axios",
79
- "pinia",
80
- "vue-router",
81
- "scss",
82
- "base"
83
- ]
84
- }
1
+ {
2
+ "name": "lins-vue3-base",
3
+ "private": false,
4
+ "version": "1.0.1",
5
+ "type": "module",
6
+ "bin": {
7
+ "lins-vue3-base": "bin/cli.js"
8
+ },
9
+ "files": [
10
+ "bin",
11
+ "public",
12
+ "src",
13
+ ".gitignore",
14
+ "eslint.config.js",
15
+ "index.html",
16
+ "package.json",
17
+ "tsconfig.app.json",
18
+ "tsconfig.json",
19
+ "tsconfig.node.json",
20
+ "vite.config.ts"
21
+ ],
22
+ "scripts": {
23
+ "dev": "vite",
24
+ "build": "vue-tsc -b && vite build",
25
+ "preview": "vite preview",
26
+ "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts,.json",
27
+ "format": "prettier --write \"**/*.{js,jsx,cjs,mjs,ts,tsx,cts,mts,vue,json}\""
28
+ },
29
+ "dependencies": {
30
+ "ant-design-vue": "^4.2.6",
31
+ "axios": "^1.13.3",
32
+ "commander": "^14.0.0",
33
+ "fs-extra": "^11.0.0",
34
+ "pinia": "^3.0.4",
35
+ "reset-css": "^5.0.2",
36
+ "vue": "^3.5.24",
37
+ "vue-router": "^4.6.4"
38
+ },
39
+ "devDependencies": {
40
+ "@eslint/js": "^9.39.2",
41
+ "@types/node": "^24.10.1",
42
+ "@typescript-eslint/eslint-plugin": "^8.53.1",
43
+ "@typescript-eslint/parser": "^8.53.1",
44
+ "@vitejs/plugin-vue": "^6.0.1",
45
+ "@vue/eslint-config-typescript": "^14.6.0",
46
+ "@vue/tsconfig": "^0.8.1",
47
+ "autoprefixer": "^10.4.23",
48
+ "eslint": "^9.39.2",
49
+ "eslint-plugin-vue": "^10.7.0",
50
+ "jsonc-eslint-parser": "^2.4.2",
51
+ "postcss": "^8.5.6",
52
+ "prettier": "^3.8.1",
53
+ "sass-embedded": "^1.97.3",
54
+ "tailwindcss": "^3.4.19",
55
+ "typescript": "~5.9.3",
56
+ "vite": "npm:rolldown-vite@7.2.5",
57
+ "vue-eslint-parser": "^10.2.0",
58
+ "vue-tsc": "^3.1.4"
59
+ },
60
+ "overrides": {
61
+ "vite": "npm:rolldown-vite@7.2.5"
62
+ }
63
+ }
package/.npmignore DELETED
@@ -1,37 +0,0 @@
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-ssr
12
- *.local
13
-
14
- # Editor directories and files
15
- .vscode/*
16
- !.vscode/extensions.json
17
- .idea
18
- .DS_Store
19
- *.suo
20
- *.ntvs*
21
- *.njsproj
22
- *.sln
23
- *.sw?
24
-
25
- # Build artifacts
26
- node_modules/
27
-
28
- # Environment variables
29
- .env
30
- .env.local
31
- .env.*.local
32
-
33
- # Test files
34
- __tests__/
35
- test/
36
- *.spec.*
37
- *.test.*
package/.prettierrc DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "tabWidth": 4,
3
- "useTabs": false,
4
- "singleQuote": false,
5
- "semi": true,
6
- "trailingComma": "es5",
7
- "bracketSpacing": true,
8
- "jsxBracketSameLine": false,
9
- "arrowParens": "avoid"
10
- }
package/postcss.config.js DELETED
@@ -1,6 +0,0 @@
1
- export default {
2
- plugins: {
3
- tailwindcss: {},
4
- autoprefixer: {},
5
- },
6
- };
@@ -1,8 +0,0 @@
1
- /** @type {import('tailwindcss').Config} */
2
- export default {
3
- content: ["./index.html", "./src/**/*.{vue,js,ts,jsx,tsx}"],
4
- theme: {
5
- extend: {},
6
- },
7
- plugins: [],
8
- };