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.

Constructors

  • The class constructor.

    Parameters

    • parsedArgs: any

      The parsed arguments passed via cli

    Returns Utils

Methods

  • Do the backup of the original package.json.

    Returns void

  • Get the selected environment name.

    Returns string

    The environment name

  • Checks if a backup of the package.json exists.

    Returns boolean

    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.

    Returns boolean

    True / False

  • 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

  • Checks if the user wishes to replace the original package.json with the environmental one instead of merging it.

    Returns boolean

    True / False

  • Checks if the environment should be resetted. Means: If the original package.json should be restored.

    Returns boolean

    True / False

  • Checks for verbose level 1.

    Returns boolean

    True / False

  • Checks for verbose level 2.

    Returns boolean

    True / False

  • 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

  • Loads the selected environment json file if possible. If not: Exits the application with exit code 1.

    Returns string

    The environment content as string

  • Loads the package.json if possible. If not: Exits the application with exit code 1.

    Returns string

    The package.json content as string

  • Replace the generated package.json with the original one.

    Returns void

  • Saves the new (merged) package.json.

    Parameters

    • mergedPackage: any

      The content for the new package.json

    Returns void

  • Used for debugging purposes. (Prints the parsed cli parameters to console.)

    Returns void