1 | 'use strict'
|
2 |
|
3 | var fs = require('fs')
|
4 |
|
5 | function _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 |
|
15 | fs.readdir('./src/components', function (error, data) {
|
16 | var components = data.filter(function (f) { return (/^[A-Z]/.test(f)) })
|
17 |
|
18 |
|
19 | for (var i = 0; i < components.length; i++) {
|
20 | _genComponentExport(components[i])
|
21 | }
|
22 | })
|