pkg-license.js 553 B

12345678910111213141516171819202122
  1. const path = require('path')
  2. const { copyFile } = require('./util')
  3. const { pkgStructs } = require('./pkg-struct')
  4. const NORMAL_LICENSE = 'LICENSE.txt'
  5. const PREMIUM_LICENSE = 'packages-premium/LICENSE.md'
  6. exports.writePkgLicenses = writePkgLicenses
  7. function writePkgLicenses() {
  8. return Promise.all(
  9. pkgStructs.map(function(pkgStruct) {
  10. let srcPath = pkgStruct.isPremium ? PREMIUM_LICENSE : NORMAL_LICENSE
  11. let destPath = path.join(pkgStruct.distDir, path.basename(srcPath))
  12. return copyFile(srcPath, destPath)
  13. })
  14. )
  15. }