Skip to content

Commit

Permalink
fix: windows globby (#612)
Browse files Browse the repository at this point in the history
  • Loading branch information
echosoar committed Aug 19, 2020
1 parent f4d6698 commit a19a143
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/faas-code-analysis/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as globby from 'globby';
import { existsSync, copy, statSync } from 'fs-extra';
import { join } from 'path';
import { platform } from 'os';

// 首字母小写
export const firstCharLower = str => {
Expand Down Expand Up @@ -34,6 +35,15 @@ export const compareFileChange = async (
options.cwd = process.cwd();
}
options.stats = true;
const isWindows = platform() === 'win32';
if (isWindows) {
fromGlob = fromGlob.map(pattern => {
return pattern.replace(/\\+/g, '/');
});
toGlob = toGlob.map(pattern => {
return pattern.replace(/\\+/g, '/');
});
}
const fromFiles: any = await globby(fromGlob, options);
const toFiles: any = await globby(toGlob, options);

Expand Down

0 comments on commit a19a143

Please sign in to comment.