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 AGGREGATION_FACTORY="github-repository-provider" # for github repos
export GITHUB_TOKEN='token providing repositroy write access' # for github repos
template-sync --template aTemplateGithubUser/aRepo myGithubUser/myRepo
Define (initial) properties to be used in the template
export AGGREGATION_FACTORY="github-repository-provider" # for github repos
export GITHUB_TOKEN='token providing repositroy write access' # for github repos
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
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
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:
- Licenses - rewriting license years
- line set files like .npmignore and .gitignore - by merging both sets together
- package.json - merge (.*)[Dd]ependencies, engines and scripts
- rollup.conf.*js - copy / rewrite + detect dev dependencies
- *.yaml - merge
- .travis.yml - merge with hints
- *.toml - merge
- *.ini - merge
- *.json - merge
- README.md - merge badges
- arlac77/template-cli-app rollup ava travis
- arlac77/template-esm-only ava travis
- arlac77/template-svelte-component svelte rollup testcafe travis
- arlac77/template-svelte-app svelte rollup pkgbuild travis
- arlac77/template-kronos-component template-esm-only with node 14
- arlac77/template-kronos-app node 14 + systemd
- Context
- sortedKeys
- Package
- Merger
- Merger
- EntryMerger
- Template
- ReplaceIfEmpty
- Readme
- MergeLineSet
- Replace
- Skip
- Delete
- normalizeTemplateSources
- jspath
Extends LogLevelMixin(class _Context {})
Context prepared to execute one branch.
provider
targetBranchName
stringoptions
(optional, default{}
)
Generate Pull Requests.
Returns AsyncIterator<PullRequest>
Generate all commits from the template entry merges.
Returns Commit<AsyncIterator>
Generate Pull Requests.
Returns AsyncIterator<PullRequest> the actual PRs
order in which json keys are written
Extends Merger
Merger for package.json
Deliver some key properties.
- name
- version
- description
- main
entry
ContentEntry
Returns Object
Mergable content
Deliver some key properties.
entry
ContentEntry
Returns Object extracted properties
Generate commits as result of merging two entries.
context
destinationEntry
sourceEntry
options
Type: Object
Deliver some key properties.
entry
ContentEntry
Returns Object extracted properties
Generate commits as result of merging two entries.
context
destinationEntry
sourceEntry
options
Type: Object
Extends LogLevelMixin(class {})
context
Conextsources
Set<string>toBeRemovedSources
Set<string>mergers
Array<Merger>branches
Set<Branch> all used branches direct and inheritedkeyBranches
Set<Branch> branches used to define the template
Find a suitable merger for each entry
entries
Iterator<ContentEntry>
Returns Iterator<[ContentEntry, Merger]>
Find a suitable merger
name
string of the entry
Returns Merger
Load all templates and collects the entries.
sources
string branch namesinheritencePath
Array<Branch> who was requesting us (optional, default[]
)
Returns Object package as merged from sources
Updates usedBy section of the template branch.
targetBranch
Branch template to be updatedtemplateSources
Array<string> original branch identifiers (even with deletion hints)options
Object as passed to commitIntoPullRequest
Returns AsyncIterator<PullRequest>
Load a template
Extends Merger
Overwrites none existing entries from template
Extends Merger
injects badges into README.md
Extends Merger
Extends Merger
Replace file from template (always)
Extends Merger
Does not generate destination entry
Extends Merger
Delete entry.
Remove duplicate sources. Sources staring with '-' will be removed
Returns Array<string> normalized sources
object
path
cb
With npm do:
npm install -g @template-tools/sync-cli
# template-sync --help
BSD-2-Clause