From a14c232935153e7b358979946c9092c2f94007e9 Mon Sep 17 00:00:00 2001 From: Cassie Tarakajian Date: Wed, 13 Jun 2018 17:40:46 -0700 Subject: [PATCH] fix fetch example scripts, add webpack config to build fetch script bundles --- scripts/backup.sh => backup.sh | 0 package.json | 4 +- .../scripts}/examples-gg-latest.js | 0 {scripts => server/scripts}/examples.js | 0 .../scripts}/fetch-examples-gg.js | 0 {scripts => server/scripts}/fetch-examples.js | 0 webpack.config.examples.js | 93 +++++++++++++++++++ 7 files changed, 95 insertions(+), 2 deletions(-) rename scripts/backup.sh => backup.sh (100%) rename {scripts => server/scripts}/examples-gg-latest.js (100%) rename {scripts => server/scripts}/examples.js (100%) rename {scripts => server/scripts}/fetch-examples-gg.js (100%) rename {scripts => server/scripts}/fetch-examples.js (100%) create mode 100644 webpack.config.examples.js diff --git a/scripts/backup.sh b/backup.sh similarity index 100% rename from scripts/backup.sh rename to backup.sh diff --git a/package.json b/package.json index e76f9646..6edafcd9 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,8 @@ "build:client": "cross-env NODE_ENV=production webpack --config webpack.config.prod.js --progress", "build:server": "cross-env NODE_ENV=production webpack --config webpack.config.server.js --progress", "test": "npm run lint", - "fetch-examples": "node scripts/fetch-examples.js", - "fetch-examples-gg": "node scripts/fetch-examples-gg.js" + "fetch-examples": "node ./server/scripts/fetch-examples.js", + "fetch-examples-gg": "node ./server/scripts/fetch-examples-gg.js" }, "main": "index.js", "author": "Cassie Tarakajian", diff --git a/scripts/examples-gg-latest.js b/server/scripts/examples-gg-latest.js similarity index 100% rename from scripts/examples-gg-latest.js rename to server/scripts/examples-gg-latest.js diff --git a/scripts/examples.js b/server/scripts/examples.js similarity index 100% rename from scripts/examples.js rename to server/scripts/examples.js diff --git a/scripts/fetch-examples-gg.js b/server/scripts/fetch-examples-gg.js similarity index 100% rename from scripts/fetch-examples-gg.js rename to server/scripts/fetch-examples-gg.js diff --git a/scripts/fetch-examples.js b/server/scripts/fetch-examples.js similarity index 100% rename from scripts/fetch-examples.js rename to server/scripts/fetch-examples.js diff --git a/webpack.config.examples.js b/webpack.config.examples.js new file mode 100644 index 00000000..a2e08e7e --- /dev/null +++ b/webpack.config.examples.js @@ -0,0 +1,93 @@ +const path = require('path'); +const nodeExternals = require('webpack-node-externals'); + +module.exports = [{ + entry: path.resolve(__dirname, 'server/scripts/fetch-examples.js'), + + output: { + path: __dirname + '/dist/', + filename: 'fetch-examples.bundle.js' + }, + + target: 'node', + + externals: [nodeExternals()], + + resolve: { + extensions: ['*', '.js', '.jsx'], + modules: [ + 'client', + 'node_modules', + ], + }, + + module: { + loaders: [ + { + test: /\.js$/, + exclude: /node_modules/, + loader: 'babel-loader', + query: { + presets: [ + 'react', + 'env', + 'stage-0', + ], + plugins: [ + [ + 'babel-plugin-webpack-loaders', { + 'config': './webpack.config.babel.js', + "verbose": false + } + ] + ] + }, + } + ], + }, +}, +{ + entry: path.resolve(__dirname, 'server/scripts/fetch-examples-gg.js'), + + output: { + path: __dirname + '/dist/', + filename: 'fetch-examples-gg.bundle.js' + }, + + target: 'node', + + externals: [nodeExternals()], + + resolve: { + extensions: ['*', '.js', '.jsx'], + modules: [ + 'client', + 'node_modules', + ], + }, + + module: { + loaders: [ + { + test: /\.js$/, + exclude: /node_modules/, + loader: 'babel-loader', + query: { + presets: [ + 'react', + 'env', + 'stage-0', + ], + plugins: [ + [ + 'babel-plugin-webpack-loaders', { + 'config': './webpack.config.babel.js', + "verbose": false + } + ] + ] + }, + } + ], + }, +}]; \ No newline at end of file