npm.io
1.0.2 • Published 4 years agoCLI

@smartworld.team/npx-update-template

Licence
ISC
Version
1.0.2
Deps
7
Size
90 kB
Vulns
0
Weekly
0

npx-update-template

NPM version NPM downloads

When creating a repository template, there is a problem with updating a child repository, this package will help you make updates almost painlessly. At the moment, automation is that this package will reduce the update to actions that cannot be done without a person. The repository will be updated and uploaded to a specific branch named: template. After all the updates - you just have to merge the two branches and test.

Get started

How to use

Install npm package in you template repo:
npm i @smartworld.team/npx-update-template
Create a file at the root template repo:
touch .templaterc.json
The file must consist of an object:
{
  directories?: Array<string>;
  templateDir?: string;
  npmDependencies?: boolean;
  npmScripts?: boolean;
  packageFile?: string;
}
Example .templaterc.json
{
  "directories": ["template/src/**/*.ts", "template/core/**/*.*"],
  "templateDir": "template",
  "packageFile": "template",
  "npmDependencies": true,
  "npmScripts": true
}
directories     - An array containing the full path to the folder with masks
templateDir     - If you have a separate folder responsible for the content of the template, you need to specify where exactly the files are located
packageFile     - You can specify which dependencies to update
npmDependencies - There is a version check logic, if the template has an older version, then the version of the child repository will not be replaced. If the template is updated and has a more current version - the dependency will be replaced with the version from the template
npmScripts      - Whether scripts need to be updated. If the script already exists, the replacement will not be performed, this flag will add only non-existing scripts
Script For update:

To update, create a command inside your template

{
  "scripts": {
    "update": "npx-update-template git@github.com:SmartWorld-LLC/npx-update-template.git"
  }
}
Charts
Sketchy Update sketchy_update
Merge Object merge_object
Compare Version compare_version

License

MIT SmartWorld

An open source project by SmartWorld

Keywords