-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Yarn v3 upgrade fixes #4029
Yarn v3 upgrade fixes #4029
Conversation
testUtilities are used by other packages, so should be compiled into dist, __tests__ should not be in dist
Previous way of defining ignored paths in build flags no longer works in yarn 3 way. Moved ignore paths to .babelrc files
Make it consistent with all other ts packages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Seems like there is a testing error in web-config-server
from codeship, wanna have a quick fix?
@@ -34,7 +34,7 @@ | |||
"test-all": "node ./scripts/node/testAll --silent", | |||
"validate": "./scripts/bash/validate.sh", | |||
"package:build:ts": "cd $INIT_CWD && tsc -p tsconfig-build.json", | |||
"package:build:js": "cd $INIT_CWD && babel src --out-dir dist --source-maps --config-file \"../../babel.config.json\"", | |||
"package:build:js": "cd $INIT_CWD && babel src --out-dir dist --source-maps --config-file \"../../babel.config.json\" --copy-files --no-copy-ignored --ignore \"**/__tests__\",\"**/__mocks__\"", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These flags are the default now
@@ -15,7 +15,7 @@ | |||
"types": "dist/index.d.ts", | |||
"private": true, | |||
"scripts": { | |||
"build": "npm run --prefix ../../ package:build:ts", | |||
"build": "rm -rf dist && npm run --prefix ../../ package:build:ts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every package cleans their dist before building to avoid issues with stale files
"build:types": "npm run --prefix ../../ package:build:types", | ||
"build-dev": "npm run build", | ||
"test": "nyc --reporter=lcov mocha", | ||
"test-coverage": "cross-env NODE_ENV=test nyc mocha" | ||
"test": "yarn package:test", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use standard test runner (jest) instead of mocha
@@ -13,7 +13,7 @@ | |||
"types": "dist/index.d.ts", | |||
"scripts": { | |||
"build": "rm -rf dist && run-p -c \"build:* {@}\" --", | |||
"build:src": "yarn package:build:js --ignore \"**src/database/migrations\",\"src/tests/**\" --copy-files --no-copy-ignored", | |||
"build:src": "yarn package:build:js", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uses standard build. The ignore flags are different... so central server outputs test files and migrations to dist now, but it shouldn't be too much of an issue since central-server is never imported by another package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we ignore them to make the bundle file smaller?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I came back to this with a fresh head and moved these flags to the .babelrc.js file. This way we can use the standard build script as well as customise the build babel config for central-server.
We are now back to 9MB builds, 3MB smaller (same as dev), and as fast as dev.
@@ -0,0 +1 @@ | |||
nmHoistingLimits: workspaces |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -20,4 +20,4 @@ export { | |||
} from './orchestrator'; | |||
export * from './types'; | |||
export * from './models'; | |||
export { TestableServer } from './__tests__/utilities'; | |||
export { TestableServer } from './testUtilities'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved testUtilities out of __tests__
because __tests__
doesn't get ouput into dist, and other packages need these testUtilities.
@@ -12,7 +12,7 @@ | |||
"main": "dist/index.js", | |||
"types": "dist/index.d.ts", | |||
"scripts": { | |||
"build": "rm -rf dist && tsc", | |||
"build": "rm -rf dist && npm run --prefix ../../ package:build:ts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use standard ts build script
@@ -4,8 +4,11 @@ | |||
* | |||
*/ | |||
|
|||
import { parseChartConfig } from '../parseChartConfig'; | |||
import { CHART_COLOR_PALETTE, EXPANDED_CHART_COLOR_PALETTE } from '../constants'; | |||
import { parseChartConfig } from '../../../components/Chart/parseChartConfig'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update ui-components folder structure to put all tests under __tests__
instead of alongside each component for consistency with all other packages.
"build:types": "npm run --prefix ../../ package:build:types", | ||
"build-dev": "npm run build", | ||
"test": "nyc --reporter=lcov mocha", | ||
"test-coverage": "cross-env NODE_ENV=test nyc mocha" | ||
"test": "yarn package:test", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use standard test runner
@billli0 Went too far in my original changes, had to roll back some packages. I was hoping we could get our old packages like web-config-server to use the normal build and test configs, but they have special needs so I rolled them back to use their old custom build and test scripts. Ready for re-review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New changes look good, thanks for the fix. Definitely it would be nice to have web-config-server
updated to be more standardised as other packages.
You mentioned the web-config-server
have its own needs, what would that be? Will it be a big one for us the refactor?
There are still a few packages that use mocha. To get these to use the standard test runner (jest) we will need to go through all tests and migrate them, some of the syntax is different, like expect().to.be instead of expect().toBe or something like that. Not too big but I thought it is probably out of scope for this PR. |
Go back to ignoring test,migration files for building
Yeah I'm just a little bit curious. It is definitely out of scope. |
Followup fixes to yarn v1 -> v3 upgrade #3994
__tests__
dirs for consistency