Skip to content

Commit

Permalink
Merge branch 'next' of github.com:IBM/carbon-addons-iot-react into 16…
Browse files Browse the repository at this point in the history
…21-card-selection
  • Loading branch information
davidicus committed Oct 28, 2020
2 parents 2e5800d + ce81cbd commit 2c56d07
Show file tree
Hide file tree
Showing 63 changed files with 7,454 additions and 1,229 deletions.
129 changes: 93 additions & 36 deletions .github/CONTRIBUTING.MD
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,31 @@

## Prerequisites

Before contributing to `carbon-addons-iot-react`, you should make sure you have the following tools
installed:
Before contributing to `carbon-addons-iot-react`, you should make sure you have
the following tools installed:

- [Node.js](https://nodejs.org/en/download/) - the required version is specified in the [`.nvmrc`](/.nvmrc)
- If you're on macOS or using WSL on Windows, we recommend using [`nvm`](https://github.com/nvm-sh/nvm) as your version manager for Node.
- [Node.js](https://nodejs.org/en/download/) - the required version is specified
in the [`.nvmrc`](/.nvmrc)
- If you're on macOS or using WSL on Windows, we recommend using
[`nvm`](https://github.com/nvm-sh/nvm) as your version manager for Node.
- Git
- [Yarn Classic](https://classic.yarnpkg.com/en/docs/install)

You'll also need a code editor to make changes. There are many to
choose from but some popular options are
[VSCode](https://code.visualstudio.com/), [Atom](https://atom.io), and
[Sublime](https://www.sublimetext.com/).
You'll also need a code editor to make changes. There are many to choose from
but some popular options are [VSCode](https://code.visualstudio.com/),
[Atom](https://atom.io), and [Sublime](https://www.sublimetext.com/).

With that all in place, you're ready to start contributing!

### Developing on Windows 10

To get a Windows environment set up for contributing to this codebase, you'll need to set up the Windows Subsystem for Linux (WSL).
To get a Windows environment set up for contributing to this codebase, you'll
need to set up the Windows Subsystem for Linux (WSL).

To set up WSL, follow [this guide published by the Carbon team](https://github.com/carbon-design-system/carbon/blob/master/docs/guides/setup/windows.md). The steps should be the same, except that you'll be cloning this repository instead of the Carbon repository.
To set up WSL, follow
[this guide published by the Carbon team](https://github.com/carbon-design-system/carbon/blob/master/docs/guides/setup/windows.md).
The steps should be the same, except that you'll be cloning this repository
instead of the Carbon repository.

```sh
git clone [email protected]:carbon-design-system/carbon-addons-iot-react.git
Expand All @@ -48,80 +53,132 @@ To get your development server running and to start coding, run:
yarn start
```

This will start a development server where you can see any changes you are making to components in our react components Storybook.
This will start a development server where you can see any changes you are
making to components in our react components Storybook.

Once it's done building, you can edit source code or create new components. The system is set up to automatically bundle your changes/additions. Visit http://localhost:3000 to see the changes happen on the fly.
Once it's done building, you can edit source code or create new components. The
system is set up to automatically bundle your changes/additions. Visit
http://localhost:3000 to see the changes happen on the fly.

## Adding a new component or feature

You're ready to add a new component or feature to this library, THANK YOU! However, this is only a [_presentational_](https://medium.com/@dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0) component library. Please do not add components with any dependencies on internationalization libraries, redux, react-router, etc.
You're ready to add a new component or feature to this library, THANK YOU!
However, this is only a
[_presentational_](https://medium.com/@dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0)
component library. Please do not add components with any dependencies on
internationalization libraries, redux, react-router, etc.

For a component request or feature enhancement to be considered ‘ready to implement’, a design spec and usage guidance should be provided in the issue. Associated code pull requests will not be merged without these artifacts.
For a component request or feature enhancement to be considered ‘ready to
implement’, a design spec and usage guidance should be provided in the issue.
Associated code pull requests will not be merged without these artifacts.

## Dependencies

Dependencies must be added via `yarn add <packageName>`. Please do not use `npm install <packageName>`.
Dependencies must be added via `yarn add <packageName>`. Please do not use
`npm install <packageName>`.

When adding new `dependencies` or `devDependencies` to the codebase, the associated pull request should include justification for the package and the alternatives considered.
When adding new `dependencies` or `devDependencies` to the codebase, the
associated pull request should include justification for the package and the
alternatives considered.

Any change to `dependencies` (including version bumps) will impact consumers that are required to go through open source approvals within their organization. This approval process is not always a trivial task. `devDependencies` are less of a concern as they are not included in the exported package.
Any change to `dependencies` (including version bumps) will impact consumers
that are required to go through open source approvals within their organization.
This approval process is not always a trivial task. `devDependencies` are less
of a concern as they are not included in the exported package.

## Submitting pull requests and commits

Commits must follow the [conventional commit](https://www.conventionalcommits.org/en/v1.0.0-beta.2/#summary) format. You won't be able to create a commit unless you follow those rules. The [recent commits in the repository](https://github.com/carbon-design-system/carbon-addons-iot-react/commits/master) show examples of the format and how it's generally used.
All new development work should take place in a feature branch off of `next`.

For more information on what type of change commit should be labeled a `BREAKING CHANGE`, `feat`, or `fix`, please read [the versioning documentation](https://github.com/carbon-design-system/carbon-addons-iot-react/blob/master/docs/guides/versioning.md).
Commits must follow the
[conventional commit](https://www.conventionalcommits.org/en/v1.0.0-beta.2/#summary)
format. You won't be able to create a commit unless you follow those rules. The
[recent commits in the repository](https://github.com/carbon-design-system/carbon-addons-iot-react/commits/master)
show examples of the format and how it's generally used.

Commits are preferred but not required to contain a link to an issue. If you choose to link commits to an issue, the 72 character limit can be avoided by placing the link in the body of the commit. Example:
For more information on what type of change commit should be labeled a
`BREAKING CHANGE`, `feat`, or `fix`, please read
[the versioning documentation](https://github.com/carbon-design-system/carbon-addons-iot-react/blob/master/docs/guides/versioning.md).

Commits are preferred but not required to contain a link to an issue. If you
choose to link commits to an issue, the 72 character limit can be avoided by
placing the link in the body of the commit. Example:

```sh
git commit -m "fix(table): columns need unique ids" -m "#123"
```

Pull requests must contain a link to a relevant issue. If applicable, [automatically close issues from PRs via the keywords](https://help.github.com/en/articles/closing-issues-using-keywords).
Pull requests must contain a link to a relevant issue. If applicable,
[automatically close issues from PRs via the keywords](https://help.github.com/en/articles/closing-issues-using-keywords).

## Styling new components

Components should have their own sass partial in which the corresponding styles are contained. If a component does not have one, please add it.
Components should have their own sass partial in which the corresponding styles
are contained. If a component does not have one, please add it.

Do not use `styled-components`. Any components using it should be refactored to the sass partial approach. This helps promote consistency with the Carbon Design System.
Do not use `styled-components`. Any components using it should be refactored to
the sass partial approach. This helps promote consistency with the Carbon Design
System.

## Testing

An automated unit test bucket runs when you execute `yarn test:base`.

Before every push, the test suite is ran automatically and takes snapshots of all of the current component stories. If you have made changes to a component, our tests will likely fail because the snapshots will no longer match. You will be prevented from pushing to git until you fix this error.
Before every push, the test suite is ran automatically and takes snapshots of
all of the current component stories. If you have made changes to a component,
our tests will likely fail because the snapshots will no longer match. You will
be prevented from pushing to git until you fix this error.

### Writing tests

The items below are high level points of guidance for writing tests:

- Use the `@testing-library` family of packages instead of `enzyme`. Helping to refactor away from `enzyme` where possible is appreciated.
- Prefer queries that reflect the experience of visual/mouse users as well as those that use assistive technology, [read more from the `@testing-library` docs](https://testing-library.com/docs/guide-which-query)
- `getByRole`, `getByLabelText`, `getByPlaceholderText`, `getByText`, `getByDisplayValue`
- Write tests using queries directly from the `screen` object rather than destructuring them from `render` result, [read more from the `prefer-screen-queries` eslint rule](https://github.com/testing-library/eslint-plugin-testing-library/blob/master/docs/rules/prefer-screen-queries.md)
- Use the `@testing-library` family of packages instead of `enzyme`. Helping to
refactor away from `enzyme` where possible is appreciated.
- Prefer queries that reflect the experience of visual/mouse users as well as
those that use assistive technology,
[read more from the `@testing-library` docs](https://testing-library.com/docs/guide-which-query)
- `getByRole`, `getByLabelText`, `getByPlaceholderText`, `getByText`,
`getByDisplayValue`
- Write tests using queries directly from the `screen` object rather than
destructuring them from `render` result,
[read more from the `prefer-screen-queries` eslint rule](https://github.com/testing-library/eslint-plugin-testing-library/blob/master/docs/rules/prefer-screen-queries.md)

### Updating snapshots

After the unit test engine has detected a snapshot difference, all snapshots can be updated by running `yarn test:update`.
After the unit test engine has detected a snapshot difference, all snapshots can
be updated by running `yarn test:update`.

_Do not blindly update snapshots to pass the testcase._ Make sure the detected change is intentional and not unintentional before updating the snapshot.
_Do not blindly update snapshots to pass the testcase._ Make sure the detected
change is intentional and not unintentional before updating the snapshot.

### Minimum code coverage

Code coverage thresholds are enforced in the repository. If you add code but do not cover it with unit tests, the git push may fail because the coverage fell to a level under the required code coverage thresholds. Please add storybook stories or unit tests to cover your new code before checking in. _Do not reduce the code coverage threshold to get around this constraint._
Code coverage thresholds are enforced in the repository. If you add code but do
not cover it with unit tests, the git push may fail because the coverage fell to
a level under the required code coverage thresholds. Please add storybook
stories or unit tests to cover your new code before checking in. _Do not reduce
the code coverage threshold to get around this constraint._

To understand what lines of code are NOT covered by the current testcases, open the coverage/index.html file in a browser and investigate.
To understand what lines of code are NOT covered by the current testcases, open
the coverage/index.html file in a browser and investigate.

## Setting up VSCode to share settings and extensions

Some contributors to this repository are using some pretty cool VSCode extensions to make local development easier. If you'd like to reuse the same ones, follow [the instructions to set up the VSCode Settings Sync](http://shanalikhan.github.io/2015/12/15/Visual-Studio-Code-Sync-Settings.html).
Some contributors to this repository are using some pretty cool VSCode
extensions to make local development easier. If you'd like to reuse the same
ones, follow
[the instructions to set up the VSCode Settings Sync](http://shanalikhan.github.io/2015/12/15/Visual-Studio-Code-Sync-Settings.html).

Here's the Gist ID to download/share settings from: `5e3fb697c29f2aaa058145a3349a8229`
Here's the Gist ID to download/share settings from:
`5e3fb697c29f2aaa058145a3349a8229`

After installing the VSCode Sync, restart VSCode, go to the Command Palette and search for Sync. Select Sync : Advanced Options-> Sync : Download Settings from Public GIST
After installing the VSCode Sync, restart VSCode, go to the Command Palette and
search for Sync. Select Sync : Advanced Options-> Sync : Download Settings from
Public GIST

Then Sync : Download Settings. It will ask you for a Public GIST URL, here it is.
Then Sync : Download Settings. It will ask you for a Public GIST URL, here it
is.

Here's the Public GIST URL:
https://gist.github.com/scottdickerson/5e3fb697c29f2aaa058145a3349a8229
86 changes: 43 additions & 43 deletions README.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<a href="https://pages.github.ibm.com/Watson-IoT/IoT-Design-Site/">
<a href="https://pages.github.ibm.com/ai-applications/design/">
<img alt="Carbon add-ons for Watson IoT" src="https://user-images.githubusercontent.com/3360588/59875762-3add3180-9367-11e9-8a65-a6cf7efa5061.png" width="100%" />
</a>
</p>
Expand All @@ -13,21 +13,15 @@
> and a vibrant community of contributors.
<p align="center">
<a href="https://carbon-addons-iot-react.com">
<img src="https://cdn.jsdelivr.net/gh/storybookjs/brand@master/badge/badge-storybook.svg" alt="Our Storybook" />
<a href="https://www.npmjs.com/package/carbon-addons-iot-react">
<img src="https://img.shields.io/npm/v/carbon-addons-iot-react/latest" alt="@latest npm version release" />
</a>
<a href="https://app.netlify.com/sites/carbon-addons-iot-react/deploys">
<img src="https://api.netlify.com/api/v1/badges/d037c99a-d51a-4729-bf7c-589679e2663e/deploy-status" alt="Netlify status" />
<a href="https://www.npmjs.com/package/carbon-addons-iot-react">
<img src="https://img.shields.io/npm/v/carbon-addons-iot-react/next" alt="@next npm version release" />
</a>
<a href="https://travis-ci.org/carbon-design-system/carbon-addons-iot-react">
<img src="https://travis-ci.org/carbon-design-system/carbon-addons-iot-react.svg?branch=master" alt="Build Status" />
</a>
<a href="https://www.npmjs.com/package/carbon-addons-iot-react">
<img src="https://img.shields.io/npm/v/carbon-addons-iot-react/latest" alt="Current npm version release" />
</a>
<a href="https://www.npmjs.com/package/carbon-addons-iot-react">
<img src="https://img.shields.io/npm/v/carbon-addons-iot-react/next" alt="Next npm version release" />
</a>
<a href="https://coveralls.io/github/carbon-design-system/carbon-addons-iot-react?branch=master">
<img src="https://coveralls.io/repos/github/carbon-design-system/carbon-addons-iot-react/badge.svg?branch=master" alt="Coverage Report" />
</a>
Expand All @@ -41,53 +35,64 @@

## Installation

Run the following command using [npm](https://www.npmjs.com/):
**@latest from
[`master`](https://github.com/carbon-design-system/carbon-addons-iot-react/tree/master)**
&nbsp; - &nbsp; <a href="https://carbon-addons-iot-react.com">
<img valign=middle src="https://img.shields.io/badge/view%20%40latest-storybook-ff4785" alt="view @latest storybook" />
</a>

```bash
npm install carbon-addons-iot-react d3@">=5.0.0 <=5.14.2"
```
# with npm
npm install carbon-addons-iot-react d3@">=5.0.0 <=5.14.2"
If you prefer [Yarn Classic](https://classic.yarnpkg.com/), use the following
command instead:

```bash
# with yarn
yarn add carbon-addons-iot-react d3@">=5.0.0 <=5.14.2"
```

> _Note `d3` is a peer dependency due to the usage of `@carbon/charts` in
> various components. The required version range is specified in
> [our package.json](https://github.com/carbon-design-system/carbon-addons-iot-react/search?l=JSON&q=peerDependencies+d3)_
**@next pre-releases from
[`next`](https://github.com/carbon-design-system/carbon-addons-iot-react/tree/next)**
&nbsp; - &nbsp; <a href="https://next.carbon-addons-iot-react.com">
<img valign=middle src="https://img.shields.io/badge/view%20%40next-storybook-ff4785" alt="view @next storybook" />
</a>

You can then import any component that you need by doing the following in your
project:
```
# with npm
npm install carbon-addons-iot-react@next d3@">=5.0.0 <=5.14.2"
```js
import { AddCard } from 'carbon-addons-iot-react';
# with yarn
yarn add carbon-addons-iot-react@next d3@">=5.0.0 <=5.14.2"
```

Prerelease versions are available on `carbon-addons-iot-react@next`. The semver
range in your project's `package.json` can be modified to follow the `next`
channel:
> _`d3` is a peer dependency due to the usage of `@carbon/charts` in various
> components. The required version range is specified in
> [package.json](https://github.com/carbon-design-system/carbon-addons-iot-react/search?l=JSON&q=peerDependencies+d3)_
```
### Subscribe to all pre-releases on `next`

[Pre-release versions](https://semver.org/#spec-item-9) are available on
`carbon-addons-iot-react@next`. The default version range that is automatically
added to your `package.json` on install/add will only follow pre-releases on the
same `major.minor.patch` version. The version range can be modifed to follow all
pre-releases:

```diff
"dependencies": {
"carbon-addons-iot-react": "next",
}
- "carbon-addons-iot-react": "^2.139.0-next.4"
+ "carbon-addons-iot-react": "next"
}
```

## 🚀 Quick Start

If you'd like to test drive everything here, run the following command to create
a new project preconfigured with everything you need to begin to build an
application.
To test drive everything here, use
[`create-iot-react-app`](https://github.com/davidicus/create-iot-react-app). It
will create a new project that is preconfigured with everything you need to
begin to build an application.

```sh
```
npx create-iot-react-app <app-name>
```

More
[info on `create-iot-react-app` here](https://github.com/davidicus/create-iot-react-app)

## Styling

What's included
Expand Down Expand Up @@ -130,11 +135,6 @@ packages; `carbon-components`, `carbon-components-react`, or `@carbon` packages
(`@carbon/grid`, `@carbon-layout`, etc) as peer dependencies. You may still need
these packages if you use them directly in your project.

## 📚 Docs

You can find more information about how to use each component by checking out
the [Storybook](https://carbon-addons-iot-react.com/).

## 🤲 Contributing

Please check out our [Contribution Guidelines](./.github/CONTRIBUTING.MD) for
Expand Down
Loading

0 comments on commit 2c56d07

Please sign in to comment.