@be-link/cos 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/upload.js +6 -3
- package/package.json +2 -2
package/lib/upload.js
CHANGED
|
@@ -4,9 +4,12 @@ const path = require('path')
|
|
|
4
4
|
const COS = require('cos-nodejs-sdk-v5')
|
|
5
5
|
const BUCKETS_CONFIG = require('./config')
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
const argv = process.argv.slice(2)
|
|
8
|
+
const [mode] = argv
|
|
9
|
+
console.log('mode', mode)
|
|
10
|
+
|
|
8
11
|
// 获取项目名称
|
|
9
|
-
const baseUrl = 'project/prod/'
|
|
12
|
+
const baseUrl = mode === 'production' ? 'project/prod/' : 'project/dev'
|
|
10
13
|
const packageUrl = path.resolve(process.cwd(), './package.json')
|
|
11
14
|
const projectPackage = fs.readFileSync(packageUrl, { encoding: 'utf-8' })
|
|
12
15
|
const projectName = JSON.parse(projectPackage).name
|
|
@@ -37,7 +40,6 @@ function upload(url, filename) {
|
|
|
37
40
|
if (err) {
|
|
38
41
|
console.log('文件上传失败', err)
|
|
39
42
|
}
|
|
40
|
-
console.log('上传成功')
|
|
41
43
|
},
|
|
42
44
|
)
|
|
43
45
|
}
|
|
@@ -116,6 +118,7 @@ function deleteProject() {
|
|
|
116
118
|
// 上传新的文件
|
|
117
119
|
|
|
118
120
|
function staticUploadToCos() {
|
|
121
|
+
console.log('资源上传至:https://release-1304510571.file.myqcloud.com' + projectRemoteUrl)
|
|
119
122
|
const files = getAllFiles(distDirUrl)
|
|
120
123
|
deleteProject().then(() => {
|
|
121
124
|
files.forEach((file) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@be-link/cos",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "前端项目产物上传cos",
|
|
5
5
|
"author": "zhuifeng <yangyiboys@163.com>",
|
|
6
6
|
"homepage": "https://github.com/snowmountain-top/be-link#readme",
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"publishConfig": {
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "7f41c9d4fef198348a623e16383a0e1cad6e1238"
|
|
31
31
|
}
|