Skip to content

Commit 4d87564

Browse files
wangxiangShawnWang
authored andcommitted
add 初始化代码
0 parents  commit 4d87564

File tree

92 files changed

+11191
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+11191
-0
lines changed

.browserslistrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
last 10 version
2+
> 1%
3+
ie > 8

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.DS_Store
2+
node_modules/
3+
.svn/
4+
5+
# local env files
6+
.env.local
7+
.env.*.local
8+
9+
# Log files
10+
npm-debug.log*
11+
yarn-debug.log*
12+
yarn-error.log*
13+
14+
# Editor directories and files
15+
.idea
16+
.vscode

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
## 文件结构
2+
```
3+
|——dist # 编译后的待发布目录
4+
|——public # 公共资源目录
5+
|——src # 源码目录
6+
|--└——api # RestFul 接口定义目录
7+
|--└——assets # 项目所需资源文件,如:图片、样式、字体
8+
|--└——components # 公用的UI组件
9+
|--└——environments # 项目的全局配置目录
10+
|--└——lib # 三方库目录
11+
|--└——routes # 路由配置及页面对应的 VUE 文件
12+
|--└——store # vuex 数据目录
13+
|--└——utils # 通用 utils 目录
14+
|--└——App.vue # 项目入口 VUE 文件
15+
|--└——global-components.vue # 全局组件模块
16+
|--└——main.ts # 项目入口 typescript 文件
17+
|--└——shims.d.ts # 类型、模块声明文件
18+
|——.gitignore # gitignore 配置文件
19+
|——package.json # npm 配置文件
20+
|——tsconfig.json # typescript 配置文件
21+
|——vue.config.js # vue cli 配置文件
22+
|——yarn.lock # yarn 依赖包信息文件
23+
```
24+
25+
## 运行步骤
26+
1. yarn
27+
2. yarn run serve
28+
29+
## 构建步骤
30+
1. yarn run build
31+
32+
## 基于该模板的个人作品
33+
- [Todo List](https://www.shawnwang.ltd/#/todo-list/index?username=%E6%B5%8B%E8%AF%95%E4%B8%93%E7%94%A8)
34+
- [诗词大全](https://www.shawnwang.ltd/#/index/index)

babel.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
presets: [
3+
'@babel/preset-env'
4+
],
5+
}

build/bin/dev-server

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
node build/run/dev-server.js

build/bin/dev-server.cmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node build/run/dev-server.js

build/bin/production

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
node build/run/production.js

build/bin/production.cmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node build/run/production.js

build/readme.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
macOs:
2+
chmod u+x build/bin/dev-server
3+
chmod u+x build/bin/production

build/run/dev-server.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
const { exec } = require('child_process')
2+
const path = require('path')
3+
const projectPath = __dirname.replace(`build${path.sep}run`, '')
4+
let port = process.env.port || 9000
5+
6+
function run () {
7+
const child = exec(`${projectPath}node_modules/.bin/webpack-dev-server --config ${projectPath}build/webpack.config.js --color`, {
8+
env: {
9+
port,
10+
},
11+
}, (error, stdout, stderr) => {
12+
if (error) {
13+
if (error.message.includes('address already in use')) {
14+
console.clear()
15+
port++
16+
run()
17+
return
18+
}
19+
console.error(error.message)
20+
}
21+
})
22+
child.stdout.on('data', (chunk) => {
23+
console.log(chunk.toString())
24+
})
25+
}
26+
27+
run()

0 commit comments

Comments
 (0)