Skip to content

Commit

Permalink
Bugfix for watching and cleaning _public patterns
Browse files Browse the repository at this point in the history
updated the readme
corrected the way merge was operating
  • Loading branch information
Bulfair, Matt committed Nov 3, 2017
1 parent e0c6ca4 commit 9d64cbf
Show file tree
Hide file tree
Showing 6 changed files with 207 additions and 103 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "edition-node-webpack",
"description": "A pure wrapper around patternlab-node core, the default pattern engine, and supporting frontend assets.",
"version": "1.0.2",
"version": "1.0.3",
"dependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
Expand All @@ -26,7 +26,7 @@
"start": "yarn patternlab:serve",
"webpack:version": "webpack --v",
"patternlab:build": "webpack --env.prod -p",
"patternlab:serve": "webpack-dev-server --env.dev --hot",
"patternlab:serve": "webpack-dev-server --env.dev --hot --progress --colors",
"patternlab:version": "node patternlab.js version",
"patternlab:help": "node patternlab.js help",
"patternlab:patternsonly": "node patternlab.js patternsonly",
Expand Down
5 changes: 4 additions & 1 deletion patternlab-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@
"url": "http://localhost",
"port": 3000
},
"webpackMerge": {
"entry":"replace"
},
"styleGuideExcludes": [
],
"defaultPattern": "all",
"defaultShowPatternInfo": false,
"cleanPublic" : false,
"cleanPublic" : true,
"patternExtension": "mustache",
"ignored-extensions" : ["scss", "DS_Store", "less"],
"ignored-directories" : ["scss"],
Expand Down
25 changes: 24 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ There's two options for installing this version:

**Please note:** Pattern Lab Node uses [npm](https://www.npmjs.com/) to manage project dependencies. To upgrade the webpack edition or to install plug-ins you'll need to be familiar with npm.

### Use npm
### Use npm (yarn)

`npm` is a dependency management and package system which can pull in all of the webpack editions's dependencies for you. To accomplish this:

Expand Down Expand Up @@ -91,6 +91,29 @@ To install a specific StarterKit from GitHub type:
yarn patternlab:loadstarterkit --kit=[starterkit-name]
### Pattern Lab - Configuration
Unlike the other editions, there were a few options added just for this edition that allow for easier upgrading, and better flexibility.
#### Setting Dev Server Settings
You can set the url and port number in the configuration for
"server": {
"url": "http://localhost",
"port": 3000
},
#### Setting the Webpack Merge Options
In this edition, it's important to make the configuration for webpack something very easy to update, and very easy to modify. The current setting for webpack merge are described [here.](https://github.com/Comcast/patternlab-edition-node-webpack/blob/master/source/_app/readme.md)
You can change how it merges by changing this object in `patternlab-config.json`:
"webpackMerge": {
"entry":"replace"
},
By default merge does a `append` if that option works for you only set which webpack configuration you want to change. The merge setting is: `smartStrategy` which is documented over on this [page.](https://www.npmjs.com/package/webpack-merge#mergesmartstrategy-key-prependappendreplaceconfiguration--configuration)
### Licenses
* [babel-core](https://github.com/babel/babel/blob/master/LICENSE) - MIT
* [babel-loader](https://github.com/babel/babel-loader/blob/master/LICENSE) -MIT,
Expand Down
7 changes: 6 additions & 1 deletion source/_app/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@ Used to store your app specific files.

**Custom Webpack Configuration**

`webpack.app.js` this file is used to place your custom webpack configuration. This will merge or override the values in `webpack.config.babel.js` This will provide a way to change your configuration and still get updates in the future.
`webpack.app.js` this file is used to place your custom webpack configuration. This will merge or override the values in `webpack.config.babel.js` This will provide a way to change your configuration and still get updates in the future.

### More information

For details into how webpack merge works, and all the options you can do, check out their page:
[Webpack Merge](https://www.npmjs.com/package/webpack-merge#mergesmartstrategy-key-prependappendreplaceconfiguration--configuration)
15 changes: 7 additions & 8 deletions webpack.config.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,18 @@ const customization = require(`${plConfig.paths.source.app}/webpack.app.js`);

module.exports = env => {
const {ifProd, ifDev} = getIfUtils(env);
const config = merge.smart(customization(env), {

const config = merge.smartStrategy(plConfig.webpackMerge)({
devtool: ifDev('source-map'),
context: resolve(__dirname, 'source'),
node: {
fs: "empty"
},
entry: {
/**
* Gathers any Source JS files and creates a bundle
* Note: To change this, please modify _app/webpack.app.js and use the same key.
*/
// Gathers any Source JS files and creates a bundle
//NOTE: This name can be changed, if so, make sure to update _meta/01-foot.mustache
"js/pl-source":
globby.sync([resolve(plConfig.paths.source.js + '**/*.js')]).map(function (filePath) {
globby.sync([resolve(plConfig.paths.source.js + '**/*.js')]).map(function (filePath) {
return filePath;
})
},
Expand Down Expand Up @@ -140,7 +139,7 @@ module.exports = env => {
contentBase: resolve(__dirname, 'public'),
port: plConfig.server.port,
open:true,
watchContentBase: true
watchContentBase: false
},
module: {
rules: [
Expand All @@ -158,7 +157,7 @@ module.exports = env => {
}
]
}
})
}, customization(env))

return config
}
Loading

0 comments on commit 9d64cbf

Please sign in to comment.