This is the util class for the worker. It handles the path operation, the load and save of the packages (json) and provides a simple way of checking the passed cli args.
The class constructor.
The parsed arguments passed via cli
Do the backup of the original package.json.
Get the selected environment name.
The environment name
Checks if a backup of the package.json exists.
True / False
Checks if the user wished only a dry run. Means: No changes are made; just display the changes which would have been made in the console.
Checks if the user wishes to include a marker in the package.json to identify the change by the Node Package Builder.
Checks if the user wishes to replace the original package.json with the environmental one instead of merging it.
Checks if the environment should be resetted. Means: If the original package.json should be restored.
Checks for verbose level 1.
Checks for verbose level 2.
Loads the backup package.json if possible. If not: Exits the application with exit code 1.
The original package.json content as string
Loads the selected environment json file if possible. If not: Exits the application with exit code 1.
The environment content as string
Loads the package.json if possible. If not: Exits the application with exit code 1.
The package.json content as string
Replace the generated package.json with the original one.
Saves the new (merged) package.json.
The content for the new package.json
Used for debugging purposes. (Prints the parsed cli parameters to console.)
This is the util class for the worker. It handles the path operation, the load and save of the packages (json) and provides a simple way of checking the passed cli args.