Blueprints for v2 addons
Standardize how you write v2 addons:
- Run
new
to create a v2 addon - Run
generate
to create source and test files - Run
destroy
to remove source and test files - Blueprints available for components, helpers, modifiers, services, and utilities
- Tailor addon blueprints to your needs
Install blueprints-v2-addon
as a development dependency in these locations:
Workspace root
/* package.json */
{
"scripts": {
"addon": "blueprints-v2-addon"
},
"devDependencies": {
"blueprints-v2-addon": "workspace:*"
}
}
V2 addon in packages
Note, the new
command will automatically update package.json
.
/* Example: packages/ui/form/package.json */
{
"scripts": {
"addon": "blueprints-v2-addon --test-app-location '../../../test-app'"
},
"devDependencies": {
"blueprints-v2-addon": "workspace:*"
}
}
Note
From the workspace root, please run pnpm build; pnpm install
so that the blueprints are available.
From the workspace root, run the new
command to create a package in packages
. The package will be added to docs-app
and test-app
.
pnpm addon new <name> [options]
# Example: Create the addon `ui-form`
pnpm addon new ui-form
# Example: Specify the location for a scoped package
pnpm addon new @my-org-ui/form --location ui/form
From the addon root, run the generate
command to create the source code and its test file.
pnpm addon generate <component|helper|modifier|service|util> <name> [options]
# Example: Create a component
pnpm addon generate component ui/form/input
# Example: Use alias
pnpm addon g component ui/form/textarea
There may be more than 1 blueprint available. You can pass --blueprint
to select the right one.
# Example: Create a <template> tag component
pnpm addon g component ui/form/select --blueprint glimmer-strict
For more information, pass --help
.
From the addon root, run the destroy
command to remove the source code and its test file.
pnpm addon destroy <component|helper|modifier|service|util> <name>
# Example: Remove a component
pnpm addon destroy component ui/form/input
# Example: Use alias
pnpm addon d component ui/form/textarea
Get the latest blueprints from create-v2-addon-repo
.
# From this package root
pnpm update-blueprints --to 0.5.0
- Node.js v18 or above
This project is licensed under the MIT License.