Skip to content

Commit 47901d3

Browse files
authored
Merge pull request #6 from Himenon/feat/support-windows-os
feat: support windows os
2 parents f7c2617 + 45fa302 commit 47901d3

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ on:
55

66
jobs:
77
build:
8-
runs-on: ubuntu-latest
8+
runs-on: ${{ matrix.os }}
99

1010
strategy:
1111
matrix:
1212
node-version: [12.x]
13+
os: [windows-latest, ubuntu-latest]
1314

1415
steps:
1516
- uses: actions/checkout@v2

scripts/tools/copyPackageSet.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ export const copyPackageSet = async (): Promise<void> => {
1111
const libDir = "lib";
1212
const publishPackageJson = path.join(libDir, "package.json");
1313
pkg.private = undefined;
14-
pkg.main = path.relative(libDir, pkg.main);
15-
pkg.module = path.relative(libDir, pkg.module);
16-
pkg.types = path.relative(libDir, pkg.types);
14+
pkg.main = path.posix.relative(libDir, pkg.main);
15+
pkg.module = path.posix.relative(libDir, pkg.module);
16+
pkg.types = path.posix.relative(libDir, pkg.types);
1717
pkg.directories = undefined;
1818
pkg.files = undefined;
1919
fs.writeFileSync(publishPackageJson, JSON.stringify(pkg, null, 2), {

src/Utils.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
1-
import { normalize } from "path";
2-
31
export const generateKey = (kind: string, name: string): string => {
42
return `${kind}:${name}`;
53
};
64

75
export const split = (p: string, delimiter: string): string[] => {
8-
return normalize(p).split(delimiter);
6+
const array = [];
7+
for (const seg of p.split(delimiter)) {
8+
switch (seg) {
9+
case ".":
10+
break;
11+
case "..":
12+
array.pop();
13+
break;
14+
default:
15+
array.push(seg);
16+
break;
17+
}
18+
}
19+
return array;
920
};

0 commit comments

Comments
 (0)