UNPKG

658 BJavaScriptView Raw
1'use strict'
2
3var fs = require('fs')
4
5function _genComponentExport(component) {
6 fs.readFile('./lib/components/' + component + '/index.js', function (error, data) {
7 var componentData = data.toString().replace('./', './components/')
8
9 fs.writeFile('./lib/' + component + '.js', componentData, function (error, data) {
10 if (error) console.error('Error: ', error)
11 })
12 })
13}
14
15fs.readdir('./src/components', function (error, data) {
16 var components = data.filter(function (f) { return (/^[A-Z]/.test(f)) })
17
18 // Generate individual component exports
19 for (var i = 0; i < components.length; i++) {
20 _genComponentExport(components[i])
21 }
22})