From 63f1adb0695c9e869785c4795aaf05b731518479 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Wed, 28 Mar 2018 14:14:35 +0430 Subject: [PATCH] chore: add kitchen-sync --- .gitignore | 2 +- kitchen-sync/index.js | 4 ++++ kitchen-sync/test-loader.js | 5 +++++ kitchen-sync/webpack.config.js | 29 +++++++++++++++++++++++++++++ package.json | 4 +++- yarn.lock | 4 ++++ 6 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 kitchen-sync/index.js create mode 100644 kitchen-sync/test-loader.js create mode 100644 kitchen-sync/webpack.config.js diff --git a/.gitignore b/.gitignore index 0f5949f..a642266 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,4 @@ Thumbs.db .vscode *.sublime-project *.sublime-workspace -test/**/dist +dist diff --git a/kitchen-sync/index.js b/kitchen-sync/index.js new file mode 100644 index 0000000..65274c9 --- /dev/null +++ b/kitchen-sync/index.js @@ -0,0 +1,4 @@ +/* eslint-disable */ + +import 'chalk'; +import 'eslint'; diff --git a/kitchen-sync/test-loader.js b/kitchen-sync/test-loader.js new file mode 100644 index 0000000..7b8353e --- /dev/null +++ b/kitchen-sync/test-loader.js @@ -0,0 +1,5 @@ +function loader(source) { + return `/* Length: ${source.length} */\n ${source}`; +} + +module.exports = loader; diff --git a/kitchen-sync/webpack.config.js b/kitchen-sync/webpack.config.js new file mode 100644 index 0000000..5518b15 --- /dev/null +++ b/kitchen-sync/webpack.config.js @@ -0,0 +1,29 @@ +const path = require('path'); +const requireESM = require('esm')(module); + +const Self = requireESM('../src/index').default; + +module.exports = { + mode: 'production', + context: __dirname, + devtool: false, + target: 'node', + entry: './index.js', + stats: false, + output: { + filename: './output.js', + path: path.join(__dirname, '/dist'), + }, + module: { + rules: [{ test: /\.js$/, use: path.resolve(__dirname, 'test-loader.js') }], + }, + plugins: [ + new Self({ + color: 'yellow', + showCursor: true, + profile: true, + clear: false, + name: 'webpack-bar', + }), + ], +}; diff --git a/package.json b/package.json index 47ac0e6..af15899 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,8 @@ "ci:lint": "npm run lint && npm run security", "ci:test": "npm run test -- --runInBand", "ci:coverage": "npm run test:coverage -- --runInBand", - "defaults": "webpack-defaults" + "defaults": "webpack-defaults", + "kitchen-sync": "webpack-cli --config kitchen-sync/webpack.config.js" }, "dependencies": { "chalk": "^2.3.2", @@ -60,6 +61,7 @@ "eslint-config-webpack": "^1.2.5", "eslint-plugin-import": "^2.9.0", "eslint-plugin-prettier": "^2.6.0", + "esm": "^3.0.11", "husky": "^0.14.3", "jest": "^22.4.3", "lint-staged": "^7.0.0", diff --git a/yarn.lock b/yarn.lock index 5e26636..a5fab91 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2580,6 +2580,10 @@ eslint@^4.19.1: table "4.0.2" text-table "~0.2.0" +esm@^3.0.11: + version "3.0.11" + resolved "https://registry.yarnpkg.com/esm/-/esm-3.0.11.tgz#223baf6b5ab6956efbec6e554e8af1824145d160" + espree@^3.5.4: version "3.5.4" resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.4.tgz#b0f447187c8a8bed944b815a660bddf5deb5d1a7"