Skip to content

Commit 320e657

Browse files
committed
fix: windows paths
1 parent e4b7fd0 commit 320e657

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/file.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { extname, join } from 'node:path';
1+
import { extname } from 'node:path';
22

33
import { globSync } from 'glob';
44

55
import { cmdLine } from './commandLine';
66

77
export const getFiles = (): string[] =>
8-
globSync(join('**/*'), { cwd: cmdLine.sourcepath, nodir: true })
8+
globSync('**/*', { cwd: cmdLine.sourcepath, nodir: true })
99
.filter((filename) => !['.gz', '.brottli'].includes(extname(filename)))
1010
.sort();

src/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable unicorn/prefer-string-replace-all */
12
import { createHash } from 'node:crypto';
23
import { readFileSync, writeFileSync } from 'node:fs';
34
import { join } from 'node:path';
@@ -28,7 +29,7 @@ for (const file of getFiles()) {
2829
if (cmdLine['no-gzip']) {
2930
sources.push({
3031
index: sourceIndex++,
31-
filename: file,
32+
filename: file.replace(/\\/g, '/'),
3233
content: rawContent,
3334
isGzip: false,
3435
mime,
@@ -41,7 +42,7 @@ for (const file of getFiles()) {
4142
if (rawContent.length > 100 && zipContent.length < rawContent.length * 0.85) {
4243
sources.push({
4344
index: sourceIndex++,
44-
filename: file,
45+
filename: file.replace(/\\/g, '/'),
4546
content: zipContent,
4647
isGzip: true,
4748
mime,
@@ -51,7 +52,7 @@ for (const file of getFiles()) {
5152
} else {
5253
sources.push({
5354
index: sourceIndex++,
54-
filename: file,
55+
filename: file.replace(/\\/g, '/'),
5556
content: rawContent,
5657
isGzip: false,
5758
mime,

0 commit comments

Comments
 (0)