Class Utils
Constructors
constructor
The class constructor.
Parameters
- parsedArgs: ParsedArgs
The parsed arguments passed via cli
Returns Utils
- parsedArgs: ParsedArgs
Methods
backupPackageJson
Do the backup of the original package.json.
Returns void
getEnvironment
Get the selected environment name.
Returns string
The environment name
isBackupExisting
Checks if a backup of the package.json exists.
Returns boolean
True / False
isDryRun
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.
Returns boolean
True / False
isIncludeEnvironment
Checks if the user wishes to include a marker in the package.json to identify the change by the Node Package Builder.
Returns boolean
True / False
isReplace
Checks if the user wishes to replace the original package.json with the environmental one instead of merging it.
Returns boolean
True / False
isResetEnvironment
Checks if the environment should be resetted. Means: If the original package.json should be restored.
Returns boolean
True / False
isVerboseL1
Checks for verbose level 1.
Returns boolean
True / False
isVerboseL2
Checks for verbose level 2.
Returns boolean
True / False
loadBackupJson
Loads the backup package.json if possible. If not: Exits the application with exit code 1.
Returns string
The original package.json content as string
loadEnvironmentJson
Loads the selected environment json file if possible. If not: Exits the application with exit code 1.
Returns string
The environment content as string
loadPackageJson
Loads the package.json if possible. If not: Exits the application with exit code 1.
Returns string
The package.json content as string
restoreBackup
Replace the generated package.json with the original one.
Returns void
savePackageJson
Saves the new (merged) package.json.
Parameters
- mergedPackage: any
The content for the new package.json
Returns void
- mergedPackage: any
verboseParameters
Used for debugging purposes. (Prints the parsed cli parameters to console.)
Returns void
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.