@template-tools/template-sync

Keep repository in sync with its template

Usage no npm install needed!

<script type="module">
  import templateToolsTemplateSync from 'https://cdn.skypack.dev/@template-tools/template-sync';
</script>

README

npm License minified size downloads GitHub Issues Build Status Styled with prettier Commitizen friendly Known Vulnerabilities Coverage Status

npm-template-sync

Keep repository in sync with its template.

Generates pull requests to bring a repository back in sync with its template.

So by making changes to the template and applying npm-template-sync the target project will be updated accoring to the template.

Works with github and bitbucket.

export GITHUB_TOKEN='token providing repositroy write access' # for github repos

npm-template-sync --template aTemplateGithubUser/aRepo myGithubUser/myRepo

Define (initial) properties to be used in the template

export GITHUB_TOKEN='token providing repositroy write access' # for github repos

npm-template-sync --define "description=a very new fantastic module" -t myUser/myTemplate myUser/newModule#aBranch

Create new repository and bind it to aTemplateGithubUser/aRepo

export GITHUB_TOKEN='token providing repositroy write access' # for github repos

npm-template-sync --track --create --template aTemplateGithubUser/aRepo myGithubUser/myRepo

Switch from arlac77/template-github to arlac77/template-arlac77-github template for arlac77/url-cmd, arlac77/uti, arlac77/content-entry and arlac77/repository-provider

export GITHUB_TOKEN='token providing repositroy write access' # for github repos

npm-template-sync --track --template arlac77/template-arlac77-github --template -arlac77/template-github arlac77/url-cmd arlac77/uti arlac77/content-entry arlac77/repository-provider

Merges contents from template branch into destination branch handling some special cases for:

generated pull request

Some templates

API

Table of Contents

Delete

Extends Merger

Delete entry.

normalizeTemplateSources

Remove duplicate sources. Sources staring with '-' will be removed

Parameters

Returns Array<string> normalized sources

jspath

Parameters

  • object
  • path
  • cb

actions2message

Parameters

  • actions
  • prefix
  • name

Returns any actions as one string lines ordered by scope

actions2messages

Parameters

  • actions
  • prefix
  • name

MergeLineSet

Extends Merger

sortedKeys

order in which json keys are written

Package

Extends Merger

Merger for package.json

properties

Deliver some key properties.

  • name
  • version
  • description
  • main

Parameters

  • entry ContentEntry

Returns Object

Readme

Extends Merger

Injects badges into README.md.

ReplaceIfEmpty

Extends Merger

Overwrites none existing entries from template.

Replace

Extends Merger

Replace file from template (always)

Merger

Mergable content

properties

Deliver some key properties.

Parameters

  • entry ContentEntry

Returns Object extracted properties

commits

Generate commits as result of merging two entries.

Parameters

  • context
  • destinationEntry
  • sourceEntry
  • options

Skip

Extends Merger

Does not generate destination entry

install

With npm do:

npm install -g npm-template-sync

# npm-template-sync --help

license

BSD-2-Clause