@domoinc/da
v2.2.0
Published
Generators for Domo's Vite template
Maintainers
Keywords
Readme
@domoinc/da
Generator CLI for Domo's React template using Vite.
Installation
Install the package globally to use the da command anywhere:
Recommended (pnpm):
pnpm add -g @domoinc/daAlternative options:
npm install -g @domoinc/da
# or
yarn global add @domoinc/daCheck installation:
da --versionCommands
da new <name> # Generate a new DomoApp [aliases: n]
da manifest [identifier] [description] # Adds a new manifest override [aliases: m]
da apply-manifest [id] # Applies manifest overrides [aliases: am]
da generate [template] # Generates code from templates [aliases: g]da new <name>
Generate a new DomoApp from the Vite React template.
Usage:
da new my-app
# or with alias
da n my-appOptions:
--force, -f- Overwrite directory if it already exists--merge, -m- Merge template into existing directory (renames conflicting files)--template, -t- Specify a custom template (npm package, GitHub repo, or local path)
Examples:
# Create a new app
da new my-domo-app
# Overwrite existing directory
da new my-domo-app --force
# Merge template into existing directory
da new my-domo-app --merge
# Use a custom template
da new my-domo-app --template @your-org/custom-template
da new my-domo-app --template owner/repo
da new my-domo-app --template ~/path/to/local-templateMerge Behavior:
When using --merge, the template files are merged into an existing directory:
- Files that don't conflict are copied normally
- Files that already exist are renamed with a
(N)suffix before the extension (e.g.,package.json→package(1).json) - Directories are merged recursively
- A list of renamed files is displayed after the merge completes
This is useful for adding template files to an existing project without losing your current work.
The CLI will:
- Validate the app name
- Check if directory exists
- Prompt for package manager (pnpm recommended)
- Clone/copy the template
- Update package.json with your app name
- Initialize git repository
- Install dependencies
da manifest [identifier] [description]
Creates a new manifest override with the given identifier and description.
Arguments:
identifier- Key used in the manifestOverrides.json file (e.g.,instance.prod,instance.dev)description- Description of the overrides (helpful to include the instance URL)
Example:
da manifest instance.prod "Production asset for instance.domo.com"da apply-manifest [id]
Applies the selected manifest overrides to the manifest at start/build time.
If you are using the Domo+Vite+React template, this is called by the serve and build processes automatically. If no id is specified, a searchable list will be provided based on the manifestOverrides.json.
Example:
da apply-manifest instance.prodda generate [template]
Generates code based on the selected template. If no template is specified, a list will be provided.
Available templates:
Component
da generate component MyComponent
# or with alias
da g component MyComponentCreates:
- Component file:
src/components/MyComponent/MyComponent.tsx - Styles:
src/components/MyComponent/MyComponent.module.scss - Test file (optional):
src/components/MyComponent/MyComponent.test.tsx - Storybook file (optional):
src/components/MyComponent/MyComponent.stories.tsx
Reducer
da generate reducer myFeatureCreates:
- Reducer slice:
src/reducers/myFeature/slice.ts - Auto-imports into
src/reducers/index.ts
Local Development
Prerequisites
- Node.js >= 16.0.0
- pnpm (recommended), npm, or yarn
- Git
Setup
Clone the repository:
git clone <repository-url> cd daInstall dependencies:
pnpm installLink the CLI globally for testing:
npm link # or pnpm link --globalThe
dacommand is now available globally and points to your local development version.
Testing with a Local Template
For local development, you can point the CLI to a local template instead of cloning from GitHub:
Create a
.envfile:cp .env.example .envEdit
.envand set the path to your local template:DA_TEMPLATE_PATH=~/dev/vite-react-template # or use an absolute path DA_TEMPLATE_PATH=/Users/yourname/projects/vite-react-templateRun the CLI - it will use your local template:
da new test-app
Note: The .env file and dotenv package are only used for local development. When published to npm, end users will always use the default GitHub template.
Making Changes
Make your changes to the source files in
src/Test your changes:
da new test-appThe linked command will use your modified code immediately (no rebuild needed for JS changes)
Project Structure
da/
├── src/
│ ├── cli.js # Main CLI entry point & command definitions
│ ├── plopHelper.js # Helper for running plop actions
│ ├── create/
│ │ ├── index.js # Logic for creating new apps
│ │ └── plop.js # Plop config for package.json updates
│ ├── generate/
│ │ ├── index.js # Logic for code generation
│ │ ├── plop.js # Plop generators (component, reducer)
│ │ └── templates/ # Handlebars templates for generators
│ └── manifest/
│ ├── index.js # Logic for manifest management
│ ├── plop.js # Plop config for manifest setup
│ └── templates/ # Manifest templates
├── index.js # CLI entry point (#!/usr/bin/env node)
├── package.json
└── .env.example # Example environment configPublishing
The package is published to npm as @domoinc/da. Only team maintainers can publish new versions.
Troubleshooting
Command not found after installation
If da command is not found after global installation:
# Check if it's installed
npm list -g @domoinc/da
# Check your PATH includes npm global bin
npm config get prefix
# Add to your PATH if needed (add to ~/.bashrc or ~/.zshrc):
export PATH="$(npm config get prefix)/bin:$PATH"Template repository unreachable
If you see an error about the template repository:
- Check your internet connection
- Verify git is installed:
git --version - Try cloning the template manually:
git clone https://github.com/DomoApps/vite-react-template.git
Permission errors during installation
On macOS/Linux, you may need to use sudo:
sudo npm install -g @domoinc/daOr configure npm to install packages globally without sudo:
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATHLicense
MIT
Maintainer
Domo - Developer Innovations
