rigjs 2.1.19 → 2.1.20
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/built/index.js +76 -76
- package/lib/classes/cicd/CICD.ts +3 -3
- package/lib/publish/index.ts +45 -9
- package/package.json +1 -1
package/lib/classes/cicd/CICD.ts
CHANGED
|
@@ -71,7 +71,7 @@ export interface CICDConfig {
|
|
|
71
71
|
* fafafafa
|
|
72
72
|
*/
|
|
73
73
|
tree_schema: string;
|
|
74
|
-
web_type: '
|
|
74
|
+
web_type: 'hash'|'history'|'mpa';
|
|
75
75
|
source: DeploySource;
|
|
76
76
|
target: DeployTarget | DeployTarget[];
|
|
77
77
|
endpoints: EndpointDict;
|
|
@@ -85,7 +85,7 @@ class CICD {
|
|
|
85
85
|
* @type {string}
|
|
86
86
|
*/
|
|
87
87
|
treeSchema: string;
|
|
88
|
-
web_type: '
|
|
88
|
+
web_type: 'hash' | 'history'|'mpa' = 'hash';
|
|
89
89
|
/**
|
|
90
90
|
* DirLevel shows every level of the directory structure
|
|
91
91
|
* @type {DirLevel[]}
|
|
@@ -102,7 +102,7 @@ class CICD {
|
|
|
102
102
|
|
|
103
103
|
constructor(config: CICDConfig) {
|
|
104
104
|
this.treeSchema = config.tree_schema;
|
|
105
|
-
this.web_type = config.web_type || '
|
|
105
|
+
this.web_type = config.web_type || 'hash';
|
|
106
106
|
this.schema = DirLevel.createSchema(this.treeSchema);
|
|
107
107
|
this.endpoints = Endpoint.createEndpointArr(config, this.schema);
|
|
108
108
|
this.source = config.source;
|
package/lib/publish/index.ts
CHANGED
|
@@ -85,6 +85,8 @@ export default async (cmd: any) => {
|
|
|
85
85
|
let webEntryPath: string;
|
|
86
86
|
if (cicd.web_type === 'mpa') {
|
|
87
87
|
webEntryPath = '/';
|
|
88
|
+
} else if (cicd.web_type === 'history'){
|
|
89
|
+
webEntryPath = '/';
|
|
88
90
|
} else {
|
|
89
91
|
webEntryPath = endpoint.web_entry_path
|
|
90
92
|
? endpoint.web_entry_path
|
|
@@ -110,7 +112,41 @@ export default async (cmd: any) => {
|
|
|
110
112
|
cdn
|
|
111
113
|
)
|
|
112
114
|
);
|
|
113
|
-
|
|
115
|
+
setRewriteUriPromises.push(
|
|
116
|
+
setRewriteUri(
|
|
117
|
+
domain,
|
|
118
|
+
`^(${webEntryPath})($|\\?|#|\\/\\?|\\/$)`,
|
|
119
|
+
`/${endpoint.deployDir.replace(/\\/g, '/')}/index.html`,
|
|
120
|
+
cdn
|
|
121
|
+
)
|
|
122
|
+
);
|
|
123
|
+
} else if (cicd.web_type === 'history'){
|
|
124
|
+
//文件
|
|
125
|
+
setRewriteUriPromises.push(
|
|
126
|
+
setRewriteUri(
|
|
127
|
+
domain,
|
|
128
|
+
'^\\/([^?]*\\.[a-zA-Z0-9]+)($|\\?)',
|
|
129
|
+
`/$1`,
|
|
130
|
+
cdn
|
|
131
|
+
)
|
|
132
|
+
);
|
|
133
|
+
setRewriteUriPromises.push(
|
|
134
|
+
setRewriteUri(
|
|
135
|
+
domain,
|
|
136
|
+
'^\\/([\\w-/]*\\w+)(?![^?]*\\.\\w+)',
|
|
137
|
+
`/${endpoint.deployDir.replace(/\\/g, '/')}/index.html`,
|
|
138
|
+
cdn
|
|
139
|
+
)
|
|
140
|
+
);
|
|
141
|
+
setRewriteUriPromises.push(
|
|
142
|
+
setRewriteUri(
|
|
143
|
+
domain,
|
|
144
|
+
`^(${webEntryPath})($|\\?|#|\\/\\?|\\/$)`,
|
|
145
|
+
`/${endpoint.deployDir.replace(/\\/g, '/')}/index.html`,
|
|
146
|
+
cdn
|
|
147
|
+
)
|
|
148
|
+
);
|
|
149
|
+
}else {
|
|
114
150
|
//文件
|
|
115
151
|
setRewriteUriPromises.push(
|
|
116
152
|
setRewriteUri(
|
|
@@ -120,15 +156,15 @@ export default async (cmd: any) => {
|
|
|
120
156
|
cdn
|
|
121
157
|
)
|
|
122
158
|
);
|
|
159
|
+
setRewriteUriPromises.push(
|
|
160
|
+
setRewriteUri(
|
|
161
|
+
domain,
|
|
162
|
+
`^(${webEntryPath})($|\\?|#|\\/\\?|\\/$)`,
|
|
163
|
+
`/${endpoint.deployDir.replace(/\\/g, '/')}/index.html`,
|
|
164
|
+
cdn
|
|
165
|
+
)
|
|
166
|
+
);
|
|
123
167
|
}
|
|
124
|
-
setRewriteUriPromises.push(
|
|
125
|
-
setRewriteUri(
|
|
126
|
-
domain,
|
|
127
|
-
`^(${webEntryPath})($|\\?|#|\\/\\?|\\/$)`,
|
|
128
|
-
`/${endpoint.deployDir.replace(/\\/g, '/')}/index.html`,
|
|
129
|
-
cdn
|
|
130
|
-
)
|
|
131
|
-
);
|
|
132
168
|
urls.push(`https://${domain}${webEntryPath}`);
|
|
133
169
|
}
|
|
134
170
|
} else {
|
package/package.json
CHANGED