Skip to content
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

Re-factor build scripts to TypeScript #202

Merged
merged 23 commits into from
Sep 10, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d7c26fd
Re-factor scripts for building, development, linting, and cleaning to…
smithki Sep 1, 2021
7fa7da1
Remove remnants of old test runner (ava)
smithki Sep 1, 2021
a210f1b
Re-factor scripts for unit testing to TypeScript
smithki Sep 1, 2021
e2ccc67
Small cleanups
smithki Sep 1, 2021
d258eeb
Refactor to merge `ViewController` and `PayloadTransport` classes (#203)
smithki Sep 2, 2021
9a59d3f
Make script code more DRY
smithki Sep 2, 2021
d12760f
Update TypeScript & make scripts more DRY
smithki Sep 2, 2021
94efcb4
Fix typo and add 'printSeparator' script utility
smithki Sep 2, 2021
a2325a2
Fix 'inject-env.ts' script following re-organization of code
smithki Sep 2, 2021
d5e2f35
Remove outdated / unused dependencies from root PackageJSON
smithki Sep 8, 2021
a858d16
Progress towards integrating microbundle
smithki Sep 9, 2021
69d343f
Update build scripts to bundle all packages via microbundle
smithki Sep 10, 2021
50a0a03
Remove unnecessary console statement
smithki Sep 10, 2021
e8c7fde
Run pre-commit hooks against all packages
smithki Sep 10, 2021
2e0e32c
Add more memory for tasks spawned via 'wsrun'
smithki Sep 10, 2021
3e28ee0
Raise the resource class in CI
smithki Sep 10, 2021
66a3346
Try to fix ENOMEM errors in CI by limiting concurrency
smithki Sep 10, 2021
89a4660
Replace 'p-limit' dependency with prior version (new version is ESM-o…
smithki Sep 10, 2021
b529dd4
Better caching in CircleCI
smithki Sep 10, 2021
f80e463
Update test script to work with Yarn 2
smithki Sep 10, 2021
494fe08
Fix tests related to ViewController refactor
smithki Sep 10, 2021
f1066f4
Reduce the CircleCI resource class back to medium
smithki Sep 10, 2021
62b4874
Fix tests related to ViewController refactor
smithki Sep 10, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Try to fix ENOMEM errors in CI by limiting concurrency
  • Loading branch information
smithki committed Sep 10, 2021
commit 66a3346e717ba16401126c80167a9652b6588589
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"npm-run-all": "^4.1.5",
"nyc": "13.1.0",
"ora": "~5.4.1",
"p-limit": "^4.0.0",
"prettier": "~2.3.2",
"react": "^16.13.1",
"react-native": "^0.62.2",
Expand Down
7 changes: 6 additions & 1 deletion scripts/bin/build.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
#!/usr/bin/env ts-node-script

import execa from 'execa';
import isCI from 'is-ci';
import { runAsyncProcess } from '../utils/run-async-process';
import { handleError } from '../utils/handle-script-error';
import { printSeparator } from '../utils/print-separator';
import { getPackages, logPackages, promptForPackage } from '../utils/workspace-helpers';

async function buildPkgs(PKG: string) {
printSeparator('Building');
await execa('yarn', ['wsrun', '-r', '--stages', `${process.env.INIT_CWD}/scripts/bin/wsrun/build-package.ts`], {

// We need to limit concurrency in CI to avoid ENOMEM errors.
const wsrunConcurrency = isCI ? '--serial' : '--stages';

await execa('yarn', ['wsrun', '-r', wsrunConcurrency, `${process.env.INIT_CWD}/scripts/bin/wsrun/build-package.ts`], {
stdio: 'inherit',
env: { PKG },
})
Expand Down
8 changes: 7 additions & 1 deletion scripts/bin/wsrun/build-package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable global-require */

import pLimit from 'p-limit';
import isCI from 'is-ci';
import { microbundle } from '../../utils/microbundle';
import { runAsyncProcess } from '../../utils/run-async-process';

Expand Down Expand Up @@ -48,7 +50,11 @@ async function cdn() {
}

async function main() {
await Promise.all([cjs(), esm(), modern(), cdn()]);
// We need to limit concurrency in CI to avoid ENOMEM errors.
const limit = pLimit(isCI ? 2 : 4);

const builders = [limit(cjs), limit(esm), limit(modern), limit(cdn)];
await Promise.all(builders);
}

runAsyncProcess(main);
17 changes: 17 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13755,6 +13755,7 @@ fsevents@^1.2.7:
npm-run-all: ^4.1.5
nyc: 13.1.0
ora: ~5.4.1
p-limit: ^4.0.0
prettier: ~2.3.2
react: ^16.13.1
react-native: ^0.62.2
Expand Down Expand Up @@ -15743,6 +15744,15 @@ fsevents@^1.2.7:
languageName: node
linkType: hard

"p-limit@npm:^4.0.0":
version: 4.0.0
resolution: "p-limit@npm:4.0.0"
dependencies:
yocto-queue: ^1.0.0
checksum: 01d9d70695187788f984226e16c903475ec6a947ee7b21948d6f597bed788e3112cc7ec2e171c1d37125057a5f45f3da21d8653e04a3a793589e12e9e80e756b
languageName: node
linkType: hard

"p-locate@npm:^2.0.0":
version: 2.0.0
resolution: "p-locate@npm:2.0.0"
Expand Down Expand Up @@ -21381,3 +21391,10 @@ resolve@~1.7.1:
checksum: 2c487b0e149e746ef48cda9f8bad10fc83693cd69d7f9dcd8be4214e985de33a29c9e24f3c0d6bcf2288427040a8947406ab27f7af67ee9456e6b84854f02dd6
languageName: node
linkType: hard

"yocto-queue@npm:^1.0.0":
version: 1.0.0
resolution: "yocto-queue@npm:1.0.0"
checksum: 2cac84540f65c64ccc1683c267edce396b26b1e931aa429660aefac8fbe0188167b7aee815a3c22fa59a28a58d898d1a2b1825048f834d8d629f4c2a5d443801
languageName: node
linkType: hard