Skip to content

Commit 5517e9e

Browse files
authored
fix: compare to \n instead of os.EOL (#157)
* fix: compare to \n instead of os.EOL os.EOL is \r\n in win32, which means this check is pretty much guaranteed to fail in windows * chore: lint
1 parent 755a300 commit 5517e9e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/check/check-changelog.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
const fs = require('@npmcli/fs')
2-
const { EOL } = require('os')
32
const { join, relative } = require('path')
43

54
const run = async ({ root, path }) => {
@@ -10,7 +9,7 @@ const run = async ({ root, path }) => {
109

1110
if (await fs.exists(changelog)) {
1211
const content = await fs.readFile(changelog, { encoding: 'utf8' })
13-
const mustStart = `# Changelog${EOL}${EOL}#`
12+
const mustStart = `# Changelog\n\n#`
1413
if (!content.startsWith(mustStart)) {
1514
return {
1615
title: `The ${relative(root, changelog)} is incorrect:`,

lib/util/get-git-url.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ const getRepo = async (path) => {
1818
const url = new URL(`https://${domain}`)
1919
url.pathname = `/${user}/${project}.git`
2020
return url.toString()
21-
} catch {}
21+
} catch {
22+
// errors are ignored
23+
}
2224
}
2325

2426
module.exports = getRepo

0 commit comments

Comments
 (0)