From 8e0458961ac478017a55cf8521275e222b2b05ea Mon Sep 17 00:00:00 2001 From: Aruna Herath Date: Wed, 13 Jul 2016 17:18:27 +0530 Subject: [PATCH] Wrote prepublish in javascript This allows storybook to be built in windows too. --- package.json | 2 +- scripts/prepublish.js | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100755 scripts/prepublish.js diff --git a/package.json b/package.json index 2f0616e6b926..7d7322276131 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "mocha": "--require scripts/mocha_runner src/**/__tests__/**/*.js" }, "scripts": { - "prepublish": "./scripts/prepublish.sh", + "prepublish": "node scripts/prepublish.js", "lint": "eslint src", "lintfix": "eslint src --fix", "testonly": "mocha $npm_package_options_mocha", diff --git a/scripts/prepublish.js b/scripts/prepublish.js new file mode 100755 index 000000000000..1fd3cef498e3 --- /dev/null +++ b/scripts/prepublish.js @@ -0,0 +1,17 @@ +require('shelljs/global') +var path = require('path') + +console.log("> Start transpiling ES2015") + +rm('-rf', 'dist') + +var babel = ['node_modules', '.bin', 'babel'].join(path.sep); +exec(babel + " --ignore __tests__,manager --plugins transform-runtime src --out-dir dist") + +if(process.env.DEV_BUILD){ + var webpack = ['node_modules', '.bin', 'webpack'].join(path.sep); + var webpackManagerConf = ["scripts", "webpack.manager.conf.js"].join(path.sep); + exec(webpack + " --config " + webpackManagerConf) +} + +console.log("> Complete transpiling ES2015")