Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/check/check-changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ const run = async ({ root, path }) => {

if (await fs.exists(changelog)) {
const content = await fs.readFile(changelog, { encoding: 'utf8' })
const mustStart = `# Changelog\n\n#`
if (!content.startsWith(mustStart)) {
const mustStart = /^#\s+Changelog\r?\n\r?\n#/
if (!mustStart.test(content)) {
return {
title: `The ${relative(root, changelog)} is incorrect:`,
body: [
'The changelog should start with',
`"${mustStart}"`,
`"# Changelog\n\n#"`,
],
solution: 'reformat the changelog to have the correct heading',
}
Expand Down
3 changes: 1 addition & 2 deletions lib/check/check-gitignore.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const log = require('proc-log')
const { EOL } = require('os')
const { resolve, relative, basename } = require('path')
const fs = require('@npmcli/fs')
const git = require('@npmcli/git')
Expand Down Expand Up @@ -48,7 +47,7 @@ const run = async ({ root, path, config }) => {

const ignores = (await fs.readFile(ignoreFile))
.toString()
.split(EOL)
.split(/\r?\n/)
.filter((l) => l && !l.trim().startsWith('#'))

const relIgnore = relativeToRoot(ignoreFile)
Expand Down
3 changes: 1 addition & 2 deletions lib/util/parser.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 { basename, extname, dirname } = require('path')
const yaml = require('yaml')
const NpmPackageJson = require('@npmcli/package-json')
Expand Down Expand Up @@ -56,7 +55,7 @@ class Base {

prepare (s) {
const header = this.header()
return header ? header + EOL + EOL + s : s
return header ? `${header}\n\n${s}` : s
}

prepareTarget (s) {
Expand Down