I started fiddling with a tool to avoid code duplication in code repositories. I made a POC with react-boilerplate so that I can use it in many repositories without duplicating code!
Problem
A popular way of working seems to be creating template, or boilerplate, projects. Problem is, while you maintain the template project, how do you spread those improvements to the 100+ repositories that once copied the template!?
I spent some time thinking about this and came up with a solution =)
Solution
I took the react-boilerplate
and created a dictator.
The dictator dictates files that should be copied to a target.
{
"message": "Copy react-boilerplate",
"actions": [
{
"copyFrom": "react-boilerplate",
"target": "."
}
]
}
I created an example of an application using this dictator.
...
"scripts": {
"prepare": "dictator-react-boilerplate",
...
"devDependencies": {
"dictator-react-boilerplate": "0.0.2",
...
The example application can choose not to be dictated on some parts.
{
"ignore": [
"/README.md",
"/.github",
"/app",
"/package.json",
"/package-lock.json",
"/Changelod.md"
]
}