File tree 2 files changed +14
-0
lines changed
project-analyse-pages/plugin
2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,10 @@ pri.commands.registerCommand({
12
12
alias : 'w' ,
13
13
description : 'Watch only for component' ,
14
14
} ,
15
+ path : {
16
+ alias : 'p' ,
17
+ description : 'specify paths to build' ,
18
+ } ,
15
19
} ,
16
20
description : text . commander . dev . description ,
17
21
action : async ( options : any ) => {
Original file line number Diff line number Diff line change 1
1
import * as _ from 'lodash' ;
2
2
import * as normalizePath from 'normalize-path' ;
3
3
import * as path from 'path' ;
4
+ import * as yargs from 'yargs' ;
4
5
import { pri } from '../../../node' ;
5
6
import { md5 } from '../../../utils/md5' ;
6
7
import { pagesPath , tempPath } from '../../../utils/structor-config' ;
@@ -71,9 +72,18 @@ pri.project.onAnalyseProject(files => {
71
72
} ;
72
73
}
73
74
75
+ const paths = ( ( yargs . argv . path ?? '' ) as string ) . split ( ',' ) . filter ( each => ! ! each ) ;
76
+
74
77
return {
75
78
projectAnalysePages : {
76
79
pages : pri . sourceConfig . routes
80
+ . filter ( route => {
81
+ if ( paths . length <= 0 ) {
82
+ return true ;
83
+ }
84
+
85
+ return paths . includes ( route . path ) ;
86
+ } )
77
87
. filter ( route => {
78
88
if ( route . redirect && route . component ) {
79
89
logFatal ( 'route "redirect" and "component" are mutually exclusive.' ) ;
You can’t perform that action at this time.
0 commit comments