Skip to content

Commit

Permalink
fix: lockfile setting adds lockfile to allowed gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys committed Apr 15, 2022
1 parent aeb0162 commit c808c4f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/content/gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
!/README*
!/LICENSE*
!/CHANGELOG*
{{#if lockfile}}
package-lock.json
{{/if}}
{{#each ignorePaths}}
{{.}}
{{/each}}
28 changes: 28 additions & 0 deletions test/apply/lockfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const t = require('tap')
const setup = require('../setup.js')

t.test('lockfile', async (t) => {
const s = await setup(t, {
package: {
templateOSS: {
lockfile: true,
},
},
})
await s.apply()
const gitignore = await s.readFile('.gitignore')
t.ok(gitignore.includes('package-lock.json'))

const npmrc = await s.readFile('.npmrc')
t.ok(npmrc.includes('package-lock=true'))
})

t.test('no lockfile by default', async (t) => {
const s = await setup(t)
await s.apply()
const gitignore = await s.readFile('.gitignore')
t.ok(!gitignore.includes('package-lock.json'))

const npmrc = await s.readFile('.npmrc')
t.ok(npmrc.includes('package-lock=false'))
})

0 comments on commit c808c4f

Please sign in to comment.