auto: 初始化
This commit is contained in:
parent
0485078e34
commit
643f8ce71f
4
txw-gxzx-web/.browserslistrc
Normal file
4
txw-gxzx-web/.browserslistrc
Normal file
@ -0,0 +1,4 @@
|
||||
> 1%
|
||||
last 2 versions
|
||||
ie > 8
|
||||
chrome > 69
|
||||
1
txw-gxzx-web/.commitlintrc.js
Normal file
1
txw-gxzx-web/.commitlintrc.js
Normal file
@ -0,0 +1 @@
|
||||
module.exports = { extends: ['@commitlint/config-conventional'] };
|
||||
89
txw-gxzx-web/.cz-config.js
Normal file
89
txw-gxzx-web/.cz-config.js
Normal file
@ -0,0 +1,89 @@
|
||||
module.exports = {
|
||||
// type 类型
|
||||
types: [
|
||||
{ value: 'feat', name: 'feat: 新增产品功能' },
|
||||
{ value: 'fix', name: 'fix: 修复 bug' },
|
||||
{ value: 'docs', name: 'docs: 文档的变更' },
|
||||
{
|
||||
value: 'style',
|
||||
name:
|
||||
'style: 不改变代码功能的变动(如删除空格、格式化、去掉末尾分号等)',
|
||||
},
|
||||
{
|
||||
value: 'refactor',
|
||||
name: 'refactor: 重构代码。不包括 bug 修复、功能新增',
|
||||
},
|
||||
{
|
||||
value: 'perf',
|
||||
name: 'perf: 性能优化',
|
||||
},
|
||||
{ value: 'test', name: 'test: 添加、修改测试用例' },
|
||||
{
|
||||
value: 'build',
|
||||
name: 'build: 构建流程、外部依赖变更,比如升级 npm 包、修改 webpack 配置'
|
||||
},
|
||||
{ value: 'ci', name: 'ci: 修改了 CI 配置、脚本' },
|
||||
{
|
||||
value: 'chore',
|
||||
name: 'chore: 对构建过程或辅助工具和库的更改,不影响源文件、测试用例的其他操作',
|
||||
},
|
||||
{ value: 'revert', name: 'revert: 回滚 commit' },
|
||||
|
||||
],
|
||||
|
||||
// scope 类型,建议前端负责人根据该项目的模块命名
|
||||
scopes: [
|
||||
['root', 'root 相关'],
|
||||
['module-1', 'module-1 相关'],
|
||||
['publish', '版本发布'],
|
||||
['other', '其他修改'],
|
||||
// 如果选择 custom ,后面会让你再输入一个自定义的 scope , 也可以不设置此项, 把后面的 allowCustomScopes 设置为 true
|
||||
['custom', '以上都不是?我要自定义'],
|
||||
].map(([value, description]) => {
|
||||
return {
|
||||
value,
|
||||
name: `${value.padEnd(30)} (${description})`
|
||||
};
|
||||
}),
|
||||
|
||||
// allowTicketNumber: false,
|
||||
// isTicketNumberRequired: false,
|
||||
// ticketNumberPrefix: 'TICKET-',
|
||||
// ticketNumberRegExp: '\\d{1,5}',
|
||||
|
||||
// 可以设置 scope 的类型跟 type 的类型匹配项,例如: 'fix'
|
||||
/*
|
||||
scopeOverrides: {
|
||||
fix: [
|
||||
{ name: 'merge' },
|
||||
{ name: 'style' },
|
||||
{ name: 'e2eTest' },
|
||||
{ name: 'unitTest' }
|
||||
]
|
||||
},
|
||||
*/
|
||||
// 覆写提示的信息
|
||||
messages: {
|
||||
type: "请确保你的提交遵循了原子提交规范!\n选择你要提交的类型:",
|
||||
scope: '\n选择一个 scope (可选):',
|
||||
// 选择 scope: custom 时会出下面的提示
|
||||
customScope: '请输入自定义的 scope:',
|
||||
subject: '填写一个简短精炼的描述语句:\n',
|
||||
body: '添加一个更加详细的描述,可以附上新增功能的描述或 bug 链接、截图链接 (可选)。使用 "|" 换行:\n',
|
||||
breaking: '列举非兼容性重大的变更 (可选):\n',
|
||||
footer: '列举出所有变更的 ISSUES CLOSED (可选)。 例如.: #31, #34:\n',
|
||||
confirmCommit: '确认提交?',
|
||||
},
|
||||
|
||||
// 是否允许自定义填写 scope ,设置为 true ,会自动添加两个 scope 类型 [{ name: 'empty', value: false },{ name: 'custom', value: 'custom' }]
|
||||
// allowCustomScopes: true,
|
||||
allowBreakingChanges: ['feat', 'fix'],
|
||||
// skip any questions you want
|
||||
// skipQuestions: [],
|
||||
|
||||
// subject 限制长度
|
||||
subjectLimit: 100,
|
||||
// breaklineChar: '|', // 支持 body 和 footer
|
||||
// footerPrefix : 'ISSUES CLOSED:'
|
||||
// askForBreakingChangeFirst : true,
|
||||
};
|
||||
8
txw-gxzx-web/.env
Normal file
8
txw-gxzx-web/.env
Normal file
@ -0,0 +1,8 @@
|
||||
VUE_APP_ENV=dev
|
||||
VUE_APP_MODEL=local
|
||||
VUE_APP_CDN_PATH=/view/gxzx
|
||||
VUE_APP_ROUTER_BASE=/view/gxzx
|
||||
VUE_APP_API_BASE_URL=
|
||||
VUE_APP_API_TIMEOUT=15000
|
||||
VUE_APP_CSS_EXTRACT=false
|
||||
|
||||
16
txw-gxzx-web/.env.development
Normal file
16
txw-gxzx-web/.env.development
Normal file
@ -0,0 +1,16 @@
|
||||
###
|
||||
# @Descripttion:
|
||||
# @Version: 1.0
|
||||
# @Author: wjx
|
||||
# @Date: 2024-02-04 14:09:22
|
||||
# @LastEditors: wjx
|
||||
# @LastEditTime: 2024-04-02 13:48:07
|
||||
###
|
||||
VUE_APP_ENV=dev
|
||||
VUE_APP_MODEL=local
|
||||
VUE_APP_CDN_PATH=/view/gxzx
|
||||
VUE_APP_ROUTER_BASE=/view/gxzx
|
||||
VUE_APP_API_BASE_URL=
|
||||
VUE_APP_DEV_SERVER_PORT=9002
|
||||
VUE_APP_MOCK=true
|
||||
VUE_APP_AUTO_ROUTER=false
|
||||
6
txw-gxzx-web/.env.production
Normal file
6
txw-gxzx-web/.env.production
Normal file
@ -0,0 +1,6 @@
|
||||
VUE_APP_ENV=prod
|
||||
VUE_APP_MODEL=online
|
||||
VUE_APP_CDN_PATH=/view/gxzx
|
||||
VUE_APP_ROUTER_BASE=/view/gxzx
|
||||
VUE_APP_API_BASE_URL=
|
||||
VUE_APP_AUTO_ROUTER=false
|
||||
15
txw-gxzx-web/.env.test
Normal file
15
txw-gxzx-web/.env.test
Normal file
@ -0,0 +1,15 @@
|
||||
###
|
||||
# @Descripttion:
|
||||
# @Version: 1.0
|
||||
# @Author: wjx
|
||||
# @Date: 2024-01-26 10:04:49
|
||||
# @LastEditors: wjx
|
||||
# @LastEditTime: 2024-01-26 10:06:52
|
||||
###
|
||||
NODE_ENV=production
|
||||
VUE_APP_ENV=beta
|
||||
VUE_APP_MODEL=online
|
||||
VUE_APP_CDN_PATH=/test
|
||||
VUE_APP_ROUTER_BASE=/test
|
||||
VUE_APP_API_BASE_URL=/test/api
|
||||
VUE_APP_API_BASE_URL2=/test/api
|
||||
4
txw-gxzx-web/.eslintignore
Normal file
4
txw-gxzx-web/.eslintignore
Normal file
@ -0,0 +1,4 @@
|
||||
**/sdk/lib
|
||||
**/sdk/es
|
||||
**/sdk/dist
|
||||
node_modules/*
|
||||
18
txw-gxzx-web/.eslintrc.js
Normal file
18
txw-gxzx-web/.eslintrc.js
Normal file
@ -0,0 +1,18 @@
|
||||
const eslintConfig = require('@gtff/tdesign-gt-vue/.eslintrc.js');
|
||||
|
||||
const projectRules = {
|
||||
'no-shadow': 0,
|
||||
'import/no-cycle': 0,
|
||||
'prettier/prettier': [
|
||||
'error',
|
||||
{
|
||||
endOfLine: 'auto',
|
||||
},
|
||||
],
|
||||
};
|
||||
eslintConfig.rules = {
|
||||
...eslintConfig.rules,
|
||||
...projectRules,
|
||||
};
|
||||
|
||||
module.exports = eslintConfig;
|
||||
9
txw-gxzx-web/.gitattributes
vendored
Normal file
9
txw-gxzx-web/.gitattributes
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
* text=auto
|
||||
*.c text
|
||||
*.h text
|
||||
|
||||
*.sln text eol=crlf
|
||||
|
||||
*.png binary
|
||||
*.jpg binary
|
||||
27
txw-gxzx-web/.gitignore
vendored
Normal file
27
txw-gxzx-web/.gitignore
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
/dist
|
||||
/public/static/svg.js
|
||||
/public/static_res/svg.js
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Editor directories and files
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
# release packages
|
||||
*.zip
|
||||
*.gz
|
||||
*.tar
|
||||
1
txw-gxzx-web/.yarnrc
Normal file
1
txw-gxzx-web/.yarnrc
Normal file
@ -0,0 +1 @@
|
||||
registry "http://registry.npm.gov.cn"
|
||||
10
txw-gxzx-web/Dockerfile
Normal file
10
txw-gxzx-web/Dockerfile
Normal file
@ -0,0 +1,10 @@
|
||||
## 前端公共镜像
|
||||
FROM ccr.xc01.cloud.sat.tax/goff/arm-webnginx:latest
|
||||
COPY /devops/nginx.conf /usr/local/openresty/nginx/conf/nginx.conf
|
||||
WORKDIR /app
|
||||
COPY ./ /app
|
||||
#ADD tsf-consul-template-docker.arm /root/
|
||||
ADD dist /usr/local/openresty/nginx/html
|
||||
|
||||
# 修改host文件
|
||||
CMD ["sh", "-ec", "/usr/local/openresty/nginx/sbin/nginx -c /usr/local/openresty/nginx/conf/nginx.conf "]
|
||||
0
txw-gxzx-web/README.md
Normal file
0
txw-gxzx-web/README.md
Normal file
29
txw-gxzx-web/babel.config.js
Normal file
29
txw-gxzx-web/babel.config.js
Normal file
@ -0,0 +1,29 @@
|
||||
let config = {
|
||||
presets: [
|
||||
[
|
||||
'@vue/cli-plugin-babel/preset',
|
||||
{
|
||||
useBuiltIns: 'entry',
|
||||
},
|
||||
],
|
||||
],
|
||||
};
|
||||
|
||||
if (process.env.VUE_APP_IE === 'true') {
|
||||
config = {
|
||||
presets: [
|
||||
'@vue/app',
|
||||
[
|
||||
'@babel/preset-env',
|
||||
{
|
||||
modules: false,
|
||||
corejs: 3,
|
||||
useBuiltIns: 'usage',
|
||||
},
|
||||
],
|
||||
],
|
||||
plugins: ['@babel/plugin-transform-runtime'],
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = config;
|
||||
7
txw-gxzx-web/devops/.yarnrc
Normal file
7
txw-gxzx-web/devops/.yarnrc
Normal file
@ -0,0 +1,7 @@
|
||||
registry "https://registry.npm.taobao.org"
|
||||
"@govcloud:registry" "https://rgnpm.pdcts.com.cn"
|
||||
electron_mirror "https://npm.taobao.org/mirrors/electron/"
|
||||
node_gyp "/data/npm/node_global/lib/node_modules/node-gyp/bin/node-gyp.js"
|
||||
sass_binary_site "https://npm.taobao.org/mirrors/node-sass"
|
||||
nodejieba_binary_host_mirror "https://npm.taobao.org/mirrors/nodejieba"
|
||||
strict-ssl false
|
||||
178
txw-gxzx-web/devops/Jenkinsfile
vendored
Normal file
178
txw-gxzx-web/devops/Jenkinsfile
vendored
Normal file
@ -0,0 +1,178 @@
|
||||
def depots = [
|
||||
[
|
||||
name: "${PROJECT_NAME}",
|
||||
origin: "${GIT_SSH_URL}",
|
||||
]
|
||||
]
|
||||
def getCheckoutJob(depot) {
|
||||
return {
|
||||
dir(path: "./modules/${depot.get('name')}") {
|
||||
checkout([$class: 'GitSCM', branches: [[name: env.GIT_BUILD_REF]],
|
||||
userRemoteConfigs: [[url: depot.get('origin'), credentialsId: env.CREDENTIALS_ID]]])
|
||||
script {
|
||||
if (depot.get('name') == 'coding-artifacts') {
|
||||
sh 'git submodule sync'
|
||||
sh 'git submodule update --init --recursive'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
def application_name = env.APPLICATION_NAME.split(",")
|
||||
def ports = env.PROTOCOL_PORTS.split(",")
|
||||
def jobs = []
|
||||
application_name.eachWithIndex{
|
||||
it,i -> jobs[i]=[application_name[i],ports[i]]
|
||||
|
||||
}
|
||||
|
||||
def parallelStagesMap = jobs.collectEntries {
|
||||
["检测tsf应用${it[0]}" : generateStage(it)]
|
||||
}
|
||||
def generateStage(jdata) {
|
||||
echo '${project_pub_name}'
|
||||
return {
|
||||
stage("stage: ${project_pub_name}") {
|
||||
echo "${jdata[0]}"
|
||||
checkTsfApplication secretId: "${env.SECRET_ID}", secretKey: "${env.SECRET_KEY}", applicationName: "${project_pub_name}", applicationType: "${env.APPLICATION_TYPE}", endpoint: "${env.TSF_ENDPOINT}", microserviceType: "${env.MICROSERVICE_TYPE}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def parallelStagesMap2 = jobs.collectEntries {
|
||||
["部署tsf应用${it[0]}" : generateStage2(it)]
|
||||
}
|
||||
def generateStage2(jdata) {
|
||||
echo '${project_pub_name}'
|
||||
return {
|
||||
stage("stage: ${project_pub_name}") {
|
||||
echo "${jdata[0]}"
|
||||
deployTsf secretId: "${env.SECRET_ID}", secretKey: "${env.SECRET_KEY}", endpoint: "${env.TSF_ENDPOINT}", applicationName: "${project_pub_name}", clusterName: "${env.CLUSTER_NAME}", namespace: "${DEPLOY_ENV}", groupName: "${project_pub_name}-${DY_ENV}", pkgVersion: "${VERSION}-${DEPLOY_ENV}", protocolPorts: "[{Protocol:\"TCP\",Port:"+"${jdata[1]}"+",TargetPort:" +"${jdata[1]}"+"}]", accessType: "${env.ACCESS_TYPE}", updateType: "${env.UPDATE_TYPE}", businessLogNames: "${logpath}"
|
||||
}
|
||||
}
|
||||
}
|
||||
def deploy_env = "${DEPLOY_ENV}"
|
||||
def createDY_ENV() {
|
||||
return deploy_env.split("-")[1]
|
||||
}
|
||||
|
||||
def createName() {
|
||||
return deploy_env.split("-")[0]
|
||||
}
|
||||
|
||||
// TODO: 这里应该要根据实际的运行域决定,待整理规范
|
||||
def getClusterName() {
|
||||
if (env.DEPLOY_ENV.contains("dev") ){
|
||||
return "IPC-public-开发环境"
|
||||
}
|
||||
else if (env.DEPLOY_ENV.contains("test") ){
|
||||
return "IPC-public-测试环境"
|
||||
}
|
||||
else {
|
||||
return "IPC-public-演示环境"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
stage("检出项目代码仓库") {
|
||||
steps {
|
||||
checkout([$class: 'GitSCM', branches: [[name: env.SUB_BRANCH]],
|
||||
userRemoteConfigs: [[url: "${env.SUB_GIT_REPO_URL}/${project_name}.git", credentialsId: env.SUB_CREDENTIALS_ID]]])
|
||||
script {
|
||||
sh """
|
||||
echo "machine git.code.tencent.com" > ~/.netrc
|
||||
echo "login ${GIT_USERNAME}" >> ~/.netrc
|
||||
echo "password ${GIT_PASSWORD}" >> ~/.netrc
|
||||
"""
|
||||
sh 'cat ~/.netrc'
|
||||
sh 'git submodule sync'
|
||||
sh 'git submodule update --init --recursive'
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('检出子仓库') {
|
||||
steps {
|
||||
script {
|
||||
checkoutJobs = [:]
|
||||
depots.findAll{
|
||||
depot -> (depot.get('origin') != '')
|
||||
}.each { depot ->
|
||||
echo "submodule > ${depot}"
|
||||
checkoutJobs[depot.get('name')] = getCheckoutJob(depot)
|
||||
checkoutJobs['failFast'] = false
|
||||
}
|
||||
parallel checkoutJobs
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('校验tsf环境') {
|
||||
steps{
|
||||
script {
|
||||
parallel parallelStagesMap
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('编译构建') {
|
||||
|
||||
agent {
|
||||
docker {
|
||||
image 'ipcmaven.pdcts.com.cn:8082/npm:tsf'
|
||||
args '-u root --network=host -v /var/run/docker.sock:/var/run/docker.sock --add-host=raw.githubusercontent.com:199.232.28.133 -v /usr/bin/docker:/usr/bin/docker -v /etc/hosts:/etc/hosts'
|
||||
reuseNode true
|
||||
}
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
withCredentials([usernamePassword(credentialsId: "${DOCKER_REGISTRY_CREDENTIALS_ID}", usernameVariable: 'REGISTRY_USER', passwordVariable: 'REGISTRY_PASS')]) {
|
||||
sh """
|
||||
pwd
|
||||
ls -ls .
|
||||
ls -ls ./modules
|
||||
npm config ls
|
||||
mv ./modules/${DEPOT_NAME}/build .
|
||||
# 编译构建
|
||||
bash -e build/build.sh ${TSF_REPO} ${project_pub_name} ${HARBOR_ACCOUNT_NAME} ${HARBOR_PASSWORD} ${image_version} ${BUILD_TYPE} ${NPM_BUILD_SCRIPT}
|
||||
"""
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
stage('触发tsf部署') {
|
||||
when {
|
||||
environment name:'DEPLOY_ENABLE', value:'true'
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
parallel parallelStagesMap2
|
||||
}
|
||||
sh """
|
||||
# 如果还要执行别的一些sh命令,可在此添加,比如企业微信的通知机器人
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
environment {
|
||||
PROTOCOL = 'http' // 系统预留参数
|
||||
APPLICATION_TYPE = 'C' // 项目类型,系统预留参数
|
||||
MICROSERVICE_TYPE = 'N' // 系统预留参数
|
||||
DY_ENV = createDY_ENV() // 环境
|
||||
PName = createName() // 项目组名passid和里约网关passid一致
|
||||
image_version = "${VERSION}-${DEPLOY_ENV}" // 镜像版本
|
||||
project_name = "${APPLICATION_NAME}" // 项目工程名称
|
||||
project_pub_name = "${PName}-${GIT_PROJECT_NAME ? GIT_PROJECT_NAME : project_name}" // TSF 项目名称
|
||||
UPDATE_TYPE = "1" // 更新类型,运维预留参数,暂时未启用
|
||||
ACCESS_TYPE = "2" // 制品类型,运维预留参数,暂时未启用
|
||||
BUILD_TYPE = "${BUILD_TYPE}" // 编译类型
|
||||
CLUSTER_NAME = getClusterName() // 部署组名称
|
||||
logpath = "${PName}-web-logs" // 日志名称
|
||||
}
|
||||
}
|
||||
78
txw-gxzx-web/devops/Jenkinsfile_TCTP
Normal file
78
txw-gxzx-web/devops/Jenkinsfile_TCTP
Normal file
@ -0,0 +1,78 @@
|
||||
pipeline {
|
||||
agent any
|
||||
stages {
|
||||
stage('检出') {
|
||||
steps {
|
||||
checkout([
|
||||
$class: 'GitSCM',
|
||||
branches: [[name: GIT_BUILD_REF]],
|
||||
userRemoteConfigs: [[
|
||||
url: GIT_REPO_URL,
|
||||
credentialsId: CREDENTIALS_ID
|
||||
]]])
|
||||
}
|
||||
}
|
||||
stage('产物构建') {
|
||||
steps {
|
||||
script {
|
||||
env.TAG_VERSION = new Date().format('yyyyMMdd-HHmmss')
|
||||
|
||||
// 分解参数
|
||||
def envs = env.ENV_INFO.split("\\|")
|
||||
env.DEPLOY_ENV = envs[0]
|
||||
env.PKG_VERSION = env.TAG_VERSION+'-'+env.DEPLOY_ENV
|
||||
|
||||
echo 'PKG_VERSION is: ' + env.PKG_VERSION
|
||||
}
|
||||
|
||||
sh '''ls -la
|
||||
pwd
|
||||
|
||||
echo '===== 开始解压node_modules ====='
|
||||
tar -xf node_modules.tar.gz
|
||||
echo '===== 完成解压node_modules ====='
|
||||
|
||||
echo '===== 开始 yarn 构建 ====='
|
||||
yarn build:site
|
||||
echo '===== 完成 yarn 构建 ====='
|
||||
|
||||
echo '===== 开始写入Dockerfile ====='
|
||||
cat << EOF > Dockerfile
|
||||
## 前端公共镜像
|
||||
FROM ccr.ccs.tencentyun.com/tdesign-gov/tsf-web-public:0.0.1
|
||||
## 添加代码压缩包到镜像中
|
||||
ADD dist /usr/local/openresty/nginx/html/
|
||||
WORKDIR /usr/local/openresty/nginx/
|
||||
|
||||
CMD ["sh", "-ec", "sh /root/tsf-consul-template-docker/script/start.sh; exec /usr/local/openresty/nginx/sbin/nginx -c /usr/local/openresty/nginx/conf/nginx.conf"]
|
||||
EOF
|
||||
|
||||
cat Dockerfile
|
||||
echo '===== 完成写入Dockerfile ====='
|
||||
'''
|
||||
}
|
||||
}
|
||||
stage('制作镜像') {
|
||||
steps {
|
||||
sh '''ls -la
|
||||
pwd
|
||||
echo '===== 开始构建docker部署镜像 ====='
|
||||
docker build -t ${DOCKER_REPO}/${PROJECT_MODEL_NAME}:${PKG_VERSION} .
|
||||
docker image ls
|
||||
echo '===== 完成构建docker部署镜像 ====='
|
||||
'''
|
||||
}
|
||||
}
|
||||
stage('推送镜像') {
|
||||
steps {
|
||||
sh '''ls -la
|
||||
pwd
|
||||
echo '===== 开始推送docker部署镜像 ====='
|
||||
docker login --username=${DOCKER_USERNAME} --password=${DOCKER_PASSWORD} ${DOCKER_REPO}
|
||||
docker push ${DOCKER_REPO}/${PROJECT_MODEL_NAME}:${PKG_VERSION}
|
||||
echo '===== 完成推送docker部署镜像 ====='
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
41
txw-gxzx-web/devops/README.md
Normal file
41
txw-gxzx-web/devops/README.md
Normal file
@ -0,0 +1,41 @@
|
||||
# 政务云 coding 标准发布脚本
|
||||
|
||||
## 接入必读须知,以下变量配置需在 coding 配置参数中使用
|
||||
|
||||
TSF 接入系统固定变量
|
||||
|
||||
| 名称 | 默认值 | 描述 | 类型 | 说明 |
|
||||
| ------------------- | ----------------------------------------- | -------------------- | ----------- | -------------------------------------------------------------------------- |
|
||||
| VERSION | v0.0.1 | 版本号 | String | 发布版本号 |
|
||||
| DEPLOY_ENABLE | true | - | Boolean | 是否自动发布,运维预留参数 |
|
||||
| TSF_REPO | `ccr.ccs.tencentyun.com/tsf_100013631257` | TSF 镜像仓库 | String | 用于拉取制品镜像地址 |
|
||||
| HARBOR_ACCOUNT_NAME | 100006274537 | TSF 发布账号 | String | - |
|
||||
| HARBOR_PASSWORD | 已运维配置为准 | TSF 镜像发布账号密码 | String | - |
|
||||
| SUB_CREDENTIALS_ID | 已运维配置为准 | 工蜂 Coding 凭据 | Coding 凭据 | 用于拉取 git 仓库代码的账号,需在自己的项目或项目组中关联`ipc_csig3`该账号 |
|
||||
| TSF_ENDPOINT | `tsf.tencentcloudapi.com` | TSF 发布服务地址 | String | - |
|
||||
| APPLICATION_TYPE | C | - | String | - |
|
||||
| MICROSERVICE_TYPE | N | - | String | - |
|
||||
| PROTOCOL_PORTS | 80 | 容器端口 | Number | 部署 tsf 容器端口 |
|
||||
| ACCESS_TYPE | 2 | - | Number | - |
|
||||
| SECRET_ID | 以运维配置为准 | tsf 认证密钥 | Password | 密钥 |
|
||||
| SECRET_KEY | 以运维配置为准 | tsf 认证密钥 key | Password | 密钥 key |
|
||||
| remote_passwd | 以运维配置为准 | tsf 认证密钥 key | Password | 密钥 key,暂未用到 |
|
||||
|
||||
| TSF 接入需配置的变量 | 名称 | 类型 | 说明 |
|
||||
| --- | --- | --- | --- |
|
||||
| SUB_GIT_REPO_URL | git 仓库地址 | String | git 代码仓库 |
|
||||
| DEPLOY_ENV | 发布项目环境 | String | 环境设置 `${项目}-dev` |
|
||||
| NPM_BUILD_SCRIPT | npm 执行脚本 | String | npm 脚本参数 |
|
||||
| GIT_USERNAME | git 账号 | String | 用于拉取 submodule |
|
||||
| GIT_PASSWORD | git 密码 | String | 用于拉取 submodule |
|
||||
| SUB_BRANCH | 分支名称 | String | 分支名称 |
|
||||
| APPLICATION_NAME | 项目工程名称 | String | 项目工程名称 |
|
||||
| GIT_PROJECT_NAME | tsf 打包发布名称 | String | tsf 打包发布名称 |
|
||||
| BUILD_TYPE | 编译类型 | String | `node | static | default ` |
|
||||
|
||||
> 开发接入 tsf 需要更改未 TSF 接入需配置的变量
|
||||
|
||||
```bash
|
||||
# doker 登录
|
||||
doker login --username=100006274537 ccr.ccs.tencentyun.com
|
||||
```
|
||||
103
txw-gxzx-web/devops/build/build.sh
Normal file
103
txw-gxzx-web/devops/build/build.sh
Normal file
@ -0,0 +1,103 @@
|
||||
#!/bin/bash
|
||||
# 使用maven编译打包源码
|
||||
image_repo=$1
|
||||
project_names=$2
|
||||
docker_username=$3 ### 镜像仓库用户名
|
||||
docker_password=$4 ### 镜像仓库库用户密码
|
||||
version=$5 ### 镜像版本变量
|
||||
BUILD_TYPE=$6
|
||||
NPM_BUILD_SCRIPT=$7
|
||||
registry_url=`echo ${image_repo}|awk -F / '{print $1}'`
|
||||
|
||||
function build_dockerfile(){
|
||||
echo "+++++++++++++++start build dockerfile++++++++++++++++++++++"
|
||||
echo "$project_name"
|
||||
tar_path=`find . -name "dist.tar.gz"`
|
||||
echo "+++++++++++ ${tar_path} +++++++"
|
||||
if [ -z "${tar_path}" ];then
|
||||
echo "need tar.gz package is not exit"
|
||||
exit 222
|
||||
fi
|
||||
targz=`find . -name "dist.tar.gz"|awk -F / '{print $NF}'`
|
||||
#cp -r ${tar_path} .
|
||||
cat << EOF > Dockerfile
|
||||
## 前端公共镜像
|
||||
FROM ccr.ccs.tencentyun.com/tsf_100013631257/tsf-web-public-image:latest
|
||||
## 定义变量
|
||||
ENV workdir /usr/local/openresty/nginx/
|
||||
## 添加代码压缩包到镜像中
|
||||
ADD ${targz} \${workdir}/html/
|
||||
RUN mv \${workdir}/html/dist/* \${workdir}/html/
|
||||
WORKDIR \${workdir}
|
||||
|
||||
CMD ["sh", "-ec", "sh /root/tsf-consul-template-docker/script/start.sh; exec /usr/local/openresty/nginx/sbin/nginx -c /usr/local/openresty/nginx/conf/nginx.conf"]
|
||||
EOF
|
||||
|
||||
}
|
||||
|
||||
function juge_status( ){
|
||||
if [ $? -ne 0 ];then
|
||||
echo "$1" "failed"
|
||||
exit 111
|
||||
fi
|
||||
}
|
||||
function build_image(){
|
||||
echo "+++++++++++++++start build docker image++++++++++++++++++++++"
|
||||
echo ${registry_url}
|
||||
docker login --username=${docker_username} --password=${docker_password} ${registry_url} && docker build -t ${image_repo}/${project_name}:${version} . && docker push ${image_repo}/${project_name}:${version}
|
||||
juge_status build_imag
|
||||
}
|
||||
|
||||
function build() {
|
||||
# 编译
|
||||
echo "+++++++++++++++start compiler++++++++++++++++++++++"
|
||||
echo '安装npm依赖 ===> start'
|
||||
# yarn config set registry https://rgnpm.pdcts.com.cn
|
||||
# yarn config set sass_binary_site "https://npm.taobao.org/mirrors/node-sass"
|
||||
|
||||
time yarn install
|
||||
echo '安装npm依赖 ===> end'
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "Failed to yarn install"
|
||||
exit -1
|
||||
fi
|
||||
# 运行编辑+打包命令. 生成dist.tar.gz
|
||||
echo '构建前端工程 ===> start'
|
||||
# node server 工程打包
|
||||
if [ $BUILD_TYPE === 'node' ]; then
|
||||
echo "yarn ${NPM_BUILD_SCRIPT}"
|
||||
yarn ${NPM_BUILD_SCRIPT}
|
||||
mv ./node_modules ./dist/
|
||||
echo $(ls ./dist/)
|
||||
# 静态文件打包
|
||||
elif [ $BUILD_TYPE === 'static' ]; then
|
||||
mv html dist
|
||||
# - 前端工程打包
|
||||
else
|
||||
yarn ${NPM_BUILD_SCRIPT}
|
||||
echo "yarn ${NPM_BUILD_SCRIPT}"
|
||||
fi
|
||||
|
||||
tar zcfv dist.tar.gz --exclude ./dist/dev.html dist/*
|
||||
|
||||
|
||||
echo '构建前端工程 ===> end'
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to build ${project_name}."
|
||||
exit 128
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function execu(){
|
||||
arr_service_list=$(echo ${project_names//,/ })
|
||||
for service in ${arr_service_list[@]};do
|
||||
project_name=$service
|
||||
build_dockerfile $service
|
||||
build_image
|
||||
done
|
||||
}
|
||||
build
|
||||
execu
|
||||
3
txw-gxzx-web/devops/multiple-deploy/web_deploy.conf
Normal file
3
txw-gxzx-web/devops/multiple-deploy/web_deploy.conf
Normal file
@ -0,0 +1,3 @@
|
||||
@%VUE_APP_CDN_PATH%@=/multiple
|
||||
@%VUE_APP_ROUTER_BASE%@=/multiple
|
||||
@%VUE_APP_API_BASE_URL%@=/multiple/Api
|
||||
110
txw-gxzx-web/devops/nginx.conf
Normal file
110
txw-gxzx-web/devops/nginx.conf
Normal file
@ -0,0 +1,110 @@
|
||||
worker_processes auto;
|
||||
worker_rlimit_nofile 65535;
|
||||
error_log logs/error.log;
|
||||
pid /var/run/nginx.pid;
|
||||
daemon off;
|
||||
|
||||
events {
|
||||
worker_connections 2048;
|
||||
}
|
||||
|
||||
http {
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for" "$http_referer"';
|
||||
|
||||
access_log logs/access.log main;
|
||||
client_max_body_size 100m;
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
types_hash_max_size 2048;
|
||||
|
||||
gzip on;
|
||||
gzip_disable "msie6";
|
||||
gzip_vary on;
|
||||
gzip_proxied any;
|
||||
gzip_comp_level 6;
|
||||
gzip_buffers 16 8k;
|
||||
gzip_http_version 1.1;
|
||||
gzip_min_length 256;
|
||||
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss application/javascript text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon;
|
||||
|
||||
|
||||
proxy_connect_timeout 300s;
|
||||
proxy_send_timeout 300s;
|
||||
proxy_read_timeout 300s;
|
||||
send_timeout 300s;
|
||||
fastcgi_connect_timeout 300;
|
||||
fastcgi_send_timeout 300;
|
||||
fastcgi_read_timeout 300;
|
||||
|
||||
include /usr/local/openresty/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
# Load modular configuration files from the /etc/nginx/conf.d directory.
|
||||
# See http://nginx.org/en/docs/ngx_core_module.html#include
|
||||
# for more information.
|
||||
include servers/*.conf;
|
||||
|
||||
server {
|
||||
listen 8080 default_server;
|
||||
listen [::]:8080 default_server;
|
||||
server_name _;
|
||||
server_tokens off;
|
||||
#root /usr/local/openresty/nginx/html/;
|
||||
|
||||
# 重写env.config.js路径
|
||||
location ~ .+/env.config.js$ {
|
||||
rewrite ^(.*)$ /env.config.js break;
|
||||
root /usr/local/openresty/nginx/html;
|
||||
}
|
||||
|
||||
# 重写svg.js路径
|
||||
location ~ .+/static_res/svg.js$ {
|
||||
rewrite ^(.*)$ /static_res/svg.js break;
|
||||
root /usr/local/openresty/nginx/html;
|
||||
}
|
||||
|
||||
# 重写/assets/img/中图片资源路径
|
||||
location ~ .+/assets_res/img/ {
|
||||
rewrite ^.*(\/assets_res\/img\/.*)$ $1 break;
|
||||
root /usr/local/openresty/nginx/html;
|
||||
}
|
||||
|
||||
# 主入口配置
|
||||
location / {
|
||||
add_header Cache-Control 'proxy-revalidate';
|
||||
alias /usr/local/openresty/nginx/html/;
|
||||
index index.html;
|
||||
try_files $uri $uri/ /index.html;
|
||||
|
||||
if ($request_filename ~* .*.(html|htm)$)
|
||||
{
|
||||
expires -1s;
|
||||
}
|
||||
|
||||
if ($request_filename ~* .*.(gif|jpg|jpeg|png|svg)$)
|
||||
{
|
||||
expires 30d;
|
||||
}
|
||||
|
||||
if ($request_filename ~ .*.(js|css)$)
|
||||
{
|
||||
expires 12h;
|
||||
}
|
||||
}
|
||||
location /ping {
|
||||
return 200 "oK";
|
||||
}
|
||||
|
||||
error_page 404 /404.html;
|
||||
location = /40x.html {
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
}
|
||||
}
|
||||
}
|
||||
6
txw-gxzx-web/env.multiple-deploy
Normal file
6
txw-gxzx-web/env.multiple-deploy
Normal file
@ -0,0 +1,6 @@
|
||||
NODE_ENV=production
|
||||
VUE_APP_ENV=prod
|
||||
VUE_APP_MODEL=online
|
||||
VUE_APP_CDN_PATH=@%VUE_APP_CDN_PATH%@
|
||||
VUE_APP_ROUTER_BASE=@%VUE_APP_ROUTER_BASE%@
|
||||
VUE_APP_API_BASE_URL=@%VUE_APP_API_BASE_URL%@
|
||||
14
txw-gxzx-web/jsconfig.json
Normal file
14
txw-gxzx-web/jsconfig.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"src/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"dist"
|
||||
]
|
||||
}
|
||||
117
txw-gxzx-web/nginx.conf
Normal file
117
txw-gxzx-web/nginx.conf
Normal file
@ -0,0 +1,117 @@
|
||||
worker_processes auto;
|
||||
worker_rlimit_nofile 65535;
|
||||
error_log logs/error.log;
|
||||
pid /var/run/nginx.pid;
|
||||
daemon off;
|
||||
|
||||
events {
|
||||
worker_connections 2048;
|
||||
}
|
||||
|
||||
http {
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for" "$http_referer"';
|
||||
|
||||
access_log logs/access.log main;
|
||||
client_max_body_size 100m;
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
types_hash_max_size 2048;
|
||||
|
||||
gzip on;
|
||||
gzip_disable "msie6";
|
||||
gzip_vary on;
|
||||
gzip_proxied any;
|
||||
gzip_comp_level 6;
|
||||
gzip_buffers 16 8k;
|
||||
gzip_http_version 1.1;
|
||||
gzip_min_length 256;
|
||||
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss application/javascript text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon;
|
||||
|
||||
|
||||
proxy_connect_timeout 300s;
|
||||
proxy_send_timeout 300s;
|
||||
proxy_read_timeout 300s;
|
||||
send_timeout 300s;
|
||||
fastcgi_connect_timeout 300;
|
||||
fastcgi_send_timeout 300;
|
||||
fastcgi_read_timeout 300;
|
||||
|
||||
include /usr/local/openresty/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
# Load modular configuration files from the /etc/nginx/conf.d directory.
|
||||
# See http://nginx.org/en/docs/ngx_core_module.html#include
|
||||
# for more information.
|
||||
include servers/*.conf;
|
||||
|
||||
server {
|
||||
listen 8080 default_server;
|
||||
listen [::]:8080 default_server;
|
||||
server_name _;
|
||||
server_tokens off;
|
||||
#root /usr/local/openresty/nginx/html/;
|
||||
|
||||
# 重写env.config.js路径
|
||||
location ~ .+/env.config.js$ {
|
||||
rewrite ^(.*)$ /env.config.js break;
|
||||
root /usr/local/openresty/nginx/html;
|
||||
}
|
||||
|
||||
# 重写svg.js路径
|
||||
location ~ .+/static_res/svg.js$ {
|
||||
rewrite ^(.*)$ /static_res/svg.js break;
|
||||
root /usr/local/openresty/nginx/html;
|
||||
}
|
||||
|
||||
# 卸载context
|
||||
location /view/gxzx {
|
||||
alias /etc/nginx/html;
|
||||
index index.html;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# 重写/assets/img/中图片资源路径
|
||||
location ~ .+/assets_res/img/ {
|
||||
rewrite ^.*(\/assets_res\/img\/.*)$ $1 break;
|
||||
root /usr/local/openresty/nginx/html;
|
||||
}
|
||||
|
||||
# 主入口配置
|
||||
location / {
|
||||
add_header Cache-Control 'proxy-revalidate';
|
||||
alias /usr/local/openresty/nginx/html/;
|
||||
index index.html;
|
||||
try_files $uri $uri/ /index.html;
|
||||
|
||||
if ($request_filename ~* .*.(html|htm)$)
|
||||
{
|
||||
expires -1s;
|
||||
}
|
||||
|
||||
if ($request_filename ~* .*.(gif|jpg|jpeg|png|svg)$)
|
||||
{
|
||||
expires 30d;
|
||||
}
|
||||
|
||||
if ($request_filename ~ .*.(js|css)$)
|
||||
{
|
||||
expires 12h;
|
||||
}
|
||||
}
|
||||
location /ping {
|
||||
return 200 "oK";
|
||||
}
|
||||
|
||||
error_page 404 /404.html;
|
||||
location = /40x.html {
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
}
|
||||
}
|
||||
}
|
||||
8
txw-gxzx-web/nodemon.json
Normal file
8
txw-gxzx-web/nodemon.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"verbose": true,
|
||||
"watch": [
|
||||
"mock/*",
|
||||
"vue.config.js",
|
||||
".env*"
|
||||
]
|
||||
}
|
||||
108
txw-gxzx-web/package.json
Normal file
108
txw-gxzx-web/package.json
Normal file
@ -0,0 +1,108 @@
|
||||
{
|
||||
"name": "znsb-mhzc",
|
||||
"description": "znsb-mhzc",
|
||||
"version": "0.1.0-alpha.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vue-cli-service serve",
|
||||
"dev:mock": "cross-env VUE_APP_MOCK=true nodemon -x vue-cli-service serve",
|
||||
"serve": "vue-cli-service serve",
|
||||
"build:site": "vue-cli-service build",
|
||||
"build": "vue-cli-service build",
|
||||
"build:site:dev": "vue-cli-service build --mode development",
|
||||
"build:site:test": "vue-cli-service build --mode test",
|
||||
"lint": "vue-cli-service lint",
|
||||
"lint:style": "vue-cli-service lint:style",
|
||||
"changelog": "conventional-changelog -p custom-config -i CHANGELOG.md -s -r 0",
|
||||
"commit": "git-cz",
|
||||
"@vue/babel-helper-vue-jsx-merge-props": "1.4.0",
|
||||
"@vue/babel-preset-jsx": "1.4.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@cssyq/ggzc-web": "^1.0.7",
|
||||
"@fortawesome/fontawesome-free": "^7.0.1",
|
||||
"@gt4/common-front": "2.0.113",
|
||||
"@gtff/tdesign-gt-vue": "1.4.0",
|
||||
"@wecity/tdesign-vue-ie": "1.3.1",
|
||||
"axios": "^0.21.1",
|
||||
"babel-polyfill": "^6.26.0",
|
||||
"clipboard": "^2.0.8",
|
||||
"core-js": "^3.6.5",
|
||||
"css-split-webpack-plugin": "0.2.6",
|
||||
"dayjs": "^1.10.4",
|
||||
"echarts": "^5.5.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
"qrcodejs2": "0.0.3",
|
||||
"regenerator-runtime": "^0.13.9",
|
||||
"tdesign-icons-vue": "0.0.8",
|
||||
"tdesign-vue": "1.4.0",
|
||||
"vue": "~2.6.11",
|
||||
"vue-echarts": "^6.6.9",
|
||||
"vue-pdf": "^4.3.0",
|
||||
"vue-router": "3.2.0",
|
||||
"vuex": "^3.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^12.1.1",
|
||||
"@commitlint/config-conventional": "^12.1.1",
|
||||
"@samhammer/vue-cli-plugin-stylelint": "^2.0.1",
|
||||
"@vue/cli-plugin-babel": "~4.5.0",
|
||||
"@vue/cli-plugin-eslint": "~4.5.0",
|
||||
"@vue/cli-plugin-router": "~4.5.0",
|
||||
"@vue/cli-plugin-vuex": "~4.5.0",
|
||||
"@vue/cli-service": "~4.5.0",
|
||||
"@wecity/static-env-config": "1.0.32",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"commitizen": "^4.2.3",
|
||||
"conventional-changelog-cli": "^2.1.1",
|
||||
"conventional-changelog-custom-config": "^0.3.1",
|
||||
"cross-env": "^7.0.3",
|
||||
"css-properties-sorting": "^1.0.10",
|
||||
"eslint": "^6.7.2",
|
||||
"eslint-config-airbnb-base": "^14.2.1",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-import-resolver-alias": "^1.1.2",
|
||||
"eslint-plugin-import": "^2.24.0",
|
||||
"eslint-plugin-prettier": "^3.3.1",
|
||||
"eslint-plugin-vue": "^6.2.2",
|
||||
"glob": "^7.1.6",
|
||||
"globby": "^11.0.3",
|
||||
"hard-source-webpack-plugin": "^0.13.1",
|
||||
"less": "^3.0.4",
|
||||
"less-loader": "^5.0.0",
|
||||
"lint-staged": "^10.5.4",
|
||||
"mockjs": "^1.1.0",
|
||||
"modify-source-webpack-plugin": "^3.0.0",
|
||||
"node-object-hash": "^2.3.8",
|
||||
"nodemon": "^2.0.7",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.3.2",
|
||||
"rimraf": "^3.0.2",
|
||||
"style-resources-loader": "^1.4.1",
|
||||
"stylelint": "^13.12.0",
|
||||
"stylelint-config-prettier": "^8.0.2",
|
||||
"stylelint-config-tencent": "1.0.0",
|
||||
"stylelint-order": "^4.1.0",
|
||||
"terser-webpack-plugin": "4.2.3",
|
||||
"vue-cli-plugin-style-resources-loader": "~0.1.5",
|
||||
"vue-template-compiler": "~2.6.11"
|
||||
},
|
||||
"config": {
|
||||
"commitizen": {
|
||||
"path": "cz-customizable"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"src/**/*.{js,vue}": "yarn lint",
|
||||
"src/**/*.{vue,js,scss,less,css,html}": "yarn lint:style"
|
||||
},
|
||||
"changelog": {
|
||||
"emojis": true,
|
||||
"authorName": true,
|
||||
"authorEmail": false
|
||||
},
|
||||
"main": "index.js",
|
||||
"repository": "http://10.23.12.27:8089/qyd-znsb/znsb-mhzc.git",
|
||||
"author": "wangjianxin@css.com.cn <wangjianxin@css.com.cn>",
|
||||
"license": "MIT"
|
||||
}
|
||||
8
txw-gxzx-web/prettier.config.js
Normal file
8
txw-gxzx-web/prettier.config.js
Normal file
@ -0,0 +1,8 @@
|
||||
const prettierConfig = require('@gtff/tdesign-gt-vue/prettier.config');
|
||||
|
||||
const config = {
|
||||
...prettierConfig,
|
||||
endOfLine: 'auto',
|
||||
};
|
||||
|
||||
module.exports = config;
|
||||
13
txw-gxzx-web/proxy.js
Normal file
13
txw-gxzx-web/proxy.js
Normal file
@ -0,0 +1,13 @@
|
||||
const CONTEXT = process.env.VUE_APP_API_BASE_URL;
|
||||
const CONTEXT_REWRITE = `^${CONTEXT}`;
|
||||
|
||||
module.exports = {
|
||||
proxy: {
|
||||
[CONTEXT]: {
|
||||
target: 'http://86.20.164.120:8081', // 房土
|
||||
pathRewrite: {
|
||||
[CONTEXT_REWRITE]: '',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
3
txw-gxzx-web/stylelint.config.js
Normal file
3
txw-gxzx-web/stylelint.config.js
Normal file
@ -0,0 +1,3 @@
|
||||
const stylelintConfig = require('@gtff/tdesign-gt-vue/stylelint.config');
|
||||
|
||||
module.exports = stylelintConfig;
|
||||
347
txw-gxzx-web/vue.config.js
Normal file
347
txw-gxzx-web/vue.config.js
Normal file
@ -0,0 +1,347 @@
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const glob = require('glob');
|
||||
// const webpack = require('webpack');
|
||||
const devServerPort = process.env.VUE_APP_DEV_SERVER_PORT || 8090;
|
||||
const PAGE_PATH = path.resolve(__dirname, './src/pages');
|
||||
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
|
||||
const StaticEnvConfigPlugin = require('@wecity/static-env-config').default;
|
||||
const TIconReplaceWebpackPlugin = require('@gtff/tdesign-gt-vue/icon/plugin');
|
||||
const AutoRouterPlugin = require('@gtff/tdesign-gt-vue/plugins/auto-router');
|
||||
const CSSSplitWebpackPlugin = require('css-split-webpack-plugin').default;
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
const mock = require('./mock');
|
||||
const packageName = require('./package.json').name;
|
||||
|
||||
const LOCAL_DEV = process.env.VUE_APP_MODEL === 'local';
|
||||
|
||||
// 本地开发配置代理
|
||||
// const PROXY = LOCAL_DEV ? require('./proxy') : {};
|
||||
|
||||
// 根据启动的模式使用不同的template
|
||||
const template = LOCAL_DEV ? 'public/local.html' : 'public/index.html';
|
||||
const isExtract = process.env.NODE_ENV === 'production' || process.env.VUE_APP_CSS_EXTRACT === 'true';
|
||||
|
||||
/**
|
||||
* 获取页面入口集合 for devServer
|
||||
*/
|
||||
function getPagesEntities(pagePath) {
|
||||
const entities = {};
|
||||
glob.sync(pagePath).forEach((entity) => {
|
||||
const moduleName = entity.split('/').slice(-1);
|
||||
entities[moduleName] = entity;
|
||||
});
|
||||
// eg:
|
||||
// {
|
||||
// apply_admin: './src/pages/admin_manage/index',
|
||||
// test: './src/pages/test/index'
|
||||
// }
|
||||
return entities;
|
||||
}
|
||||
|
||||
const pages = getPagesEntities(`${PAGE_PATH}/*`);
|
||||
|
||||
const multiPage = {};
|
||||
|
||||
Object.keys(pages).forEach((page) => {
|
||||
if (!Object.prototype.hasOwnProperty.call(pages, page)) {
|
||||
return;
|
||||
}
|
||||
const configFile = `${PAGE_PATH}/${page}/config.js`;
|
||||
const config = fs.existsSync(configFile) ? require(configFile) : {};
|
||||
multiPage[page] = {
|
||||
// page 的入口
|
||||
entry: `src/pages/${page}/main.js`,
|
||||
// 模板来源
|
||||
template,
|
||||
// 在 dist/index.html 的输出
|
||||
filename: page === 'index' ? `${page}.html` : `${page}/index.html`,
|
||||
// 当使用 title 选项时,
|
||||
// template 中的 title 标签需要是 <title><%= htmlWebpackPlugin.options.title %></title>
|
||||
title: process.env.VUE_APP_NAME || '可信碳信息网',
|
||||
// 在这个页面中包含的块,默认情况下会包含
|
||||
// 提取出来的通用 chunk 和 vendor chunk。
|
||||
chunks: ['chunk-vendors', 'chunk-common', page],
|
||||
...config,
|
||||
};
|
||||
});
|
||||
|
||||
/**
|
||||
* 将对应环境的env的环境变量处理成常量,等待注入到static-env-config插件配置中去
|
||||
* 只注入VUE_APP_开头的环境变量
|
||||
*/
|
||||
const STATIC_ENV_CONFIG = {};
|
||||
Object.keys(process.env).forEach((key) => {
|
||||
if (/^VUE_APP_/.test(key)) {
|
||||
Object.assign(STATIC_ENV_CONFIG, {
|
||||
[key]: process.env[key],
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
delete STATIC_ENV_CONFIG.VUE_APP_API_BASE_URL;
|
||||
delete STATIC_ENV_CONFIG.VUE_APP_CDN_PATH;
|
||||
delete STATIC_ENV_CONFIG.VUE_APP_ROUTER_BASE;
|
||||
|
||||
/**
|
||||
* 修复生产模式build出来的css background image url(~@)路径不符合预期的问题
|
||||
* @type {string[]}
|
||||
*/
|
||||
const styles = ['css', 'postcss', 'scss', 'sass', 'less', 'stylus'];
|
||||
const modules = ['vue-modules', 'vue', 'normal-modules', 'normal'];
|
||||
|
||||
const configureWebpackPlugin = [];
|
||||
|
||||
/**
|
||||
* 本地开发启用hard-source-webpack-plugin
|
||||
*/
|
||||
if (LOCAL_DEV) {
|
||||
console.log('====>> 启动本地开发缓存');
|
||||
configureWebpackPlugin.push(
|
||||
new HardSourceWebpackPlugin({
|
||||
// 缓存目录,支持相对目录或绝对目录
|
||||
// 如果有设置VUE_APP_HARD_SOURCE_FOLDER目录则使用设置值
|
||||
// 一般在coding流水线编译使用,把缓存设置到`/data/npm/`中,不会丢失
|
||||
cacheDirectory: `${(process.env.VUE_APP_HARD_SOURCE_FOLDER && path.join(process.env.VUE_APP_HARD_SOURCE_FOLDER, '/')) ||
|
||||
path.join(process.cwd(), 'node_modules', '/')
|
||||
}.cache/hard-source/[confighash]`,
|
||||
// 基于package.json中的name来生成不同的hash串用于cacheDirectory的目录
|
||||
// @param webpackConfig
|
||||
configHash(webpackConfig) {
|
||||
return require('node-object-hash')({ sort: false }).hash({ packageName, ...webpackConfig });
|
||||
},
|
||||
// 根据目录中的lock文件来决定是否重设缓存,如果设置false则需要手动删除
|
||||
environmentHash: {
|
||||
root: process.cwd(),
|
||||
directories: [],
|
||||
files: ['package-lock.json', 'yarn.lock'],
|
||||
},
|
||||
info: {
|
||||
// 'none' or 'test'.
|
||||
mode: 'none',
|
||||
// 'debug', 'log', 'info', 'warn', or 'error'.
|
||||
level: 'debug',
|
||||
},
|
||||
// 自动清除过期、过大缓存
|
||||
cachePrune: {
|
||||
// 缓存时间:默认7天
|
||||
maxAge: 7 * 24 * 60 * 60 * 1000,
|
||||
// 超过该处设置的阈值(默认500MB),则自动删除缓存
|
||||
sizeThreshold: 500 * 1024 * 1024,
|
||||
},
|
||||
}),
|
||||
new HardSourceWebpackPlugin.ExcludeModulePlugin([
|
||||
{
|
||||
// HardSource works with mini-css-extract-plugin but due to how
|
||||
// mini-css emits assets, assets are not emitted on repeated builds with
|
||||
// mini-css and hard-source together. Ignoring the mini-css loader
|
||||
// modules, but not the other css loader modules, excludes the modules
|
||||
// that mini-css needs rebuilt to output assets every time.
|
||||
test: /mini-css-extract-plugin[\\/]dist[\\/]loader/,
|
||||
},
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
if (isExtract) {
|
||||
configureWebpackPlugin.push(
|
||||
new CSSSplitWebpackPlugin({
|
||||
size: 4000,
|
||||
preserve: true,
|
||||
filename: 'assets_res/css/[name]-[part].[ext]',
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
if (process.env.VUE_APP_AUTO_ROUTER === 'true') {
|
||||
console.log('====>> 启动自动路由,若不需要请在.env.development文件把[VUE_APP_AUTO_ROUTER]变量删除或者设置为false');
|
||||
configureWebpackPlugin.push(new AutoRouterPlugin({ pages: './src/pages/*/views' }));
|
||||
}
|
||||
const transpileDependencies = ['tdesign-icons-vue', '@gt4/common-front'];
|
||||
if (LOCAL_DEV && process.env.VUE_APP_IE === 'true') {
|
||||
transpileDependencies.push('sockjs-client');
|
||||
}
|
||||
module.exports = {
|
||||
lintOnSave: LOCAL_DEV,
|
||||
transpileDependencies,
|
||||
publicPath: process.env.NODE_ENV === 'production' ? '/' : process.env.VUE_APP_CDN_PATH,
|
||||
assetsDir: 'assets_res',
|
||||
// 生产模式生成sourcemap
|
||||
productionSourceMap: false,
|
||||
css: {
|
||||
sourceMap: false,
|
||||
// 在真实ie9下调试dev需要开始样式分离才能正常加载样式
|
||||
extract: isExtract,
|
||||
},
|
||||
chainWebpack: (config) => {
|
||||
// alias注册
|
||||
// eg:
|
||||
// config.resolve.alias.set('@src', path.resolve(process.cwd(), 'src'));
|
||||
|
||||
/**
|
||||
* 修复生产模式build出来的css background-image: url(~@)路径不符合预期的问题
|
||||
* eg: alias to pages/index => ~@/pages/index
|
||||
*/
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
styles.forEach((s) => {
|
||||
modules.forEach((m) =>
|
||||
config.module
|
||||
.rule(s)
|
||||
.oneOf(m)
|
||||
.use('extract-css-loader')
|
||||
.tap((options) => {
|
||||
// Set whatever you want as publicPath
|
||||
// options.publicPath = process.env.VUE_APP_CDN_PATH;
|
||||
// Object.assign(options, {
|
||||
// publicPath: './',
|
||||
// });
|
||||
return options;
|
||||
}),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
config.plugin('static-env-config').use(
|
||||
new StaticEnvConfigPlugin({
|
||||
// url: './env.config.js',
|
||||
url: '/view/gxzx/env.config.js',
|
||||
headResourceTags: [
|
||||
{
|
||||
tagName: 'link',
|
||||
attributes: {
|
||||
href: '/favicon.ico',
|
||||
rel: 'icon',
|
||||
},
|
||||
},
|
||||
],
|
||||
config: {
|
||||
// 这三个必须配置,默认从.env文件中来
|
||||
ROUTER_PREFIX: process.env.VUE_APP_ROUTER_BASE,
|
||||
API_PREFIX: process.env.VUE_APP_API_BASE_URL,
|
||||
RESOURCE_PREFIX: process.env.VUE_APP_CDN_PATH,
|
||||
// 把config里面的配置注入到最终的env.config.js中
|
||||
...STATIC_ENV_CONFIG,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
// 移除prefetch插件
|
||||
config.plugins.delete('prefetch-index');
|
||||
},
|
||||
|
||||
configureWebpack: {
|
||||
// 以下规则用于微前端
|
||||
// 让主应用能正确识别微应用暴露出来的一些信息
|
||||
output: {
|
||||
library: `${packageName}-[name]`,
|
||||
libraryTarget: 'umd',
|
||||
jsonpFunction: `webpackJsonp_${packageName}`,
|
||||
},
|
||||
optimization: {
|
||||
minimizer: [
|
||||
new TerserPlugin({
|
||||
terserOptions: {
|
||||
compress: {
|
||||
warnings: false,
|
||||
drop_console: true,
|
||||
drop_debugger: true,
|
||||
},
|
||||
},
|
||||
}),
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
...configureWebpackPlugin,
|
||||
// t-icon替换插件
|
||||
new TIconReplaceWebpackPlugin({
|
||||
staticPath: 'static_res',
|
||||
}),
|
||||
],
|
||||
},
|
||||
|
||||
/**
|
||||
* 本地开发服务配置
|
||||
*/
|
||||
devServer: {
|
||||
port: devServerPort,
|
||||
host: '0.0.0.0',
|
||||
contentBase: './dist',
|
||||
publicPath: process.env.VUE_APP_ROUTER_BASE,
|
||||
https: process.env.VUE_APP_PROTOCOL_HTTPS === 'true',
|
||||
compress: false,
|
||||
disableHostCheck: true,
|
||||
overlay: {
|
||||
warnings: false,
|
||||
errors: true,
|
||||
},
|
||||
headers: {
|
||||
'X-Custom-Foo': 'bar',
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
|
||||
'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization',
|
||||
},
|
||||
// proxy: {
|
||||
// // '/api': {
|
||||
// // // target: 'http://dzswj.mhnsrd.jcsj.tax.cn/sbzx/api/cxssb', // 云测试环境
|
||||
// // target: 'http://86.20.165.47:8082/dfts/api/sbf/',
|
||||
// // changeOrigin: true,
|
||||
// // // 用于将/api从请求路径中移除
|
||||
// // pathRewrite: {
|
||||
// // '^/api': '',
|
||||
// // },
|
||||
// // },
|
||||
// [process.env.VUE_APP_API_BASE_URL]: {
|
||||
// // target: 'http://dzswj.mhnsrd.jcsj.tax.cn/sbzx/api/cxssb', // 云测试环境
|
||||
// target: 'http://127.0.0.1:48080/', // 苗梓誉职工&单位缴费证明开具
|
||||
// changeOrigin: true,
|
||||
// // 用于将/api从请求路径中移除
|
||||
// pathRewrite: {
|
||||
// // '^/znsb/api': '',
|
||||
// },
|
||||
// },
|
||||
// '/gs-api': {
|
||||
// target: 'https://zr.jcsk100.com//', // 目标服务器地址 跳转到个税页面,跨域用的
|
||||
// changeOrigin: true,
|
||||
// pathRewrite: {
|
||||
// '^/gs-api': ''
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
before(app) {
|
||||
if (process.env.VUE_APP_MOCK === 'true') {
|
||||
// 是否开启MOCK,默认开启,检查项目根目录下是否存在.env.development文件 内容为VUE_APP_MOCK=true
|
||||
// 设置mock数据路由, 创建get或者post目录,该目录下的文件则为url请求地址
|
||||
// app对象、请求方法、url前缀
|
||||
// mock.setMock(app, 'get', process.env.VUE_APP_API_BASE_URL);
|
||||
// app对象、请求方法、url前缀 eg: user_bulk__delete.json => /api/user/bulk_delete
|
||||
// mock.setMock(app, 'post', process.env.VUE_APP_API_BASE_URL);
|
||||
// mock.mockSubDirs(app, ['post'], '/abc') // 增加子目录,mock/xxx/post 目录下的文件为url请求地址 eg: user_bulk__delete.json => /xxx/abc/user/bulk_delete
|
||||
// 设置mock数据路由, 对应目录下,创建get或者post目录,再请求目录下创建业务目录demo(没有层级层级的限制),该目录下的文件则为url请求地址 eg: fail.json => /demo/fail
|
||||
// app对象、请求方法、url前缀
|
||||
mock.setMockByBasePath(app, 'get', process.env.VUE_APP_API_BASE_URL);
|
||||
mock.setMockByBasePath(app, 'post', process.env.VUE_APP_API_BASE_URL);
|
||||
}
|
||||
},
|
||||
// ...PROXY,
|
||||
},
|
||||
/**
|
||||
* 插件配置
|
||||
*/
|
||||
pluginOptions: {
|
||||
// 添加了插件(@samhammer/vue-cli-plugin-stylelint), 所以需要配置
|
||||
lintStyleOnBuild: true,
|
||||
stylelint: {
|
||||
fix: true, // boolean (default: true)
|
||||
files: ['src/**/*.{vue,htm,html,css,sss,less,scss}'], // string | [string]
|
||||
},
|
||||
// 注入less全局变量
|
||||
'style-resources-loader': {
|
||||
preProcessor: 'less',
|
||||
patterns: [path.resolve(__dirname, './src/styles/variables/*.less')],
|
||||
},
|
||||
},
|
||||
/**
|
||||
* 多页应用配置
|
||||
*/
|
||||
pages: multiPage,
|
||||
};
|
||||
13825
txw-gxzx-web/yarn.lock
Normal file
13825
txw-gxzx-web/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user