@cactuslab/update-template v2.1.0
📠 Update Template
If you've created a repository using a template (see Creating a repository from a template on GitHub), it can be hard to "update" the template when new features are added, since it's not a fork. This package fixes that.
⭐ Get started
Using a template
If your template is a git repostiroy, you can install or update it using the URL of the original template repo:
npx update-template https://github.com/user/repoOr if your repo is based on a template in a local directory:
npx update-template ./templates/my-templateYou can also specify multiple templates, and they will be applied sequentially.
npx update-template ./templates/my-template1 ./templates/my-template2A .update-template-changes.json file will be created to store the changes that have been made by the
template(s), so that when you re-run update-template any files or dependencies etc added by the template,
but that are no longer in the template, will be removed.
Creating a template
If you're building a template repository, add update-template as a dependency:
npm install @cactuslab/update-templateThen, create a .templaterc.json file with a list of files you'd like to overwrite:
{
"files": ["src/**/*.js"]
}Lastly, add an update script to your package.json with the URL of your repository:
{
"scripts": {
"update-template": "update-template"
}
}When users want to update your template, they can run npm run update-template
If you want to sync your package.json (without changing keys like the package name), you can add any of the following
keys to sync the corresponding parts of package.json:
{
"package": {
"engines": true,
"dependencies": true,
"devDependencies": true,
"optionalDependencies": true,
"peerDependencies": true,
"scripts": true
}
}👩💻 Development
Build TypeScript:
npm run build