The DXWorks CLI (dxw) is a command-line tool for managing DXWorks plugins and tools. It provides a plugin-based architecture that allows extending functionality through installable packages.
This is an Nx monorepo containing the following packages:
| Package | Description |
|---|---|
@dxworks/cli |
Main CLI application with plugin and hub commands |
@dxworks/common |
Shared utilities (logging, downloads, git, compression) |
@dxworks/voyenv |
Voyager environment CLI for managing instrument releases |
The dxw CLI provides the following commands:
| Command | Aliases | Description |
|---|---|---|
dxw plugin list |
ls |
List installed plugins. Use -a to show all available plugins |
dxw plugin install <plugins...> |
i, add |
Install plugins. Use -a for all, -f to force unknown plugins |
dxw plugin update [plugins...] |
upgrade, up |
Update plugins. Use -l for latest versions |
dxw plugin outdated |
- | List outdated plugins |
dxw plugin uninstall <plugins...> |
remove, rm |
Uninstall plugins |
dxw plugin link [path] |
ln |
Link a local project as a plugin |
| Command | Aliases | Description |
|---|---|---|
dxw hub update |
pull, fetch, get |
Update dxworks-hub data |
dxw hub refresh |
reset, rs |
Remove and re-clone dxworks-hub |
# Build the CLI
pnpm build
# Run directly
node packages/cli/dist/index.js --help
# Or link globally for development
cd packages/cli && npm link
dxw --helpTo add a new command to the CLI:
- Create the command file in
packages/cli/src/commands/<group>/<command>.ts - Export a Commander Command instance with name, description, options, and action
- Register in the group index file (e.g.,
packages/cli/src/commands/plugin/index.ts) - If creating a new group, register it in
packages/cli/src/index.ts
// packages/cli/src/commands/plugin/example.ts
import { Command } from 'commander';
export const pluginExample = new Command()
.name('example')
.alias('ex') // Optional alias
.description('An example command')
.argument('[name]', 'Optional argument') // Use <name> for required
.option('-f, --flag', 'A boolean flag', false)
.action(async (name: string | undefined, options: { flag: boolean }) => {
console.log(`Hello ${name ?? 'world'}!`);
if (options.flag) {
console.log('Flag was set');
}
});Then register it in the group index:
// packages/cli/src/commands/plugin/index.ts
import { pluginExample } from './example.js';
export const pluginCommand = new Command()
.name('plugin')
.description('handles dxworks cli plugins')
.addCommand(pluginExample); // Add new command here# Install dependencies
pnpm install
# Build all packages
pnpm build
# Run tests
pnpm test
# Lint code
pnpm lintpnpm install # Install all dependencies
pnpm build # Build all packages
pnpm test # Run all tests
pnpm test:watch # Run tests in watch mode
pnpm test:coverage # Run tests with coverage report
pnpm lint # Check for lint errors
pnpm lint:fix # Auto-fix lint errors
pnpm format # Format code with Prettierpnpm nx build cli # Build only the CLI package
pnpm nx test common # Test only the common package
pnpm nx lint voyenv # Lint only the voyenv packageTo add a new library to the workspace:
# Create a publishable library
npx nx g @nx/js:lib packages/my-lib --publishable --importPath=@dxworks/my-lib
# Create an internal library (not published)
npx nx g @nx/js:lib packages/my-lib --importPath=@dxworks/my-libAfter generating:
- Update the
package.jsonwith appropriate dependencies - Configure exports in
package.jsonif needed - Add the package to workspace dependencies where it's used
This workspace is built with Nx. Run npx nx graph to visually explore the project structure.
npx nx g @nx/js:lib packages/pkg1 --publishable --importPath=@my-org/pkg1To build the library use:
npx nx build pkg1To run any task with Nx use:
npx nx <target> <project-name>These targets are either inferred automatically or defined in the project.json or package.json files.
More about running tasks in the docs »
To version and release the library use
npx nx release
Pass --dry-run to see what would happen without actually releasing the library.
Nx automatically updates TypeScript project references in tsconfig.json files to ensure they remain accurate based on your project dependencies (import or require statements). This sync is automatically done when running tasks such as build or typecheck, which require updated references to function correctly.
To manually trigger the process to sync the project graph dependencies information to the TypeScript project references, run the following command:
npx nx syncYou can enforce that the TypeScript project references are always in the correct state when running in CI by adding a step to your CI job configuration that runs the following command:
npx nx sync:checkTo connect to Nx Cloud, run the following command:
npx nx connectConnecting to Nx Cloud ensures a fast and scalable CI pipeline. It includes features such as:
- Remote caching
- Task distribution across multiple machines
- Automated e2e test splitting
- Task flakiness detection and rerunning
Use the following command to configure a CI workflow for your workspace:
npx nx g ci-workflowNx Console is an editor extension that enriches your developer experience. It lets you run tasks, generate code, and improves code autocompletion in your IDE. It is available for VSCode and IntelliJ.
Learn more:
- Learn more about this workspace setup
- Learn about Nx on CI
- Releasing Packages with Nx release
- What are Nx plugins?
And join the Nx community: