diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-01-24 02:10:43 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-01-24 02:10:43 +0800 |
commit | d965fdb11dfba5631c1f98ad3e309876c199999a (patch) | |
tree | ec10b7341707cfcc6841d1b5fcbf0d3852536a79 /packages/testnet-faucets/gulpfile.js | |
parent | 8a858501f2b633f47cec9576b25e6f99911bbc09 (diff) | |
download | dexon-sol-tools-d965fdb11dfba5631c1f98ad3e309876c199999a.tar.gz dexon-sol-tools-d965fdb11dfba5631c1f98ad3e309876c199999a.tar.zst dexon-sol-tools-d965fdb11dfba5631c1f98ad3e309876c199999a.zip |
Rename to testnet-faucets
Diffstat (limited to 'packages/testnet-faucets/gulpfile.js')
-rw-r--r-- | packages/testnet-faucets/gulpfile.js | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/packages/testnet-faucets/gulpfile.js b/packages/testnet-faucets/gulpfile.js new file mode 100644 index 000000000..773faf33a --- /dev/null +++ b/packages/testnet-faucets/gulpfile.js @@ -0,0 +1,92 @@ +const gulp = require('gulp'); +const nodemon = require('nodemon'); +const path = require('path'); +const webpack = require('webpack'); +const fs = require('fs'); +const nodeExternals = require('webpack-node-externals'); + +const config = { + target: 'node', + entry: [path.join(__dirname, '/src/ts/server.ts')], + output: { + path: path.join(__dirname, '/bin'), + filename: 'server.js', + }, + devtool: 'source-map', + resolve: { + modules: [ + path.join(__dirname, '/src/ts'), + 'node_modules', + ], + extensions: ['.ts', '.tsx', '.js', '.jsx', '.json'], + alias: { + ts: path.join(__dirname, '/src/ts'), + contract_artifacts: path.join(__dirname, '/src/contract_artifacts'), + }, + }, + module: { + rules: [ + { + test: /\.js$/, + loader: 'source-map-loader', + }, + { + test: /\.tsx?$/, + loader: 'awesome-typescript-loader', + }, + ], + }, + plugins: [ + new webpack.BannerPlugin({ + banner: 'require("source-map-support").install();', + raw: true, + entryOnly: false, + }), + ], + externals: nodeExternals({ + modulesDir: path.join(__dirname, '../../node_modules') + }), + watchOptions: { + ignored: /bin|node_modules|transpiled/ + }, +}; + +gulp.task('build', function(done) { + webpack(config).run(onBuild(done)); +}); + +gulp.task('watch', function() { + webpack(config).watch(100, function(err, stats) { + onBuild()(err, stats); + nodemon.restart(); + }); +}); + +gulp.task('run', ['watch'], function() { + nodemon({ + execMap: { + js: 'node', + }, + script: path.join(__dirname, 'bin/server'), + ignore: ['*'], + watch: ['foo/'], + ext: 'noop', + }).on('restart', function() { + console.log('Restarted!'); + }); +}); + +function onBuild(done) { + return function(err, stats) { + if(err) { + console.log('Error', err); + } + else { + console.log(stats.toString()); + } + + if(done) { + done(); + } + } +} |