Browse Source

新增npm run version 命令,在打包后的文件夹中添加版本文件

yunxing 4 years ago
parent
commit
f465516ccd
2 changed files with 2 additions and 1 deletions
  1. 1 0
      package.json
  2. 1 1
      version.js

+ 1 - 0
package.json

@@ -15,6 +15,7 @@
         "build:wanda_dev": "cross-env NODE_ENV=wanda_dev vue-cli-service build",
         "build:wanda_build": "cross-env NODE_ENV=wanda_build vue-cli-service build",
         "lint": "vue-cli-service lint",
+        "version": "node version.js",
         "publish": "node publish.js"
     },
     "dependencies": {

+ 1 - 1
version.js

@@ -1,6 +1,6 @@
 /** 自动记录版本信息**/
 const fs = require('fs')
-const buildPath = 'wandaBmGuide' //放置 version.txt的路径
+const buildPath = process.env.npm_package_remote_local //'wandaBmGuide' //放置 version.txt的路径
 const execSync = require('child_process').execSync //同步子进程
 const date = new Date() // Date对象