Skip to content

Commit

Permalink
Merge pull request #716 from Availity/chore/upgrade-node
Browse files Browse the repository at this point in the history
Chore/upgrade node
  • Loading branch information
gregmartDOTin authored Jul 29, 2024
2 parents 43456b0 + 7194194 commit 7a2cfea
Show file tree
Hide file tree
Showing 87 changed files with 5,408 additions and 8,528 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This monorepo is managed using [yarn](https://yarnpkg.com/getting-started) and [

## Installation

Ensure you are running version 14 or 16 of `node` and [yarn](https://classic.yarnpkg.com/en/docs/install#mac-stable) is installed. We recommend using [nvm](https://github.com/nvm-sh/nvm#readme) or [fnm](https://github.com/Schniz/fnm#readme) to manage your installation of `node`.
Ensure you are running version 18 or 20 of `node` and [yarn](https://classic.yarnpkg.com/en/docs/install#mac-stable) is installed. We recommend using [nvm](https://github.com/nvm-sh/nvm#readme) or [fnm](https://github.com/Schniz/fnm#readme) to manage your installation of `node`.

```bash
node --version
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Set Node Version
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20

- name: Get yarn cache directory path
id: yarn-cache-dir-path
Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
- name: Set Node Version
uses: actions/setup-node@v2
with:
node-version: 18
node-version: 20

- name: Get yarn cache directory path
id: yarn-cache-dir-path
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
node: [16, 18]
node: [18, 20]

steps:
- name: Checkout Code
Expand Down Expand Up @@ -70,5 +70,5 @@ jobs:
run: yarn build:packages

- name: Build Docs
if: ${{matrix.node > 16}}
if: ${{matrix.node > 18}}
run: yarn build:docs
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ coverage/
!.yarn/versions
yarn-error.log
.pnp.*

.nx/cache
.nx/workspace-data
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"

yarn commitlint -e $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"

yarn 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,6 +1,3 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint:affected
yarn test:affected
yarn check:deps
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18
20
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ plop-templates/
/**/lib
/**/build
**/CHANGELOG.md

/.nx/cache
/.nx/workspace-data
10 changes: 5 additions & 5 deletions docusaurus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
"format": "prettier '**/*' --write --ignore-unknown"
},
"dependencies": {
"@docusaurus/core": "^3.1.1",
"@docusaurus/preset-classic": "^3.1.1",
"@docusaurus/core": "^3.4.0",
"@docusaurus/preset-classic": "^3.4.0",
"@mdx-js/react": "^3.0.1",
"clsx": "^2.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"clsx": "^2.1.1",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"browserslist": {
"production": [
Expand Down
8 changes: 4 additions & 4 deletions docusaurus/project.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"root": "docusaurus",
"name": "@availity/dinosaurdocs",
"$schema": "../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"targets": {
"version": {
"executor": "@jscutlery/semver:version",
"options": {
"preset": "angular",
"commitMessageFormat": "chore({projectName}): release version ${version} [skip ci]",
"tagPrefix": "@availity/{projectName}@",
"tagPrefix": "{projectName}@",
"baseBranch": "master"
}
},
"lint": {
"executor": "@nx/linter:eslint",
"executor": "@nx/eslint:lint",
"options": {
"eslintConfig": ".eslintrc.yaml",
"lintFilePatterns": ["docusaurus/**/*.{js,ts}"],
"silent": false,
"fix": false,
"cache": true,
Expand Down
3 changes: 2 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
transform: {
'^.+\\.(ts|js)$': 'ts-jest',
},
transformIgnorePatterns: ['node_modules/(?!axios)'],
transformIgnorePatterns: ['node_modules/(?!axios|@bundled-es-modules/*)'],
moduleFileExtensions: ['ts', 'js'],
preset: '../../jest.preset.js',
testEnvironment: 'jest-environment-jsdom-global',
Expand All @@ -20,4 +20,5 @@ module.exports = {
moduleNameMapper: {
...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>/../../' }),
},
setupFiles: ['../../jest.polyfills.js']
};
36 changes: 36 additions & 0 deletions jest.polyfills.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// jest.polyfills.js
/**
* @note The block below contains polyfills for Node.js globals
* required for Jest to function when running JSDOM tests.
* These HAVE to be require's and HAVE to be in this exact
* order, since "undici" depends on the "TextEncoder" global API.
*
* Consider migrating to a more modern test runner if
* you don't want to deal with this.
*/

const { TextDecoder, TextEncoder } = require('node:util')

Object.defineProperties(globalThis, {
TextDecoder: { value: TextDecoder },
TextEncoder: { value: TextEncoder },
})

const { ReadableStream } = require('node:stream/web')

Object.defineProperties(globalThis, {
ReadableStream: { value: ReadableStream }
})

const { Blob, File } = require('node:buffer')
const { fetch, Headers, FormData, Request, Response } = require('undici')

Object.defineProperties(globalThis, {
fetch: { value: fetch, writable: true },
Blob: { value: Blob },
File: { value: File },
Headers: { value: Headers },
FormData: { value: FormData },
Request: { value: Request },
Response: { value: Response },
})
40 changes: 30 additions & 10 deletions nx.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,35 @@
{
"extends": "@nx/workspace/presets/npm.json",
"npmScope": "availity",
"tasksRunnerOptions": {
"default": {
"runner": "nx/tasks-runners/default",
"targetDefaults": {
"build": {
"cache": true
},
"@nx/jest:jest": {
"cache": true,
"inputs": [
"default",
"^default",
"{workspaceRoot}/jest.preset.js"
],
"options": {
"cacheableOperations": ["build", "test", "lint", "package", "prepare"]
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
},
"@nx/eslint:lint": {
"cache": true,
"inputs": [
"default",
"{workspaceRoot}/.eslintrc.yaml",
"{workspaceRoot}/tools/eslint-rules/**/*"
]
}
},
"extends": "@nx/workspace/presets/npm.json",
"targetDependencies": {
"build": [
{
Expand All @@ -29,12 +50,11 @@
}
]
},
"affected": {
"defaultBase": "master"
},
"pluginsConfig": {
"@nx/js": {
"analyzeSourceFiles": true
}
}
},
"useInferencePlugins": false,
"defaultBase": "master"
}
57 changes: 28 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@
],
"engines": {
"yarn": "^3.0.0",
"node": "^14.0.0 || ^16.0.0"
"node": "^18.0.0 || ^20.0.0"
},
"scripts": {
"build": "nx run-many --target=build --all",
"build:packages": "nx run-many --target=build --all --exclude=docusaurus",
"build:docs": "nx build docusaurus",
"build:packages": "nx run-many --target=build --all --exclude=@availity/dinosaurdocs",
"build:docs": "nx build @availity/dinosaurdocs",
"build:affected": "nx affected --target=build",
"check:deps": "adio",
"check:registry": "sh ./scripts/artifactory-check.sh",
"clean": "nx run-many --target=clean --all && rm -rf node_modules",
"codecov:ci": "codecov",
"deploy:docs": "yarn build:docs && gh-pages -d docusaurus/build --message 'deployed docs [skip ci]'",
"deploy:docs": "yarn build:docs && gh-pages -d @availity/dinosaurdocs/build --message 'deployed docs [skip ci]'",
"dev": "nx run-many --target=dev --all",
"format:check": "nx format:check --all",
"format:write": "nx format:write --all",
Expand All @@ -37,46 +37,45 @@
"lint:fix": "nx affected --target=lint --fix",
"new": "plop",
"nx": "nx",
"postinstall": "is-ci || husky install",
"postinstall": "is-ci || husky",
"publish": "nx affected --target version --parallel=1",
"publish:dry-run": "nx affected --target version --dryRun --parallel=1",
"start": "nx start docusaurus",
"start": "nx start @availity/dinosaurdocs",
"test:affected": "nx affected --target=test",
"test:ci": "nx run-many --target=test --all --parallel=3 --runInBand --coverage && node ./scripts/merge-coverage.js",
"test": "nx run-many --target=test --all",
"version:dry-run": "nx affected --target version --dryRun --parallel=1"
},
"devDependencies": {
"@commitlint/cli": "^17.8.1",
"@commitlint/config-conventional": "^17.8.1",
"@commitlint/config-nx-scopes": "^17.8.1",
"@jscutlery/semver": "^3.1.0",
"@nx/jest": "^16.7.2",
"@nx/js": "^16.7.2",
"@nx/linter": "^16.7.2",
"@nx/workspace": "^16.7.2",
"@commitlint/cli": "^18.6.1",
"@commitlint/config-conventional": "^18.6.3",
"@commitlint/config-nx-scopes": "^18.6.1",
"@jscutlery/semver": "^5.2.2",
"@nx/eslint": "19.5.3",
"@nx/jest": "19.5.3",
"@nx/js": "19.5.3",
"@nx/workspace": "19.5.3",
"@types/jest": "^26.0.24",
"@types/node": "^18.17.7",
"@types/node": "18.19.40",
"adio": "^1.2.1",
"codecov": "^3.8.3",
"conventional-changelog-cli": "^3.0.0",
"conventional-recommended-bump": "^7.0.1",
"dependency-check": "^4.1.0",
"eslint": "^7.32.0",
"eslint-config-availity": "^9.0.0",
"eslint": "8.57.0",
"eslint-config-availity": "^10.0.2",
"gh-pages": "^6.1.1",
"husky": "^8.0.3",
"husky": "^9.1.2",
"is-ci": "^3.0.1",
"jest": "^27.0.0",
"jest-environment-jsdom": "^27.0.0",
"jest-environment-jsdom-global": "^3.0.0",
"lint-staged": "^14.0.1",
"nock": "^13.3.3",
"nx": "16.7.2",
"jest": "^27.5.1",
"jest-environment-jsdom": "^27.5.1",
"jest-environment-jsdom-global": "^3.1.2",
"lint-staged": "^15.2.7",
"nock": "^13.5.4",
"nx": "19.5.3",
"plop": "^4.0.1",
"prettier": "^3.0.2",
"ts-jest": "^27.0.0",
"typescript": "^5.1.6",
"prettier": "^3.3.3",
"ts-jest": "^27.1.5",
"typescript": "5.5.4",
"undici": "^6.19.4",
"xhr-mock": "^2.5.1"
},
"resolutions": {
Expand Down
4 changes: 2 additions & 2 deletions packages/analytics-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
"publish": "yarn npm publish --tolerate-republish --access public"
},
"dependencies": {
"uuid": "^9.0.1",
"uuid": "^10.0.0",
"yup": "^0.32.11"
},
"devDependencies": {
"@availity/api-axios": "workspace:*",
"tsup": "^7.2.0",
"typescript": "^5.1.6"
"typescript": "^5.5.4"
},
"publishConfig": {
"access": "public"
Expand Down
13 changes: 6 additions & 7 deletions packages/analytics-core/project.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
{
"root": "packages/analytics-core",
"name": "@availity/analytics-core",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"targets": {
"test": {
"executor": "@nx/jest:jest",
"outputs": ["coverage/analytics-core"],
"outputs": ["{workspaceRoot}/coverage/analytics-core"],
"options": {
"jestConfig": "packages/analytics-core/jest.config.js",
"passWithNoTests": true
"jestConfig": "packages/analytics-core/jest.config.js"
}
},
"version": {
"executor": "@jscutlery/semver:version",
"options": {
"preset": "angular",
"commitMessageFormat": "chore({projectName}): release version ${version} [skip ci]",
"tagPrefix": "@availity/{projectName}@",
"tagPrefix": "{projectName}@",
"baseBranch": "master",
"trackDeps": true
}
},
"lint": {
"executor": "@nx/linter:eslint",
"executor": "@nx/eslint:lint",
"options": {
"eslintConfig": ".eslintrc.yaml",
"lintFilePatterns": ["packages/analytics-core/**/*.{js,ts}"],
"silent": false,
"fix": false,
"cache": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/analytics-core/src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const isValidEventTypeOnTarget = (event) =>
export const isPluginEnabled = (plugin) =>
typeof plugin.isEnabled === 'function' ? plugin.isEnabled() : plugin.isEnabled;

export const camelCase = (str) => str.replace(/-([\da-z])/gi, (match, char) => char.toUpperCase());
export const camelCase = (str) => str.replaceAll(/-([\da-z])/gi, (match, char) => char.toUpperCase());

/**
* Polyfill for [`Event.composedPath()`][1].
Expand Down
Loading

0 comments on commit 7a2cfea

Please sign in to comment.