Skip to content

Commit

Permalink
fix: fix key values ​​to be POSIX path separators
Browse files Browse the repository at this point in the history
  • Loading branch information
mato533 committed Dec 23, 2024
1 parent d58c451 commit bf35d75
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/@wdio_electron-pkg-builder/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const findEntryPoint = (name: string, rootDir: string, srcDir: string) => {
const checkPath = join(rootDir, srcPath);
debug(`Checking path: ${checkPath}`);
if (existsSync(checkPath)) {
const posixPath = posix.join(...srcPath.split(sep));
const posixPath = normalizeToPosix(srcPath);
debug(`Found entry point: ${posixPath}`);
return posixPath;
}
Expand All @@ -33,6 +33,8 @@ export const getFieldMissingErrorMessage = (field: string, path: string) => {
return `"${field}" field which is required is not set: ${path}`;
};

const normalizeToPosix = (path: string) => posix.join(...path.split(sep));

export const getInputConfig = (pkg: NormalizedReadResult, srcDir: string) => {
debug(`Resolving entry points using exports field`);
const exportsValue = pkg.packageJson.exports;
Expand All @@ -44,7 +46,7 @@ export const getInputConfig = (pkg: NormalizedReadResult, srcDir: string) => {
const config = Object.keys(exportsValue).reduce((acc: Record<string, string>, key) => {
debug(`Resolving entry points using exports field value: ${key}`);
const name = basename(key) === '.' ? 'index' : relative('./', key);
acc[name] = findEntryPoint(name, rootDir, srcDir);
acc[normalizeToPosix(name)] = findEntryPoint(name, rootDir, srcDir);
return acc;
}, {});

Expand Down

0 comments on commit bf35d75

Please sign in to comment.