# Ongoing Development

To open Stencil where everything is built:

- migrate to the cwru-components folder
- `git checkout master`
- `git remote update`
- `git pull`
- `nvm use 12.10` (OLD)
- `nvm use 18`
- `npm install`(OLD)
- `npm install --legacy-peer-deps`

To start Stencil: `npm run start`,
To start Storybook: `npm run storybook`

After changes are complete:

- checkout a different branch
- `git add -A`
- `git commit -m "MESSAGE"`
- git push then copy the command within the terminal and run that git push command
- create the pull request and merge it, and resolve any conflicts
- `git checkout master`
- `git remote update`
- `git pull`

To publish
- make sure the pull request is successful
- increase the version number in package.json
- `npm publish`
- Follow the prompts from the terminal. Must be logged in logged in `npm login`
- Wait a few minutes and then check [jsdeliver](https://www.jsdelivr.com/package/npm/cwru-components) to see if the new version is available.
- Switch to the gh-pages branch and add a new file. Name is `.nojekll` and keep it blank. Commit it and push it up
- make sure the pull request is successful
- `npm run deploy-storybook`
- Purge the CDN Server Cache by going to https://www.jsdelivr.com/tools/purge and purging https://cdn.jsdelivr.net/npm/cwru-components/dist/cwru-components/cwru-components.esm.min.js.

# Using these components

Include the script and stylesheet tags in the `<head>` of all your html files. The script tag MUST include `type="module"`.

```html
<link href="https://cdn.jsdelivr.net/npm/cwru-components/dist/cwru-components/cwru-components.min.css" rel="stylesheet" />
<script type="module" src="https://cdn.jsdelivr.net/npm/cwru-components/dist/cwru-components/cwru-components.esm.min.js"></script>
<script nomodule src="https://cdn.jsdelivr.net/npm/cwru-components/dist/cwru-components/cwru-components.js"></script>
```

# Documentation

The documentation is still under development. It lives on https://cwru.github.io/cwru-components/

When viewing a component, you can live update the attributes under the Controls tab at the bottom. When you are ready to use the component, click the HTML tab and the copy button at the bottom. This will keep all of the values you entered on the Controls tab.

# Updating and Publishing Components

This library is built using Stencil.js for generating the web components. We are using Storybook to create the docs.
The production version of the components live on NPM. To publish the latest version to NPM, first increase the version number in `package.json` and then run `npm publish`. Wait a few minutes and then check [jsdeliver](https://www.jsdelivr.com/package/npm/cwru-components) to see if the new version is available.

If an error occurs of "403 Forbidden - PUT https://registry.npmjs.org/cwru-components - Two-factor authentication or granular access token with bypass 2fa enabled is required to publish packages.", try `npm adduser` with username of cwru-components and jen's email address. Then do `npm login` and follow prompts. Run `npm publish` again.

npm recovery codes can be found here: https://drive.google.com/file/d/1QCr6uT9OzAy9EiLrlTCj8yEC1wbADhUf/view?usp=drive_link. CWRU-Components code is 131105

# Updating Storybook

Switch to the `gh-pages` branch and add a new file. Name is `.nojekll` and keep it blank. Commit it and push it up.

To update the components to show up on Storybook, `npm run deploy-storybook`

Purge the CDN Server Cache by going to https://www.jsdelivr.com/tools/purge and purging https://cdn.jsdelivr.net/npm/cwru-components/dist/cwru-components/cwru-components.esm.min.js.
