From 11c79b2d56572042faa29b9ff5716f2f30d78a96 Mon Sep 17 00:00:00 2001 From: Ben Kalman Date: Wed, 13 Apr 2016 16:31:08 -0700 Subject: [PATCH] Add run.py script to jsmodules/webpack-config (#1243) This is intended to replace simpler uses of .npm_run_helper.py, then I'll continually migrate views until they can use the simpler form. Currently it will only be Splore that uses it. --- jsmodules/webpack-config/package.json | 2 +- jsmodules/webpack-config/run.py | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 jsmodules/webpack-config/run.py diff --git a/jsmodules/webpack-config/package.json b/jsmodules/webpack-config/package.json index 3e1b4e9417..6ade24b374 100644 --- a/jsmodules/webpack-config/package.json +++ b/jsmodules/webpack-config/package.json @@ -1,6 +1,6 @@ { "name": "@attic/webpack-config", - "version": "1.0.1", + "version": "2.0.0", "description": "Shared webpack config for noms", "main": "index.js", "dependencies": { diff --git a/jsmodules/webpack-config/run.py b/jsmodules/webpack-config/run.py new file mode 100644 index 0000000000..ed5a542e9f --- /dev/null +++ b/jsmodules/webpack-config/run.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +import argparse, os, subprocess, sys + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--out', type=str, help='destination js file') + parser.add_argument('--src', type=str, help='source of main js file') + parser.add_argument('mode', type=str, help='"production" or "development"') + args = parser.parse_args() + + env = { + 'NODE_ENV': args.mode, + 'BABEL_ENV': args.mode, + }.update(os.environ) + subprocess.check_call( + ['node_modules/.bin/webpack', + '--config', 'node_modules/@attic/webpack-config/index.js', args.src, args.out], + env=env, shell=False) + + +if __name__ == "__main__": + main()