Skip to content
update-template / 2.1.0

update-template 2.1.0

Install from the command line:
Learn more about npm packages
$ npm install @cactuslab/update-template@2.1.0
Install via package.json:
"@cactuslab/update-template": "2.1.0"

About this version

πŸ“  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/repo

Or if your repo is based on a template in a local directory:

npx update-template ./templates/my-template

You can also specify multiple templates, and they will be applied sequentially.

npx update-template ./templates/my-template1 ./templates/my-template2

A .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-template

Then, 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

πŸ“„ License

MIT Β© Koj

Koj

An open source project by Koj.
Furnish your home in style, for as low as CHF175/month β†’

Details


Assets

  • update-template-2.1.0.tgz

Download activity

  • Total downloads 1,416
  • Last 30 days 152
  • Last week 31
  • Today 3

Recent versions

View all