Skip to content

Commit c808c4f

Browse files
committed
fix: lockfile setting adds lockfile to allowed gitignore
1 parent aeb0162 commit c808c4f

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

lib/content/gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
!/README*
1313
!/LICENSE*
1414
!/CHANGELOG*
15+
{{#if lockfile}}
16+
package-lock.json
17+
{{/if}}
1518
{{#each ignorePaths}}
1619
{{.}}
1720
{{/each}}

test/apply/lockfile.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
const t = require('tap')
2+
const setup = require('../setup.js')
3+
4+
t.test('lockfile', async (t) => {
5+
const s = await setup(t, {
6+
package: {
7+
templateOSS: {
8+
lockfile: true,
9+
},
10+
},
11+
})
12+
await s.apply()
13+
const gitignore = await s.readFile('.gitignore')
14+
t.ok(gitignore.includes('package-lock.json'))
15+
16+
const npmrc = await s.readFile('.npmrc')
17+
t.ok(npmrc.includes('package-lock=true'))
18+
})
19+
20+
t.test('no lockfile by default', async (t) => {
21+
const s = await setup(t)
22+
await s.apply()
23+
const gitignore = await s.readFile('.gitignore')
24+
t.ok(!gitignore.includes('package-lock.json'))
25+
26+
const npmrc = await s.readFile('.npmrc')
27+
t.ok(npmrc.includes('package-lock=false'))
28+
})

0 commit comments

Comments
 (0)