Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.2.0 #125

Merged
merged 73 commits into from
Apr 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
f75c1da
Bump ts-jest from 24.1.0 to 24.3.0
dependabot-preview[bot] Mar 17, 2020
76328b2
Bump babel-jest from 24.9.0 to 25.1.0
dependabot-preview[bot] Mar 17, 2020
55167d9
Bump @babel/preset-react from 7.0.0 to 7.8.3
dependabot-preview[bot] Mar 19, 2020
a479ac3
Bump prettier from 1.18.2 to 1.19.1
dependabot-preview[bot] Mar 19, 2020
39cabe3
Resolve conflicts with master
Mar 30, 2020
c2dc106
Install dangerjs
gidjin Mar 24, 2020
0ff34c9
Add a dangerfile configuration
gidjin Mar 24, 2020
2eedba3
Update CHANGELOG
gidjin Mar 24, 2020
5339233
Add danger to husky hooks
gidjin Mar 24, 2020
96df3b5
Update Roadmap
gidjin Mar 24, 2020
b8e6805
fix CVE-2020-7598 1/3 force upgrade postcss-sass
sojeri Apr 5, 2020
c0f0a82
fix CVE-2020-7598 2/3 patch deps
sojeri Apr 5, 2020
791b1e2
fix CVE-2020-7598 3/3 remove temp force upgrade dep
sojeri Apr 5, 2020
fac6225
fix SNYK-JS-ACORN-559469 by patching yarn.lock
sojeri Apr 5, 2020
232e6bf
use resolutions to document required deps
sojeri Apr 6, 2020
bacabcd
better fix for gonzales-pe version: upgrade stylelint
sojeri Apr 6, 2020
b549d57
Correct formatting of CODEOWNERS to avoid highlanders scenario
tinyels Apr 6, 2020
0a642d0
Merge pull request #56 from trussworks/els-fix-CODEOWNERS
tinyels Apr 6, 2020
1a44236
added more codeowners
Apr 6, 2020
8e13604
Merge remote-tracking branch 'origin/develop' into sojeri/resolve-sec…
gidjin Apr 6, 2020
951c9f2
Merge pull request #48 from trussworks/sojeri/resolve-security-adviso…
gidjin Apr 6, 2020
c253c71
update contributors
Apr 6, 2020
2a8f03e
Merge branch 'develop' into els_more_codeowners
tinyels Apr 6, 2020
89c1496
Merge pull request #57 from trussworks/els_more_codeowners
tinyels Apr 6, 2020
a193306
Run yarn upgrade to update our dependencies
gidjin Apr 6, 2020
2002e99
Update CHANGELOG
gidjin Apr 6, 2020
7c3a539
Merge pull request #58 from trussworks/gdjn_yarn_update
gidjin Apr 7, 2020
3b6309d
Bump css-loader from 3.5.0 to 3.5.1
dependabot-preview[bot] Apr 7, 2020
54717c9
Merge remote-tracking branch 'origin/develop' into gdjn_add_dangerjs
gidjin Apr 13, 2020
4d4dd34
Merge pull request #39 from trussworks/gdjn_add_dangerjs
gidjin Apr 13, 2020
32685aa
Bump jest from 25.2.7 to 25.3.0
dependabot-preview[bot] Apr 13, 2020
5cfa3d6
combine upgrades from PRS 60-70
Apr 14, 2020
9a91b27
Bump babel-jest from 25.2.6 to 25.3.0
dependabot-preview[bot] Apr 14, 2020
beb7f12
Merge pull request #71 from trussworks/els_combine_dependabot_branches
tinyels Apr 14, 2020
da573fd
Add new global util classes
Apr 15, 2020
0e72193
Bump danger from 10.0.0 to 10.1.1
dependabot-preview[bot] Apr 20, 2020
db15b39
Basic horizontal nav
Apr 24, 2020
52b9fe1
Add auto-approve workflow for dependabot
Apr 27, 2020
9bb87ac
Bump babel-jest from 25.3.0 to 25.4.0
dependabot-preview[bot] Apr 20, 2020
2d0f724
Merge branch 'develop' into dependabot-npm_and_yarn-danger-10.1.1
Apr 27, 2020
48d1c6e
Add auto-approve workflow for dependabot
Apr 27, 2020
de4a3c8
Merge branch 'sr-dependabot-codeowner' of github.com:trussworks/react…
Apr 27, 2020
5e9f21b
Limit Jest to 1 worker when running in CI
Apr 27, 2020
86e5f37
Merge pull request #116 from trussworks/sr-103-jest-ci-memory
Apr 27, 2020
87f34b8
Merge branch 'develop' into sr-dependabot-codeowner
Apr 27, 2020
01c91ed
Merge pull request #108 from trussworks/sr-dependabot-codeowner
Apr 27, 2020
f57e8c3
Merge branch 'develop' into dependabot-npm_and_yarn-danger-10.1.1
Apr 27, 2020
8e3502a
Merge pull request #90 from trussworks/dependabot-npm_and_yarn-danger…
Apr 27, 2020
825092e
Merge branch 'develop' of github.com:trussworks/react-uswds into sr-s…
Apr 27, 2020
aad8459
Bump @types/react from 16.9.32 to 16.9.34
dependabot-preview[bot] Apr 27, 2020
49b4f11
Remove HorizontalNav component
Apr 27, 2020
9cf4df2
Bump jest from 25.3.0 to 25.4.0
dependabot-preview[bot] Apr 27, 2020
f6d73b2
Updated CHANGELOG
Apr 27, 2020
1d9787e
Bump @typescript-eslint/eslint-plugin from 2.28.0 to 2.30.0
dependabot-preview[bot] Apr 27, 2020
5049104
Bump lint-staged from 10.1.3 to 10.1.7
dependabot-preview[bot] Apr 27, 2020
4be8652
Bump @testing-library/react from 10.0.2 to 10.0.3
dependabot-preview[bot] Apr 27, 2020
a0271a5
Bump @typescript-eslint/parser from 2.27.0 to 2.30.0
dependabot-preview[bot] Apr 27, 2020
e92147b
Bump ts-jest from 25.3.1 to 25.4.0
dependabot-preview[bot] Apr 27, 2020
dcbbd4f
Add new styles to Alert, add HTML props
Apr 27, 2020
d926ae4
Merge pull request #117 from trussworks/sr-alert-slim-106
Apr 28, 2020
04539bc
Merge branch 'develop' into sr-saber-port
Apr 28, 2020
f8aa924
Bump stylelint from 13.3.2 to 13.3.3
dependabot-preview[bot] Apr 27, 2020
9f77c63
Merge pull request #101 from trussworks/sr-saber-port
Apr 28, 2020
da73390
Bump css-loader from 3.5.2 to 3.5.3
dependabot-preview[bot] Apr 28, 2020
1ff5e85
Add storybook deployer
Apr 28, 2020
a074dae
Testing deploy workflow
Apr 28, 2020
741ed2b
Add signIn and passwordReset form templates (#100)
haworku Apr 28, 2020
aaaf284
Testing deploy workflow
Apr 28, 2020
1b0f0c1
Testing deploy workflow
Apr 28, 2020
ca2a1ea
Try caching yarn
Apr 28, 2020
61432ab
Only deploy on pushes to master
Apr 28, 2020
8408d61
Merge pull request #122 from trussworks/sr-storybook-site-76
Apr 29, 2020
f911919
Update release notes, version, contributors
Apr 30, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ jobs:
- node_modules
key: v1.0.0-dependencies-{{ checksum "package.json" }}

- run: yarn test
- run: yarn test -w 1
- run: yarn lint
- run: yarn danger ci --failOnErrors
12 changes: 12 additions & 0 deletions .github/workflows/auto-approve.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Auto approve

on: pull_request

jobs:
auto-approve:
runs-on: ubuntu-latest
steps:
- uses: hmarr/auto-approve-action@v2.0.0
if: github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]'
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
40 changes: 40 additions & 0 deletions .github/workflows/deploy-storybook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Deploy Storybook

on:
push:
branches:
- master

jobs:
deploy-storybook:
runs-on: ubuntu-latest
name: Deploy Storybook
steps:
- name: Check out repository
uses: actions/checkout@v2

- name: Set up node
uses: actions/setup-node@v1
with:
node-version: '10.x'

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v1
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install

- name: Deploy Storybook to Github page
run: yarn storybook:deploy --ci
env:
GH_TOKEN: trussworks:${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .storybook/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { configure, addDecorator } from '@storybook/react'
import { withInfo } from '@storybook/addon-info'

import 'uswds/dist/css/uswds.css'
import '../src/styles/index.scss'
import './custom-story.css'

configure(require.context('../src', true, /\.stories\.tsx?$/), module)
Expand Down
6 changes: 4 additions & 2 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"plugins": ["stylelint-prettier"],
"plugins": ["stylelint-scss", "stylelint-prettier"],
"rules": {
"at-rule-no-unknown": null,
"scss/at-rule-no-unknown": true,
"prettier/prettier": true,
"selector-class-pattern": ""
},
"extends": ["stylelint-config-recommended", "stylelint-prettier/recommended", "stylelint-config-sass-guidelines"],
"extends": ["stylelint-config-recommended", "stylelint-prettier/recommended", "stylelint-config-sass-guidelines", "stylelint-config-css-modules"],
}
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.2.0] - 2020-04-30

- Added new Alert styles (slim, no icon) and allow the Alert to accept `div` attributes as props
- Added additional examples of Form templates (Sign In form, Reset Password form) to Storybook
- Turn off USWDS SCSS notifications on compile
- Updated CODEOWNERS and contributors
- Fixed Jest running in CI
- Auto-approve Dependabot PRs
- Deploy Storybook static site on merge to master
- Run `yarn upgrade` to update all out of date dependencies
- Add [DangerJS](https://danger.systems/js/) to automate some checks for contribution standards
- Add additional CSS utility classes for background colors and text colors

## [1.1.0] - 2020-03-19

- Add initial set of USWDS form components (Checkbox, Dropdown, ErrorMessage, Fieldset, Form, FormGroup, Label, Radio, TextInput, Textarea)
Expand Down
3 changes: 1 addition & 2 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
* @suzubara
* @gidjin
* @suzubara @gidjin @tinyels @sarboc
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Also make sure to include the following in order to import the compiled CSS from
- [x] Load and export USWDS fonts/svgs/other assets
- [x] Decide on long-term lib publishing/hosting solution
- [x] Add CI status badge
- [x] Setup https://danger.systems/js/ to check on contribution standards, possibly even checking yarn install for warnings
- [ ] Document decision behind node version and upgrade plan
- [ ] ADR to decide on and set up a React component test helper:
- https://airbnb.io/enzyme/
Expand All @@ -76,7 +77,6 @@ Also make sure to include the following in order to import the compiled CSS from
- [ ] Add testing coverage collection
- [ ] Set up Storybook as public Github page
- [ ] Add example application that uses the library to the repo
- [ ] Setup https://danger.systems/js/ to check on contribution standards, possibly even checking yarn install for warnings
- [ ] Add visual testing automation tool (i.e., Loki)
- [ ] Enforce adding to CHANGELOG when merging a PR into develop
- [ ] Make sure new components are added as package exports
46 changes: 46 additions & 0 deletions dangerfile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { includes } from 'lodash';
import { danger, warn, fail } from 'danger';

// No PR is too small to include a description of why you made a change
if (danger.github && danger.github.pr.body.length < 10) {
warn('Please include a description of your PR changes.');
}

// load all modified and new files
const allFiles = danger.git.modified_files.concat(danger.git.created_files);

// Request changes to package source code to also include changes to tests.
const hasCodeChanges = allFiles.some(p => !!p.match(/src\/.*\.[jt]sx?/));
const hasTestChanges = allFiles.some(p => !!p.match(/src\/.*\.test\.[jt]sx?/));
if (hasCodeChanges && !hasTestChanges) {
warn('This PR does not include changes to tests, even though it affects source code.');
}

// Require new src/components files to include changes to storybook
const hasStorybookChanges = allFiles.some(p => !!p.match(/src\/.*\.stories\.[jt]sx?/));

if (hasCodeChanges && !hasStorybookChanges) {
warn('This PR does not include changes to storybook, even though it affects component code.');
}

// Request update of yarn.lock if package.json changed but yarn.lock isn't
const packageChanged = includes(allFiles, 'package.json');
const lockfileChanged = includes(allFiles, 'yarn.lock');
if (packageChanged && !lockfileChanged) {
const message = 'Changes were made to package.json, but not to yarn.lock';
const idea = 'Perhaps you need to run `yarn install`?';
warn(`${message} - <i>${idea}</i>`);
}

// ensure we have access to github for this check
let isTrivial = false;
if (danger.github) {
isTrivial = includes((danger.github.pr.body + danger.github.pr.title), "#trivial")
}

// Add a CHANGELOG entry for app changes
const hasChangelog = includes(danger.git.modified_files, "CHANGELOG.md")

if (!hasChangelog && !isTrivial) {
warn("Please add a changelog entry for your changes.")
}
28 changes: 23 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@trussworks/react-uswds",
"version": "1.1.0",
"version": "1.2.0",
"description": "React USWDS 2.0 component library",
"keywords": [
"react",
Expand All @@ -24,6 +24,7 @@
"test:watch": "jest --watch",
"test:coverage": "jest --coverage",
"storybook": "start-storybook",
"storybook:deploy": "storybook-to-ghpages",
"build": "webpack",
"build:watch": "webpack --watch",
"lint": "tsc --noEmit && eslint --ext js,jsx,ts,tsx src",
Expand All @@ -33,7 +34,15 @@
"type": "git",
"url": "github:trussworks/react-uswds"
},
"author": "Suzanne Rozier <suz@truss.works>",
"contributors": [
"Suzanne Rozier <suz@truss.works>",
"John Gedeon <john@truss.works>",
"Erin Stanfill <erin@truss.works>",
"Sara Bocciardi <sara@truss.works>",
"Jeri Sommers <sojeri@truss.works>",
"Emily Mahanna <emahanna@truss.works>",
"Hana Worku <hana@truss.works>"
],
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/trussworks/react-uswds/issues"
Expand All @@ -54,6 +63,7 @@
"@babel/preset-react": "^7.0.0",
"@storybook/addon-info": "^5.2.3",
"@storybook/react": "^5.2.1",
"@storybook/storybook-deployer": "^2.8.5",
"@testing-library/jest-dom": "^5.3.0",
"@testing-library/react": "^10.0.1",
"@testing-library/react-hooks": "^3.2.1",
Expand All @@ -66,10 +76,11 @@
"@typescript-eslint/parser": "^2.3.2",
"awesome-typescript-loader": "^5.2.1",
"babel-eslint": "^10.0.3",
"babel-jest": "^25.2.3",
"babel-jest": "^25.1.0",
"babel-loader": "^8.0.6",
"css-loader": "^3.2.0",
"css-modules-typescript-loader": "^4.0.0",
"danger": "^10.0.0",
"eslint": "^6.5.1",
"eslint-config-prettier": "^6.3.0",
"eslint-plugin-import": "^2.18.2",
Expand All @@ -90,20 +101,27 @@
"sass-loader": "^8.0.2",
"sass-resources-loader": "^2.0.1",
"source-map-loader": "^0.2.4",
"stylelint": "^13.2.1",
"stylelint": "^13.3.0",
"stylelint-config-css-modules": "^2.2.0",
"stylelint-config-prettier": "^8.0.1",
"stylelint-config-recommended": "^3.0.0",
"stylelint-config-sass-guidelines": "^7.0.0",
"stylelint-prettier": "^1.1.1",
"stylelint-scss": "^3.17.1",
"ts-jest": "^25.2.1",
"typescript": "^3.6.3",
"url-loader": "^4.0.0",
"webpack": "^4.41.0",
"webpack-cli": "^3.3.9"
},
"resolutions": {
"webpack/acorn": "^6.4.1",
"acorn-globals/acorn": "^6.4.1"
},
"husky": {
"hooks": {
"pre-commit": "tsc --noEmit && lint-staged"
"pre-commit": "tsc --noEmit && lint-staged",
"pre-push": "yarn danger local --failOnErrors"
}
},
"lint-staged": {
Expand Down
51 changes: 51 additions & 0 deletions src/components/Alert/Alert.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,57 @@ export const info = (): React.ReactElement => (
</Alert>
)

export const slim = (): React.ReactElement => (
<>
<Alert type="success" slim>
{testText}
</Alert>
<Alert type="warning" slim>
{testText}
</Alert>
<Alert type="error" slim>
{testText}
</Alert>
<Alert type="info" slim>
{testText}
</Alert>
</>
)

export const noIcon = (): React.ReactElement => (
<>
<Alert type="success" noIcon>
{testText}
</Alert>
<Alert type="warning" noIcon>
{testText}
</Alert>
<Alert type="error" noIcon>
{testText}
</Alert>
<Alert type="info" noIcon>
{testText}
</Alert>
</>
)

export const slimNoIcon = (): React.ReactElement => (
<>
<Alert type="success" slim noIcon>
{testText}
</Alert>
<Alert type="warning" slim noIcon>
{testText}
</Alert>
<Alert type="error" slim noIcon>
{testText}
</Alert>
<Alert type="info" slim noIcon>
{testText}
</Alert>
</>
)

export const withCTA = (): React.ReactElement => (
<Alert
type="warning"
Expand Down
7 changes: 7 additions & 0 deletions src/components/Alert/Alert.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ describe('Alert component', () => {
expect(queryByTestId('alert')).toBeInTheDocument()
})

it('accepts className prop', () => {
const { queryByTestId } = render(
<Alert type="success" className="myClass" />
)
expect(queryByTestId('alert')).toHaveClass('myClass')
})

describe('with a CTA', () => {
it('renders the CTA', () => {
const testCTA = <button type="button">Click Here</button>
Expand Down
30 changes: 21 additions & 9 deletions src/components/Alert/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,36 @@ interface AlertProps {
heading?: React.ReactNode
children?: React.ReactNode
cta?: React.ReactNode
slim?: boolean
noIcon?: boolean
}

export const Alert = ({
type,
heading,
cta,
children,
}: AlertProps): React.ReactElement => {
const classes = classnames('usa-alert', {
'usa-alert--success': type === 'success',
'usa-alert--warning': type === 'warning',
'usa-alert--error': type === 'error',
'usa-alert--info': type === 'info',
[styles.alertWithCTA]: !!cta,
})
slim,
noIcon,
className,
...props
}: AlertProps & React.HTMLAttributes<HTMLDivElement>): React.ReactElement => {
const classes = classnames(
'usa-alert',
{
'usa-alert--success': type === 'success',
'usa-alert--warning': type === 'warning',
'usa-alert--error': type === 'error',
'usa-alert--info': type === 'info',
'usa-alert--slim': slim,
'usa-alert--no-icon': noIcon,
[styles.alertWithCTA]: !!cta,
},
className
)

return (
<div className={classes} data-testid="alert">
<div className={classes} data-testid="alert" {...props}>
<div className="usa-alert__body">
{heading && <h3 className="usa-alert__heading">{heading}</h3>}
{children && <p className="usa-alert__text">{children}</p>}
Expand Down
Loading