From 2c71384fcae347e660364a2c3f64927575802e89 Mon Sep 17 00:00:00 2001 From: Greg Dunn Date: Tue, 22 Jan 2019 11:23:16 -0500 Subject: [PATCH 1/7] Update README.md --- README.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 1642515..67a8600 100644 --- a/README.md +++ b/README.md @@ -26,16 +26,17 @@ webpack-dev.js ... const pkWebpack = require('pk-webpack'); const path = require('path'); -const appRoot = path.resolve(__dirname, './'); -pkWebpack( - { - 'appRoot': appRoot, - 'env': 'dev' - } -); +const appRoot = path.resolve(__dirname, '../'); + +const config = { + 'mode': 'development' +}; + +pkWebpack(appRoot, config); + ``` -This initializes Webpack with the proper dev environment, and passes along the root of the project for proper "build" context. In other words, it gives Webpack knowledge of where to look for, and compile assets. "env" could either be `dev` or `prod`, depending on the context and the file that you're in. +This initializes Webpack with the proper dev environment, and passes along the root of the project for proper "build" context. In other words, it gives Webpack knowledge of where to look for, and compile assets. "mode" could either be `development` or `production`, depending on the context and the file that you're in. This gets merged with Webpack's standard configuration object, so you can pass other parameters here as well. 4. `pk-webpack` will look inside your `src` folder for javascript, and sass files within `js`, and `scss` folders respectively. Following best practices, the entry points are `/src/js/site.js` and `/src/scss/site.scss`. From 5b63b40094d140417129bf36ff3d1288fc25fa0e Mon Sep 17 00:00:00 2001 From: bgantick Date: Fri, 1 Feb 2019 11:48:50 -0500 Subject: [PATCH 2/7] add prepare script --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 44b4f6e..9bf806e 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "test": "echo \"Error: no test specified\" && exit 1", "dev": "webpack --watch", "stylelint": "./node_modules/.bin/stylelint \"src/**/*.scss\"", - "eslint": "./node_modules/.bin/eslint eslint" + "eslint": "./node_modules/.bin/eslint eslint", + "prepare": "npm install" }, "author": "", "license": "ISC", From 65a7aa664570a5dda372bad67f4e34e9a794efd6 Mon Sep 17 00:00:00 2001 From: bgantick Date: Fri, 1 Feb 2019 12:00:52 -0500 Subject: [PATCH 3/7] remove install --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9bf806e..8608e6c 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "dev": "webpack --watch", "stylelint": "./node_modules/.bin/stylelint \"src/**/*.scss\"", "eslint": "./node_modules/.bin/eslint eslint", - "prepare": "npm install" + "prepare": "" }, "author": "", "license": "ISC", From 07d49d0aaee09d9e5fa50533f506ed070e72a268 Mon Sep 17 00:00:00 2001 From: bgantick Date: Fri, 1 Feb 2019 12:09:36 -0500 Subject: [PATCH 4/7] Change to postinstall --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8608e6c..f9c8133 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "dev": "webpack --watch", "stylelint": "./node_modules/.bin/stylelint \"src/**/*.scss\"", "eslint": "./node_modules/.bin/eslint eslint", - "prepare": "" + "postinstall": "npm i" }, "author": "", "license": "ISC", From 945764f662a5a9e1c95e363cccd580921801b1df Mon Sep 17 00:00:00 2001 From: bgantick Date: Fri, 1 Feb 2019 12:17:08 -0500 Subject: [PATCH 5/7] these aren't devDependenies --- package.json | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index f9c8133..f7fb69f 100644 --- a/package.json +++ b/package.json @@ -7,12 +7,11 @@ "test": "echo \"Error: no test specified\" && exit 1", "dev": "webpack --watch", "stylelint": "./node_modules/.bin/stylelint \"src/**/*.scss\"", - "eslint": "./node_modules/.bin/eslint eslint", - "postinstall": "npm i" + "eslint": "./node_modules/.bin/eslint eslint" }, "author": "", "license": "ISC", - "devDependencies": { + "dependencies": { "babel-core": "^6.26.3", "babel-loader": "^7.1.4", "babel-preset-env": "^1.7.0", @@ -40,6 +39,5 @@ "stylelint-webpack-plugin": "^0.10.5", "webpack": "^4.28.4", "webpack-cli": "^3.2.1" - }, - "dependencies": {} + } } From 3bed707c86cfb5b5cb68f0825ad5a6c194f77f31 Mon Sep 17 00:00:00 2001 From: bgantick Date: Fri, 1 Feb 2019 13:09:51 -0500 Subject: [PATCH 6/7] Resolve loader paths --- webpack.config.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 6a83225..6f61471 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -21,11 +21,7 @@ module.exports = function (appRoot) { configFile: path.join(__dirname, './.stylelintrc.json') }) ], - resolve: { - modules: [ path.join(__dirname, 'node_modules') ] - }, resolveLoader: { - modules: [ path.join(__dirname, 'node_modules') ], extensions: [ '.js', '.json' ] }, module: { From 0a4389a264e3feec456d8b5a166ec21c3a5e5d0f Mon Sep 17 00:00:00 2001 From: Gregory Dunn Date: Fri, 1 Feb 2019 14:06:23 -0500 Subject: [PATCH 7/7] remove loader extensions --- .eslintrc.json => .eslintrc | 0 .stylelintrc.json => .stylelintrc | 0 webpack.config.js | 7 ++----- 3 files changed, 2 insertions(+), 5 deletions(-) rename .eslintrc.json => .eslintrc (100%) rename .stylelintrc.json => .stylelintrc (100%) diff --git a/.eslintrc.json b/.eslintrc similarity index 100% rename from .eslintrc.json rename to .eslintrc diff --git a/.stylelintrc.json b/.stylelintrc similarity index 100% rename from .stylelintrc.json rename to .stylelintrc diff --git a/webpack.config.js b/webpack.config.js index 6f61471..c31798a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -18,12 +18,9 @@ module.exports = function (appRoot) { }), new StyleLintPlugin({ failOnError: false, - configFile: path.join(__dirname, './.stylelintrc.json') + configFile: path.join(__dirname, './.stylelintrc') }) ], - resolveLoader: { - extensions: [ '.js', '.json' ] - }, module: { rules: [ { @@ -38,7 +35,7 @@ module.exports = function (appRoot) { exclude: /node_modules/, loader: 'eslint-loader', options: { - configFile: path.join(__dirname, './.eslintrc.json') + configFile: path.join(__dirname, './.eslintrc') } }, {