rigjs 2.1.17 → 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.
@@ -71,7 +71,7 @@ export interface CICDConfig {
71
71
  * fafafafa
72
72
  */
73
73
  tree_schema: string;
74
- web_type: 'spa'|'mpa';
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: 'spa' | 'mpa' = 'spa';
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 || 'spa';
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;
@@ -10,7 +10,7 @@ interface EndpointInfo {
10
10
  defines: Define;
11
11
  vue_env?: string;
12
12
  extra_env?:{[env: string]: String};
13
- web_entry_path: string;
13
+ web_entry_path?: string;
14
14
  uri_rewrite: {
15
15
  original: string;
16
16
  original_regexp: string;
@@ -35,7 +35,7 @@ class Endpoint {
35
35
  extra_env?:{[env: string]: String};
36
36
  publicPath: string = '';
37
37
  defines: Define;
38
- web_entry_path: string = '/';//effective when no validate uri_rewrite
38
+ web_entry_path?: string;//effective when no validate uri_rewrite
39
39
  uri_rewrite: {
40
40
  original: string,
41
41
  original_regexp: string;
@@ -62,7 +62,7 @@ class Endpoint {
62
62
  this.domains = info.domains
63
63
  this.defines = info.defines;
64
64
  this.uri_rewrite = info.uri_rewrite;
65
- this.web_entry_path = info.web_entry_path || '/';
65
+ this.web_entry_path = info.web_entry_path;
66
66
  this.vue_env = info.vue_env;
67
67
  this.extra_env = info.extra_env;
68
68
 
@@ -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
- } else {
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rigjs",
3
- "version": "2.1.17",
3
+ "version": "2.1.20",
4
4
  "description": "A multi-repos dev tool based on yarn and git.Rig is inspired by cocoapods. Not like those monorepo solutions,rig is a tool for organizing multi-repos.",
5
5
  "keywords": [
6
6
  "modular",