diff --git a/.gitignore b/.gitignore index 32266548b6..e8084ef54e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,6 @@ bundles/ PIG/bundles/ Parse-Dashboard/public/bundles/ Parse-Dashboard/parse-dashboard-config.json -dist/ npm-debug.log // vim .swp diff --git a/bin/parse-dashboard b/bin/parse-dashboard index 79eb70c64a..d83bb2f1a7 100755 --- a/bin/parse-dashboard +++ b/bin/parse-dashboard @@ -1,2 +1,2 @@ #!/usr/bin/env node -require('../dist/Parse-Dashboard'); +require('../Parse-Dashboard'); diff --git a/gulpfile.js b/gulpfile.js deleted file mode 100644 index bee4b01ddd..0000000000 --- a/gulpfile.js +++ /dev/null @@ -1,28 +0,0 @@ -var gulp = require('gulp'); -var webpack = require('webpack'); -var webpackConfig = require("./webpack/production.config"); - -var dist = './dist/Parse-Dashboard'; -var bundlesDir = './production/bundles'; - -gulp.task('webpack', function(callback) { - // run webpack - webpack(webpackConfig, function(err, stats) { - if(err) throw new gutil.PluginError('webpack', err); - callback(); - }); -}); - -gulp.task('bundles', ['webpack'], function(){ - gulp.src([bundlesDir + '/dashboard.bundle.js', bundlesDir + '/sprites.svg']) - .pipe(gulp.dest(dist + '/public/bundles/')); -}) - -gulp.task('static', ['bundles'], function() { - gulp.src(['./Parse-Dashboard/**/*', // all files - '!./Parse-Dashboard/*.json', // but the config - '!./Parse-Dashboard/public/bundles/*']) // but the bundles - .pipe(gulp.dest(dist)); -}); - -gulp.task('default', ['static', 'bundles']); diff --git a/package.json b/package.json index 96b8d07314..9e722b0642 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ }, "license": "LicenseRef-LICENSE", "files": [ - "dist" + "Parse-Dashboard", + "bin" ], "dependencies": { "babel-runtime": "~5.8.25", @@ -32,7 +33,6 @@ "babel-loader": "~5.3.0", "babel-plugin-remove-proptypes": "~1.0.0", "css-loader": "~0.18.0", - "gulp": "^3.9.1", "http-server": "~0.8.5", "immutable-devtools": "~0.0.4", "jest-cli": "^0.7.1", @@ -51,8 +51,8 @@ "build": "NODE_ENV=production webpack --config webpack/production.config.js && webpack --config webpack/PIG.config.js", "test": "NODE_PATH=./node_modules jest", "generate": "node scripts/generate.js", - "prepublish": "gulp", - "start": "node ./dist/Parse-Dashboard/index.js" + "prepublish": "webpack --config webpack/publish.config.js --progress", + "start": "node ./Parse-Dashboard/index.js" }, "bin": { "parse-dashboard": "./bin/parse-dashboard" diff --git a/webpack/publish.config.js b/webpack/publish.config.js new file mode 100644 index 0000000000..97ebc4e6d2 --- /dev/null +++ b/webpack/publish.config.js @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2016-present, Parse, LLC + * All rights reserved. + * + * This source code is licensed under the license found in the LICENSE file in + * the root directory of this source tree. + */ +var configuration = require('./base.config.js'); + +configuration.entry = {dashboard: './dashboard/index.js'}; +configuration.output.path = './Parse-Dashboard/public/bundles'; + +var webpack = require('webpack'); + +// Add propType removal to Babel +var loaders = configuration.module.loaders; +for (var i = 0; i < loaders.length; i++) { + if (loaders[i].loader === 'babel-loader') { + if (!loaders[i].query.plugins) { + loaders[i].query.plugins = []; + } + loaders[i].query.plugins.push('babel-plugin-remove-proptypes'); + break; + } +} + +// Enable minification +configuration.plugins.push( + new webpack.DefinePlugin({ + 'process.env': { + 'NODE_ENV': '"production"' + } + }), + new webpack.optimize.UglifyJsPlugin({ + compress: { + warnings: false + } + }), + new webpack.optimize.OccurenceOrderPlugin(), + function() { + this.plugin('done', function(stats) { + if (stats.compilation.errors && stats.compilation.errors.length) { + console.log(stats.compilation.errors); + process.exit(1); + } + }); + } +); + +module.exports = configuration;