Esri welcomes contributions from anyone and everyone. Please see our guidelines for contributing.
Calcite Components is still in its early stages. You can help most by:
- Adding ideas for components to out wishlist project We are using the wishlist to gather ideas about what components teams are using that we might be able to reproduce as a part of Calcite Components.
- If you want to help develop components take a look at out 1.0.0 components which are the components we are targeting for the first release of Calcite Components. Before starting development please review our component conventions and the Stencil documentation.
If you aren't familiar with the basics of WebComponents and Shadow DOM please read through some of the following resources before contributing:
- Google - Custom Elements v1: Reusable Web Components
- Google - Shadow DOM v1: Self-Contained Web Components
- CSS Tricks - An Introduction to Web Components
If something isn't working the way you expected, please take a look at previously logged issues first. Have you found a new bug? Want to request a new feature? We'd love to hear from you.
Please include the following information in your issue:
- Browser (or Node.js) version
- A snippet of code
- an explanation of
- What you saw
- What you expected to see
You don't have to but we recommend installing TypeScript, TSLint, Prettier and EditorConfig extensions for your editor of choice.
- https://code.visualstudio.com/
- https://atom.io/packages/atom-typescript
- https://github.com/Microsoft/TypeScript-Sublime-Plugin
- etc...
To start the local development environment run npm start
this will start the local Stencil development server on http://localhost:3333. You can modify the index.html to add and test your new component. Just add another HTML file to the demos
folder and link to this new page from index.html
.
Before adding a new component, have a read through the component conventions guide. This guide covers everything from colors to event naming syntax and will help you create a component that is consistent with those that exist already.
npm test
will run the current test suite.
Calcite Components include Stencil's default testing tools which are built on Jest and Puppeteer.
If you're working on writing tests for a particular component, it can be helpful to use npm run test:watch
to retest on file changes. Once the initial tests run, typing o
at the prompt will run tests only on changed files, allowing you to quickly iterate on tests for a specific component.
Please refer to the Stencil testing documentation for more information.
Calcite Components utilizes Storybook for documenting components. Adding a new component is very simple:
- Create a new file inside your component directory like
calcite-X.stories.js
- Write stories (see below)
- Run the documentation locally with
npm run docs:preview
The docs:preview
command will build Calcite Components, and open your browser to view the storybook docs locally.
Each component should use a storiesOf
with at least one story. It's a great idea to add the component's auto-generated readme.md
as notes. If your component has props that effect visual styles, you can use the storybook knobs addon to allow people to manipulate props and see live updates in the documentation. A minimal stories file might look something like this:
import { storiesOf } from '@storybook/html';
import { boolean } from '@storybook/addon-knobs'
import notes from './readme.md';
storiesOf('My component', module)
.add('Simple', () => `
<my-component demo-prop="${boolean("demo-prop", true)}"></my-component>
, { notes })`
We deploy the docs with storybook deployer.
- Make sure your changes have landed in
master
- Use
npm run release:docs
to build the docs and deploy to gh-pages
To release a new version of Calcite Components you must:
- Be a member of the @esri organization on npm.
- Be a member of the admin team for Calcite Components.
- Make sure you have a remote named
origin
pointing to Esri/calcite-components. - Ensure you have set up an access token (see below)
- Run
npm run release:prepare
. This script will:
- Create a build
- Run all the tests
- Update the package version
- Create a changelog entry for the current release
- Create a commit and tag it -
⚠️ Note if you need to make changes after this step, make sure to amend the commit (git commit --amend
) and recreate the tag (git tag --force <version>
)
- Run
npm run release:publish
. This script will:
- Push the release tag to the repo
- Publish to NPM
- Publish to GitHub (including source and package)
- Lastly, run
npm run release:docs
to update the docs. This script will:
-
Create the component doc
-
Create the storybook build
-
Push all doc content to the
gh-pages
branchNote: this script can be run anytime the docs need to be updated
In order for the release script to work, you'll need to generate an access token with GitHub and export it into your shell environment as GH_RELEASE_GITHUB_API_TOKEN
. First, generate a token, then copy that token and add it to your bash_profile
(~/.bash_profile
on Mac):
export GH_RELEASE_GITHUB_API_TOKEN=PASTE_TOKEN_HERE
You may need to start a new terminal window to apply the profile changes.