Skip to content

Commit

Permalink
fix!: use posix file path style for reference paths
Browse files Browse the repository at this point in the history
  • Loading branch information
MKruschke committed Dec 23, 2020
1 parent 64e0099 commit 0bd3d5e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "update-ts-references",
"version": "1.3.0",
"version": "2.0.0",
"bin": "src/index.js",
"scripts": {
"lint": "eslint src tests",
Expand Down
10 changes: 8 additions & 2 deletions src/update-ts-references.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,18 @@ const getReferencesFromDependencies = (
.sort((refA, refB) => (refA.path > refB.path ? 1 : -1));
};

const ensurePosixPathStyle = (reference) => ({
...reference,
path: reference.path.split(path.sep).join(path.posix.sep),
});

const updateTsConfig = (
references,
win32OrPosixReferences,
discardComments,
check,
{ packageDir } = { packageDir: process.cwd() }
) => {
const references = (win32OrPosixReferences || []).map(ensurePosixPathStyle);
const tsconfigFilePath = path.join(packageDir, TS_CONFIG_JSON);
let pureJson = true;
try {
Expand All @@ -131,7 +137,7 @@ Do you want to discard them and proceed?`
}
let isEqual = false;
try {
assert.deepEqual(config.references || [], references || []);
assert.deepEqual(config.references || [], references);
isEqual = true;
} catch {
// ignore me
Expand Down

0 comments on commit 0bd3d5e

Please sign in to comment.