@winner-fed/winner-deploy 3.0.4 → 3.0.5
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/README.md +10 -8
- package/package.json +1 -1
- package/src/genDockerPackage.js +8 -3
- package/src/winner-deploy.js +6 -3
package/README.md
CHANGED
|
@@ -7,11 +7,11 @@ python2 对应 template/1.x
|
|
|
7
7
|
```javscript
|
|
8
8
|
/**
|
|
9
9
|
* 生成 see 平台部署包
|
|
10
|
-
* @param system {string}
|
|
11
|
-
* @param type {string}
|
|
12
|
-
* @param name {string}
|
|
13
|
-
* @param appType {string}
|
|
14
|
-
* @param version {string}
|
|
10
|
+
* @param system {string} 系统类型, SEE 平台的分组是以系统类型字段纬度来的, 默认为 winner-front
|
|
11
|
+
* @param type {string} 应用类型, 外框架 - bizframe | 子系统 - subsystem, 默认为 子系统 - subsystem
|
|
12
|
+
* @param name {string} 发布物名称
|
|
13
|
+
* @param appType {string} 发布物类型, 默认为 应用名称 - name
|
|
14
|
+
* @param version {string} 发布包版本
|
|
15
15
|
* @param configName {string} 配置文件名称,不带有 .js, 默认为 config.local
|
|
16
16
|
* @param templateFunc {function} 自定义变量配置文件, 默认为
|
|
17
17
|
* function () {
|
|
@@ -38,12 +38,14 @@ python2 对应 template/1.x
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
* @param copyFiles {Array<string>} 不包含在 manifest.json 配置的文件,直接拷贝到 see 包里。文件路径是相对于项目根目录的路径+文件名,比如 dist/子包/version.js,那么 copyFiles: ['version.js']
|
|
41
|
+
* @param copyFiles {Array<string>} 不包含在 manifest.json 配置的文件,直接拷贝到 see 包里。文件路径是相对于项目根目录的路径+文件名,比如 dist/子包/version.js,那么 copyFiles: ['version.js']
|
|
42
42
|
* @param description {string} 发布包说明
|
|
43
43
|
* @param seePackageName {string} see发布物的包名,也就是 zip 包的命名,默认为 `${system}-${name}-${version}`
|
|
44
|
-
* @param cb {function} 回调函数,用于处理在组装 see
|
|
44
|
+
* @param cb {function} 回调函数,用于处理在组装 see 包后,可以自定义执行的动作
|
|
45
|
+
* @param seePackageType see 平台发布物包的类型,'web'(默认的) | 'docker'(支持容器化部署的SEE发布物)
|
|
46
|
+
* @param dockerImage docker 容器化镜像名,seePackageType 为 docker 生效
|
|
45
47
|
*/
|
|
46
|
-
exports.generateSeePackageZip = function generateSeePackageZip({system, type, name, appType, version, configName, templateFunc, variablesFunc, copyFiles, description}, cb) {
|
|
48
|
+
exports.generateSeePackageZip = function generateSeePackageZip({system, type, name, appType, version, configName, templateFunc, variablesFunc, copyFiles, description, seePackageType, dockerImage}, cb) {
|
|
47
49
|
...
|
|
48
50
|
}
|
|
49
51
|
```
|
package/package.json
CHANGED
package/src/genDockerPackage.js
CHANGED
|
@@ -31,13 +31,18 @@ exports.genDockerPackage = function genDockerPackage (seePackageName, options, h
|
|
|
31
31
|
template,
|
|
32
32
|
variables,
|
|
33
33
|
configName: configFileName,
|
|
34
|
-
description
|
|
34
|
+
description,
|
|
35
|
+
dockerImage = version.indexOf('-') > 0 ? `ws6.0-docker-dev-local/${name}` : `ws6.0-docker-release-local/${name}`
|
|
35
36
|
} = options
|
|
36
37
|
fs.ensureDirSync(tmp)
|
|
37
38
|
|
|
38
39
|
// 项目根目录下 Dockerfile 文件
|
|
39
40
|
fs.ensureDirSync('docker')
|
|
40
|
-
|
|
41
|
+
|
|
42
|
+
// 如果项目根目录下已经存在 Dockerfile,则不进行重新生成
|
|
43
|
+
if (!fs.pathExistsSync(path.resolve(process.cwd(), `docker/Dockerfile`))) {
|
|
44
|
+
fs.outputFileSync(path.resolve(process.cwd(), `docker/Dockerfile`), genDockerfile({ name }));
|
|
45
|
+
}
|
|
41
46
|
|
|
42
47
|
// 缺少 scripts 目录会导致 SEE 平台上传发布物报错
|
|
43
48
|
fs.ensureDirSync(`${tmp}/scripts`);
|
|
@@ -70,7 +75,7 @@ exports.genDockerPackage = function genDockerPackage (seePackageName, options, h
|
|
|
70
75
|
variables,
|
|
71
76
|
description,
|
|
72
77
|
web_app_web_service_name: `${name}-web`,
|
|
73
|
-
dockerImage
|
|
78
|
+
dockerImage
|
|
74
79
|
}))
|
|
75
80
|
|
|
76
81
|
if (handler) {
|
package/src/winner-deploy.js
CHANGED
|
@@ -67,8 +67,9 @@ function genManifest (type, name) {
|
|
|
67
67
|
* @param copyFiles {Array<string>} 不包含在 manifest.json 配置的文件,直接拷贝到 see 包里。文件路径是相对于项目根目录的路径+文件名,比如 dist/子包/version.js,那么 copyFiles: ['version.js']
|
|
68
68
|
* @param description {string} 发布包说明
|
|
69
69
|
* @param seePackageName {string} see发布物的包名,也就是 zip 包的命名,默认为 `${system}-${name}-${version}`
|
|
70
|
-
* @param cb {function} 回调函数,用于处理在组装 see
|
|
70
|
+
* @param cb {function} 回调函数,用于处理在组装 see 包后,可以自定义执行的动作
|
|
71
71
|
* @param seePackageType see 平台发布物包的类型,'web'(默认的) | 'docker'(支持容器化部署的SEE发布物)
|
|
72
|
+
* @param dockerImage docker 容器化镜像名,seePackageType 为 docker 生效
|
|
72
73
|
*/
|
|
73
74
|
exports.generateSeePackageZip = function generateSeePackageZip ({
|
|
74
75
|
system,
|
|
@@ -82,7 +83,8 @@ exports.generateSeePackageZip = function generateSeePackageZip ({
|
|
|
82
83
|
copyFiles,
|
|
83
84
|
description,
|
|
84
85
|
seePackageName,
|
|
85
|
-
seePackageType = 'web'
|
|
86
|
+
seePackageType = 'web',
|
|
87
|
+
dockerImage
|
|
86
88
|
}, cb) {
|
|
87
89
|
if (!name || !version) {
|
|
88
90
|
throw new Error('应用名称和应用版本不能缺失~')
|
|
@@ -126,7 +128,8 @@ exports.generateSeePackageZip = function generateSeePackageZip ({
|
|
|
126
128
|
configName,
|
|
127
129
|
template: (templateFunc)(),
|
|
128
130
|
variables: (variablesFunc)(),
|
|
129
|
-
description
|
|
131
|
+
description,
|
|
132
|
+
dockerImage
|
|
130
133
|
},
|
|
131
134
|
done => {
|
|
132
135
|
|