-
Notifications
You must be signed in to change notification settings - Fork 26
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
feat: use composite builds to speed up compilation #692
base: develop
Are you sure you want to change the base?
Changes from 12 commits
8157873
665a353
751fb31
86a8d24
c4cc734
9a7744a
97da75d
8cadee4
2cd1de6
a0bc126
88bf269
fba7bb3
d34e2f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
"modules": "commonjs" | ||
} | ||
] | ||
"presets": [ | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
"modules": "commonjs" | ||
} | ||
] | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
{ | ||
"repository": "https://github.com/kiltprotocol/sdk-js", | ||
"name": "root-workspace", | ||
"private": true, | ||
"workspaces": [ | ||
"packages/*", | ||
"docs/*" | ||
], | ||
"license": "BSD-4-Clause", | ||
"scripts": { | ||
"check": "tsc -p tsconfig.json --noEmit", | ||
"build": "yarn workspaces foreach -p -t --exclude '{root-workspace}' run build", | ||
"check": "tsc -b tsconfig.json", | ||
"build": "yarn clean && yarn workspaces foreach -pt --exclude 'root-workspace' run build", | ||
"build:dev": "yarn workspaces foreach -pt --exclude 'root-workspace' run build:cjs", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this is to be used before unit/integration tests? Can we mention it somewhere? Otherwise I am 99% sure people will still be running There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True, I haven't updated READMEs and such. Could also add comments above the respective scripts There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay so we don't have a section on development in the README and we can't add comments to the package.json, where do you think we should put that info? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess the README then? I don't see any other place where this could go, personally. Maybe @arty-name has some prior experience for this? |
||
"build:watch": "yarn build:dev && tsc -b tsconfig.json --watch", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the benefit of this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It complains as soon as you break something and is more efficient as running There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just checked, you would want to have this running as well if jest is running in watch mode to make sure packages are being rebuild on changes. Otherwise imports from another package may use out of date versions. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So this is supposed to be run before and during tests? And There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, this is for watch mode. As in, you keep jest running and it re-executes tests whenever you change a file. So far we didn't have a solution for that. You can also just run As for the naming, I was considering making There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes sense. Rather use the build for development and something else for production. |
||
"build:docs": "typedoc --theme default --out docs/api --tsconfig tsconfig.docs.json && touch docs/.nojekyll", | ||
"bundle": "yarn workspace @kiltprotocol/sdk-js run bundle", | ||
"clean": "rimraf tests/dist && yarn workspaces foreach -p --exclude '{root-workspace}' run clean", | ||
"clean": "rimraf tests/dist && yarn workspaces foreach -p --exclude 'root-workspace' run clean", | ||
"clean:docs": "rimraf docs/api", | ||
"prepublish": "yarn workspaces foreach -p --no-private exec cp -f ../../LICENSE .", | ||
"publish": "yarn workspaces foreach -pt --no-private npm publish", | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
{ | ||
"extends": "./tsconfig.build.json", | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"module": "ES6", | ||
"outDir": "./lib/esm" | ||
"outDir": "./lib/esm", | ||
"declaration": false, | ||
"composite": false | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"outDir": "./lib/cjs", | ||
"rootDir": "./src" | ||
}, | ||
"include": ["src/**/*.ts", "src/**/*.js"], | ||
"exclude": ["coverage", "**/*.spec.ts"], | ||
// indicates package dependencies; must be in sync with @kiltprotocol imports in package.json | ||
"references": [ | ||
{ | ||
"path": "../types" | ||
}, | ||
{ | ||
"path": "../utils" | ||
} | ||
] | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
{ | ||
"extends": "./tsconfig.build.json", | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"module": "ES6", | ||
"outDir": "./lib/esm" | ||
"outDir": "./lib/esm", | ||
"declaration": false, | ||
"composite": false | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"outDir": "./lib/cjs", | ||
"rootDir": "./src", | ||
"skipLibCheck": true, | ||
"noUnusedLocals": false, | ||
"paths": { | ||
"@kiltprotocol/augment-api/*": ["./src/*"], | ||
"@polkadot/api/augment": ["./src/interfaces/augment-api.ts"], | ||
"@polkadot/types/augment": ["./src/interfaces/augment-types.ts"] | ||
} | ||
}, | ||
"include": ["src/**/*.ts", "src/**/*.js"], | ||
"exclude": ["coverage", "**/*.spec.ts", "src/**/definitions.ts"], | ||
// indicates package dependencies; must be in sync with @kiltprotocol imports in package.json | ||
"references": [ | ||
{ | ||
"path": "../type-definitions" | ||
} | ||
] | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
{ | ||
"extends": "./tsconfig.build.json", | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"module": "ES6", | ||
"outDir": "./lib/esm" | ||
"outDir": "./lib/esm", | ||
"declaration": false, | ||
"composite": false | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"outDir": "./lib/cjs", | ||
"rootDir": "./src" | ||
}, | ||
"include": ["src/**/*.ts", "src/**/*.js"], | ||
"exclude": ["coverage", "**/*.spec.ts"], | ||
// indicates package dependencies; must be in sync with @kiltprotocol imports in package.json | ||
"references": [ | ||
{ "path": "../config" }, | ||
{ "path": "../types" }, | ||
{ "path": "../utils" } | ||
] | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
{ | ||
"extends": "./tsconfig.build.json", | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"module": "ES6", | ||
"outDir": "./lib/esm" | ||
"outDir": "./lib/esm", | ||
"declaration": false, | ||
"composite": false | ||
} | ||
} |
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.
If we run
yarn clean
before a build, we lose the incremental compilation benefit you mention in the PR description, I guess. So we should probably not clean by default.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.
This is by design;
yarn build
is only meant to be run for production builds essentially (it's also the command run in CI). Running a clean beforehand makes sure we don't get any weird artefacts. For standard builds and rebuilds in development you can simply usebuild:dev
.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.
As mentioned below, we should then somehow advertise that
build:dev
is the to-go command then.