Эх сурвалжийг харах

feat: 新增jy-version流程

zhangyuhan 5 жил өмнө
parent
commit
b740c65301
7 өөрчлөгдсөн 907 нэмэгдсэн , 633 устгасан
  1. 57 60
      .drone.yml
  2. 13 8
      .gitignore
  3. 39 0
      ch2version.config.json
  4. 146 0
      ch2version.version.json
  5. 16 9
      package.json
  6. 5 9
      vue.config.js
  7. 631 547
      yarn.lock

+ 57 - 60
.drone.yml

@@ -1,74 +1,73 @@
 kind: pipeline
-name: default
+name: 数据报告-构建
 
 steps:
-  - name: restore-cache
-    image: drillster/drone-volume-cache
-    volumes:
-      - name: cache
-        path: /cache
-    settings:
-      restore: true
-      mount:
-        - ./node_modules
-
+  # 环境依赖相关
   - name: npm-install
-    image: node:10.21.0
+    pull: if-not-exists
+    image: node:lts
     commands:
-      - echo Running check
       - echo Use yarn management node_modules
       - npm config set registry https://registry.npm.taobao.org --global
       - npm config set disturl https://npm.taobao.org/dist --global
       - npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass
-      - npm install yarn
+      - npm install yarn -D
       - yarn config set registry https://registry.npm.taobao.org --global
       - yarn config set disturl https://npm.taobao.org/dist --global
       - yarn config set sass_binary_site https://npm.taobao.org/mirrors/node-sass
-      - yarn
-
-  - name: rebuild-cache
-    image: drillster/drone-volume-cache
-    volumes:
-      - name: cache
-        path: /cache
-    settings:
-      rebuild: true
-      mount:
-        - ./node_modules
-
-
+      - yarn install --prefer-offline
+  # 质量相关
   - name: lint-code
-    image: node:10.21.0
+    pull: if-not-exists
+    image: node:lts
+    failure: ignore
     commands:
       - npm run lint
-
+  # 编译相关
   - name: build-code
-    image: node:10.21.0
+    pull: if-not-exists
+    image: node:lts
     commands:
-      - npm -v
-      - node -v
-      - npm run build
-      - npm run replace
-      - pwd
-      - ls -l
-
-  - name: scp-code
-    image: appleboy/drone-scp
+      - npm run build:ci
+  # 部署相关
+  # 压缩
+  - name: zip
+    pull: if-not-exists
+    image: alpine
+    commands:
+      - tar -cvf dist-datareport.tar ./dist-version
+  # 邮件
+  - name: notify
+    pull: if-not-exists
+    image: drillster/drone-email
     settings:
-      host:
-        from_secret: ssh_host
+      host: smtp.exmail.qq.com
+      port: 465
       username:
-        from_secret: ssh_user
-      port: 22
+        from_secret: email_username
       password:
-        from_secret: ssh_password
-      target:
-        from_secret: ssh_remote_dir
-      source:
-        - datareport
+        from_secret: email_password
+      from: zhangyuhan@topnet.net.cn
+      recipients:
+        - zhangyuhan@topnet.net.cn
+      attachment: dist-datareport.tar
+  # 回推Git
+  - name: push-commit
+    pull: if-not-exists
+    image: appleboy/drone-git-push
+    settings:
+      ssh_key:
+        from_secret: ssh_key
+      remote:
+        from_secret: git_remote
+      branch: dev1.4
+      force: false
+      commit: true
+
 
-#
+#  # 钉钉通知
 #  - name: notification-success
+#    pull: if-not-exists
 #    image: lddsb/drone-dingtalk-message
 #    settings:
 #      token:
@@ -76,15 +75,14 @@ steps:
 #      secret:
 #        from_secret: ding-secret-for-generate-sign
 #      type: markdown
-#      tpl: ./ding.md
-#      tips_title: '滴滴'
+#      tpl: ./ding-build.md
+#      tips_title: '滴滴,编译打包成功'
 #      success_color: "008000"
-#      success_pic: "https://raw.githubusercontent.com/Ethan-Liuu/picture/master/success.png"
 #    when:
 #      status:
 #        - success
-#
 #  - name: notification-failure
+#    pull: if-not-exists
 #    image: lddsb/drone-dingtalk-message
 #    settings:
 #      token:
@@ -92,16 +90,15 @@ steps:
 #      secret:
 #        from_secret: ding-secret-for-generate-sign
 #      type: markdown
-#      tpl: ./ding.md
-#      tips_title: '滴滴'
+#      tpl: ./ding-build.md
+#      tips_title: 'Error, 编译打包错误待处理'
 #      success_color: "FF0000"
-#      success_pic: "https://raw.githubusercontent.com/Ethan-Liuu/picture/master/failed.png"
 #    when:
 #      status:
 #        - failure
 
+trigger:
+  event:
+    include:
+      - tag
 
-volumes:
-  - name: cache
-    host:
-      path: /home/parallels/Desktop/cache

+ 13 - 8
.gitignore

@@ -1,8 +1,15 @@
 .DS_Store
 node_modules
+/dist*
 /datareport
-dist
-rev
+/node_modules
+/online
+
+# compressed files
+*.rar
+*.zip
+*.7z
+*.tar
 
 # local env files
 .env.local
@@ -12,18 +19,16 @@ rev
 npm-debug.log*
 yarn-debug.log*
 yarn-error.log*
+pnpm-debug.log*
 
 # Editor directories and files
 .idea
-# .vscode
+.vscode
 *.suo
 *.ntvs*
 *.njsproj
 *.sln
 *.sw?
 
-# 压缩文件
-*.rar
-*.zip
-*.7z
-.vscode
+# yarn only lock
+package-lock.json

+ 39 - 0
ch2version.config.json

@@ -0,0 +1,39 @@
+{
+    "language": "cn",
+    "mode": "base",
+    "version": "8000",
+    "inDir": "./datareport",
+    "outDir": "./dist-version",
+    "config": "./ch2version.config.json",
+    "outVersion": "./ch2version.version.json",
+    "git": false,
+    "clear": true,
+    "rewrite": true,
+    "prompt": false,
+    "ignore": [
+        ".git/"
+    ],
+    "replaceDomain": {
+        "readPath": "dist-version",
+        "baseURL": "/datareport/",
+        "urlLocal": "/jyapp/local",
+        "output": [
+            {
+                "origin": "res://app-i2.jianyu360.com",
+                "fileName": "index_i2.html"
+            },
+            {
+                "origin": "res://app-i1.jianyu360.com",
+                "fileName": "index_i1.html"
+            },
+            {
+                "origin": "res://app2-jytest.jianyu360.cn",
+                "fileName": "index_app2.html"
+            },
+            {
+                "origin": "",
+                "fileName": "index_android.html"
+            }
+        ]
+    }
+}

+ 146 - 0
ch2version.version.json

@@ -0,0 +1,146 @@
+{
+    "css": {
+        "404.css": {
+            "name": "404.css",
+            "hash": "e79e75d42a",
+            "version": "8000",
+            "md5": "c0a0bbd9ae9a5af1c65bcecf504e5be0"
+        },
+        "app.css": {
+            "name": "app.css",
+            "hash": "bd17442c67",
+            "version": "8000",
+            "md5": "bb72a0af02025ed53c7a48e627ced3ae"
+        },
+        "chunk-vendors.css": {
+            "name": "chunk-vendors.css",
+            "hash": "419a403883",
+            "version": "8000",
+            "md5": "80399b082ead75e6f6198896f55d60f5"
+        },
+        "home.css": {
+            "name": "home.css",
+            "hash": "9719670bf1",
+            "version": "8000",
+            "md5": "23dce0cb84a90f4b5f6d49534fc69f27"
+        },
+        "index.css": {
+            "name": "index.css",
+            "hash": "05d826bd53",
+            "version": "8000",
+            "md5": "2e0bb83b227f26965069ca899445f50e"
+        },
+        "order.css": {
+            "name": "order.css",
+            "hash": "5227253d8e",
+            "version": "8000",
+            "md5": "1221f90a981229ce8b5af5db0bbab42f"
+        },
+        "pay.css": {
+            "name": "pay.css",
+            "hash": "ca3760e3ac",
+            "version": "8000",
+            "md5": "83f65fbc0cad8188ac19854710462b4c"
+        },
+        "test.css": {
+            "name": "test.css",
+            "hash": "9506a72505",
+            "version": "8000",
+            "md5": "aa4315f2045ffe6db911e18c88286051"
+        }
+    },
+    "favicon.ico": {
+        "name": "favicon.ico",
+        "hash": "",
+        "version": "8000",
+        "md5": "52c992b5ec4cd2d487fd7d4a1d55ff7d"
+    },
+    "img": {
+        "data_report_bg.png": {
+            "name": "data_report_bg.png",
+            "hash": "36057767",
+            "version": "8000",
+            "md5": "1cbffa486a45b78fcc27d149dc3879c3"
+        },
+        "empty.png": {
+            "name": "empty.png",
+            "hash": "b176b285",
+            "version": "8000",
+            "md5": "0805e8ba9ad0151a1e6e8e186ccc67d4"
+        },
+        "order-detail-header-mask3x.png": {
+            "name": "order-detail-header-mask3x.png",
+            "hash": "df2d82e2",
+            "version": "8000",
+            "md5": "f1f1fff0a374f8eb8594a470b5ff0f3b"
+        },
+        "order-shujubaogao.png": {
+            "name": "order-shujubaogao.png",
+            "hash": "62e4e2f4",
+            "version": "8000",
+            "md5": "7ef74941deacfd8a5aadfa9bdc7e89ff"
+        }
+    },
+    "index.html": {
+        "name": "index.html",
+        "hash": "",
+        "version": "8000",
+        "md5": "d287f761248726914c9aa5e57228009e"
+    },
+    "js": {
+        "404.js": {
+            "name": "404.js",
+            "hash": "2dc3a414b3",
+            "version": "8000",
+            "md5": "f13f4d91ec7ab0aa542dff5d639131e0"
+        },
+        "app.js": {
+            "name": "app.js",
+            "hash": "03eeef705d",
+            "version": "8000",
+            "md5": "c1c9037579e6672a571d72c01998b2ff"
+        },
+        "chunk-vendors.js": {
+            "name": "chunk-vendors.js",
+            "hash": "d846a180f9",
+            "version": "8000",
+            "md5": "0073cd67e65b8742d44fba0429332b4c"
+        },
+        "commonForVue.js": {
+            "name": "commonForVue.js",
+            "hash": "",
+            "version": "8000",
+            "md5": "909f882733ba639181a8a3961fb4bec4"
+        },
+        "home.js": {
+            "name": "home.js",
+            "hash": "e32f7c7dee",
+            "version": "8000",
+            "md5": "59cb88f7997cf1668c4add68c92a6f33"
+        },
+        "index.js": {
+            "name": "index.js",
+            "hash": "1342579672",
+            "version": "8000",
+            "md5": "b33da905bed42e9b738c43b244cbd284"
+        },
+        "order.js": {
+            "name": "order.js",
+            "hash": "0718c71a40",
+            "version": "8000",
+            "md5": "3df63675c30ac907a6077ae6437bbcdb"
+        },
+        "pay.js": {
+            "name": "pay.js",
+            "hash": "e325d914ee",
+            "version": "8000",
+            "md5": "8898b0b1feab70d9ab6b20d6706b5436"
+        },
+        "test.js": {
+            "name": "test.js",
+            "hash": "66b264b508",
+            "version": "8000",
+            "md5": "33e586cd85bd65100c61c5adbb542578"
+        }
+    }
+}

+ 16 - 9
package.json

@@ -5,23 +5,29 @@
   "scripts": {
     "serve": "vue-cli-service serve",
     "build": "vue-cli-service build --mode production",
-    "build:prod": "npm run build && npm run replace",
-    "replace": "node addVersion.js",
+    "build:prod": "npm run build && npm run ch2version-update && npm run ch2version-replace",
+    "build:base": "npm run build && npm run ch2version-base && npm run ch2version-replace",
+    "build:ci": "npm run build:base",
     "lint": "vue-cli-service lint --fix",
+    "replace": "node addVersion.js",
     "analyzer": "use_analyzer=true vue-cli-service build --mode production",
-    "analyze": "cross-env use_analyzer=true vue-cli-service build --mode production"
+    "analyze": "cross-env use_analyzer=true vue-cli-service build --mode production",
+    "ch2version-update": "ch2version update -lang cn",
+    "ch2version-base": "ch2version base -lang cn",
+    "ch2version-replace": "ch2version replace",
+    "ch2version": "ch2version"
   },
   "dependencies": {
     "axios": "^0.19.2",
     "core-js": "^3.6.4",
-    "vue": "^2.6.11",
-    "vue-router": "^3.1.5",
-    "vuex": "^3.4.0",
-    "vant": "^2.8.2",
-    "moment": "^2.24.0",
     "js-cookie": "^2.2.1",
+    "moment": "^2.24.0",
+    "vant": "^2.8.2",
+    "vue": "^2.6.11",
     "vue-class-component": "^7.2.2",
-    "vue-property-decorator": "^8.3.0"
+    "vue-property-decorator": "^8.3.0",
+    "vue-router": "^3.1.5",
+    "vuex": "^3.4.0"
   },
   "devDependencies": {
     "@types/js-cookie": "^2.2.5",
@@ -38,6 +44,7 @@
     "amfe-flexible": "^2.2.1",
     "autoprefixer": "^9.7.4",
     "babel-plugin-import": "^1.13.0",
+    "contenthash2version": "^0.1.4",
     "cross-env": "^7.0.2",
     "eslint": "^6.7.2",
     "eslint-plugin-import": "^2.20.1",

+ 5 - 9
vue.config.js

@@ -78,8 +78,8 @@ module.exports = {
   },
   css: {
     extract: {
-      filename: `css/[name].css?v=${s_version}`,
-      chunkFilename: `css/[name].css?v=${s_version}`
+      filename: 'css/[name].[contenthash:10].css?v=[contenthash:8]',
+      chunkFilename: 'css/[name].[contenthash:10].css?v=[contenthash:8]'
     },
     loaderOptions: {
       sass: {
@@ -116,6 +116,9 @@ module.exports = {
     // eslint-disable-next-line no-unused-expressions
     // config.plugins.delete('named-chunks')
     if (process.env.NODE_ENV === 'production') {
+      config.output
+        .chunkFilename('js/[name].[contenthash:10].js?v=[contenthash:8]')
+        .filename('js/[name].[contenthash:10].js?v=[contenthash:8]')
       // 打包时需要执行,开发环境运行不需要执行
       config.externals(externals)
 
@@ -173,12 +176,5 @@ module.exports = {
         })
         return options
       })
-  },
-  configureWebpack: {
-    // 修改打包后js文件名
-    output: {
-      filename: `js/[name].js?v=${s_version}`,
-      chunkFilename: `js/[name].js?v=${s_version}`
-    }
   }
 }

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 631 - 547
yarn.lock


Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно