Skip to content

Commit

Permalink
chore: fix win
Browse files Browse the repository at this point in the history
  • Loading branch information
SoonIter committed Aug 13, 2024
1 parent ef426b5 commit f1e3984
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 0 additions & 2 deletions e2e/scripts/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import fg, {
} from 'fast-glob';
import fse from 'fs-extra';

export const getFiles = async (_pattern: string) => {};

// fast-glob only accepts posix path
// https://github.com/mrmlnc/fast-glob#convertpathtopatternpath
const convertPath = (path: string) => {
Expand Down
11 changes: 9 additions & 2 deletions packages/plugin-dts/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ export async function processDtsFiles(

const dtsFiles = await fg(`${dir}/**/*.d.ts`);

console.log('11111 fg', dir, 'dtsFiles', dtsFiles);

for (const file of dtsFiles) {
try {
const newFile = file.replace('.d.ts', dtsExtension);
Expand Down Expand Up @@ -107,7 +109,12 @@ export async function calcLongestCommonPath(
return null;
}

const splitPaths = absPaths.map((p) => p.split(path.sep));
// we support two cases
// 1. /packages-a/src/index.ts
// 2. D:/packages-a/src/index.ts
const sep = path.posix.sep as '/';

const splitPaths = absPaths.map((p) => p.split(sep));
let lcaFragments = splitPaths[0]!;
for (let i = 1; i < splitPaths.length; i++) {
const currentPath = splitPaths[i]!;
Expand All @@ -121,7 +128,7 @@ export async function calcLongestCommonPath(
lcaFragments = lcaFragments.slice(0, j);
}

let lca = lcaFragments.length > 0 ? lcaFragments.join(path.sep) : '/';
let lca = lcaFragments.length > 0 ? lcaFragments.join(sep) : sep;

const stats = await fsP.stat(lca);
if (stats?.isFile()) {
Expand Down

0 comments on commit f1e3984

Please sign in to comment.