使用git应用项目公共模板

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
1. 切换到develop分支
git checkout develop
2. 创建一个干净的dev/test分支
git checkout --orphan dev/test
3. 将代码提交到远端dev/test分支


git add .
git commit -m "feature: 保存原始代码"
git push --set-upstream origin dev/test
4. 添加PC公共模板项目的源

git remote add common "git项目地址"
5. 整合PC公共模板到具体项目

git pull --rebase common develop
6. 解决冲突

git add .
git rebase --continue

直到解决完所有冲突
7. 修改manifest.js

Url.js的值 修改到 manifest.js

8. 如果是ts项目


1. 核对package.json,可以按敏感指标的为准
2. 核对.eslintrc.js
module.exports = {
root: true,
env: {
node: true,
},
extends: [
"plugin:vue/essential",
"eslint:recommended",
"@vue/typescript/recommended",
"plugin:prettier/recommended",
],
parser: "vue-eslint-parser",
parserOptions: {
parser: {
js: "@babel/eslint-parser",
ts: "@typescript-eslint/parser",
"<template>": "espree",
},
sourceType: "module",
},
rules: {
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-unused-vars": "off",
"no-undef": "off",
"vue/no-mutating-props": "off",
"vue/multi-word-component-names": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-this-alias": "off",
"no-mixed-spaces-and-tabs": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-var-requires": "off",
},
};

3. 核对babel.config.js
module.exports = {
presets: ["@vue/cli-plugin-babel/preset"],
plugins: [
[
"import",
{ libraryName: "ant-design-vue", libraryDirectory: "es", style: true },
],
],
};

4. 核对vue.config.js 修改入口
pages: {
index: {
entry: "src/main.js",
},
},
transpileDependencies: true, // babel编译时会把nodemodules里面的一期编译
5. 核对tsconfig.js
{
"compilerOptions": {
"allowJs": true,
"target": "esnext",
"module": "esnext",
"strict": true,
"jsx": "preserve",
"moduleResolution": "node",
"experimentalDecorators": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"useDefineForClassFields": true,
"sourceMap": true,
"baseUrl": ".",
"outDir": ".",
"types": ["webpack-env"],
"paths": {
"@/*": ["src/*"]
},
"lib": ["esnext", "dom", "dom.iterable", "scripthost"]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.tsx"
],
"exclude": ["node_modules"]
}

6. @/router @/store的引用修改为了
@/router/index.js @/store/index.js
9. 修改路由和store将业务的代码整合一起