rigjs 2.1.19 → 2.1.22
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 +3 -3
- package/lib/classes/cicd/CICD.ts +3 -3
- package/lib/publish/index.ts +16 -14
- 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
|
|
@@ -92,16 +94,7 @@ export default async (cmd: any) => {
|
|
|
92
94
|
}
|
|
93
95
|
for (const domain of endpoint.domains) {
|
|
94
96
|
if (cicd.web_type === 'mpa') {
|
|
95
|
-
|
|
96
|
-
setRewriteUriPromises.push(
|
|
97
|
-
setRewriteUri(
|
|
98
|
-
domain,
|
|
99
|
-
'^\\/([^?]*\\.[a-zA-Z0-9]+)($|\\?)',
|
|
100
|
-
`/${endpoint.deployDir.replace(/\\/g, '/')}/$1`,
|
|
101
|
-
cdn
|
|
102
|
-
)
|
|
103
|
-
);
|
|
104
|
-
//非首页
|
|
97
|
+
//mpa匹配非首页
|
|
105
98
|
setRewriteUriPromises.push(
|
|
106
99
|
setRewriteUri(
|
|
107
100
|
domain,
|
|
@@ -110,17 +103,26 @@ export default async (cmd: any) => {
|
|
|
110
103
|
cdn
|
|
111
104
|
)
|
|
112
105
|
);
|
|
113
|
-
} else {
|
|
114
|
-
|
|
106
|
+
} else if (cicd.web_type === 'history'){
|
|
107
|
+
//spa/history匹配非首页
|
|
115
108
|
setRewriteUriPromises.push(
|
|
116
109
|
setRewriteUri(
|
|
117
110
|
domain,
|
|
118
|
-
'^\\/([
|
|
119
|
-
`/$
|
|
111
|
+
'^\\/([\\w-/]*\\w+)(?![^?]*\\.\\w+)',
|
|
112
|
+
`/${endpoint.deployDir.replace(/\\/g, '/')}/index.html`,
|
|
120
113
|
cdn
|
|
121
114
|
)
|
|
122
115
|
);
|
|
123
116
|
}
|
|
117
|
+
setRewriteUriPromises.push(
|
|
118
|
+
setRewriteUri(
|
|
119
|
+
domain,
|
|
120
|
+
'^\\/([^?]*\\.[a-zA-Z0-9]+)($|\\?)',
|
|
121
|
+
`/${endpoint.deployDir.replace(/\\/g, '/')}/$1`,
|
|
122
|
+
cdn
|
|
123
|
+
)
|
|
124
|
+
);
|
|
125
|
+
//首页匹配正则,hash,history,mpa三个模式通用
|
|
124
126
|
setRewriteUriPromises.push(
|
|
125
127
|
setRewriteUri(
|
|
126
128
|
domain,
|
package/package.json
CHANGED