Skip to content

Commit

Permalink
Merge 9f25f74 into db0db6e
Browse files Browse the repository at this point in the history
  • Loading branch information
joshblack authored Dec 16, 2022
2 parents db0db6e + 9f25f74 commit ca4f570
Show file tree
Hide file tree
Showing 44 changed files with 26,953 additions and 29,203 deletions.
5 changes: 5 additions & 0 deletions .changeset/eight-peas-tan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': minor
---

Update to React.useId() when using React 18
5 changes: 5 additions & 0 deletions .changeset/strong-dolls-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

Update types for components to work for React 17 and 18
13 changes: 13 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,19 @@
{
"ts-ignore": "allow-with-description"
}
],
"no-restricted-imports": [
"error",
{
"paths": [
{
"name": "@react-aria/ssr",
"importNames": ["useSSRSafeId"],
"message": "Please use the `useId` hook from `src/hooks/useId.ts` instead"
}
],
"patterns": []
}
]
}
},
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ jobs:
run: npm run lint

test:
strategy:
fail-fast: false
matrix:
react: [17, 18]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -38,16 +42,30 @@ jobs:
with:
node-version: 16

- name: Set React version
run: node script/set-react-version.js ${{ matrix.react }}

- name: Install dependencies
if: ${{ matrix.react == 17 }}
run: npm install --legacy-peer-deps

- name: Install dependencies
if: ${{ matrix.react == 18 }}
run: npm ci

- name: Build
run: npm run build

- name: Test
run: npm run test -- --coverage
env:
REACT_VERSION_17: ${{ matrix.react == 17 }}

type-check:
strategy:
fail-fast: false
matrix:
react: [17, 18]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -58,7 +76,15 @@ jobs:
with:
node-version: 16

- name: Set React version
run: node script/set-react-version.js ${{ matrix.react }}

- name: Install dependencies
if: ${{ matrix.react == 17 }}
run: npm install --legacy-peer-deps

- name: Install dependencies
if: ${{ matrix.react != 17 }}
run: npm ci

- name: Type check
Expand Down
19 changes: 8 additions & 11 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,26 @@ module.exports = {
{
name: 'storybook-addon-turbo-build',
options: {
optimizationLevel: 2
}
optimizationLevel: 2,
},
},
...(process.env.NODE_ENV === 'production' && process.env.GITHUB_JOB !== 'chromatic'
? ['@whitespace/storybook-addon-html']
: [])
],
core: {
builder: {
name: 'webpack5',
options: {
fsCache: true
}
}
fsCache: true,
},
},
},
features: {
interactionsDebugger: true,
storyStoreV7: true,
buildStoriesJson: true
buildStoriesJson: true,
},
framework: '@storybook/react',
reactOptions: {
fastRefresh: true,
strictMode: true
}
strictMode: true,
},
}
12 changes: 12 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
/* eslint-disable github/unescaped-html-literal */

'use strict'

const {REACT_VERSION_17} = process.env

/**
* @type {import('jest').Config}
*/
module.exports = {
globals: {
REACT_VERSION_LATEST: REACT_VERSION_17 ? REACT_VERSION_17 !== 'true' : true,
REACT_VERSION_17: REACT_VERSION_17 === 'true',
},
testEnvironment: 'jsdom',
cacheDirectory: '.test',
collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}', '!src/stories/**', '!**/*.stories.{js,jsx,ts,tsx}'],
Expand Down
Loading

0 comments on commit ca4f570

Please sign in to comment.