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

Convert to monorepo #831

Merged
merged 135 commits into from Nov 11, 2022
Merged
Show file tree
Hide file tree
Changes from 123 commits
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
be212ce
POC - Start converting to monorepo
mcmire May 16, 2022
d4a7428
Migrate from Yarn v1 to Yarn v3
Gudahtt Jun 3, 2022
0da8306
Replace `setup` script with new Yarn plugin
Gudahtt Jun 6, 2022
0164652
Merge branch 'main' into upgrade-to-yarn-3
Gudahtt Jun 7, 2022
36afcd4
Fix typo
Gudahtt Jun 7, 2022
d9c87b0
Merge branch 'upgrade-to-yarn-3' into monorepo-poc
mcmire Jun 7, 2022
30e86e2
Move remaining packages to packages/
mcmire Jun 8, 2022
6e4ea9a
Get all tests passing
mcmire Jun 13, 2022
5e2613a
Merge branch 'main' into monorepo-poc
mcmire Jun 13, 2022
be2bbe1
Simplify build:clean command
mcmire Jun 13, 2022
25916fd
Simplify globs in tsconfigs
mcmire Jun 13, 2022
8b8a688
Use __dirname in Jest config
mcmire Jun 13, 2022
97d5e3f
Fix linting
mcmire Jun 13, 2022
826e62d
Merge branch 'upgrade-to-yarn-3' into monorepo-poc
mcmire Jun 13, 2022
416f0ad
Clean some things up
mcmire Jun 13, 2022
ddab44d
Simplify Jest config, move configs to each package
mcmire Jun 14, 2022
2b4345a
Fix lint issues
mcmire Jun 14, 2022
8ed6e03
Fix TypeDoc
mcmire Jun 14, 2022
6991d90
Fix CI so that --maxWorkers works
mcmire Jun 14, 2022
f06ac0a
Fix tests to not hang if there are outstanding timers
mcmire Jun 14, 2022
7395afc
Merge branch 'main' into monorepo-poc
mcmire Jun 14, 2022
c0ff9e2
Initialize changelogs for all packages
mcmire Jun 14, 2022
cff70d7
Add 'yarn constraints' to CI
mcmire Jun 14, 2022
059d330
Oops, fix yarn.lock
mcmire Jun 14, 2022
00be2cd
Fix lint issues
mcmire Jun 14, 2022
7eb7e17
Put build and test after lint
mcmire Jun 14, 2022
4baf34f
Add Yarn version plugin
mcmire Jun 14, 2022
ef9fdbd
Add changesets
mcmire Jun 14, 2022
fc1c892
Make some quick tweaks
mcmire Jun 15, 2022
38a72df
Oops, remove .changeset directory
mcmire Jun 15, 2022
c24f6db
Turns out we need this after all
mcmire Jun 15, 2022
b61ac10
Merge main
mcmire Sep 9, 2022
c242b76
Merge branch 'main' into monorepo-poc
mcmire Sep 9, 2022
3cd59d2
Revert/restore build-lint-test.yml
mcmire Sep 9, 2022
07bab4b
Fix changelog validation in CI
mcmire Sep 9, 2022
0c34e53
Merge branch 'main' into monorepo-poc
mcmire Sep 19, 2022
afecade
Merge branch 'main' into monorepo-poc
mcmire Sep 27, 2022
b93feaa
Fix TypeScript and linting issues
mcmire Sep 27, 2022
91de999
Merge branch 'main' into monorepo-poc
mcmire Oct 5, 2022
0fa45f8
Remove symlinks for scripts in favor of using their direct paths
mcmire Oct 5, 2022
fbaffa9
Update README
mcmire Oct 5, 2022
0963bdd
build, lint, test -> lint, build, test
mcmire Oct 5, 2022
5f6205c
Fix constraints
mcmire Oct 6, 2022
b7f8c6d
Update package READMEs to provide description and remove Usage (for now)
mcmire Oct 7, 2022
a824252
Don't use 4 spaces for indentation in Markdown files
mcmire Oct 7, 2022
7d1532a
Fix lint issues
mcmire Oct 7, 2022
90de519
Split apart more controllers
mcmire Oct 7, 2022
e0dfdf1
Add --forceExit again to Jest command on CI
mcmire Oct 7, 2022
7a568e8
Fix Yarn constraints to correct compare version strings
mcmire Oct 8, 2022
4f98075
Extract more things from controller-utils that should be in other pac…
mcmire Oct 8, 2022
d294040
Regenerate yarn.lock
mcmire Oct 8, 2022
045b4e3
Clean up constraints.pro
mcmire Oct 8, 2022
26db827
Don't export this file
mcmire Oct 10, 2022
9537b08
Fix READMEs for composable-controller and message-manager
mcmire Oct 10, 2022
16f425e
Flip around some lines to make diffs easier to read
mcmire Oct 10, 2022
99ed774
Update descriptions in package.json to match README
mcmire Oct 10, 2022
48fbdab
Remove the need for an extra tsconfig for tests
mcmire Oct 10, 2022
fc07abc
Merge branch 'main' into monorepo-poc
mcmire Oct 10, 2022
72d47b1
Fix exports of all packages to match current exports
mcmire Oct 10, 2022
7447865
Add more constraints
mcmire Oct 10, 2022
ccd2e83
Bump the version to the current version
mcmire Oct 10, 2022
190489d
Start all packages' versions from scratch
mcmire Oct 10, 2022
d9e2b7a
Fix tests
mcmire Oct 10, 2022
843a5f5
Tweak wording in constraints file
mcmire Oct 11, 2022
d221d80
Merge branch 'main' into monorepo-poc
mcmire Oct 12, 2022
b3eeefd
Restore .editorconfig
mcmire Oct 13, 2022
d2c700e
Restore .github/workflows/build-lint-test.yml
mcmire Oct 13, 2022
e72cb39
Merge branch 'main' into monorepo-poc
mcmire Oct 13, 2022
d501396
Merge branch 'main' into monorepo-poc
mcmire Oct 13, 2022
9742ca7
Restore isomorphic-fetch
mcmire Oct 13, 2022
80f4ef7
Merge branch 'main' into monorepo-poc
mcmire Oct 13, 2022
d354a5f
Remove this instance of Yarn allow-scripts plugin
mcmire Oct 13, 2022
296cced
Remove the Yarn version plugin
mcmire Oct 13, 2022
4271859
Add a release.config.json for action-publish-release to read
mcmire Oct 13, 2022
8147c62
Merge branch 'main' into monorepo-poc
mcmire Oct 13, 2022
0b7becf
Bring back isomorphic-fetch type stub
mcmire Oct 13, 2022
dd828dd
Don't need this
mcmire Oct 13, 2022
b567f43
Tweak ordering to make diff easier to read
mcmire Oct 13, 2022
65961a6
Add back some of the release steps to the README
mcmire Oct 14, 2022
32286dd
Forgot about this file in a previous change
mcmire Oct 14, 2022
8a2819e
Remove jest-it-up, simplify 'test' and 'test:watch' scripts
mcmire Oct 14, 2022
4be5e3a
Restore previous changes to yarn.lock
mcmire Oct 14, 2022
4c6ed67
Fix test failures
mcmire Oct 14, 2022
e792a1e
Use @types/uuid ^8.3.0
mcmire Oct 14, 2022
b23a926
Restore more dependency specifications
mcmire Oct 14, 2022
e04c6ec
Add a Yarn constraint to ensure that babel-runtime is added if eth-qu…
mcmire Oct 14, 2022
3916201
Switch the Yarn constraint around so that the least version range win…
mcmire Oct 14, 2022
0b38110
Make sure we ask people to submit a PR
mcmire Oct 14, 2022
5589099
Revert check for undefined argument to hexToBN
mcmire Oct 14, 2022
6b35da7
Clean up jest.config.packages.js a bit
mcmire Oct 14, 2022
25a7afa
Assign a return type to setTimeout that works in both Node and browse…
mcmire Oct 14, 2022
655d7a0
Fix these too
mcmire Oct 14, 2022
41b1c56
I'm not being very thorough today, apparently
mcmire Oct 14, 2022
113c7a0
Attempting to fix tests
mcmire Oct 14, 2022
ac20a31
Make this variable name more readable
mcmire Oct 14, 2022
0476bfb
Update publish-release workflow to support new release process
mcmire Oct 14, 2022
6c63a2a
Remove create-release-pr action
mcmire Oct 14, 2022
d1db12d
Switch rpc method tests back to using toStrictEqual
Gudahtt Oct 14, 2022
6959246
add create-release-branch
Gudahtt Oct 14, 2022
ee323bd
COLLECTIBLE -> NFT
mcmire Oct 15, 2022
b6d186d
PermissionController: Link to Arch document from README, fix name in …
mcmire Oct 15, 2022
5286350
Merge remote-tracking branch 'origin/main' into monorepo-poc
Gudahtt Oct 31, 2022
2e36aa9
Fix README lint error
Gudahtt Oct 31, 2022
839944e
Merge branch 'main' into monorepo-poc
mcmire Nov 8, 2022
77a4b24
Make links to main README in per-package READMEs absolute
mcmire Nov 8, 2022
f3770ba
Merge branch 'main' into monorepo-poc
mcmire Nov 9, 2022
a08ab7e
Fix changelog validation on release branches
mcmire Nov 9, 2022
3de137d
Bump action-publish-release
mcmire Nov 9, 2022
4a0d96c
Fix publish-release workflow to restore compiled JS
mcmire Nov 9, 2022
3c824fd
Update to 'action-npm-publish@v2
Gudahtt Nov 10, 2022
6326c50
Merge remote-tracking branch 'origin/main' into monorepo-poc
Gudahtt Nov 10, 2022
cc9bdbb
Update workflows
mcmire Nov 10, 2022
6c2cad8
Clean up publish-release workflow
mcmire Nov 10, 2022
75cfcb4
Fix main workflow
mcmire Nov 10, 2022
407a17f
Run tests in parallel
mcmire Nov 10, 2022
e43457a
Clean up workflows still
mcmire Nov 10, 2022
b65b4ae
Fix workflow
mcmire Nov 10, 2022
eb2670e
Run more workflow jobs in parallel to match the module template
mcmire Nov 10, 2022
259f7b1
Fix workflow
mcmire Nov 10, 2022
40a3e1e
Fix workflow
mcmire Nov 10, 2022
743f434
Change action-publish-release back to v2
mcmire Nov 10, 2022
c9f960a
Remove --maxWorkers=1 from 'yarn test'
mcmire Nov 10, 2022
853e460
Add back all-jobs-pass
mcmire Nov 10, 2022
31cf514
Test on Node 18.x and 19.x
mcmire Nov 11, 2022
43ca97e
Fix JSDoc for ContactEntry interface
mcmire Nov 11, 2022
1b24bc7
Remove testEnvironmentOptions override and custom arrayMerge option i…
mcmire Nov 11, 2022
4714429
Revert "Test on Node 18.x and 19.x"
mcmire Nov 11, 2022
750ac80
Simplify doc script, add doc:clean
mcmire Nov 11, 2022
0691206
Use ES2017 instead of ES2020
mcmire Nov 11, 2022
ca16296
Fix lint
mcmire Nov 11, 2022
a015279
Remove doc:clean
mcmire Nov 11, 2022
3bf6120
Better align scripts to module template
mcmire Nov 11, 2022
3a3b749
Fix lint
mcmire Nov 11, 2022
0b957f8
Rename doc to build:docs for each package too
mcmire Nov 11, 2022
b7c1fbe
No need to install node for npm-publish jobs
mcmire Nov 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
43 changes: 0 additions & 43 deletions .github/workflows/create-release-pr.yml

This file was deleted.

103 changes: 74 additions & 29 deletions .github/workflows/lint-build-test.yml
@@ -1,14 +1,12 @@
name: Lint, Build, and Test
mcmire marked this conversation as resolved.
Show resolved Hide resolved

on:
push:
branches: [main]
pull_request:
workflow_call:
mcmire marked this conversation as resolved.
Show resolved Hide resolved

jobs:
lint-build-test:
name: Lint, Build, and Test
runs-on: ubuntu-20.04
prepare:
name: Prepare
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 16.x]
Mrtenz marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -18,31 +16,78 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Get Yarn cache directory
run: echo "YARN_CACHE_DIR=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
id: yarn-cache-dir
- name: Get Yarn version
run: echo "YARN_VERSION=$(yarn --version)" >> $GITHUB_OUTPUT
id: yarn-version
- name: Cache yarn dependencies
uses: actions/cache@v3
cache: yarn
- run: yarn --immutable

lint:
name: Lint
runs-on: ubuntu-latest
needs: prepare
strategy:
matrix:
node-version: [14.x, 16.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
path: ${{ steps.yarn-cache-dir.outputs.YARN_CACHE_DIR }}
key: yarn-cache-${{ runner.os }}-${{ steps.yarn-version.outputs.YARN_VERSION }}-${{ hashFiles('yarn.lock') }}
node-version: ${{ matrix.node-version }}
cache: yarn
- run: yarn --immutable
- run: yarn lint
- name: Validate RC changelog
if: ${{ startsWith(github.ref, 'release/') }}
run: yarn auto-changelog validate --rc
- name: Validate changelog
if: ${{ !startsWith(github.ref, 'release/') }}
run: yarn auto-changelog validate
- run: yarn changelog:validate
- name: Require clean working directory
shell: bash
run: |
if ! git diff --exit-code; then
echo "Working tree dirty at end of job"
exit 1
fi

build:
name: Build
runs-on: ubuntu-latest
needs: prepare
strategy:
matrix:
node-version: [14.x, 16.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- run: yarn --immutable
- run: yarn build
- run: yarn test --maxWorkers=1
all-jobs-pass:
name: All jobs pass
runs-on: ubuntu-20.04
needs:
- lint-build-test
- name: Require clean working directory
shell: bash
run: |
if ! git diff --exit-code; then
echo "Working tree dirty at end of job"
exit 1
fi

test:
name: Test
runs-on: ubuntu-latest
needs: prepare
strategy:
matrix:
node-version: [14.x, 16.x]
steps:
- run: echo "Great success!"
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- run: yarn --immutable
- run: yarn test
- name: Require clean working directory
shell: bash
run: |
if ! git diff --exit-code; then
echo "Working tree dirty at end of job"
exit 1
fi
51 changes: 51 additions & 0 deletions .github/workflows/main.yml
@@ -0,0 +1,51 @@
name: Main

on:
push:
branches: [main]
pull_request:

jobs:
check-workflows:
name: Check workflows
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download actionlint
id: download-actionlint
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/7fdc9630cc360ea1a469eed64ac6d78caeda1234/scripts/download-actionlint.bash) 1.6.22
shell: bash
- name: Check workflow files
run: ${{ steps.download-actionlint.outputs.executable }} -color
shell: bash

lint-build-test:
name: Lint, build, and test
needs: check-workflows
uses: ./.github/workflows/lint-build-test.yml

is-release:
name: Determine whether this is a release merge commit
needs: lint-build-test
if: startsWith(github.event.commits[0].author.name, 'github-actions')
runs-on: ubuntu-latest
outputs:
IS_RELEASE: ${{ steps.is-release.outputs.IS_RELEASE }}
steps:
- uses: MetaMask/action-is-release@v1
id: is-release

publish-release:
name: Publish release
needs: is-release
if: needs.is-release.outputs.IS_RELEASE == 'true'
permissions:
contents: write
uses: ./.github/workflows/publish-release.yml

all-jobs-pass:
name: All jobs pass
runs-on: ubuntu-latest
needs: lint-build-test
steps:
- run: echo "Great success!"
71 changes: 27 additions & 44 deletions .github/workflows/publish-release.yml
@@ -1,58 +1,33 @@
name: Publish Release

on:
push:
branches: [main]
workflow_call:

jobs:
is-release:
# release merge commits come from github-actions
if: startsWith(github.event.commits[0].author.name, 'github-actions')
outputs:
IS_RELEASE: ${{ steps.is-release.outputs.IS_RELEASE }}
runs-on: ubuntu-latest
steps:
- uses: MetaMask/action-is-release@v1
id: is-release

publish-release:
permissions:
contents: write
if: needs.is-release.outputs.IS_RELEASE == 'true'
runs-on: ubuntu-latest
needs: is-release
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.sha }}
- name: Get Node.js version
id: nvm
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_OUTPUT
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ steps.nvm.outputs.NODE_VERSION }}
node-version-file: '.nvmrc'
cache: yarn
- uses: actions/cache@v3
with:
path: |
./packages/**/dist
./node_modules/.yarn-state.yml
key: ${{ github.sha }}
- uses: MetaMask/action-publish-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get Yarn cache directory
run: echo "YARN_CACHE_DIR=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
id: yarn-cache-dir
- name: Get Yarn version
run: echo "YARN_VERSION=$(yarn --version)" >> $GITHUB_OUTPUT
id: yarn-version
- name: Cache yarn dependencies
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir.outputs.YARN_CACHE_DIR }}
key: yarn-cache-${{ runner.os }}-${{ steps.yarn-version.outputs.YARN_VERSION }}-${{ hashFiles('yarn.lock') }}
- run: yarn --immutable
- run: yarn build
- uses: actions/cache@v3
id: restore-build
with:
path: ./dist
key: ${{ github.sha }}

publish-npm-dry-run:
runs-on: ubuntu-latest
Expand All @@ -61,16 +36,20 @@ jobs:
- uses: actions/checkout@v3
with:
ref: ${{ github.sha }}
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: yarn
- uses: actions/cache@v3
id: restore-build
with:
path: ./dist
path: |
./packages/**/dist
./node_modules/.yarn-state.yml
key: ${{ github.sha }}
# Set `ignore-scripts` to skip `prepublishOnly` because the release was built already in the previous job
- run: npm config set ignore-scripts true
- name: Dry Run Publish
# omit npm-token token to perform dry run publish
uses: MetaMask/action-npm-publish@v1
uses: MetaMask/action-npm-publish@v2
env:
SKIP_PREPACK: true

Expand All @@ -82,15 +61,19 @@ jobs:
- uses: actions/checkout@v3
with:
ref: ${{ github.sha }}
- name: Setup Node
mcmire marked this conversation as resolved.
Show resolved Hide resolved
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: yarn
- uses: actions/cache@v3
id: restore-build
with:
path: ./dist
path: |
./packages/**/dist
./node_modules/.yarn-state.yml
key: ${{ github.sha }}
# Set `ignore-scripts` to skip `prepublishOnly` because the release was built already in the previous job
- run: npm config set ignore-scripts true
- name: Publish
uses: MetaMask/action-npm-publish@v1
uses: MetaMask/action-npm-publish@v2
with:
npm-token: ${{ secrets.NPM_TOKEN }}
env:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -24,3 +24,6 @@ docs
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# typescript
*.tsbuildinfo
52 changes: 52 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-constraints.cjs

Large diffs are not rendered by default.