xpm run
Purpose
Run actions.
Synopsis
xpm run [options...] [<action>] [-- <script args>]
Aliases:
run-action
rum
ru
Description
Execute an action, which is a named sequence of shell
commands defined in the actions
object
in package.json
.
Options passed after the double dash separator are not processed but are appended as-is at the end of the command string, if there is only one command.
PATH
Before creating new processes to run the command, xpm run
prepends
xpacks/.bin:node_modules/.bin
to the environment PATH
.
The immediate effect is that all executables provided by locally-installed dependencies will take precedence over any other similar executables present in the PATH.
Actions can be defined for the entire project or for specific build configurations.
For configuration-specific actions, build/<config>/xpacks/.bin
is also prepended to PATH, giving priority to configuration
dependencies.
Options
Help (--help
)
% xpm run --help
xPack project manager - run package/configuration specific action
Usage: xpm run [options...] [--config <config_name>] [--dry-run]
[--all-configs] [--ignore-errors] [<action>] [-- <action_args>]
where:
<action> The name of the action/script (optional)
<action_args>... Extra arguments for the action (optional, multiple)
Run options:
-c|--config <config_name> Run the configuration specific action (optional)
-n|--dry-run Pretend to run the action (optional)
-a|--all-configs Run the action for all configurations (optional)
--ignore-errors Ignore script errors (optional)
Common options:
--loglevel <level> Set log level (silent|warn|info|verbose|debug|trace)
-s|--silent Disable all messages (--loglevel silent)
-q|--quiet Mostly quiet, warnings and errors (--loglevel warn)
--informative Informative (--loglevel info)
-v|--verbose Verbose (--loglevel verbose)
-d|--debug Debug messages (--loglevel debug)
-dd|--trace Trace messages (--loglevel trace, -d -d)
--no-update-notifier Skip check for a more recent version
-C <folder> Set current folder
xpm -h|--help Quick help
xpm --version Show version
xpm -i|--interactive Enter interactive mode
npm xpm@0.20.8 '/Users/ilg/.nvm/versions/node/v20.18.0/lib/node_modules/xpm'
Home page: <https://xpack.github.io/xpm-preview/>
Bug reports: <https://github.com/xpack/xpm-js/issues>
Configuration (-c|--config
)
Run actions associated with an existing configuration instead of actions defined for the entire project.
Dry-run (-n|--dry-run
)
Do everything except to actually run the action.
Examples
In the top folder of the
@micro-os-plus/utils-lists
project, there are, among other things, the following definitions:
{
...
"devDependencies": {
"del-cli": "^5.1.0"
},
"xpack": {
"actions": {
"npm-install": "npm install",
"git-log": "git log --pretty='%cd * %h %s' --date=short",
"npm-pack": "npm pack",
"npm-version-patch": "npm version patch",
"npm-version-minor": "npm version minor",
"npm-version": "echo $(which node) $(node --version) && echo $(which npm) $(npm --version)",
"deep-clean": "del-cli xpacks node_modules package-lock.json"
}
},
...
}
To do a deep clean:
% xpm run deep-clean
> del-cli xpacks node_modules package-lock.json