Skip to content

Commit

Permalink
fix: ts build cwd (#396)
Browse files Browse the repository at this point in the history
* fix: fix build cwd

* fix/remove conflict

* fix: build default include

* fix: golbby file filter

* fix: concat files

* fix: item instead of file
  • Loading branch information
echosoar authored Feb 20, 2020
1 parent 7a8ec94 commit 83732f9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions packages/midway-bin/lib/cmd/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,30 +300,18 @@ class BuildCommand extends Command {
}

async tsCfg2CliArgs(cwd, argv, args) {
const cfg = argv.tsConfig
const cfg = argv.tsConfig;
// https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
/**
* Files
*/
for (const file of cfg.files || []) {
if (/\.tsx?$/.test(file)) {
args.push(file);
}
}

/**
* include & exclude
*/
const files = await globby(
[].concat(
// include
cfg.include ? cfg.include : './',
// exclude
(cfg.exclude || []).map(str => '!' + str)
cfg.files || [],
cfg.include ? cfg.include : 'src/**/*', // include
(cfg.exclude || []).map(str => '!' + str) // exclude
),
{
cwd: argv.srcDir ? path.join(argv.srcDir, '..') : cwd,
}
{ cwd }
);
for (const item of files) {
if (/\.tsx?$/.test(item)) {
Expand Down

0 comments on commit 83732f9

Please sign in to comment.