merge-template v1.0.12
merge-template
Merge your project with predefined templates or customs, install dependencies and apply some codemods.
Installation
npm install merge-template -gUsage
To use default default template and files run in your project root:
merge-templateWith default template
It will:
- install or update
dependenciesanddevDependencieslisted in package-json-overrides.json (by default).
You can skip this step with option --no-install:
merge-template --no-install- copy all files from ./templates/cra-overrides (or custom template directory) to your project.
NOTE: files and directories from the template directory will override existing files.
You can skip this step with the option --no-copy-files or use your own
template (see section Customization).
merge-template --no-copy-files- modify
package.jsonin your project by rules specified inpackage-json-overrides.json.
Customization
Command line options
--template use template directory with package-json-overrides.json (required) and files to copy
--no-install skip installation step
--no-copy-files don't copy files from template directory
--no-delete don't delete dependencies listed in "deleteDependencies" in package-json-overrides.json
--no-post-tasks don't execute post tasks (section "postTasks" in package-json-overrides.json)
--ignore-files files in template directory that should't be copied into project. Default: 'node_modules' 'build' 'dist' '.git' 'package-json-overrides.json'You can specify your own template directory with option --template. It
must include a file package-json-overrides.json.
merge-template --template /home/user/my-custom-template-directory/Any other directories and files in this directory will be copied into
your project root, overriding existing ones.
package-json-overrides.json
This file should be JSON and can contain the following sections:
dependenciesThe format is the as in
package.jsondependencies, it will be installed or updated to specified version.devDependenciesThe format is the as in
package.jsondevDependencies, it will be installed or updated to specified version.deleteDependenciesDependencies to remove. The format is the as in
package.jsondependencies, but versions will be ignored.mergeSectionsThe value of this section will be merged into existing
package.json.addSectionsThe value will be added to the existing
package.json, overriding existing sections.postTasksShell commands to execute after other steps. Nested lists where each element is an array of form command, …args, e.g.:
"postTasks": [["npx", "@mui/codemod", "v5.0.0/preset-safe", "src"]]