boiler-room-custodian
v0.6.2
Published
Mop up those boilerplates
Downloads
2,436
Readme
:eyeglasses: Boiler Room Custodian
Because boilerplates need a little cleanup sometimes :honeybee:
:exclamation: :question: Why :question: :exclamation:
Simple :full_moon_with_face: There are lots of amazing boilerplates out there that do a great job of giving us what we need. They also often include minimal sample app code just so we can "see it run". What boiler-plate-custodian
aims to do is have a way to use configuration to clean that all up when ready to start development on the project.
:bulb: What should this turn into? :bulb:
Ideally the best place for a cleanup configuration to be stored would be in the root directory of the boilerplate repositories themselves. Then have a little npm script that runs mop
(the bin of boiler-plate-custodian
). That way the boilerplate consumers would have a typical workflow of...
- clone the boilerplate
- run the boilerplate as-is viewing functionality/sample
- run
boiler-plate-custodian
(i.e.npm run cleanup
) - start development on minified project
:boom: (boilerplate maintainers) What should you do? :boom:
npm install --save-dev boiler-room-custodian
- create
setup.js
in the root dir of the boilerplate - note what it would take (files removed, added, modified) to remove unnecessary code/files
- inject the item changes in the
setup.js
configuration - create an npm script i.e.
"cleanup": "mop -v"
:page_facing_up: setup.js
structure/sample :page_facing_up:
The below example uses a cleanup configuration for the extremely useful electron-react-boilerplate
Pull Request illustrating the code changes for this boilerplate
module.exports = {
// remove the following files as they are mostly
// related to the sample counter page and functionality
remove: [
{ file: 'app/actions/counter.js' },
{ file: 'app/components/Counter.css' },
{ file: 'app/components/Counter.js' },
{ file: 'app/containers/CounterPage.js' },
{ file: 'app/reducers/counter.js' },
{ file: 'test/actions/counter.spec.js' },
{ file: 'test/components/Counter.spec.js' },
{ file: 'test/containers/CounterPage.spec.js' },
{ file: 'test/reducers/counter.spec.js' },
{ file: 'CHANGELOG.md' },
{ file: 'erb-logo.png' }
],
// clean the following files by either clearing them
// (by specifying {clear: true}) or by removing lines
// that match a regex pattern
clean: [
{
file: 'app/reducers/index.js',
pattern: /counter/
},
{
file: 'app/store/configureStore.development.js',
pattern: /counterActions/
},
{
file: 'app/app.global.css',
clear: true
},
{
file: 'app/routes.js',
pattern: /CounterPage/
},
{
file: 'test/e2e.js',
clear: true
},
{
file: 'README.md',
clear: true
},
{
file: 'app/components/Home.js',
pattern: /(h2|Link to)/
}
],
// add the following files to the project, mostly
// related to .gitkeep for version control
add: [
{ file: 'app/actions/.gitkeep' },
{ file: 'test/actions/.gitkeep' },
{ file: 'test/components/.gitkeep' },
{ file: 'test/containers/.gitkeep' },
{ file: 'test/reducers/.gitkeep' }
]
};