diff --git a/package.json b/package.json index 61e33753d15..1111385c417 100644 --- a/package.json +++ b/package.json @@ -32,9 +32,7 @@ "react-ace": "5.5.0", "serve": "6.3.1", "tabbable": "1.1.0", - "uuid": "3.1.0" - }, - "devDependencies": { + "uuid": "3.1.0", "@elastic/eslint-config-kibana": "0.13.0", "autoprefixer": "7.1.5", "babel-cli": "6.26.0", diff --git a/scripts/compile-clean.sh b/scripts/compile-clean.sh index 5b0f27d423b..c7b31970d5f 100755 --- a/scripts/compile-clean.sh +++ b/scripts/compile-clean.sh @@ -2,4 +2,14 @@ set -e -rm -rf dist lib +eui="$(pwd)" + +while getopts 'e:' arg +do + case ${arg} in + e) eui=${OPTARG};; + *) return 1 # illegal option + esac +done + +rm -rf "${eui}/dist" "${eui}/lib" diff --git a/scripts/compile-eui.sh b/scripts/compile-eui.sh index ebcd05a63bb..f5b1fdb1cc9 100755 --- a/scripts/compile-eui.sh +++ b/scripts/compile-eui.sh @@ -2,11 +2,21 @@ set -e +eui="$(pwd)" + +while getopts 'e:' arg +do + case ${arg} in + e) eui=${OPTARG};; + *) return 1 # illegal option + esac +done + compile_lib() { local color_green="\033[0;32m" local color_reset="\033[0m" - mkdir -p lib/components lib/services lib/test + mkdir -p "${eui}/lib/components" "${eui}/lib/services" "${eui}/lib/test" # We use tput below to save the cursor position, then restore it later in # order to overwrite "processing" messages. @@ -15,30 +25,30 @@ compile_lib() { echo -n " Compiling src/ to lib/ " >&2 babel \ --quiet \ - --out-dir=lib \ + --out-dir="${eui}/lib" \ --ignore "**/webpack.config.js,**/*.test.js" \ - src + "${eui}/src" tput rc echo -e "${color_green}✔ Finished compiling src/ to lib/${color_reset}" >&2 # Also copy over SVGs. Babel has a --copy-files option but that brings over # all kinds of things we don't want into the lib folder. - mkdir -p lib/components/icon/assets - for SVG in $(cd src && find components -name \*.svg); do - cp "src/$SVG" "lib/$SVG" + mkdir -p "${eui}/lib/components/icon/assets" + for SVG in $(cd "${eui}/src" && find components -name \*.svg); do + cp "${eui}/src/$SVG" "${eui}/lib/$SVG" done echo -e "${color_green}✔ Finished copying SVGs${color_reset}" >&2 } compile_bundle() { - mkdir -p dist + mkdir -p "${eui}/dist" echo -e "\nBuilding bundle...\n" >&2 - webpack --config=src/webpack.config.js + webpack --config="${eui}/src/webpack.config.js" echo -e "\nBuilding minified bundle...\n" >&2 - NODE_ENV=production webpack --config=src/webpack.config.js + NODE_ENV=production webpack --config="${eui}/src/webpack.config.js" } compile_lib diff --git a/scripts/compile-scss.sh b/scripts/compile-scss.sh index 71cb0952952..a59da8c6eee 100755 --- a/scripts/compile-scss.sh +++ b/scripts/compile-scss.sh @@ -2,9 +2,22 @@ set -e -mkdir -p dist +eui="$(pwd)" -for THEME in src/theme_*.scss; do - node-sass "$THEME" > "dist/eui_$(basename "$THEME" .scss).css" - postcss --replace --config src-docs/postcss.config.js "dist/eui_$(basename "$THEME" .scss).css" +while getopts 'e:' arg +do + case ${arg} in + e) eui=${OPTARG};; + *) return 1 # illegal option + esac +done + +mkdir -p "${eui}/dist" + +src="${eui}/src/theme_*.scss" + +for THEME in $src; do + dest="${eui}/dist/eui_$(basename "$THEME" .scss).css" + node-sass "$THEME" > "$dest" + postcss --replace --config "${eui}/src-docs/postcss.config.js" "$dest" done diff --git a/scripts/compile.sh b/scripts/compile.sh index aa4766405ae..1c37d089d71 100755 --- a/scripts/compile.sh +++ b/scripts/compile.sh @@ -2,6 +2,16 @@ set -e -./scripts/compile-clean.sh -./scripts/compile-scss.sh -./scripts/compile-eui.sh +eui="$(pwd)" + +while getopts 'e:' arg +do + case ${arg} in + e) eui=${OPTARG};; + *) return 1 # illegal option + esac +done + +"${eui}/scripts/compile-clean.sh" +"${eui}/scripts/compile-scss.sh" +"${eui}/scripts/compile-eui.sh" diff --git a/src/webpack.config.js b/src/webpack.config.js index d506d0b336d..2874f34c7de 100644 --- a/src/webpack.config.js +++ b/src/webpack.config.js @@ -43,11 +43,11 @@ module.exports = { loaders: [{ test: /\.js$/, loader: 'babel-loader', - exclude: /node_modules/ + include: path.resolve(__dirname, '../src'), }, { test: /\.scss$/, loaders: ['style-loader', 'css-loader', 'postcss-loader', 'sass-loader'], - exclude: /node_modules/ + include: path.resolve(__dirname, '../src'), }, { test: /\.(woff|woff2|ttf|eot|ico|png|gif|jpg|jpeg)(\?|$)/, loader: 'file-loader',