Skip to content

Commit

Permalink
Merge pull request #251 from Availity/chore/upgrade-nx
Browse files Browse the repository at this point in the history
Chore/upgrade nx
  • Loading branch information
gregmartDOTin authored Apr 19, 2024
2 parents a9a83fd + 9c6beb2 commit 769f36b
Show file tree
Hide file tree
Showing 184 changed files with 8,867 additions and 8,667 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
.yarn
!.storybook/

Expand Down
10 changes: 5 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"root": true,
"ignorePatterns": [],
"plugins": ["@nrwl/nx"],
"plugins": ["@nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"@nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
Expand All @@ -23,12 +23,12 @@
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"],
"extends": ["plugin:@nx/typescript"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nrwl/nx/javascript"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
},
{
Expand All @@ -42,7 +42,7 @@
"*.test.js",
"*.test.jsx"
],
"extends": ["plugin:@nrwl/nx/typescript"],
"extends": ["plugin:@nx/typescript"],
"env": {},
"rules": {}
},
Expand Down
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This monorepo is managed using [yarn](https://yarnpkg.com/getting-started) and [

## Installation

The currently recommended version of node to use when developing in this repo is: `v16.16.0`. We recommend using [fnm](https://github.com/Schniz/fnm#readme) to have your node version automatically changed when you `cd` into the repo.
The currently recommended version of node to use when developing in this repo is: `v20`. We recommend using [fnm](https://github.com/Schniz/fnm#readme) to have your node version automatically changed when you `cd` into the repo.

We use `yarn berry` (aka yarn v3) to manage dependencies. Install `yarn` globally:

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:

- uses: actions/setup-node@v3
with:
node-version: '16'
node-version: '20'

- run: yarn install --immutable

- uses: wagoid/commitlint-github-action@v4
- uses: wagoid/commitlint-github-action@v5
env:
NODE_PATH: ${{ github.workspace }}/node_modules
12 changes: 6 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Set Node Version
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20

- name: Get yarn cache directory path
id: yarn-cache-dir-path
Expand All @@ -37,9 +37,9 @@ jobs:
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-16-yarn-${{ hashFiles('**/yarn.lock') }}
key: ${{ runner.os }}-20-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-16-yarn-
${{ runner.os }}-20-yarn-
- name: Install Dependencies
run: yarn install --immutable
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
- name: Set Node Version
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20

- name: Get yarn cache directory path
id: yarn-cache-dir-path
Expand All @@ -79,9 +79,9 @@ jobs:
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-16-yarn-${{ hashFiles('**/yarn.lock') }}
key: ${{ runner.os }}-20-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-16-yarn-
${{ runner.os }}-20-yarn-
- name: Install Dependencies
run: yarn install --immutable
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
node: [16]
node: [18, 20]

steps:
- name: Checkout Code
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Set Node Version
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20

- name: Get yarn cache directory path
id: yarn-cache-dir-path
Expand All @@ -39,9 +39,9 @@ jobs:
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-16-yarn-${{ hashFiles('**/yarn.lock') }}
key: ${{ runner.os }}-20-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-16-yarn-
${{ runner.os }}-20-yarn-
- name: Install Dependencies
run: yarn install --immutable
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,5 @@ yarn-error.log
# System Files
.DS_Store
Thumbs.db

.nx/cache
3 changes: 0 additions & 3 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit $1
5 changes: 1 addition & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged --relative
yarn lint:affected
3 changes: 0 additions & 3 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint:affected
yarn test:affected
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.16.0
20
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@

/dist
/coverage

/.nx/cache
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const App = () => {

## Development

The currently recommended version of node to use when developing in this repo is: `v16.16.0`. We recommend using [fnm](https://github.com/Schniz/fnm#readme) to have your node version automatically changed when you `cd` into the repo.
The currently recommended version of node to use when developing in this repo is: `v20`. We recommend using [fnm](https://github.com/Schniz/fnm#readme) to have your node version automatically changed when you `cd` into the repo.

We use `yarn berry` (aka yarn v3) to manage dependencies. Install `yarn` globally:

Expand Down
24 changes: 18 additions & 6 deletions apps/element-storybook/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import { dirname, join } from "path";
import remarkGfm from 'remark-gfm';
import { StorybookConfig } from '@storybook/react-vite';

const config: StorybookConfig = {
stories: [
'../src/*.mdx',
'../src/**/*.stories.@(js|jsx|ts|tsx|mdx)',
'../src/**/*.@(stories.@(js|jsx|ts|tsx|mdx))',
'../../../packages/*/*.mdx',
'../../../packages/*/src/lib/*.stories.@(js|jsx|ts|tsx|mdx)',
'../../../packages/*/src/lib/*.@(stories.@(js|jsx|ts|tsx|mdx))'
],

addons: [
'@storybook/addon-essentials',
'@storybook/addon-styling',
'@storybook/addon-a11y',
getAbsolutePath("@storybook/addon-essentials"),
getAbsolutePath("@storybook/addon-themes"),
getAbsolutePath("@storybook/addon-a11y"),
{
name: '@storybook/addon-docs',
options: {
Expand All @@ -22,23 +24,29 @@ const config: StorybookConfig = {
},
},
},
getAbsolutePath("@chromatic-com/storybook")
],

framework: {
name: '@storybook/react-vite',
name: getAbsolutePath("@storybook/react-vite"),
options: {
builder: {
viteConfigPath: '',
},
},
},

typescript: {
reactDocgenTypescriptOptions: {
propFilter: (prop) =>
prop.parent
? !/node_modules\/(?!@mui)/.test(prop.parent.fileName) // filter out all node_modules except packages starting with "@mui"
: true,
},

reactDocgen: 'react-docgen-typescript'
},

staticDirs: ['../../../static'],
features: { storyStoreV7: false, legacyMdx1: true },
};
Expand All @@ -48,3 +56,7 @@ export default config;
// To customize your Vite configuration you can use the viteFinal field.
// Check https://storybook.js.org/docs/react/builders/vite#configuration
// and https://nx.dev/packages/storybook/documents/custom-builder-configs

function getAbsolutePath(value: string): any {
return dirname(require.resolve(join(value, "package.json")));
}
2 changes: 1 addition & 1 deletion apps/element-storybook/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const preview: Preview = {

// Make sure we are in the browser before starting
if (typeof global.process === 'undefined') {
// eslint-disable-next-line @nrwl/nx/enforce-module-boundaries
// eslint-disable-next-line @nx/enforce-module-boundaries
import('../../../packages/mock/src/lib/browser').then(({ worker }) => {
const config =
process.env.NODE_ENV === 'development'
Expand Down
30 changes: 0 additions & 30 deletions apps/element-storybook/.storybook/tsconfig.json

This file was deleted.

6 changes: 3 additions & 3 deletions apps/element-storybook/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"tags": [],
"targets": {
"storybook": {
"executor": "@nrwl/storybook:storybook",
"executor": "@nx/storybook:storybook",
"options": {
"port": 4400,
"configDir": "apps/element-storybook/.storybook"
Expand All @@ -19,8 +19,8 @@
"dependsOn": ["^build"]
},
"build-storybook": {
"executor": "@nrwl/storybook:build",
"outputs": ["{options.outputDir}"],
"executor": "@nx/storybook:build",
"outputs": ["{workspaceRoot}/dist/storybook"],
"options": {
"outputDir": "dist/storybook",
"configDir": "apps/element-storybook/.storybook"
Expand Down
8 changes: 5 additions & 3 deletions apps/element-storybook/src/templates/bs4migration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { Meta, Source } from '@storybook/blocks';
# Component Migration

This migration guide is just an overview. For more in depth component information, visit:

- [Availity Usage Guide](https://zeroheight.com/2e36e50c7/p/48eb7b-button/b/062837)
- [MUI Documentation](https://mui.com/material-ui/react-button/)


## Key Differences (not exhaustive list)

- Changed
Expand Down Expand Up @@ -38,7 +38,8 @@ const ReactstrapButton = () => (
I'm a Button
</Button>
);
`}/>
`}
/>

`@availity/element` Example:

Expand All @@ -55,4 +56,5 @@ const MUIButton = () => (
I'm a Button
</Button>
);
`}/>
`}
/>
2 changes: 1 addition & 1 deletion apps/element-storybook/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"references": [
{
"path": "./.storybook/tsconfig.json"
"path": "./tsconfig.storybook.json"
}
]
}
30 changes: 30 additions & 0 deletions apps/element-storybook/tsconfig.storybook.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"outDir": ""
},
"files": [
"../../node_modules/@nx/react/typings/styled-jsx.d.ts",
"../../node_modules/@nx/react/typings/cssmodule.d.ts",
"../../node_modules/@nx/react/typings/image.d.ts"
],
"exclude": ["src/**/*.spec.ts", "src/**/*.spec.js", "src/**/*.spec.tsx", "src/**/*.spec.jsx"],
"include": [
".storybook/*.js",
".storybook/*.ts",
"*.tsx",
"src/*.stories.ts",
"src/*.stories.js",
"src/*.stories.jsx",
"src/*.stories.tsx",
"src/*.stories.mdx",
"../../packages/*.stories.mdx",
"../../packages/*/src/lib/*.stories.js",
"../../packages/*/src/lib/*.stories.jsx",
"../../packages/*/src/lib/*.stories.ts",
"../../packages/*/src/lib/*.stories.tsx",
"../../packages/*/src/lib/*.stories.mdx"
]
}
13 changes: 7 additions & 6 deletions apps/nx-generator-e2e/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
export default {
displayName: 'nx-generator-e2e',
preset: '../../jest.preset.js',
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
},
},
globals: {},
transform: {
'^.+\\.[tj]s$': 'ts-jest',
'^.+\\.[tj]s$': [
'ts-jest',
{
tsconfig: '<rootDir>/tsconfig.spec.json',
},
],
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/apps/nx-generator-e2e',
Expand Down
Loading

0 comments on commit 769f36b

Please sign in to comment.