This commit is contained in:
Stas Ukolov 2016-12-23 08:51:29 +05:00
Родитель 8faa52d26f
Коммит b08b81d759
2 изменённых файлов: 20 добавлений и 10 удалений

Просмотреть файл

@ -4,8 +4,9 @@ Build top package
fs = require 'fs'
path = require 'path'
pckg = require '../package'
pckg = JSON.parse JSON.stringify pckg
paths = require './paths'
pckg = JSON.parse JSON.stringify paths.package
name = pckg.name
@ -20,14 +21,11 @@ Object.keys pckg
pckg.optionalDependencies =
"#{name}": pckg.version
src = path.join __dirname, '..'
dst = path.join src, 'top'
try fs.mkdirSync paths.top
try fs.mkdirSync dst
fs.writeFile path.join(dst, 'package.json'), JSON.stringify(pckg, null, ' '), ->
fs.writeFile path.join(dst, 'index.js'), require('./js'), ->
fs.writeFile path.join(paths.top, 'package.json'), JSON.stringify(pckg, null, ' '), ->
fs.writeFile path.join(paths.top, 'index.js'), require('./js'), ->
for k in 'README.md'.split ' '
fs.createReadStream path.join src, k
.pipe fs.createWriteStream path.join dst, k
fs.createReadStream path.join paths.root, k
.pipe fs.createWriteStream path.join paths.top, k

12
build/paths.coffee Normal file
Просмотреть файл

@ -0,0 +1,12 @@
path = require 'path'
@package =
pckg = require '../package'
@root =
root = path.join __dirname, '..'
for f in 'src top'.split ' '
@[f] = path.join root, f
@dst = path.join root, pckg.files[0]