Skip to content

Commit

Permalink
fix: find baseDir in egg (#1154)
Browse files Browse the repository at this point in the history
  • Loading branch information
czy88840616 authored Jul 14, 2021
1 parent 2df53c2 commit 2fc9a44
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/web/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { isTypeScriptEnvironment } from '@midwayjs/bootstrap';
import { basename, join } from 'path';
import { sync as findUpSync, stop } from 'find-up';
import { existsSync } from 'fs';

export const parseNormalDir = (baseDir: string, isTypescript = true) => {
if (isTypescript) {
if (/src$/.test(baseDir) || /dist$/.test(baseDir)) {
// 这里要么就是 src 目录,要么就已经是根目录
if (!existsSync(join(baseDir, 'package.json'))) {
baseDir = basename(baseDir);
}

Expand Down

0 comments on commit 2fc9a44

Please sign in to comment.