AnandChowdhary/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.

Node CI

⭐ Get started

For repositories

If your repo is based on a template, you can update it using the URL of the original template repo:

npx update-template https://github.com/user/repo

For templates

If you’re building a template repository, add update-template as a dependency:

npm install 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 https://github.com/user/repo”
  }
}

When users want to update your template, they can run npm run update-template

If you want to sync your package.json and package-lock.json dependencies (without changing keys like the package name), you can add:

{
  “npmDependencies”: true
}

Similarly, npm scripts can be added:

{
  “npmScripts”: true
}

👩‍💻 Development

Build TypeScript:

npm run build

📄 License

MIT © Koj