@winner-fed/winner-deploy 4.0.0 → 4.0.6
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 +3 -1
- package/dist/index.cjs +7 -7
- package/dist/index.d.ts +130 -0
- package/dist/index.js +7 -7
- package/package.json +11 -18
- package/templates/see/bash/deploy.xml +2 -0
- package/templates/see/docker/deploy.xml +2 -0
- package/templates/see/docker/k8s-deploy-res.yaml +9 -9
- package/templates/see/python/deploy.xml +2 -0
- package/LICENSE +0 -21
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# winner-deploy
|
|
2
2
|
|
|
3
3
|
## 功能接口说明
|
|
4
|
+
|
|
4
5
|
```javscript
|
|
5
6
|
/**
|
|
6
7
|
* 生成 see 平台部署包
|
|
@@ -10,6 +11,7 @@
|
|
|
10
11
|
* @param options.appType {string} 发布物类型, 默认为 应用名称 - name
|
|
11
12
|
* @param options.version {string} 发布包版本
|
|
12
13
|
* @param options.configName {string} 配置文件名称,不带有 .js, 默认为 config.local
|
|
14
|
+
* @param options.outputName {string} 输出的目录名称,默认为 dist
|
|
13
15
|
* @param options.templateFunc {function} 自定义变量配置文件, 默认为
|
|
14
16
|
* function () {
|
|
15
17
|
if (type === 'bizframe') {
|
|
@@ -43,7 +45,7 @@
|
|
|
43
45
|
* @param options.scriptsType 脚本类型 'python'(默认的) | 'bash'
|
|
44
46
|
* @param cb {function} 回调函数,用于处理在组装 see 包后,可以自定义执行的动作
|
|
45
47
|
*/
|
|
46
|
-
export const generateSeePackageZip = function generateSeePackageZip({system, type, name, appType, version, configName, templateFunc, variablesFunc, copyFiles, description, seePackageType, dockerImage, scriptsType}, cb) {
|
|
48
|
+
export const generateSeePackageZip = function generateSeePackageZip({system, type, name, appType, version, configName, outputName, templateFunc, variablesFunc, copyFiles, description, seePackageType, dockerImage, scriptsType}, cb) {
|
|
47
49
|
...
|
|
48
50
|
}
|
|
49
51
|
```
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)}else if(t==="switchForm"||t==="division")p=i.children.map(
|
|
3
|
-
`);else{if(t==="complexSelect")return
|
|
4
|
-
`))(),description:
|
|
5
|
-
`))(),description:
|
|
6
|
-
`))(),description:
|
|
7
|
-
`).succeed(),
|
|
1
|
+
var me=Object.create;var w=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var ye=Object.getOwnPropertyNames;var ge=Object.getPrototypeOf,de=Object.prototype.hasOwnProperty;var q=i=>w(i,"__esModule",{value:!0});var Se=(i,t)=>{q(i);for(var o in t)w(i,o,{get:t[o],enumerable:!0})},$e=(i,t,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ye(t))!de.call(i,r)&&r!=="default"&&w(i,r,{get:()=>t[r],enumerable:!(o=ue(t,r))||o.enumerable});return i},y=i=>$e(q(w(i!=null?me(ge(i)):{},"default",i&&i.__esModule&&"default"in i?{get:()=>i.default,enumerable:!0}:{value:i,enumerable:!0})),i);Se(exports,{generateSeePackageZip:()=>ke});var ae=y(require("chalk")),pe=y(require("path")),z=y(require("ora")),h=y(require("fs-extra"));var g=y(require("fs-extra")),Q=y(require("rimraf"));var X=y(require("path")),D=y(require("fs-extra")),W=y(require("archiver")),K=y(require("xml")),Z=process.cwd(),H=function(t){let o={"&":"&",""":'"',"'":"'","<":"<",">":">"};return t&&t.replace?t.replace(/(&)|(")|(')|(<)|(>)/g,function(r){return o[r]}):t},v=function(t,o){let r=o||"",a=X.default.resolve(Z,t,r,"sysconfig.js");return D.default.pathExistsSync(a)},E=function(t){let o=X.default.resolve(Z,t,"config.local.js");return D.default.pathExistsSync(o)},F=function(t,o,r){let a="package";D.default.ensureDirSync(a);let n=D.default.createWriteStream(`${a}/${t}.zip`);n.on("close",function(){setTimeout(function(){r&&r()})});let e=(0,W.default)("zip",{zlib:{level:9}});e.on("error",function(l){console.error(),console.error(l.stack||l),l.details&&console.error(l.details)}),e.pipe(n),e.directory(o,!1),e.finalize()},L=function(t,o,r){let{type:a,label:n,name:e,tooltip:l="",visible:s="true",required:c="false",fixed:p="false",fold:f="false",options:m=""}=t,d=t.default;if(r==="form"){let x=(0,K.default)({form:[{_attr:{name:e,tooltip:l,visible:s,required:c,fixed:p,fold:f,options:m}},o]});return exports.unEscapeForXML(x)}let O=(0,K.default)({field:[{_attr:{type:a,label:n,name:e,tooltip:l,visible:s,required:c,fixed:p,fold:f,options:m}},d||o]});return exports.unEscapeForXML(O)},Y=function(t){let r=t.children.map(a=>{let e=a.children.map(l=>L(l)).join("");return L(a,e,"form")}).join("");return L(t,r)},M=function i(t,o,r="",a=""){for(let n=0;n<t.length;n++){let e=t[n];if(e.fullName=`${r===""?"":r+"."}${e.name}`,e.fullPath=`${a===""?"":a+"-"}${e.type}`,o(e))return e;if(e.children&&e.children.length>0){let l=i(e.children,o,e.fullName,e.fullPath);if(l)return l}}return null};var k=y(require("fs-extra")),G=y(require("path")),b=y(require("lodash.template")),ee=y(require("xml")),te=y(require("@babel/core"));var he=["input","editor","select","switch","smallfile","table","mselect","switchForm","complexSelect","division"],P=i=>G.default.resolve(__dirname,`../templates/see/${i}`),N=i=>{let t=i.type;if(!he.includes(t))return"";let{label:o,name:r,tooltip:a="",visible:n="true",required:e="false",fixed:l="false",fold:s="false",options:c=""}=i,p=i.default;if(t==="table"){let m=i.keys||[];p=(i.columns||m).map(O=>N(O)).join(`
|
|
2
|
+
`)}else if(t==="switchForm"||t==="division")p=i.children.map(d=>N(d)).join(`
|
|
3
|
+
`);else{if(t==="complexSelect")return Y(i);t==="editor"?p=[JSON.stringify(p)]:p=[p]}let f=(0,ee.default)({field:[{_attr:{type:t,label:o,name:r,tooltip:a,visible:n,required:e,fixed:l,fold:s,options:c}},p].concat(p)});return H(`${f}`)},ne=function({system:t,type:o,name:r,appType:a,version:n,configFileName:e="config.local",variables:l=[],description:s}){let c=k.default.readFileSync(P("python/deploy.xml")).toString();return(0,b.default)(c,{interpolate:/{{([\s\S]+?)}}/g})({system:t,type:o,name:r,appType:a,version:n,configFileName:e,variables:(()=>l.map(p=>N(p)).join(`
|
|
4
|
+
`))(),description:s})},j=function(t,o){let r=k.default.readFileSync(P(`python/scripts/${t}.py`)).toString();return(0,b.default)(r,{interpolate:/{{([\s\S]+?)}}/g})(o)},T=function(t,o=[]){let{code:r}=te.default.transformFileSync(t,{babelrc:!1,plugins:[function(){return{visitor:{Literal(n){if(n.parentPath.isProperty()){let e=n.parentPath.get("key").node,l=e.name;e.type==="StringLiteral"&&(e.type="Identifier",e.name=e.value,l=e.value);let s=M(o,c=>l===c.name);if(s){if(s.fullPath.includes("complexSelect")&&(s.name=s.fullName),n.isObjectExpression()){n.node.value=`[NO_QUOTATION_MARKS]\${${s.name}}[NO_QUOTATION_MARKS]`;return}if(n.isNumericLiteral()){n.node.value=`$!{${s.name}}`;return}if(n.isBooleanLiteral()){if(n.node.type="StringLiteral",s.fullPath.includes("complexSelect")){n.node.value=`$!{${s.fullName}}`;return}n.node.value=`[NO_QUOTATION_MARKS]\${${s.name}}[NO_QUOTATION_MARKS]`}if(n.isObjectExpression()){n.node.value=`$!{${s.name}}`;return}}}},ArrayExpression(n){if(n.parentPath.isProperty()){let e=M(o,l=>n.parentPath.get("key").node.name===l.name);if(e){e.fullPath.includes("complexSelect")&&(e.name=e.fullName);let l="",s=e.keys||[],c=e.columns||s;if(e.options){l=`[NO_QUOTATION_MARKS][#foreach($row in $${e.name}) '$row' , #end][NO_QUOTATION_MARKS]`,n.node.type="StringLiteral",n.node.value=l;return}c&&c.length&&c.forEach(f=>{l+=`${f.name}: '$!{row.${f.name}}',`}),n.node.type="StringLiteral",n.node.value=`[NO_QUOTATION_MARKS][#foreach($row in $${e.name}) {${l}}, #end][NO_QUOTATION_MARKS]`}}},ObjectExpression(n){if(n.parentPath.isProperty()){let e=n.parentPath.get("key").node,l=e.name;if(e){let s=M(o,c=>l===c.name);if(s){if(n.node.type="StringLiteral",s.fullPath.includes("editor")){n.node.value=`[NO_QUOTATION_MARKS]\${${s.name}}[NO_QUOTATION_MARKS]`;return}n.node.value=`[NO_QUOTATION_MARKS]\${${s.name}}[NO_QUOTATION_MARKS]`;return}}}}}}}],retainLines:!0});return r.replace(/"\[NO_QUOTATION_MARKS](.*)\[NO_QUOTATION_MARKS]"/g,"$1")},re=function({system:t,type:o,name:r,appType:a,version:n,configFileName:e="config.local",variables:l=[],description:s,web_app_web_service_name:c,dockerImage:p}){let f=k.default.readFileSync(P("docker/deploy.xml")).toString();return(0,b.default)(f,{interpolate:/{{([\s\S]+?)}}/g})({system:t,type:o,name:r,appType:a,version:n,configFileName:e,variables:(()=>l.map(m=>N(m)).join(`
|
|
5
|
+
`))(),description:s,web_app_web_service_name:c,dockerImage:p})},oe=function(t){let o=k.default.readFileSync(P("docker/k8s-deploy-res.yaml")).toString();return(0,b.default)(o,{interpolate:/{{([\s\S]+?)}}/g})(t)},ie=function(t){let o=k.default.readFileSync(P("docker/Dockerfile")).toString();return(0,b.default)(o)(t)},le=function({system:t,type:o,name:r,appType:a,version:n,configFileName:e="config.local",variables:l=[],description:s}){let c=k.default.readFileSync(P("bash/deploy.xml")).toString();return(0,b.default)(c,{interpolate:/{{([\s\S]+?)}}/g})({system:t,type:o,name:r,appType:a,version:n,configFileName:e,variables:(()=>l.map(p=>N(p)).join(`
|
|
6
|
+
`))(),description:s})},R=function(t,o){let r=k.default.readFileSync(P(`bash/scripts/${t}.sh`)).toString();return(0,b.default)(r,{interpolate:/{{([\s\S]+?)}}/g})(o)};var u="tmp",se=function(t,o,r){let{system:a,type:n,name:e,appType:l,version:s,template:c,variables:p,configName:f,outputName:m,description:d,scriptsType:O}=o;g.default.ensureDirSync(u),g.default.ensureDirSync(`${u}/scripts`),g.default.ensureDirSync(`${u}/template`),E(m)?g.default.outputFileSync(`./${u}/template/config.local.js`,c?T(c,p):""):v(m)||v(m,e)?(f="sysconfig",g.default.outputFileSync(`./${u}/template/sysconfig.js`,c?T(c,p):"")):f&&g.default.outputFileSync(`./${u}/template/${f}.js`,c?T(c,p):""),O==="python"?(g.default.outputFileSync(`./${u}/scripts/${e}/utils.py`,j("utils")),g.default.outputFileSync(`./${u}/scripts/${e}/install.py`,j("install",{name:e,type:n})),g.default.outputFileSync(`./${u}/scripts/${e}/afterInstall.py`,j("afterInstall",{name:e})),g.default.outputFileSync(`./${u}/scripts/${e}/uninstall.py`,j("uninstall",{name:e,type:n})),g.default.outputFileSync(`./${u}/deploy.xml`,ne({system:a,type:n,name:e,appType:l,version:s,configFileName:f,variables:p,description:d}))):(g.default.outputFileSync(`./${u}/scripts/${e}/install.sh`,R("install",{name:e,type:n})),g.default.outputFileSync(`./${u}/scripts/${e}/afterInstall.sh`,R("afterInstall",{name:e})),g.default.outputFileSync(`./${u}/scripts/${e}/uninstall.sh`,R("uninstall",{name:e,type:n})),g.default.outputFileSync(`./${u}/deploy.xml`,le({system:a,type:n,name:e,appType:l,version:s,configFileName:f,variables:p,description:d}))),r?r(x=>{F(t,u,()=>{Q.default.sync(u),typeof x=="function"&&x()})}):F(t,u,()=>{Q.default.sync(u)})};var U=y(require("path")),S=y(require("fs-extra")),V=y(require("rimraf"));var $="tmp",ce=function(t,o,r){let{system:a,type:n,name:e,appType:l,version:s,template:c,variables:p,configName:f,outputName:m,description:d,dockerImage:O=s.indexOf("-")>0?`isee1.0-docker-dev-local/${e}`:`isee1.0-docker-release-local/${e}`}=o;S.default.ensureDirSync($),S.default.ensureDirSync("docker"),S.default.pathExistsSync(U.default.resolve(process.cwd(),"docker/Dockerfile"))||S.default.outputFileSync(U.default.resolve(process.cwd(),"docker/Dockerfile"),ie({name:e,type:n})),S.default.ensureDirSync(`${$}/scripts`),S.default.ensureDirSync(`${$}/template`),E(m)?S.default.outputFileSync(`./${$}/template/${e}/config.local.js`,c?T(c,p):""):v(m)||v(m,e)?(f="sysconfig",S.default.outputFileSync(`./${$}/template/${e}/sysconfig.js`,c?T(c,p):"")):f&&S.default.outputFileSync(`./${$}/template/${e}/${f}.js`,c?T(c,p):""),S.default.outputFileSync(`./${$}/template/k8s-deploy-res.yaml`,oe({configFileName:f})),S.default.outputFileSync(`./${$}/deploy.xml`,re({system:a,type:n,name:e,appType:l,version:s,configFileName:f,variables:p,description:d,web_app_web_service_name:`${e}-web`,dockerImage:O})),r?r(x=>{F(t,$,()=>{V.default.sync($),typeof x=="function"&&x()})}):F(t,$,()=>{V.default.sync($)})};var xe=process.cwd();function Oe(i,t,o){let r="",a;if(i==="bizframe"){r=h.default.readdirSync(`./${o}`).find(n=>/manifest\.[0-9]+\.json/.test(n));try{a=h.default.readJsonSync(`./${o}/${r}`)}catch(n){process.exit(0)}}return i==="subsystem"&&(r=h.default.readdirSync(`./${o}/${t}`).find(n=>/manifest\.[0-9]+\.json/.test(n)),a=h.default.readJsonSync(`./${o}/${t}/${r}`)),{manifest:r,manifestJson:a}}var ke=function({system:t="winner-front",type:o="bizframe",name:r,appType:a,version:n,configName:e="config.local",outputName:l="dist",templateFunc:s,variablesFunc:c,copyFiles:p,description:f,seePackageName:m,seePackageType:d="web",dockerImage:O,scriptsType:x="python"},J){if(!r||!n)throw new Error("\u5E94\u7528\u540D\u79F0\u548C\u5E94\u7528\u7248\u672C\u4E0D\u80FD\u7F3A\u5931~");if(r=r.replace(/@/gi,"").replace(/\//gi,"-"),typeof m=="string"&&m&&(m=m.replace(/@/gi,"").replace(/\//gi,"-")),a=a||r,c=c||function(){try{let{variables:_}=require(pe.default.resolve(xe,"build","package","./variables.js"));return _||[]}catch(_){return console.error(_),[]}},s=s||function(){return o==="bizframe"?`./${l}/config.local.js`:`./${l}/${r}/sysconfig.js`},d==="docker"){ce(m||`${t}-${r}-${n}`,{system:t,type:o,name:r,appType:a,version:n,configName:e,outputName:l,template:s(),variables:c(),description:f,dockerImage:O},_=>{console.log(),(0,z.default)("docker \u5BB9\u5668\u5316\u90E8\u7F72\u7684 SEE \u53D1\u5E03\u7269\u5236\u4F5C\u5B8C\u6210\uFF0C\u60A8\u53EF\u4EE5\u5728 SEE \u5E73\u53F0\u4E0A\u4F20\u5E76\u90E8\u7F72\u5E94\u7528\u3002").succeed(),_(J)});return}se(m||`${t}-${r}-${n}`,{system:t,type:o,name:r,appType:a,version:n,configName:e,outputName:l,template:s(),variables:c(),description:f,scriptsType:x},_=>{if(x==="python"){let{manifest:A,manifestJson:I}=Oe(o,r,l);for(let B in I)if(I.hasOwnProperty(B)){let{path:C,dir:fe}=I[B];h.default.ensureDirSync(`./tmp/source/${fe}`),h.default.copyFileSync(`./${l}/${C}`,`./tmp/source/${C}`)}h.default.outputJSONSync(`./tmp/scripts/${r}/conf/${A}`,I)}else h.default.ensureDirSync("./tmp/source"),h.default.copySync(`./${l}`,"./tmp/source");Array.isArray(p)&&p.length&&p.forEach(A=>{h.default.ensureFileSync(`./tmp/source/${r}/${A}`),h.default.copyFileSync(`./${l}/${r}/${A}`,`./tmp/source/${r}/${A}`)}),console.log(),(0,z.default)(`\u53D1\u5E03\u7269\u5236\u4F5C\u5B8C\u6210\uFF0C\u60A8\u53EF\u4EE5\u5728 SEE \u5E73\u53F0\u4E0A\u4F20\u5E76\u90E8\u7F72\u5E94\u7528\u3002\u6CE8\u610F\uFF1A${ae.default.yellow("\u5B50\u7CFB\u7EDF\u53D1\u5E03\u7269\u7684\u5B89\u88C5\u76EE\u5F55\u9700\u8981\u6307\u5B9A\u5230\u5177\u4F53\u7684\u5E94\u7528\u76EE\u5F55")}\u3002\u6BD4\u5982/home/hsiar/hsiar-green/html/\u3002
|
|
7
|
+
`).succeed(),_(J)})};0&&(module.exports={generateSeePackageZip});
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
declare type variablesType = 'input' | 'select' | 'switch' | 'smallfile' | 'table' | 'mselect' | 'switchForm' | 'complexSelect' | 'division';
|
|
2
|
+
interface variables {
|
|
3
|
+
type: variablesType;
|
|
4
|
+
label: string;
|
|
5
|
+
name: string;
|
|
6
|
+
options: string;
|
|
7
|
+
required: boolean;
|
|
8
|
+
fold: boolean;
|
|
9
|
+
children: Array<variables>;
|
|
10
|
+
tooltip: string;
|
|
11
|
+
default: string;
|
|
12
|
+
}
|
|
13
|
+
interface deployOptions {
|
|
14
|
+
/**
|
|
15
|
+
* 系统类型, SEE 平台的分组是以系统类型字段纬度来的
|
|
16
|
+
* @default winner-front
|
|
17
|
+
*/
|
|
18
|
+
system: string;
|
|
19
|
+
/**
|
|
20
|
+
* 应用类型, 外框架 - bizframe | 子系统 - subsystem
|
|
21
|
+
* @default bizframe
|
|
22
|
+
*/
|
|
23
|
+
type: 'bizframe' | 'subsystem';
|
|
24
|
+
/**
|
|
25
|
+
* 发布物名称。当包含 scope 时,如字符 @、/ 。会做自动的转换。如@winner-fed/winner-deploy 转换为 winner-fed-winner-deploy
|
|
26
|
+
* @default package.json -> name
|
|
27
|
+
*/
|
|
28
|
+
name: string;
|
|
29
|
+
/**
|
|
30
|
+
* 发布包版本
|
|
31
|
+
* @default package.json -> version
|
|
32
|
+
*/
|
|
33
|
+
version: string;
|
|
34
|
+
/**
|
|
35
|
+
* 发布包的描述说明
|
|
36
|
+
* @default package.json -> description
|
|
37
|
+
*/
|
|
38
|
+
description: string;
|
|
39
|
+
/**
|
|
40
|
+
* 发布物类型, 默认为 应用名称
|
|
41
|
+
* @default name
|
|
42
|
+
*/
|
|
43
|
+
appType?: string;
|
|
44
|
+
/**
|
|
45
|
+
* 配置文件名称,不带有 .js。当强制为空时,可以理解成,是构建静态资源的 see 包,不包含 index.html,config.local.js 文件等,此时 scriptsType 只能使用 bash
|
|
46
|
+
* @default config.local
|
|
47
|
+
*/
|
|
48
|
+
configName?: string;
|
|
49
|
+
/**
|
|
50
|
+
* 输出的目录名称
|
|
51
|
+
* @default dist
|
|
52
|
+
*/
|
|
53
|
+
outputName?: string;
|
|
54
|
+
/**
|
|
55
|
+
* 自定义变量配置文件
|
|
56
|
+
*/
|
|
57
|
+
templateFunc?: () => string | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* deploy.xml模板变量, 可以动态配置
|
|
60
|
+
*/
|
|
61
|
+
variablesFunc?: () => Array<variables> | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* 不包含在 manifest.json 配置的文件,直接拷贝到 see 包里。文件路径是相对于项目根目录的路径+文件名,比如 dist/子包/version.js,那么 copyFiles: ['version.js']
|
|
64
|
+
*/
|
|
65
|
+
copyFiles?: string[];
|
|
66
|
+
/**
|
|
67
|
+
* see发布物的包名,也就是 zip 包的命名
|
|
68
|
+
* @default `${system}-${name}-${version}`
|
|
69
|
+
*/
|
|
70
|
+
seePackageName?: string;
|
|
71
|
+
/**
|
|
72
|
+
* see平台发布物包的类型,'web'(默认的) | 'docker'(支持容器化部署的SEE发布物)
|
|
73
|
+
* @default web
|
|
74
|
+
*/
|
|
75
|
+
seePackageType?: 'web' | 'docker';
|
|
76
|
+
/**
|
|
77
|
+
* docker 容器化镜像名,seePackageType 为 docker 时生效
|
|
78
|
+
*/
|
|
79
|
+
dockerImage?: string;
|
|
80
|
+
/**
|
|
81
|
+
* 脚本类型
|
|
82
|
+
* @default python
|
|
83
|
+
*/
|
|
84
|
+
scriptsType?: 'python' | 'bash';
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* 生成 see 平台部署包
|
|
88
|
+
* @param system {string} 系统类型, SEE 平台的分组是以系统类型字段纬度来的, 默认为 winner-front
|
|
89
|
+
* @param type {string} 应用类型, 外框架 - bizframe | 子系统 - subsystem, 默认为 主系统 - bizframe
|
|
90
|
+
* @param name {string} 发布物名称。当包含 scope 时,如字符 @、/ 。会做自动的转换。如@winner-fed/winner-deploy 转换为 winner-fed-winner-deploy
|
|
91
|
+
* @param appType {string} 发布物类型, 默认为 应用名称 - name
|
|
92
|
+
* @param version {string} 发布包版本
|
|
93
|
+
* @param configName {string} 配置文件名称,不带有 .js, 默认为 config.local
|
|
94
|
+
* @param outputName {string} 输出的目录名称,默认为 dist
|
|
95
|
+
* @param templateFunc {function} 自定义变量配置文件, 默认为
|
|
96
|
+
* function () {
|
|
97
|
+
if (type === 'bizframe') {
|
|
98
|
+
return `./dist/config.local.js`;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
* @param variablesFunc {function} deploy.xml模板变量, 可以动态配置, 默认为
|
|
102
|
+
* function () {
|
|
103
|
+
* const context = process.cwd()
|
|
104
|
+
if (type === 'bizframe') {
|
|
105
|
+
try {
|
|
106
|
+
const {variables} = require(path.resolve(
|
|
107
|
+
context,
|
|
108
|
+
'build',
|
|
109
|
+
'package',
|
|
110
|
+
`./variables.js`
|
|
111
|
+
));
|
|
112
|
+
|
|
113
|
+
return variables || [];
|
|
114
|
+
} catch (error) {
|
|
115
|
+
console.error(error);
|
|
116
|
+
return [];
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
* @param copyFiles {Array<string>} 不包含在 manifest.json 配置的文件,直接拷贝到 see 包里。文件路径是相对于项目根目录的路径+文件名,比如 dist/子包/version.js,那么 copyFiles: ['version.js']
|
|
121
|
+
* @param description {string} 发布包说明
|
|
122
|
+
* @param seePackageName {string} see发布物的包名,也就是 zip 包的命名,默认为 `${system}-${name}-${version}`
|
|
123
|
+
* @param seePackageType see 平台发布物包的类型,'web'(默认的) | 'docker'(支持容器化部署的SEE发布物)
|
|
124
|
+
* @param dockerImage docker 容器化镜像名,seePackageType 为 docker 生效
|
|
125
|
+
* @param scriptsType 脚本类型 'python' | 'bash'
|
|
126
|
+
* @param cb {function} 回调函数,用于处理在组装 see 包后,可以自定义执行的动作
|
|
127
|
+
*/
|
|
128
|
+
declare const generateSeePackageZip: ({ system, type, name, appType, version, configName, outputName, templateFunc, variablesFunc, copyFiles, description, seePackageName, seePackageType, dockerImage, scriptsType }: deployOptions, cb: () => void) => void;
|
|
129
|
+
|
|
130
|
+
export { deployOptions, generateSeePackageZip, variables, variablesType };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)}else if(
|
|
3
|
-
`);else{if(
|
|
4
|
-
`))(),description:
|
|
5
|
-
`))(),description:
|
|
6
|
-
`))(),description:
|
|
7
|
-
`).succeed(),k(
|
|
1
|
+
var L=(c=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(c,{get:(n,o)=>(typeof require!="undefined"?require:n)[o]}):c)(function(c){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+c+'" is not supported')});import ae from"chalk";import pe from"path";import ne from"ora";import $ from"fs-extra";import y from"fs-extra";import H from"rimraf";import Q from"path";import j from"fs-extra";import oe from"archiver";import U from"xml";var V=process.cwd(),z=function(n){let o={"&":"&",""":'"',"'":"'","<":"<",">":">"};return n&&n.replace?n.replace(/(&)|(")|(')|(<)|(>)/g,function(r){return o[r]}):n},P=function(n,o){let r=o||"",a=Q.resolve(V,n,r,"sysconfig.js");return j.pathExistsSync(a)},I=function(n){let o=Q.resolve(V,n,"config.local.js");return j.pathExistsSync(o)},v=function(n,o,r){let a="package";j.ensureDirSync(a);let t=j.createWriteStream(`${a}/${n}.zip`);t.on("close",function(){setTimeout(function(){r&&r()})});let e=oe("zip",{zlib:{level:9}});e.on("error",function(i){console.error(),console.error(i.stack||i),i.details&&console.error(i.details)}),e.pipe(t),e.directory(o,!1),e.finalize()},M=function(n,o,r){let{type:a,label:t,name:e,tooltip:i="",visible:l="true",required:s="false",fixed:p="false",fold:f="false",options:m=""}=n,g=n.default;if(r==="form"){let h=U({form:[{_attr:{name:e,tooltip:i,visible:l,required:s,fixed:p,fold:f,options:m}},o]});return exports.unEscapeForXML(h)}let x=U({field:[{_attr:{type:a,label:t,name:e,tooltip:i,visible:l,required:s,fixed:p,fold:f,options:m}},g||o]});return exports.unEscapeForXML(x)},J=function(n){let r=n.children.map(a=>{let e=a.children.map(i=>M(i)).join("");return M(a,e,"form")}).join("");return M(n,r)},w=function c(n,o,r="",a=""){for(let t=0;t<n.length;t++){let e=n[t];if(e.fullName=`${r===""?"":r+"."}${e.name}`,e.fullPath=`${a===""?"":a+"-"}${e.type}`,o(e))return e;if(e.children&&e.children.length>0){let i=c(e.children,o,e.fullName,e.fullPath);if(i)return i}}return null};import b from"fs-extra";import ie from"path";import T from"lodash.template";import le from"xml";import se from"@babel/core";var ce=["input","editor","select","switch","smallfile","table","mselect","switchForm","complexSelect","division"],_=c=>ie.resolve(__dirname,`../templates/see/${c}`),A=c=>{let n=c.type;if(!ce.includes(n))return"";let{label:o,name:r,tooltip:a="",visible:t="true",required:e="false",fixed:i="false",fold:l="false",options:s=""}=c,p=c.default;if(n==="table"){let m=c.keys||[];p=(c.columns||m).map(x=>A(x)).join(`
|
|
2
|
+
`)}else if(n==="switchForm"||n==="division")p=c.children.map(g=>A(g)).join(`
|
|
3
|
+
`);else{if(n==="complexSelect")return J(c);n==="editor"?p=[JSON.stringify(p)]:p=[p]}let f=le({field:[{_attr:{type:n,label:o,name:r,tooltip:a,visible:t,required:e,fixed:i,fold:l,options:s}},p].concat(p)});return z(`${f}`)},B=function({system:n,type:o,name:r,appType:a,version:t,configFileName:e="config.local",variables:i=[],description:l}){let s=b.readFileSync(_("python/deploy.xml")).toString();return T(s,{interpolate:/{{([\s\S]+?)}}/g})({system:n,type:o,name:r,appType:a,version:t,configFileName:e,variables:(()=>i.map(p=>A(p)).join(`
|
|
4
|
+
`))(),description:l})},D=function(n,o){let r=b.readFileSync(_(`python/scripts/${n}.py`)).toString();return T(r,{interpolate:/{{([\s\S]+?)}}/g})(o)},O=function(n,o=[]){let{code:r}=se.transformFileSync(n,{babelrc:!1,plugins:[function(){return{visitor:{Literal(t){if(t.parentPath.isProperty()){let e=t.parentPath.get("key").node,i=e.name;e.type==="StringLiteral"&&(e.type="Identifier",e.name=e.value,i=e.value);let l=w(o,s=>i===s.name);if(l){if(l.fullPath.includes("complexSelect")&&(l.name=l.fullName),t.isObjectExpression()){t.node.value=`[NO_QUOTATION_MARKS]\${${l.name}}[NO_QUOTATION_MARKS]`;return}if(t.isNumericLiteral()){t.node.value=`$!{${l.name}}`;return}if(t.isBooleanLiteral()){if(t.node.type="StringLiteral",l.fullPath.includes("complexSelect")){t.node.value=`$!{${l.fullName}}`;return}t.node.value=`[NO_QUOTATION_MARKS]\${${l.name}}[NO_QUOTATION_MARKS]`}if(t.isObjectExpression()){t.node.value=`$!{${l.name}}`;return}}}},ArrayExpression(t){if(t.parentPath.isProperty()){let e=w(o,i=>t.parentPath.get("key").node.name===i.name);if(e){e.fullPath.includes("complexSelect")&&(e.name=e.fullName);let i="",l=e.keys||[],s=e.columns||l;if(e.options){i=`[NO_QUOTATION_MARKS][#foreach($row in $${e.name}) '$row' , #end][NO_QUOTATION_MARKS]`,t.node.type="StringLiteral",t.node.value=i;return}s&&s.length&&s.forEach(f=>{i+=`${f.name}: '$!{row.${f.name}}',`}),t.node.type="StringLiteral",t.node.value=`[NO_QUOTATION_MARKS][#foreach($row in $${e.name}) {${i}}, #end][NO_QUOTATION_MARKS]`}}},ObjectExpression(t){if(t.parentPath.isProperty()){let e=t.parentPath.get("key").node,i=e.name;if(e){let l=w(o,s=>i===s.name);if(l){if(t.node.type="StringLiteral",l.fullPath.includes("editor")){t.node.value=`[NO_QUOTATION_MARKS]\${${l.name}}[NO_QUOTATION_MARKS]`;return}t.node.value=`[NO_QUOTATION_MARKS]\${${l.name}}[NO_QUOTATION_MARKS]`;return}}}}}}}],retainLines:!0});return r.replace(/"\[NO_QUOTATION_MARKS](.*)\[NO_QUOTATION_MARKS]"/g,"$1")},C=function({system:n,type:o,name:r,appType:a,version:t,configFileName:e="config.local",variables:i=[],description:l,web_app_web_service_name:s,dockerImage:p}){let f=b.readFileSync(_("docker/deploy.xml")).toString();return T(f,{interpolate:/{{([\s\S]+?)}}/g})({system:n,type:o,name:r,appType:a,version:t,configFileName:e,variables:(()=>i.map(m=>A(m)).join(`
|
|
5
|
+
`))(),description:l,web_app_web_service_name:s,dockerImage:p})},q=function(n){let o=b.readFileSync(_("docker/k8s-deploy-res.yaml")).toString();return T(o,{interpolate:/{{([\s\S]+?)}}/g})(n)},W=function(n){let o=b.readFileSync(_("docker/Dockerfile")).toString();return T(o)(n)},Z=function({system:n,type:o,name:r,appType:a,version:t,configFileName:e="config.local",variables:i=[],description:l}){let s=b.readFileSync(_("bash/deploy.xml")).toString();return T(s,{interpolate:/{{([\s\S]+?)}}/g})({system:n,type:o,name:r,appType:a,version:t,configFileName:e,variables:(()=>i.map(p=>A(p)).join(`
|
|
6
|
+
`))(),description:l})},E=function(n,o){let r=b.readFileSync(_(`bash/scripts/${n}.sh`)).toString();return T(r,{interpolate:/{{([\s\S]+?)}}/g})(o)};var u="tmp",Y=function(n,o,r){let{system:a,type:t,name:e,appType:i,version:l,template:s,variables:p,configName:f,outputName:m,description:g,scriptsType:x}=o;y.ensureDirSync(u),y.ensureDirSync(`${u}/scripts`),y.ensureDirSync(`${u}/template`),I(m)?y.outputFileSync(`./${u}/template/config.local.js`,s?O(s,p):""):P(m)||P(m,e)?(f="sysconfig",y.outputFileSync(`./${u}/template/sysconfig.js`,s?O(s,p):"")):f&&y.outputFileSync(`./${u}/template/${f}.js`,s?O(s,p):""),x==="python"?(y.outputFileSync(`./${u}/scripts/${e}/utils.py`,D("utils")),y.outputFileSync(`./${u}/scripts/${e}/install.py`,D("install",{name:e,type:t})),y.outputFileSync(`./${u}/scripts/${e}/afterInstall.py`,D("afterInstall",{name:e})),y.outputFileSync(`./${u}/scripts/${e}/uninstall.py`,D("uninstall",{name:e,type:t})),y.outputFileSync(`./${u}/deploy.xml`,B({system:a,type:t,name:e,appType:i,version:l,configFileName:f,variables:p,description:g}))):(y.outputFileSync(`./${u}/scripts/${e}/install.sh`,E("install",{name:e,type:t})),y.outputFileSync(`./${u}/scripts/${e}/afterInstall.sh`,E("afterInstall",{name:e})),y.outputFileSync(`./${u}/scripts/${e}/uninstall.sh`,E("uninstall",{name:e,type:t})),y.outputFileSync(`./${u}/deploy.xml`,Z({system:a,type:t,name:e,appType:i,version:l,configFileName:f,variables:p,description:g}))),r?r(h=>{v(n,u,()=>{H.sync(u),typeof h=="function"&&h()})}):v(n,u,()=>{H.sync(u)})};import G from"path";import S from"fs-extra";import ee from"rimraf";var d="tmp",te=function(n,o,r){let{system:a,type:t,name:e,appType:i,version:l,template:s,variables:p,configName:f,outputName:m,description:g,dockerImage:x=l.indexOf("-")>0?`isee1.0-docker-dev-local/${e}`:`isee1.0-docker-release-local/${e}`}=o;S.ensureDirSync(d),S.ensureDirSync("docker"),S.pathExistsSync(G.resolve(process.cwd(),"docker/Dockerfile"))||S.outputFileSync(G.resolve(process.cwd(),"docker/Dockerfile"),W({name:e,type:t})),S.ensureDirSync(`${d}/scripts`),S.ensureDirSync(`${d}/template`),I(m)?S.outputFileSync(`./${d}/template/${e}/config.local.js`,s?O(s,p):""):P(m)||P(m,e)?(f="sysconfig",S.outputFileSync(`./${d}/template/${e}/sysconfig.js`,s?O(s,p):"")):f&&S.outputFileSync(`./${d}/template/${e}/${f}.js`,s?O(s,p):""),S.outputFileSync(`./${d}/template/k8s-deploy-res.yaml`,q({configFileName:f})),S.outputFileSync(`./${d}/deploy.xml`,C({system:a,type:t,name:e,appType:i,version:l,configFileName:f,variables:p,description:g,web_app_web_service_name:`${e}-web`,dockerImage:x})),r?r(h=>{v(n,d,()=>{ee.sync(d),typeof h=="function"&&h()})}):v(n,d,()=>{ee.sync(d)})};var fe=process.cwd();function me(c,n,o){let r="",a;if(c==="bizframe"){r=$.readdirSync(`./${o}`).find(t=>/manifest\.[0-9]+\.json/.test(t));try{a=$.readJsonSync(`./${o}/${r}`)}catch(t){process.exit(0)}}return c==="subsystem"&&(r=$.readdirSync(`./${o}/${n}`).find(t=>/manifest\.[0-9]+\.json/.test(t)),a=$.readJsonSync(`./${o}/${n}/${r}`)),{manifest:r,manifestJson:a}}var Ve=function({system:n="winner-front",type:o="bizframe",name:r,appType:a,version:t,configName:e="config.local",outputName:i="dist",templateFunc:l,variablesFunc:s,copyFiles:p,description:f,seePackageName:m,seePackageType:g="web",dockerImage:x,scriptsType:h="python"},R){if(!r||!t)throw new Error("\u5E94\u7528\u540D\u79F0\u548C\u5E94\u7528\u7248\u672C\u4E0D\u80FD\u7F3A\u5931~");if(r=r.replace(/@/gi,"").replace(/\//gi,"-"),typeof m=="string"&&m&&(m=m.replace(/@/gi,"").replace(/\//gi,"-")),a=a||r,s=s||function(){try{let{variables:k}=L(pe.resolve(fe,"build","package","./variables.js"));return k||[]}catch(k){return console.error(k),[]}},l=l||function(){return o==="bizframe"?`./${i}/config.local.js`:`./${i}/${r}/sysconfig.js`},g==="docker"){te(m||`${n}-${r}-${t}`,{system:n,type:o,name:r,appType:a,version:t,configName:e,outputName:i,template:l(),variables:s(),description:f,dockerImage:x},k=>{console.log(),ne("docker \u5BB9\u5668\u5316\u90E8\u7F72\u7684 SEE \u53D1\u5E03\u7269\u5236\u4F5C\u5B8C\u6210\uFF0C\u60A8\u53EF\u4EE5\u5728 SEE \u5E73\u53F0\u4E0A\u4F20\u5E76\u90E8\u7F72\u5E94\u7528\u3002").succeed(),k(R)});return}Y(m||`${n}-${r}-${t}`,{system:n,type:o,name:r,appType:a,version:t,configName:e,outputName:i,template:l(),variables:s(),description:f,scriptsType:h},k=>{if(h==="python"){let{manifest:F,manifestJson:N}=me(o,r,i);for(let X in N)if(N.hasOwnProperty(X)){let{path:K,dir:re}=N[X];$.ensureDirSync(`./tmp/source/${re}`),$.copyFileSync(`./${i}/${K}`,`./tmp/source/${K}`)}$.outputJSONSync(`./tmp/scripts/${r}/conf/${F}`,N)}else $.ensureDirSync("./tmp/source"),$.copySync(`./${i}`,"./tmp/source");Array.isArray(p)&&p.length&&p.forEach(F=>{$.ensureFileSync(`./tmp/source/${r}/${F}`),$.copyFileSync(`./${i}/${r}/${F}`,`./tmp/source/${r}/${F}`)}),console.log(),ne(`\u53D1\u5E03\u7269\u5236\u4F5C\u5B8C\u6210\uFF0C\u60A8\u53EF\u4EE5\u5728 SEE \u5E73\u53F0\u4E0A\u4F20\u5E76\u90E8\u7F72\u5E94\u7528\u3002\u6CE8\u610F\uFF1A${ae.yellow("\u5B50\u7CFB\u7EDF\u53D1\u5E03\u7269\u7684\u5B89\u88C5\u76EE\u5F55\u9700\u8981\u6307\u5B9A\u5230\u5177\u4F53\u7684\u5E94\u7528\u76EE\u5F55")}\u3002\u6BD4\u5982/home/hsiar/hsiar-green/html/\u3002
|
|
7
|
+
`).succeed(),k(R)})};export{Ve as generateSeePackageZip};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@winner-fed/winner-deploy",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.6",
|
|
4
4
|
"description": "Generate a publication deployed by the See platform",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"winner",
|
|
@@ -34,37 +34,30 @@
|
|
|
34
34
|
"dist",
|
|
35
35
|
"templates"
|
|
36
36
|
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"prepublishOnly": "npm run build",
|
|
39
|
+
"dev": "tsup --watch",
|
|
40
|
+
"build": "tsup",
|
|
41
|
+
"typecheck": "tsc --noEmit"
|
|
42
|
+
},
|
|
37
43
|
"dependencies": {
|
|
38
44
|
"@babel/core": "^7.12.3",
|
|
39
45
|
"archiver": "^3.1.1",
|
|
40
46
|
"chalk": "^4.0.0",
|
|
41
|
-
"fs-extra": "^
|
|
47
|
+
"fs-extra": "^10.1.0",
|
|
42
48
|
"lodash.template": "^4.5.0",
|
|
43
49
|
"ora": "^4.0.4",
|
|
44
50
|
"rimraf": "^3.0.2",
|
|
45
51
|
"xml": "^1.0.1"
|
|
46
52
|
},
|
|
47
53
|
"devDependencies": {
|
|
48
|
-
"@antfu/ni": "^0.7.0",
|
|
49
54
|
"@types/fs-extra": "^9.0.13",
|
|
50
55
|
"@types/lodash.template": "^4.5.1",
|
|
51
56
|
"@types/node": "^16.10.1",
|
|
52
|
-
"
|
|
53
|
-
"esno": "^0.9.1",
|
|
54
|
-
"pnpm": "^7.0.0",
|
|
55
|
-
"tsup": "^4.14.0",
|
|
56
|
-
"typescript": "^4.6.4"
|
|
57
|
+
"tsup": "^4.14.0"
|
|
57
58
|
},
|
|
58
59
|
"publishConfig": {
|
|
59
60
|
"access": "public",
|
|
60
61
|
"registry": "https://registry.npmjs.org/"
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
"dev": "nr build --watch",
|
|
64
|
-
"start": "esno src/index.ts",
|
|
65
|
-
"build": "tsup",
|
|
66
|
-
"release": "bumpp --commit --push --tag && pnpm publish",
|
|
67
|
-
"typecheck": "tsc --noEmit"
|
|
68
|
-
},
|
|
69
|
-
"readme": "# winner-deploy\n\n## 功能接口说明\n```javscript\n/**\n * 生成 see 平台部署包\n * @param options.system {string} 系统类型, SEE 平台的分组是以系统类型字段纬度来的, 默认为 winner-front\n * @param options.type {string} 应用类型, 外框架 - bizframe | 子系统 - subsystem, 默认为 子系统 - subsystem\n * @param options.name {string} 发布物名称\n * @param options.appType {string} 发布物类型, 默认为 应用名称 - name\n * @param options.version {string} 发布包版本\n * @param options.configName {string} 配置文件名称,不带有 .js, 默认为 config.local\n * @param options.templateFunc {function} 自定义变量配置文件, 默认为\n * function () {\n if (type === 'bizframe') {\n return `./dist/config.local.js`;\n }\n }\n * @param options.variablesFunc {function} deploy.xml模板变量, 可以动态配置, 默认为\n * function () {\n * const context = process.cwd()\n if (type === 'bizframe') {\n try {\n const {variables} = require(path.resolve(\n context,\n 'build',\n 'package',\n `./variables.js`\n ));\n\n return variables || [];\n } catch (error) {\n console.error(error);\n return [];\n }\n }\n }\n * @param options.copyFiles {Array<string>} 不包含在 manifest.json 配置的文件,直接拷贝到 see 包里。文件路径是相对于项目根目录的路径+文件名,比如 dist/子包/version.js,那么 copyFiles: ['version.js']\n * @param options.description {string} 发布包说明\n * @param options.seePackageName {string} see发布物的包名,也就是 zip 包的命名,默认为 `${system}-${name}-${version}`\n * @param options.seePackageType see 平台发布物包的类型,'web'(默认的) | 'docker'(支持容器化部署的SEE发布物)\n * @param options.dockerImage docker 容器化镜像名,seePackageType 为 docker 生效\n * @param options.scriptsType 脚本类型 'python'(默认的) | 'bash'\n * @param cb {function} 回调函数,用于处理在组装 see 包后,可以自定义执行的动作\n */\nexport const generateSeePackageZip = function generateSeePackageZip({system, type, name, appType, version, configName, templateFunc, variablesFunc, copyFiles, description, seePackageType, dockerImage, scriptsType}, cb) {\n...\n}\n```\n"
|
|
70
|
-
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -36,7 +36,9 @@
|
|
|
36
36
|
<% } %>
|
|
37
37
|
{{ variables }}
|
|
38
38
|
</variables>
|
|
39
|
+
<% if (configFileName) { %>
|
|
39
40
|
<config path="./${webAppName}/{{ configFileName }}.js" encoding="UTF-8"/>
|
|
41
|
+
<% } %>
|
|
40
42
|
<config path="./scripts/{{ name }}/install.sh" encoding="UTF-8"/>
|
|
41
43
|
<config path="./scripts/{{ name }}/afterInstall.sh" encoding="UTF-8"/>
|
|
42
44
|
<config path="./scripts/{{ name }}/uninstall.sh" encoding="UTF-8"/>
|
|
@@ -39,7 +39,9 @@
|
|
|
39
39
|
{{ variables }}
|
|
40
40
|
|
|
41
41
|
</variables>
|
|
42
|
+
<% if (configFileName) { %>
|
|
42
43
|
<config path="./{{ name }}/{{ configFileName }}.js" encoding="UTF-8"/>
|
|
44
|
+
<% } %>
|
|
43
45
|
<config reference="" encoding="utf-8" path="./k8s-deploy-res.yaml" />
|
|
44
46
|
<node describe="节点私有配置信息" />
|
|
45
47
|
</system>
|
|
@@ -7,9 +7,9 @@ metadata:
|
|
|
7
7
|
name: ${svc_id}-service
|
|
8
8
|
spec:
|
|
9
9
|
ports:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
- name: 'http'
|
|
11
|
+
port: 80
|
|
12
|
+
targetPort: 80
|
|
13
13
|
selector:
|
|
14
14
|
name: ${svc_id}
|
|
15
15
|
---
|
|
@@ -29,10 +29,10 @@ spec:
|
|
|
29
29
|
name: ${svc_id}
|
|
30
30
|
spec:
|
|
31
31
|
imagePullPolicy: ${image_pull_policy}
|
|
32
|
-
#if(${image_pull_secrets_enable} == "true")
|
|
32
|
+
#if(${image_pull_secrets_enable} == "true")
|
|
33
33
|
imagePullSecrets:
|
|
34
|
-
|
|
35
|
-
#end
|
|
34
|
+
- name: ${image_pull_secrets}
|
|
35
|
+
#end
|
|
36
36
|
restartPolicy: ${restart_policy}
|
|
37
37
|
hostname: ${web_app_web_service_name}
|
|
38
38
|
containers:
|
|
@@ -43,7 +43,7 @@ spec:
|
|
|
43
43
|
value: Asia/Shanghai
|
|
44
44
|
ports:
|
|
45
45
|
- containerPort: 80
|
|
46
|
-
#if(${resources_enable} == "true")
|
|
46
|
+
#if(${resources_enable} == "true")
|
|
47
47
|
resources:
|
|
48
48
|
requests:
|
|
49
49
|
cpu: ${cpu_req}
|
|
@@ -51,8 +51,8 @@ spec:
|
|
|
51
51
|
limits:
|
|
52
52
|
cpu: ${cpu_limit}
|
|
53
53
|
memory: ${memory_limit}
|
|
54
|
-
#end
|
|
55
|
-
#if(${liveness_probe_enable} == "true")
|
|
54
|
+
#end
|
|
55
|
+
#if(${liveness_probe_enable} == "true")
|
|
56
56
|
livenessProbe:
|
|
57
57
|
httpGet:
|
|
58
58
|
scheme: HTTP
|
|
@@ -37,7 +37,9 @@
|
|
|
37
37
|
{{ variables }}
|
|
38
38
|
|
|
39
39
|
</variables>
|
|
40
|
+
<% if (configFileName) { %>
|
|
40
41
|
<config path="./${webAppName}/{{ configFileName }}.js" encoding="UTF-8"/>
|
|
42
|
+
<% } %>
|
|
41
43
|
<config path="./scripts/{{ name }}/install.py" encoding="UTF-8"/>
|
|
42
44
|
<config path="./scripts/{{ name }}/afterInstall.py" encoding="UTF-8"/>
|
|
43
45
|
<config path="./scripts/{{ name }}/uninstall.py" encoding="UTF-8"/>
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2020 winner-fed
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|