Blueprints for v2 addons
Standardize how you write v2 addons:
- Run
newto create a v2 addon - Run
generateto create source and test files - Run
destroyto 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/formFrom 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/textareaThere 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-strictFor 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/textareaGet the latest blueprints from create-v2-addon-repo. The versions available for --to can be found at blueprints-v2-addon-output.
# From this package root
pnpm update-blueprints --to 0.5.0- Node.js v20 or above
This project is licensed under the MIT License.