Browse Source

add license file to npm publish (#11705)

shelley vohr 7 years ago
parent
commit
4757980f9c
1 changed files with 4 additions and 2 deletions
  1. 4 2
      script/publish-to-npm.js

+ 4 - 2
script/publish-to-npm.js

@@ -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