Skip to content

Commit

Permalink
build: switch package based repo
Browse files Browse the repository at this point in the history
  • Loading branch information
jordan-a-young committed Feb 10, 2023
1 parent 44adfc4 commit 21fefcd
Show file tree
Hide file tree
Showing 36 changed files with 1,244 additions and 1,612 deletions.
2 changes: 1 addition & 1 deletion .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": ["@commitlint/config-conventional"],
"extends": ["@commitlint/config-conventional", "@commitlint/config-nx-scopes"],
"rules": {}
}
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ static/
/**/.docusaurus
/**/build
/**/dist
dist/
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"ignorePatterns": [],
"plugins": ["@nrwl/nx"],
"overrides": [
{
Expand Down Expand Up @@ -33,6 +33,7 @@
},
{
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
"extends": ["plugin:@nrwl/nx/typescript"],
"env": {},
"rules": {}
}
Expand Down
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Enforce Unix newlines
.* text eol=lf

# Mark binary files to avoid Git showing huge diffs
/.yarn/releases/** binary
/.yarn/plugins/** binary
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16.16.0
25 changes: 25 additions & 0 deletions jest.config.global.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const { pathsToModuleNameMapper } = require('ts-jest');

const { compilerOptions } = require('./tsconfig.json');

module.exports = {
setupFilesAfterEnv: ['@testing-library/jest-dom/extend-expect'],
globalSetup: '../../jest.setup.global.js',
transform: {
'^.+\\.(ts|tsx|js|html)$': 'ts-jest',
},
moduleFileExtensions: ['ts', 'js', 'tsx'],
preset: '../../jest.preset.js',
testEnvironment: 'jest-environment-jsdom-global',
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
},
jsdom: true,
},
coverageReporters: ['json'],
moduleNameMapper: {
...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>/../../' }),
'\\.(css|scss)$': 'identity-obj-proxy',
},
};
3 changes: 3 additions & 0 deletions jest.preset.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const nxPreset = require('@nrwl/jest/preset');

module.exports = { ...nxPreset };
3 changes: 3 additions & 0 deletions jest.setup.global.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = async () => {
process.env.TZ = 'UTC';
};
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"babel": true
},
"library": {
"unitTestRunner": "vite"
"unitTestRunner": "jest"
}
}
}
Expand Down
50 changes: 20 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
{
"name": "availity-element-monorepo",
"version": "0.0.0",
"private": true,
"description": "React component library for the Availity design system",
"repository": "https://github.com/Availity/element.git",
"author": "Jordan Young <[email protected]>",
"license": "MIT",
"private": true,
"author": "Jordan Young <[email protected]>",
"workspaces": [
"packages/*"
],
"packageManager": "[email protected]",
"engines": {
"yarn": "^3.0.0",
"node": "^16.0.0"
},
"scripts": {
"build": "yarn nx run-many --target=build --all",
"clean": "nx run-many --target=clean --all",
"prepare": "is-ci || husky install",
"test": "nx run-many --target=test --all",
"version": "nx affected --target version --parallel=1",
"version:dry-run": "nx affected --target version --dryRun --parallel=1"
},
"devDependencies": {
"@babel/preset-react": "^7.18.6",
"@commitlint/cli": "^17.0.0",
"@commitlint/config-conventional": "^17.0.0",
"@emotion/babel-plugin": "11.10.5",
"@commitlint/config-nx-scopes": "^17.0.0",
"@jscutlery/semver": "^2.29.3",
"@nrwl/eslint-plugin-nx": "15.6.2",
"@nrwl/jest": "15.6.2",
Expand All @@ -24,15 +35,13 @@
"@nrwl/vite": "15.6.2",
"@nrwl/workspace": "15.6.2",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "13.4.0",
"@testing-library/react": "12.1.5",
"@types/jest": "28.1.1",
"@types/node": "18.11.9",
"@types/react": "18.0.25",
"@types/react-dom": "18.0.9",
"@typescript-eslint/eslint-plugin": "^5.36.1",
"@typescript-eslint/parser": "^5.36.1",
"@vitejs/plugin-react": "^3.0.0",
"@vitest/ui": "^0.25.8",
"babel-jest": "28.1.1",
"eslint": "~8.15.0",
"eslint-config-prettier": "8.1.0",
Expand All @@ -41,36 +50,17 @@
"eslint-plugin-react": "7.31.11",
"eslint-plugin-react-hooks": "4.6.0",
"husky": "^8.0.0",
"is-ci": "^3.0.1",
"jest": "28.1.1",
"jest-environment-jsdom": "28.1.1",
"jest-environment-jsdom-global": "^4.0.0",
"jsdom": "~20.0.3",
"nx": "15.6.2",
"prettier": "^2.6.2",
"react-test-renderer": "18.2.0",
"ts-jest": "28.0.5",
"ts-node": "10.9.1",
"typescript": "~4.8.2",
"vite": "^4.0.1",
"vite-plugin-dts": "~1.7.1",
"vite-plugin-eslint": "^1.8.1",
"vite-tsconfig-paths": "^4.0.2",
"vitest": "^0.25.8"
},
"dependencies": {
"@availity/design-tokens": "0.5.0-alpha.0",
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@mui/material": "^5.11.6",
"@mui/x-date-pickers": "^5.0.15",
"date-fns": "^2.29.3",
"react": "18.2.0",
"react-dom": "18.2.0",
"tslib": "^2.3.0"
"typescript": "~4.8.2"
},
"scripts": {
"prepare": "husky install",
"build:all": "yarn nx run-many --target=build --all",
"version": "nx affected --target version --parallel=1",
"version:dry-run": "nx affected --target version --dryRun --parallel=1"
}
"packageManager": "[email protected]"
}
18 changes: 0 additions & 18 deletions packages/element/.eslintrc.json

This file was deleted.

4 changes: 1 addition & 3 deletions packages/element/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# element

This library was generated with [Nx](https://nx.dev).

## Running unit tests

Run `nx test element` to execute the unit tests via [Vitest](https://vitest.dev/).
Run `nx test element` to execute the unit tests
7 changes: 7 additions & 0 deletions packages/element/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const global = require('../../jest.config.global');

module.exports = {
...global,
displayName: 'element',
coverageDirectory: '../../coverage/element',
};
29 changes: 25 additions & 4 deletions packages/element/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,33 @@
{
"name": "@availity/element",
"version": "0.0.1",
"main": "./index.js",
"types": "./index.d.ts",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": "./index.mjs",
"require": "./index.js"
"import": "./dist/index.mjs",
"require": "./dist/index.js"
}
},
"scripts": {
"build": "tsup src/index.ts --format esm,cjs --dts",
"dev": "tsup src/index.ts --format esm,cjs --watch --dts",
"clean": "rm -rf dist",
"clean:nm": "rm -rf node_modules",
"bundlesize": "bundlesize",
"publish": "yarn npm publish --tolerate-republish --access public",
"publish:canary": "yarn npm publish --access public --tag canary"
},
"dependencies": {
"@availity/theme-provider": "workspace:*"
},
"devDependencies": {
"react": "18.2.0",
"react-dom": "18.2.0",
"tsup": "^5.12.7",
"typescript": "^4.6.4"
},
"peerDependencies": {
"react": ">=16.8.0"
}
}
40 changes: 14 additions & 26 deletions packages/element/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,26 @@
"targets": {
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["packages/element/**/*.{ts,tsx,js,jsx}"]
}
},
"build": {
"executor": "@nrwl/vite:build",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
"outputPath": "dist/packages/element"
},
"configurations": {
"development": {
"mode": "development"
},
"production": {
"mode": "production"
}
"eslintConfig": ".eslintrc.yaml",
"lintFilePatterns": ["packages/element/**/*.{js,ts}"],
"silent": false,
"fix": false,
"cache": true,
"cacheLocation": "./node_modules/.cache/element/.eslintcache",
"maxWarnings": -1,
"quiet": false,
"noEslintrc": false,
"hasTypeAwareRules": true,
"cacheStrategy": "metadata"
}
},
"test": {
"executor": "@nrwl/vite:test",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"executor": "@nrwl/jest:jest",
"outputs": ["coverage/element"],
"options": {
"jestConfig": "packages/element/jest.config.js",
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
},
"version": {
Expand Down
22 changes: 3 additions & 19 deletions packages/element/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@
{
"compilerOptions": {
"jsx": "react-jsx",
"allowJs": false,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"types": ["vite/client"]
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
],
"extends": "../../tsconfig.base.json"
"extends": "../../tsconfig.json",
"include": ["."],
"exclude": ["dist", "build", "node_modules"]
}
22 changes: 0 additions & 22 deletions packages/element/tsconfig.lib.json

This file was deleted.

19 changes: 0 additions & 19 deletions packages/element/tsconfig.spec.json

This file was deleted.

Loading

0 comments on commit 21fefcd

Please sign in to comment.