ff-stream-web

git clone git://archive.git.mtrnord.blog/MTRNord/ff-stream-web.git
Log | Files | Refs | README | LICENSE

commit 2cb08b9cf8702d6cf1893471478ed6d72f250ba5
parent b24074488d507d0110b91798e6f423e298cd0da2
Author: Pavel Lang <langpavel@phpskelet.org>
Date:   Thu, 16 Feb 2017 03:32:04 +0100

Revert "Generate stats.json for Webpack Analyser (http://webpack.github.io/analyse/)"

This reverts commit 4bd3f3fdaf067842c49af1ce5b2e3188066e7d17.

Diffstat:
M.gitignore | 1-
Mpackage.json | 3+--
Dtools/stats.js | 47-----------------------------------------------
3 files changed, 1 insertion(+), 50 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -6,4 +6,3 @@ database.sqlite node_modules ncp-debug.log npm-debug.log -stats.json diff --git a/package.json b/package.json @@ -208,7 +208,6 @@ "deploy": "babel-node tools/run deploy", "render": "babel-node tools/run render", "serve": "babel-node tools/run runServer", - "start": "babel-node tools/run start", - "stats": "babel-node tools/run stats" + "start": "babel-node tools/run start" } } diff --git a/tools/stats.js b/tools/stats.js @@ -1,47 +0,0 @@ -/** - * React Starter Kit (https://www.reactstarterkit.com/) - * - * Copyright © 2014-present Kriasoft, LLC. All rights reserved. - * - * This source code is licensed under the MIT license found in the - * LICENSE.txt file in the root directory of this source tree. - */ - -import webpack from 'webpack'; -import { writeFile } from 'fs'; -import { open } from 'openurl'; -import webpackConfig from './webpack.config'; - -const WEBPACK_ANALYSER_URL = 'http://webpack.github.io/analyse/'; -/** - * Creates application stats for client bundle. - */ -function clientStats() { - return new Promise((resolve, reject) => { - const clientConfig = { - ...webpackConfig[0], - profile: true, - }; - - webpack(clientConfig).run((err, stats) => { - if (err) { - reject(err); - return; - } - - const statsJson = JSON.stringify(stats.toJson(), null, 2); - writeFile('stats.json', statsJson, 'utf-8', (saveErr) => { - if (saveErr) { - console.error(saveErr.message); - reject(saveErr); - return; - } - console.log(`Now you can load \`stats.json\` into page at ${WEBPACK_ANALYSER_URL}`); - open(WEBPACK_ANALYSER_URL); - resolve(stats); - }); - }); - }); -} - -export default clientStats;