Skip to content

Commit cf01dbc

Browse files
committed
wip: basic structure
1 parent fafa537 commit cf01dbc

File tree

40 files changed

+589
-0
lines changed

40 files changed

+589
-0
lines changed

index.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import prompts from 'prompts'
2+
import kolorist from 'kolorist'
3+
4+
import renderTemplate from './renderTemplate.js'
5+
6+
// Prompts:
7+
// - Project name:
8+
// - Project language: JavaScript / TypeScript
9+
// - Install Vue Router & Vuex for Single Page Applications?
10+
// - Adding tests?
11+
12+
// TODO:
13+
// add command-line for all possible option combinations
14+
// so that we can generate them in playgrounds
15+
16+
// Add configs.
17+
// renderTemplate('config/base')
18+
// if (needs tests) {
19+
// renderTemplate('config/cypress')
20+
// }
21+
// if (is typescript) {
22+
// renderTemplate('config/typescript')
23+
// }
24+
25+
// sourceTemplateName =
26+
// (isTs ? 'typescript-' : '') +
27+
// (isSPA ? 'spa' : 'default')
28+
// renderTemplate(`source/${sourceTemplateName}`)
29+
30+
// Cleanup.
31+
32+
// All templates assumes the need of tests.
33+
// If the user doesn't need it:
34+
// rm -rf cypress **/__tests__/
35+
36+
// TS config template may add redundant tsconfig.json.
37+
// Should clean that too.
38+
39+
// Instructions:
40+
// Supported package managers: pnpm > yarn > npm

package.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "create-vue",
3+
"version": "3.0.0",
4+
"description": "An easy way to start a Vue project",
5+
"type": "module",
6+
"main": "index.js",
7+
"bin": {
8+
"create-vue": "index.js"
9+
},
10+
"files": [
11+
"index.js",
12+
"renderTemplate.js",
13+
"templates"
14+
],
15+
"engines": {
16+
"node": "^12.13.0 || ^14.0.0 || >= 16.0.0"
17+
},
18+
"scripts": {
19+
"test": "echo \"Error: no test specified\" && exit 1"
20+
},
21+
"repository": {
22+
"type": "git",
23+
"url": "git+https://github.com/vuejs/create-vue.git"
24+
},
25+
"keywords": [],
26+
"author": "Haoqun Jiang <[email protected]>",
27+
"license": "ISC",
28+
"bugs": {
29+
"url": "https://github.com/vuejs/create-vue/issues"
30+
},
31+
"homepage": "https://github.com/vuejs/create-vue#readme",
32+
"dependencies": {
33+
"kolorist": "^1.5.0",
34+
"prompts": "^2.4.1"
35+
}
36+
}

playground/.gitkeep

Whitespace-only changes.

pnpm-lock.yaml

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

renderTemplate.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default function renderTemplate(templateFolder) {
2+
// TODO:
3+
// Recursively copy all files under `template/${templateFolder}`,
4+
// with the following exception:
5+
// - `_filename` should be renamed to `.filename`
6+
// - Fields in `package.json` should be recursively merged
7+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["johnsoncodehk.volar"]
3+
}

template/config/base/README.md

Whitespace-only changes.

template/config/base/_gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
.DS_Store
12+
dist
13+
dist-ssr
14+
*.local
15+
16+
/cypress/videos/
17+
/cypress/screenshots/
18+
19+
# Editor directories and files
20+
.vscode
21+
!.vscode/extensions.json
22+
.idea
23+
*.suo
24+
*.ntvs*
25+
*.njsproj
26+
*.sln
27+
*.sw?

template/config/base/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
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>

template/config/base/package.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"scripts": {
3+
"dev": "vite",
4+
"build": "vite build",
5+
"prepreview": "vite build",
6+
"preview": "vite preview --port 5050"
7+
},
8+
"dependencies": {
9+
"vue": "^3.1.5"
10+
},
11+
"devDependencies": {
12+
"@vitejs/plugin-vue": "^1.2.5",
13+
"@vitejs/plugin-vue-jsx": "^1.1.6",
14+
"@vue/compiler-sfc": "^3.1.5",
15+
"vite": "^2.4.3"
16+
}
17+
}

0 commit comments

Comments
 (0)