Skip to content

Commit 94af562

Browse files
author
daniel.gomez
committed
Added build script
1 parent 7faf6b2 commit 94af562

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/src
2+
# Created by .ignore support plugin (hsz.mobi)

package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
"name": "redux-autoform-bootstrap-ui",
33
"version": "1.0.0",
44
"description": "Bootstrap UI implementation for redux-autoform",
5-
"main": "./src/index.js",
5+
"main": "./lib/index.js",
66
"scripts": {
7+
"build-lib": "babel-node ./tools/build-lib.js",
78
"test": "mocha ./test --compilers js:babel-register"
89
},
910
"repository": {
@@ -41,6 +42,11 @@
4142
"babel-preset-react": "^6.5.0",
4243
"babel-preset-stage-0": "^6.5.0",
4344
"chai": "^3.5.0",
44-
"mocha": "^2.5.3"
45+
"child-process-promise": "^2.0.3",
46+
"colors": "^1.1.2",
47+
"fs-extra-promise": "^0.4.0",
48+
"mocha": "^2.5.3",
49+
"path": "^0.12.7",
50+
"rimraf-promise": "^2.0.0"
4551
}
4652
}

tools/build-lib.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import path from 'path';
2+
import fsep from 'fs-extra-promise';
3+
import rimraf from 'rimraf-promise';
4+
import colors from 'colors';
5+
import { exec } from 'child-process-promise';
6+
7+
const repoRoot = path.resolve(__dirname, '../');
8+
const lib = path.join(repoRoot, 'lib');
9+
const lessSrc = path.join(repoRoot, '/src/less');
10+
const lessDest = path.join(lib, '/less');
11+
12+
console.log('building lib'.green);
13+
14+
rimraf(lib)
15+
.then(function (error) {
16+
let babelCli = '"./node_modules/.bin/babel" src -d lib';
17+
return exec(babelCli).fail(function (error) {
18+
console.log(colors.red(error))
19+
});
20+
})
21+
.then(() => fsep.copyAsync(lessSrc, lessDest))
22+
.then(() => console.log('lib built'.green));

0 commit comments

Comments
 (0)