Skip to content

Commit

Permalink
build: Upgrade yarn to yarn3 (#797)
Browse files Browse the repository at this point in the history
  • Loading branch information
jessieweiyi committed Jan 3, 2023
1 parent 256eba9 commit 301885d
Show file tree
Hide file tree
Showing 17 changed files with 26,567 additions and 19,300 deletions.
10 changes: 5 additions & 5 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
!/.storybook

build/
**/build/
temp/
cdk.out/
coverage/
**/cdk.out/
**/coverage/
node_modules/
**/node_modules/
oss-attribution/
storybook.out/
styleguide.out/
**/storybook.out/
**/styleguide.out/
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["plugin:prettier/recommended"]
}
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,12 @@ package-lock.json

CODECOMMIT_SOURCE_VERSION

.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions


28 changes: 28 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

Large diffs are not rendered by default.

823 changes: 823 additions & 0 deletions .yarn/releases/yarn-3.3.1.cjs

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
nmHoistingLimits: workspaces

nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"

yarnPath: .yarn/releases/yarn-3.3.1.cjs
23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,20 @@
"react-component",
"aws-northstar"
],
"packageManager": "yarn@3.3.1",
"scripts": {
"build": "yarn workspaces run build",
"build": "yarn workspaces foreach --parallel run build",
"check:all": "yarn test:ci && yarn build && yarn storybook:build && yarn styleguide:build",
"license:check": "yarn license-checker --summary --production --excludePrivatePackages --onlyAllow 'MIT;Apache-2.0;Unlicense;BSD;BSD*;BSD-2-Clause;BSD-3-Clause;ISC;Zlib;WTFPL;Custom: https://github.com/tmcw/jsonlint;Custom: http://badges.github.io/stability-badges/dist/stable.svg;Custom: https://github.com/substack/node-browserify;'",
"lint:fix": "yarn workspaces run lint:fix",
"lint": "yarn workspaces run lint",
"license:check": "yarn workspaces foreach --parallel run license:check",
"lint:fix": "eslint --fix --ext .ts --ext .tsx --ext .js --ext .jsx .",
"lint": "eslint --max-warnings 0 --ext .ts --ext .tsx --ext .js --ext .jsx .",
"lint-staged": "lint-staged",
"storybook:build": "yarn workspace aws-northstar run storybook:build",
"storybook": "yarn workspace aws-northstar run storybook",
"styleguide:build": "yarn workspace aws-northstar run styleguidist build",
"styleguide": "yarn workspace aws-northstar run styleguidist server",
"test:ci": "yarn workspaces run test:ci && yarn license:check && git secrets --scan",
"test": "yarn workspaces run test",
"test:ci": "yarn lint && yarn workspaces foreach run test:ci && yarn license:check && git secrets --scan",
"test": "yarn workspaces foreach run test",
"prepare": "husky install"
},
"lint-staged": {
Expand All @@ -46,11 +47,10 @@
"@semantic-release/github": "^8.0.7",
"@semantic-release/npm": "^8.0.3",
"@semantic-release/release-notes-generator": "^10.0.3",
"@types/eslint": "^8.4.6",
"@types/eslint-plugin-prettier": "^3.1.0",
"@types/license-checker": "^25.0.3",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "4.33.0",
"babel-eslint": "^10.1.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-react-app": "^6.0.0",
Expand All @@ -61,15 +61,16 @@
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.31.11",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-storybook": "^0.6.8",
"git-conventional-commits": "^2.4.0",
"husky": "^8.0.2",
"license-checker": "^25.0.1",
"lint-staged": "^13.0.4",
"semantic-release-monorepo": "^7.0.5"
"prettier": "^2.7.1",
"semantic-release-monorepo": "^7.0.5",
"typescript": "^4.8.4"
},
"resolutions": {
"**/@types/react": "^17",
"**/@types/react-dom": "^17",
"d3-color": "^3.1.0",
"glob-parent": "^5.1.2",
"trim": "^0.0.3",
Expand Down
5 changes: 2 additions & 3 deletions packages/examples/legacy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
"react-app"
]
},
"browserslist": {
Expand All @@ -61,4 +60,4 @@
"last 1 safari version"
]
}
}
}
11 changes: 0 additions & 11 deletions packages/legacy/.eslintignore

This file was deleted.

2 changes: 1 addition & 1 deletion packages/legacy/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": ["react-app", "plugin:prettier/recommended", "plugin:storybook/recommended"],
"plugins": ["header"],
"rules": {
"header/header": [2, "../../header.js"],
"header/header": [2, "header.js"],
"no-restricted-imports": [
2,
{
Expand Down
4 changes: 2 additions & 2 deletions packages/legacy/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ module.exports = {
moduleNameMapper: {
'\\.(css|less)$': '<rootDir>/src/__mocks__/styleMock.ts',
},
globalSetup: '../../jest/jest.globalsetup.js',
setupFilesAfterEnv: ['../../jest/jest.setup.ts'],
globalSetup: './jest/jest.globalsetup.js',
setupFilesAfterEnv: ['./jest/jest.setup.ts'],
coverageThreshold: {
global: {
branches: 80,
Expand Down
File renamed without changes.
File renamed without changes.
26 changes: 2 additions & 24 deletions packages/legacy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@
"build:esm": "tsc --build tsconfig.build.esm.json",
"build": "tsc --build tsconfig.build.json && yarn build:esm && yarn build:build-package-json && yarn build:build-readme",
"check:all": "yarn test:ci && yarn build && yarn storybook:build && yarn styleguide:build",
"lint:fix": "eslint --fix --ext .ts --ext .tsx --ext .js --ext .jsx .",
"lint": "eslint --max-warnings 0 --ext .ts --ext .tsx --ext .js --ext .jsx .",
"license:check": "yarn license-checker --summary --production --excludePrivatePackages --onlyAllow 'MIT;Apache-2.0;Unlicense;BSD;BSD*;BSD-2-Clause;BSD-3-Clause;ISC;Zlib;WTFPL;Custom: https://github.com/tmcw/jsonlint;Custom: http://badges.github.io/stability-badges/dist/stable.svg;Custom: https://github.com/substack/node-browserify;'",
"semantic-release": "semantic-release",
"storybook:build": "build-storybook -s ./public -o storybook.out",
"storybook": "start-storybook -s ./public -p 9090",
"styleguide:build": "styleguidist build",
"styleguide": "styleguidist server",
"test:ci": "yarn test --coverage && yarn lint",
"test:ci": "yarn test --coverage",
"test": "jest",
"test:watch": "jest --runInBand --watch ./src"
},
Expand All @@ -52,16 +51,10 @@
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^12.1.5",
"@testing-library/react-hooks": "^8.0.1",
"@types/babel__core": "^7.1.19",
"@types/eslint": "^8.4.6",
"@types/eslint-plugin-prettier": "^3.1.0",
"@types/jest": "^29.2.2",
"@types/jest-axe": "^3.5.3",
"@types/license-checker": "^25.0.3",
"@types/lodash.orderby": "^4.6.7",
"@types/node": "^18.11.17",
"@types/plotly.js": "^2.12.10",
"@types/prettier": "^2.7.1",
"@types/react": "^17.0.27",
"@types/react-dom": "^17.0.9",
"@types/react-plotly.js": "^2.5.2",
Expand All @@ -70,23 +63,9 @@
"@types/react-test-renderer": "^17.0.2",
"@types/storybook-react-router": "^1.0.2",
"@types/testing-library__jest-dom": "^5.14.5",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "4.33.0",
"babel-eslint": "^10.1.0",
"babel-loader": "^9.1.0",
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.7.3",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-react-app": "^6.0.0",
"eslint-plugin-flowtype": "^7.0.0",
"eslint-plugin-header": "^3.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.31.11",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-storybook": "^0.6.8",
"git-conventional-commits": "^2.4.0",
"husky": "^8.0.2",
"jest": "29.3.1",
Expand All @@ -96,7 +75,6 @@
"lint-staged": "^13.0.4",
"lodash.orderby": "^4.6.0",
"plotly.js": "^2.16.4",
"prettier": "^2.7.1",
"react": "^17.0.2",
"react-docgen-typescript-loader": "^3.6.0",
"react-docgen-typescript-plugin": "^1.0.2",
Expand Down
123 changes: 62 additions & 61 deletions packages/legacy/src/components/ProgressBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,73 +167,74 @@ const CircularProgressWithLabel: React.FunctionComponent<
/**
* A progress bar is a horizontal progress-bar for indicating progress and activity.
*/
const ProgressBar: FunctionComponent<ProgressBarProps & Omit<LinearProgressProps & CircularProgressProps, 'variant'>> =
({
value,
displayValue = true,
status = 'in-progress',
variant = 'linear',
label,
description,
additionalInfo,
resultText,
resultButtonText,
resultButtonClick,
...props
}) => {
const classes = useStyles();

const progressBody = (
ProgressBarComponent: React.FunctionComponent<ProgressBarComponentProps>
): React.ReactNode => {
if (status === 'error' || status === 'success') {
return (
<div className={classes.body}>
<div className={classes.icon}>
<StatusIndicator statusType={statusMapping[status]}>{resultText}</StatusIndicator>
</div>
{resultButtonText && (
<div className={classes.resultButton}>
<Button onClick={resultButtonClick}>{resultButtonText}</Button>
</div>
)}
</div>
);
}
const ProgressBar: FunctionComponent<
ProgressBarProps & Omit<LinearProgressProps & CircularProgressProps, 'variant'>
> = ({
value,
displayValue = true,
status = 'in-progress',
variant = 'linear',
label,
description,
additionalInfo,
resultText,
resultButtonText,
resultButtonClick,
...props
}) => {
const classes = useStyles();

const progressBody = (
ProgressBarComponent: React.FunctionComponent<ProgressBarComponentProps>
): React.ReactNode => {
if (status === 'error' || status === 'success') {
return (
<ProgressBarComponent
value={value || (value === 0 ? 0 : 100)}
displayValue={displayValue}
{...props}
data-testid={`${testId}-indicator`}
/>
<div className={classes.body}>
<div className={classes.icon}>
<StatusIndicator statusType={statusMapping[status]}>{resultText}</StatusIndicator>
</div>
{resultButtonText && (
<div className={classes.resultButton}>
<Button onClick={resultButtonClick}>{resultButtonText}</Button>
</div>
)}
</div>
);
};

const ProgressBarComponent = useMemo(
() => (variant === 'linear' ? LinearProgressComponent : CircularProgressWithLabel),
[variant]
);

const testId = props['data-testid'] || 'progress-bar';
}

return (
<div data-testid={testId}>
{label && <Heading variant="h3">{label}</Heading>}
{description && (
<Typography className={classes.description} variant="body1">
{description}
</Typography>
)}
{progressBody(ProgressBarComponent)}
{additionalInfo && (
<Typography className={classes.description} variant="body1">
{additionalInfo}
</Typography>
)}
</div>
<ProgressBarComponent
value={value || (value === 0 ? 0 : 100)}
displayValue={displayValue}
{...props}
data-testid={`${testId}-indicator`}
/>
);
};

const ProgressBarComponent = useMemo(
() => (variant === 'linear' ? LinearProgressComponent : CircularProgressWithLabel),
[variant]
);

const testId = props['data-testid'] || 'progress-bar';

return (
<div data-testid={testId}>
{label && <Heading variant="h3">{label}</Heading>}
{description && (
<Typography className={classes.description} variant="body1">
{description}
</Typography>
)}
{progressBody(ProgressBarComponent)}
{additionalInfo && (
<Typography className={classes.description} variant="body1">
{additionalInfo}
</Typography>
)}
</div>
);
};

export default ProgressBar;
4 changes: 2 additions & 2 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ STYLEGUIDE_FOLDER_LEGACY=./packages/legacy/styleguide.out/
STYLEGUIDE_FOLDER_LEGACY_EXAMPLE=${STYLEGUIDE_FOLDER_LEGACY}examples/
EXAMPLES_FOLDER=./packages/examples/

yarn install --frozen-lockfile
yarn install --immutable
yarn test:ci
yarn styleguide:build
yarn storybook:build
Expand All @@ -27,7 +27,7 @@ if ! [ -d .nyc_output/ ]; then mkdir .nyc_output/; fi
find ./packages -type f -name "coverage-final.json" -path "*/coverage/*" -not \( -path "*/node_modules/*" -prune \) \
| nl -bt -nln \
| sed -re 's!^([0-9]+) +\t(.+)$!\2 .nyc_output/coverage-final-\1.json!' \
| xargs -t cp
| xargs -t cp
npx nyc report --reporter lcov

echo 'Copy the examples to published examples folder'
Expand Down
Loading

0 comments on commit 301885d

Please sign in to comment.