- Overview
- Clone the repo
- Install dependencies
- Adding components
- Developing
- Tests
- Documentation
- VS Code setup
The ember-toucan-core repo is an Ember v2 addon. It is setup as a monorepo with the following structure:
packages/ember-toucan-core
- the actual Ember addon containing the Toucan componentsdocs-app
- an Ember application used for the documentation site at http://ember-toucan-core.pages.devdocs
- contains Markdown files that are consumed by the docs-apptest-app
- the test app where tests are written
The first step in developing in the ember-toucan-core repo is to clone the repo.
git clone [email protected]:CrowdStrike/ember-toucan-core.git
ember-toucan-core uses PNPM as its package manager. If you're used to Yarn or NPM, PNPM has similar commands so you should be right at home!
cd ember-toucan-core
pnpm install # or `pnpm i`
When developing a new component, add it to the packages/ember-toucan-core
directory.
A few things to remember:
- Components are added under
packages/ember-toucan-core/src/components
- When adding a new component, it needs to be added to the template registry so Glint picks it up.
To do that, add a line in
packages/ember-toucan-core/src/template-registry.ts
.
To develop in this monorepo you can simply run:
pnpm start
from the root directory.
This will:
- Build all of the
packages/*
and watch them for changes - Build the docs app and the tests app and serve them
- Automatically sync changes from the
packages/*
to the served apps so that they are always up to date.
You can now visit:
- The docs app at http://localhost:4201/
- The tests app at http://localhost:4200/tests
If you don't need to run both apps you can save a little of your local compute by running:
start:docs-app
and visiting http://localhost:4201/start:test-app
and visiting http://localhost:4200/tests
These commands will still build and watch the packages/*
and sync changes
to the running app. Don't run both only
tasks together as this will cause
issues - if you want to run both apps simply use pnpm start
.
Tests are written in the test-app
under test-app/tests
.
We use Glint, so you will see the file extension is .gts
.
To run the test-app:
cd test-app
pnpm start
Navigate to http://localhost:4200/tests to view your tests.
Documentation lives in both the docs
and docs-app
directories.
For most cases when adding components, you'll only need to add markdown files in docs
.
The docs-app
directory is the Ember app powering the documentation, so it's not as likely to be edited when adding new functionality to ember-toucan-core.
Upon cloning the repo and opening it in VS Code, you may be prompted to download the recommended extensions. This is highly recommended! We've hand picked extensions that assist in writing Glint-powered Ember code. The following workspace settings are also recommended to get Prettier auto-save and ESLint working:
"files.trimTrailingWhitespace": true,
"editor.tabSize": 2,
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
// This is used to tell Glint where to look for the Glint dependencies
// In our case, we use glint in the test-app!
"glint.libraryPath": "test-app",
"[glimmer-js]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[glimmer-ts]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"prettier.documentSelectors": ["**/*.gjs", "**/*.gts"],
"editor.formatOnSave": true