Template projects and code duplication

Scenario

Problem

Solution

  • .editorconfig
  • .gitattributes
  • .travis.yml
  • package.json
  • .gitignore

Create a dictator

{
"message": "Copy react-boilerplate",
"actions": [
{
"beSupersetOfJsonFile": "react-boilerplate/package.json",
"target": "package.json"
},
{
"copyFrom": "react-boilerplate",
"target": "."
},
{
"haveLineContaining": ["*.tgz"],
"target": ".gitignore"
}
]
}
  • Let the package.json in an application be a superset of the package.json in the dictator.
  • Copy all files from folder react-boilerplate to root
  • Add “*.tgz” to .gitignore

Use the dictator

npx dictator-react-boilerplate
{
"name": "react-boilerplate-example",
"version": "1.2.3",
"description": "asdasasd",
"scripts": {
"prepare": "dictator-react-boilerplate"
},
"devDependencies": {
"dictator-react-boilerplate": "0.0.8"
}
}
{
"ignore": [
"/README.md",
"/.github/*",
"/.github/**/*",
"/app",
"/package-lock.json",
"/Changelod.md"
]
}

--

--

--

http://tomasbjerre.se/

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Build. Part 2: Incremental Reproducibility.

Vim and Git

Scrapy Shell

Prometheus: Apdex alerting

Implementing a Design System: A Mid-trospective

Third Person Spectator Camera for Virtual Reality in Unity

Did the pandemic push Gen Z into software development?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Tomas Bjerre

Tomas Bjerre

http://tomasbjerre.se/

More from Medium

How to implement your own Promise.

How to Send Cookies from Express to a Front-End Application in Production

“This.” keyword with arrow functions and with normal functions in JavaScript

Utilizing Associated Classes in a JS Application