@squiz/vermgmt
v2.0.1
Published
Management script for components, including version management and custom commands
Downloads
2,184
Maintainers
Keywords
Readme
verMgmt: DXP Component Service Version Management Script
Intro
verMgmt is a version management script for Component Service, designed to easily increment or decrement the versions of components included in the manifest.json files. Additionally, it allows running custom commands on project components, such as deploying and listing files inside a component's folder.
All commands, including increment, decrement, and custom commands, can be executed for a single selected component or multiple selected components.
Installation
To install verMgmt, use the following command:
npm i @squiz/verMgmtUsage
After installation, add the following script to your package.json:
{
"scripts": {
"vermgmt": "vermgmt"
}
}Then, verMgmt can be used by running:
npm run vermgmtThis will start the script and present a list of options to manage components' versions or run custom commands.
[Optional] For direct use run command:
node ./bin/verMgmt.js ./verMgmt.config.jsonConfiguration
By default, verMgmt is configured to look for manifest files in the following path:
{
"manifestGlob": "components/*/manifest.json"
}This configuration can be overridden by creating a verMgmt.config.json file in the project root directory. This allows customization of paths and addition of custom commands to suit the project's needs.
Single Configuration Object
Example verMgmt.config.json:
{
"manifestGlob": "components/*/src/manifest.json",
"customCommands": [
{
"name": "Build and deploy",
"value": "npm run build && npx @squiz/dxp-cli-next cmp deploy ."
},
{
"name": "List root files (command: ls -l)",
"value": "ls -l"
}
]
}Multiple Configuration Objects
The configuration file can also contain an array of configuration objects. When multiple configurations are found, the script will prompt the user to select one.
Example verMgmt.config.json with multiple configurations:
[
{
"name": "Development",
"manifestGlob": "components/dev/*/manifest.json",
"customCommands": [
{
"name": "Build and deploy",
"value": "npm run build && npx @squiz/dxp-cli-next cmp deploy ."
},
{
"name": "List root files (command: ls -l)",
"value": "ls -l"
}
]
},
{
"name": "Production",
"manifestGlob": "components/prod/*/manifest.json",
"customCommands": [
{
"name": "Build and deploy",
"value": "npm run build && npx @squiz/dxp-cli-next cmp deploy ."
},
{
"name": "List root files (command: ls -l)",
"value": "ls -l"
}
]
}
]Additionally, it may be necessary to adjust the deployment path to match the location where the build files are stored.
Options
When running the script, the following options are available:
- Increment version: Increments the version of the selected components.
- Decrement version: Decrements the version of the selected components.
- Set arbitrary version: Allows setting an arbitrary version for the selected components.
- Run custom command: Executes a custom command defined in the configuration file on the selected components.
- Change configuration: Allows switching between multiple configurations if more than one is defined.
- Quit: Exits the script.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss the proposed changes.
Please make sure to update tests as appropriate.
