add license file to npm publish (#11705)

This commit is contained in:
shelley vohr 2018-01-23 18:09:08 -05:00 committed by GitHub
parent 39554566cc
commit 4757980f9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,7 +21,8 @@ const files = [
'index.js',
'install.js',
'package.json',
'README.md'
'README.md',
'LICENSE'
]
const jsonFields = [
@ -49,9 +50,10 @@ new Promise((resolve, reject) => {
tempDir = dirPath
// copy files from `/npm` to temp directory
files.forEach((name) => {
const noThirdSegment = name === 'README.md' || 'LICENSE'
fs.writeFileSync(
path.join(tempDir, name),
fs.readFileSync(path.join(__dirname, '..', name === 'README.md' ? '' : 'npm', name))
fs.readFileSync(path.join(__dirname, '..', noThirdSegment ? '' : 'npm', name))
)
})
// copy from root package.json to temp/package.json