Skip to content

Commit

Permalink
Merge pull request #1011 from Autodesk/development
Browse files Browse the repository at this point in the history
Release: July 6, 2018
  • Loading branch information
morrisallison authored Jul 6, 2018
2 parents 893f988 + 10845e0 commit 5b6a996
Show file tree
Hide file tree
Showing 90 changed files with 1,737 additions and 218 deletions.
44 changes: 35 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
## Contributing to HIG

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->


- [Filing Issues](#filing-issues)
- [Suggestions](#suggestions)
- [Bugs](#bugs)
- [Contributing Code](#contributing-code)
- [Contributing Features](#contributing-features)
- [Fork the project](#fork-the-project)
- [Create a new branch off of the `development` branch](#create-a-new-branch-off-of-the-development-branch)
- [Develop new functionality](#develop-new-functionality)
- [Create a pull request](#create-a-pull-request)
- [Open source governance](#open-source-governance)
- [See Also](#see-also)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

### Filing Issues

**Suggestions**
#### Suggestions

The HIG project is meant to evolve with feedback - the project and its users greatly appreciate any thoughts on ways to improve the design or features. Please use the `enhancement` tag to specifically denote issues that are suggestions - this helps us triage and respond appropriately.

**Bugs**
#### Bugs

As with all pieces of software, you may end up running into bugs. Please submit bugs as regular issues on GitHub - HIG developers are regularly monitoring issues and will try to fix open bugs quickly.

Expand All @@ -18,44 +36,52 @@ The HIG project accepts and greatly appreciates contributions. The project follo

When contributing code, please also include appropriate tests as part of the pull request, and follow the same comment and coding style as the rest of the project. Take a look through the existing code for examples of the testing and style practices the project follows.

Please view the [contribution example][] for an example of the recommended package structure.

[contribution example]: ./packages/contribution-example

### Contributing Features

All pull requests for new features must go through the following process:
* Please familiarize yourself with the [DEVELOPING](DEVELOPING.md) resources

* Please familiarize yourself with the [Developing guide](DEVELOPING.md).
* Start an Intent-to-implement GitHub issue for discussion of the new feature.
* LGTM from Tech Lead and one other core committer is required
* Written approval from the HIG engineering team (GitHub comment).
* Development occurs on a separate branch of a separate fork, noted in the intent-to-implement issue
* A pull request is created, referencing the issue.
* HIG developers will provide feedback on pull requests, looking at code quality, style, tests, performance, and directional alignment with the goals of the project. That feedback should be discussed and incorporated
* LGTM from Tech Lead and one other core committer, who confirm engineering quality and direction.
* HIG developers will provide feedback on pull requests, looking at code quality, style, tests, performance, and directional alignment with the goals of the project. That feedback should be discussed and incorporated.
* Approval via code review from the Tech Lead and another core committer, who can confirm engineering quality and direction.

#### Fork the project

Fork the `hig` project with your GitHub account.

#### Create a new branch off of the `development` branch

On your fork, locally, create a new branch off of `development`.
The name of your branch should include the type of change it holds, a brief description of the changes, and the issue number if relevant.
E.g. Fixing a typo in the readme as discussed in issue #101 would have a branch name like this:

```
bugs/fix-readme-type-101
```

#### Develop new functionality
Read [DEVELOPING](DEVELOPING.md) for more information about how to develop within this project. Once your changes are complete ensure your branch meets testing, coverage, and linting standards.
- Ensure changes are tested
- Add to the playground for manual testing if needed
- Add to the Storybook for manual testing if needed
- Ensure branch meets testing, coverage, and linting standards
- `yarn test-ci`
- `yarn lint`

#### Create a pull request

When you're ready for feedback, create a pull request against the `development` branch. The title of your pull request should be a concise description of the changes within it. The description of the PR should include the reason behind your PR, a brief explanation of your approach, and highlights of any especially interesting or potentially surprising details. If the change is visual, add a screenshot or gif to the pull request description.

When you create a pull request, our continuous integration system automatically runs tests,ensures test coverage stays above a threshold, and ensures code complies with linting standards. All CI checks must pass before the pull request is ready to merge.

A core committer will review your pull request and provide feedback or merge it into `development` as appropriate.


### Open source governance

The HIG project's chief and primary concern is with the development of HIG Interface and platform specific implementations, an open source library of components which increase developer efficiency and provide a consistent look and feel to web applications across Autodesk. The look and feel of components is based on Autodesk Human Interface guidelines designs and the various product teams that contribute to HIG. The HIG project's governance model thus reflects only the need to steer the engineering direction of the components and not any other activities which are out of scope.
Expand All @@ -69,7 +95,7 @@ In the event there are no Core Committers, Autodesk Inc. will appoint one.
Core Committers:

- Tech Lead: Sean Durham (@nfiniteset)
- Core Committer: Morris Allison (@morrisallison)
- Core Committer: Morris Allison III (@morrisallison)

### See Also

Expand Down
140 changes: 126 additions & 14 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,148 @@
# Developing - HIG
# Developing

We use Yarn workspaces and Lerna to manage interdependencies between packages. To get set up, run this from the project root:
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->


- [Prerequisites](#prerequisites)
- [Getting Started](#getting-started)
- [Project structure](#project-structure)
- [Monorepo](#monorepo)
- [Private packages](#private-packages)
- [Code style](#code-style)
- [Testing](#testing)
- [Unit testing](#unit-testing)
- [How it works](#how-it-works)
- [How to run manually](#how-to-run-manually)
- [Visual regression testing](#visual-regression-testing)
- [How it works](#how-it-works-1)
- [How to run manually](#how-to-run-manually-1)
- [Git commits](#git-commits)
- [Package versioning](#package-versioning)
- [Deployment](#deployment)
- [How to deploy](#how-to-deploy)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## Prerequisites

The following dependencies must be available to be begin project development.

* [Unix-like][] operating system _[Windows Subsystem for Linux][] also works_
* [Git][]
* [Node][] `^9.7.1`
* [Yarn][] `>=1.5.1`
* [Python][] `^2.7` _— Some dependencies require `node-gyp` which uses Python_

[Git]: https://git-scm.com/
[Node]: https://nodejs.org
[Python]: https://www.python.org
[Unix-like]: https://en.wikipedia.org/wiki/Unix-like
[Yarn]: https://yarnpkg.com
[Windows Subsystem for Linux]: https://docs.microsoft.com/en-us/windows/wsl/about

## Getting Started

To get set up, run the following commands:

```bash
git clone https://github.com/Autodesk/hig
cd hig
yarn
yarn build
```

# Testing
## Project structure

### Monorepo

This project is structured as a [monorepo][], with each package residing within its own directory.

The monorepo uses [Yarn workspaces][] and [Lerna][] to manage the interdependencies between packages.

[Lerna]: https://lernajs.io/
[monorepo]: https://github.com/babel/babel/blob/master/doc/design/monorepo.md
[Yarn workspaces]: https://yarnpkg.com/lang/en/docs/workspaces/

### Private packages

Private packages are used to organize development tools and dependencies. For example, the [`@hig/scripts`][hig-scripts] package contains the build script that's used to build every component package.

[hig-scripts]: ./packages/scripts

## Code style

We use [ESLint][] and [Prettier][] to ensure consistency throughout the source code. Please view our [ESLint configuration][] for details on style rules.

[ESLint]: https://eslint.org/
[ESLint configuration]: ./packages/eslint-config
[Prettier]: https://prettier.io/

## Unit Tests
## Testing

Currently, to run Jest tests, run this from the project root:
### Unit testing

[Jest][] along with [Enzyme][] is used to run our unit testing suite. While we aim for the highest possible code coverage, every component should be covered with a [snapshot test][] at the very least.

[Enzyme]: http://airbnb.io/enzyme/
[Jest]: http://jestjs.io/
[snapshot test]: http://jestjs.io/docs/en/snapshot-testing.html

#### How it works

Unit tests reside within module specifications (`moduleName.test.js`), which are placed next to their respective modules. Jest runs all of the project's unit tests together, and evaluates code coverage on the project as a whole.

#### How to run manually

```bash
cd packages/storybook
yarn test
```

## Visual Regression Tests
### Visual regression testing

To ensure that changes do not break the visual presentation of components, we run a suite of visual regression tests via [Gemini][].

[Gemini]: https://gemini-testing.github.io/

#### How it works

The tests are run upon a Storybook developed specifically for automated testing. Screenshots of each test are stored within the repository similar to unit test snapshots.

We use Gemini to ensure that changes do not break the visual presentation of components. We use Storybook to render an example of a component, then save a screenshot of the example to the repository.
#### How to run manually

```bash
cd packages/storybook
yarn gemini-update # Update snapshots
yarn gemini # Check components against committed snapshots
```

# Deployment
## Git commits

Commit messages should adhere to the [Angular Git Commit Guidelines][].

## Package versioning

Package versioning is automated via [Semantic Release][] and determined by commit messages. Commit messages should adhere to [Angular Git Commit Guidelines][].

[Angular Git Commit Guidelines]: https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines
[Semantic Release]: https://github.com/semantic-release/semantic-release

## Deployment

Packages are published via [Semantic Release][].

### How to deploy

1. Create a pull request (PR) to merge `development` into `master`.
1. Wait for the PR to receive approval and all automation to finish.
1. Merge the PR with a **merge commit**
* Merging with a merge commit ensures there's no loss of commit information.

_Semantic Release will then:_

1. Switch to `development` branch.
1. `yarn update-packages # Update package version numbers and adds tags and publish commit`
1. `git push --follow-tags # Push development and new tags`
1. Create a pull request to merge `development` into `master`.
1. Merge.
1. Create new Git tags
1. Create/update changelogs
1. Publish new package versions to NPM
1. Update the `master` branch
1. Create GitHub releases
1. Merge all changes into the `development` branch
26 changes: 26 additions & 0 deletions docs/contribution-example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Component Scaffold

> This is a private example package which can serve as a base for contributions.
[COMPONENT_DESCRIPTION]

Read more about when and how to use the COMPONENT_NAME component [on the internal wiki](https://wiki.autodesk.com/display/HIG/COMPONENT_NAME).

## Getting started

```
yarn add @hig/PACKAGE_NAME
```

## Import the component and CSS

```
import Banner from '@hig/PACKAGE_NAME';
import '@hig/PACKAGE_NAME/build/index.css';
```

## Basic usage

```jsx
// Basic example
```
55 changes: 55 additions & 0 deletions docs/contribution-example/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"private": true,
"name": "@hig/contribution-example",
"version": "0.1.0-alpha",
"description": "",
"author": "Autodesk Inc.",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/Autodesk/hig.git"
},
"publishConfig": {
"access": "public"
},
"main": "build/index.js",
"module": "build/index.es.js",
"style": "build/index.css",
"files": [
"build/*"
],
"dependencies": {
"prop-types": "^15.6.1",
"react-lifecycles-compat": "^2.0.0"
},
"devDependencies": {
"@hig/babel-preset": "^0.1.0",
"@hig/eslint-config": "^0.1.0",
"@hig/scripts": "^0.1.2",
"@hig/semantic-release-config": "^0.1.0",
"@hig/styles": "^0.1.1"
},
"peerDependencies": {
"react": "^15.4.1 || ^16.3.2"
},
"scripts": {
"build": "hig-scripts-build",
"lint": "hig-scripts-lint",
"release": "hig-scripts-release"
},
"eslintConfig": {
"extends": "@hig"
},
"release": {
"extends": "@hig/semantic-release-config"
},
"babel": {
"env": {
"test": {
"presets": [
"@hig/babel-preset/test"
]
}
}
}
}
1 change: 1 addition & 0 deletions docs/contribution-example/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default function noop() {}
7 changes: 7 additions & 0 deletions docs/contribution-example/src/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import * as index from "./index";

describe("contribution-example/index", () => {
it(`exports default`, () => {
expect(index).toHaveProperty("default", expect.any(Function));
});
});
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@
"extract:dependencies": "bash scripts/extract-dependencies.sh",
"archive:builds": "node scripts/archive-builds.js",
"archive:dependencies": "node scripts/archive-dependencies.js",
"update-development": "bash scripts/update-development.sh"
"update-development": "bash scripts/update-development.sh",
"docs": "doctoc --notitle DEVELOPING.md CONTRIBUTING.md"
},
"devDependencies": {
"archiver": "^2.1.1",
"doctoc": "^1.3.1",
"lerna": "^2.11.0",
"mkdirp": "^0.5.1",
"node-fetch": "^1.7.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/avatar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"devDependencies": {
"@hig/babel-preset": "^0.1.0",
"@hig/eslint-config": "^0.1.0",
"@hig/scripts": "^0.1.1",
"@hig/scripts": "^0.1.2",
"@hig/semantic-release-config": "^0.1.0",
"@hig/styles": "^0.1.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/banner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@hig/button": "^0.1.1",
"@hig/eslint-config": "^0.1.0",
"@hig/rich-text": "^0.1.1",
"@hig/scripts": "^0.1.1",
"@hig/scripts": "^0.1.2",
"@hig/semantic-release-config": "^0.1.0",
"@hig/styles": "^0.1.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/button/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@hig/babel-preset": "^0.1.0",
"@hig/eslint-config": "^0.1.0",
"@hig/icon": "^0.1.1",
"@hig/scripts": "^0.1.1",
"@hig/scripts": "^0.1.2",
"@hig/semantic-release-config": "^0.1.0",
"@hig/styles": "^0.1.1"
},
Expand Down
Loading

0 comments on commit 5b6a996

Please sign in to comment.