Skip to content

๐Ÿ“  Easily update repos created with GitHub templates

License

Notifications You must be signed in to change notification settings

cactuslab/update-template

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

52 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“  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 โ†’

About

๐Ÿ“  Easily update repos created with GitHub templates

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • TypeScript 98.3%
  • JavaScript 1.7%