The generic object used to pass parameters to the constructor.
A reference to a Logger instance.
A string with the full package name, as from the name
property in the package.json file.
A string with the package version, in semver, as from the
version property in the package.json file.
OptionalenvVariableName?: stringA string with the name of an environment variable which, when present disables the update checks.
If missing, NO_<packageName>_UPDATE_NOTIFIER is used.
OptionaltimestampsFolderPath?: stringA string with the path to the folder where the timestamps are located.
If missing, by default, timestamps are created in
the $HOME/.config/timestamps folder.
OptionalcheckUpdatesIntervalSeconds?: numberA number with the minimum interval between checks, in milliseconds,
If missing, by default, checks are performed no sooner than 24 hours.
This variable holds the result of calling the
latest-version module.
The content is a string in semver format.
ProtectedlogA reference to a Logger instance.
ProtectedpackageA string with the full package name, as from the package.json.
ProtectedpackageA string with the package version, in semver, as from the
package.json.
ProtectedtimestampsA string with the path to the folder where the stamps are created.
ProtectedcheckA number with the minimum interval to check for the updates, in milliseconds
ProtectedlatestA promise which resolves to a string with the latest version.
ProtectedprocessA map with environment variables.
ProtectedisCIA boolean True when running in a CI environment.
ProtectedisTTYA boolean True when running in a terminal.
ProtectedisA boolean True when running with administrative credentials.
ProtectedisA boolean True when the package is installed globally.
ProtectedisA boolean True when the package is installed with administrative rights.
StatictestNothing.
The operation is performed by the third party package
latest-version,
which accesses the location where the package is stored
(like the npmjs.com server, or GitHub).
Since this is a potentially long operation, it is expected to be started at the beginning of a CLI application and completed at the end, giving it a good chance to run in parallel.
The operation is not started if it is considered
not useful, like when running in a CI environment, when not
running from a console, or an environment variable like
NO_<packageName>_UPDATE_NOTIFIER is defined.
Nothing.
The notification message is composed using the values stored in the instance properties.
The message is sent out by writing to the log, using the info level.
This can be silenced by lowering the log level.
The notification message looks like this:
>>> New version 0.14.9 -> 0.15.0 available. <<<
>>> Run 'npm install --global xpm@0.15.0' to update. <<<
To customise the notification message, this function can be redefined in a class derived from this one.
ProtecteddidProtectedreadProtectedclearProtectedcreate
Description
Checking the version requires an access to the packages registry, which might take some time to complete.
Given that the result is needed later, before exiting, the operation can be started asynchronously and awaited at the end.