Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Jym77 committed Sep 7, 2023
1 parent ef97ab3 commit 8d31884
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/review/api/alfa-toolchain.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export { Validation }

// Warnings were encountered during analysis:
//
// src/validation/validate-package-json.ts:41:5 - (ae-forgotten-export) The symbol "JSON" needs to be exported by the entry point index.d.ts
// src/validation/validate-package-json.ts:43:5 - (ae-forgotten-export) The symbol "JSON" needs to be exported by the entry point index.d.ts

// (No @packageDocumentation comment for this package)

Expand Down
19 changes: 7 additions & 12 deletions packages/alfa-toolchain/src/validation/validate-package-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,14 @@ export function validatePackageJson(
`${name}: package.json does not have repository.url: "${config.repo}".`
);
}
if (
!dir
// dir is built by @manypkg/get-packages with OS specific separator,
// but packageJson.repository.directory is stored with posix ones (/).
// So, we need to do some magic to convert formats.
.split(path.sep)
.join(path.posix.sep)
.endsWith(packageJson?.repository?.directory ?? "INVALID")
) {

// dir is built by @manypkg/get-packages with OS specific separator,
// but packageJson.repository.directory is stored with posix ones (/).
// So, we need to do some magic to convert formats.
const posixDir = dir.split(path.sep).join(path.posix.sep);
if (!posixDir.endsWith(packageJson?.repository?.directory ?? "INVALID")) {
errors.push(
`${name}: package.json repository.directory (${
packageJson?.repository?.directory
}) does not match its actual directory (${dir.replace("\\", "/")}).`
`${name}: package.json repository.directory (${packageJson?.repository?.directory}) does not match its actual directory (${posixDir}).`
);
}
}
Expand Down

0 comments on commit 8d31884

Please sign in to comment.