排除异常空格
This commit is contained in:
		
							
								
								
									
										56
									
								
								bin/serve.js
									
									
									
									
									
								
							
							
						
						
									
										56
									
								
								bin/serve.js
									
									
									
									
									
								
							| @@ -77,7 +77,7 @@ const start = () => { | |||||||
|       if (/appName/.test(vue)) { |       if (/appName/.test(vue)) { | ||||||
|         let appName = vue.replace(/[\s\S]*(appName:.+),[\s\S]*/gm, '$1'), |         let appName = vue.replace(/[\s\S]*(appName:.+),[\s\S]*/gm, '$1'), | ||||||
|             title = appName.replace(/(appName:|["'])/g, '') |             title = appName.replace(/(appName:|["'])/g, '') | ||||||
|         app.style = {navigationBarTitleText: title} |         app.style = {navigationBarTitleText: title.trim()} | ||||||
|       } |       } | ||||||
|       json.pages.push(app) |       json.pages.push(app) | ||||||
|     } |     } | ||||||
| @@ -91,38 +91,38 @@ const start = () => { | |||||||
|       if (/appName/.test(vue)) { |       if (/appName/.test(vue)) { | ||||||
|         let appName = vue.replace(/[\s\S]*(appName:.+),[\s\S]*/gm, '$1'), |         let appName = vue.replace(/[\s\S]*(appName:.+),[\s\S]*/gm, '$1'), | ||||||
|             title = appName.replace(/(appName:|["'])/g, '') |             title = appName.replace(/(appName:|["'])/g, '') | ||||||
|         app.style = {navigationBarTitleText: title} |         app.style = {navigationBarTitleText: title.trim()} | ||||||
|       } |       } | ||||||
|       json.pages.push(app) |       json.pages.push(app) | ||||||
|     } |     } | ||||||
|   })).then(() =>  findApp('src/saas', file => { |   })).then(() => findApp('src/saas', file => { | ||||||
|       if (/.+\\App[^\\]+\\[^\\]+\.vue/g.test(file)) { |     if (/.+\\App[^\\]+\\[^\\]+\.vue/g.test(file)) { | ||||||
|         let app = { |       let app = { | ||||||
|           name: file.replace(/.*\\([^\\]+).vue/g, '$1'), |         name: file.replace(/.*\\([^\\]+).vue/g, '$1'), | ||||||
|           path: file.replace(/^src\\(.*).vue/g, '$1').replace(/\\/g, '/') |         path: file.replace(/^src\\(.*).vue/g, '$1').replace(/\\/g, '/') | ||||||
|         } |  | ||||||
|         let vue = fs.readFileSync(file).toString() |  | ||||||
|         if (/appName/.test(vue)) { |  | ||||||
|           let appName = vue.replace(/[\s\S]*(appName:.+),[\s\S]*/gm, '$1'), |  | ||||||
|               title = appName.replace(/(appName:|["'])/g, '') |  | ||||||
|           app.style = {navigationBarTitleText: title} |  | ||||||
|         } |  | ||||||
|         json.pages.push(app) |  | ||||||
|       } |       } | ||||||
|   })).then(() =>  findApp('src/project', file => { |       let vue = fs.readFileSync(file).toString() | ||||||
|       if (/.+\\App[^\\]+\\[^\\]+\.vue/g.test(file)) { |       if (/appName/.test(vue)) { | ||||||
|         let app = { |         let appName = vue.replace(/[\s\S]*(appName:.+),[\s\S]*/gm, '$1'), | ||||||
|           name: file.replace(/.*\\([^\\]+).vue/g, '$1'), |             title = appName.replace(/(appName:|["'])/g, '') | ||||||
|           path: file.replace(/^src\\(.*).vue/g, '$1').replace(/\\/g, '/') |         app.style = {navigationBarTitleText: title.trim()} | ||||||
|         } |  | ||||||
|         let vue = fs.readFileSync(file).toString() |  | ||||||
|         if (/appName/.test(vue)) { |  | ||||||
|           let appName = vue.replace(/[\s\S]*(appName:.+),[\s\S]*/gm, '$1'), |  | ||||||
|               title = appName.replace(/(appName:|["'])/g, '') |  | ||||||
|           app.style = {navigationBarTitleText: title} |  | ||||||
|         } |  | ||||||
|         json.pages.push(app) |  | ||||||
|       } |       } | ||||||
|  |       json.pages.push(app) | ||||||
|  |     } | ||||||
|  |   })).then(() => findApp('src/project', file => { | ||||||
|  |     if (/.+\\App[^\\]+\\[^\\]+\.vue/g.test(file)) { | ||||||
|  |       let app = { | ||||||
|  |         name: file.replace(/.*\\([^\\]+).vue/g, '$1'), | ||||||
|  |         path: file.replace(/^src\\(.*).vue/g, '$1').replace(/\\/g, '/') | ||||||
|  |       } | ||||||
|  |       let vue = fs.readFileSync(file).toString() | ||||||
|  |       if (/appName/.test(vue)) { | ||||||
|  |         let appName = vue.replace(/[\s\S]*(appName:.+),[\s\S]*/gm, '$1'), | ||||||
|  |             title = appName.replace(/(appName:|["'])/g, '') | ||||||
|  |         app.style = {navigationBarTitleText: title.trim()} | ||||||
|  |       } | ||||||
|  |       json.pages.push(app) | ||||||
|  |     } | ||||||
|   })).then(() => { |   })).then(() => { | ||||||
|     fsExtra.outputJson('src/pages.json', json, () => { |     fsExtra.outputJson('src/pages.json', json, () => { | ||||||
|       chalkTag.done('生成pages.json') |       chalkTag.done('生成pages.json') | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user