Skip to content

Commit 7cc1705

Browse files
committed
feat: add path
1 parent 4535505 commit 7cc1705

File tree

2 files changed

+14
-0
lines changed
  • src/built-in-plugins

2 files changed

+14
-0
lines changed

src/built-in-plugins/command-dev/plugin/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ pri.commands.registerCommand({
1212
alias: 'w',
1313
description: 'Watch only for component',
1414
},
15+
path: {
16+
alias: 'p',
17+
description: 'specify paths to build',
18+
},
1519
},
1620
description: text.commander.dev.description,
1721
action: async (options: any) => {

src/built-in-plugins/project-analyse-pages/plugin/index.ts

+10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as _ from 'lodash';
22
import * as normalizePath from 'normalize-path';
33
import * as path from 'path';
4+
import * as yargs from 'yargs';
45
import { pri } from '../../../node';
56
import { md5 } from '../../../utils/md5';
67
import { pagesPath, tempPath } from '../../../utils/structor-config';
@@ -71,9 +72,18 @@ pri.project.onAnalyseProject(files => {
7172
};
7273
}
7374

75+
const paths = ((yargs.argv.path ?? '') as string).split(',').filter(each => !!each);
76+
7477
return {
7578
projectAnalysePages: {
7679
pages: pri.sourceConfig.routes
80+
.filter(route => {
81+
if (paths.length <= 0) {
82+
return true;
83+
}
84+
85+
return paths.includes(route.path);
86+
})
7787
.filter(route => {
7888
if (route.redirect && route.component) {
7989
logFatal('route "redirect" and "component" are mutually exclusive.');

0 commit comments

Comments
 (0)