Skip to content

Commit

Permalink
fix: compare to \n instead of os.EOL (#157)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
nlf authored Aug 15, 2022
1 parent 755a300 commit 5517e9e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 1 addition & 2 deletions lib/check/check-changelog.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const fs = require('@npmcli/fs')
const { EOL } = require('os')
const { join, relative } = require('path')

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

if (await fs.exists(changelog)) {
const content = await fs.readFile(changelog, { encoding: 'utf8' })
const mustStart = `# Changelog${EOL}${EOL}#`
const mustStart = `# Changelog\n\n#`
if (!content.startsWith(mustStart)) {
return {
title: `The ${relative(root, changelog)} is incorrect:`,
Expand Down
4 changes: 3 additions & 1 deletion lib/util/get-git-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ const getRepo = async (path) => {
const url = new URL(`https://${domain}`)
url.pathname = `/${user}/${project}.git`
return url.toString()
} catch {}
} catch {
// errors are ignored
}
}

module.exports = getRepo

0 comments on commit 5517e9e

Please sign in to comment.