-
-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Currently, this repo and everything within it is published as a single package. Using and maintaining this package, however, is problematic for a few reasons: 1. Even if your library uses a couple of controllers, you must add the entire package and all of its dependencies to your library's dependency tree. 2. Because this package is used by many teams, when we make a new release, even if that release contains changes to one controller, we must coordinate with all teams to ensure that nothing has broken. In addition, we want to be able to maintain our existing libraries more easily, as right now it is difficult due to code being split across multiple repositories. To solve this problem, this commit converts the existing structure to a monorepo structure, assigning controllers to packages which we can then publish individually. (A full list of packages is contained in the README.) Along with a monorepo structure comes with a litany of changes: * **TypeScript:** We have a "master" TypeScript config file, which is used by developers' code editors, but each package also has its own TypeScript config files. We are also using TypeScript project references, which allows us to inform TypeScript how all packages are connected to each other dependency-wise; this allows TypeScript to know which packages to build first. * **Jest:** Each package has its own Jest config file, and we use Yarn workspaces to run the tests for each package in parallel. * **ESLint:** We are able to lint the monorepo in the same way as we linted before. * **TypeDoc:** We've added TypeDoc to each package and use Yarn workspaces to generate docs for each package in parallel. * **Yarn:** A bunch of Yarn constraints have been added that verify that both the root package and each package has a well-formed `package.json`. * **Other notes:** * Some packages depend on other packages within the monorepo. In other words, we might have an import for `@metamask/base-controller` within a controller file. Out of the box both TypeScript and Jest won't know what to do with this. Although Yarn will add a symlink in `node_modules` to the proper directory in `packages` for the package in question, TypeScript expects the code for the package to be compiled (i.e. for `dist/` to be populated), and Jest, as it has custom resolver logic, doesn't know what to do at all. To make this possible we have to add a custom mapping for both TypeScript and Jest that will tell them what to do when it sees a `@metamask/*` import. * The GitHub Action workflow files have been standardized against the newest changes to the module template. Co-authored-by: Mark Stacey <[email protected]> Co-authored-by: Maarten Zuidhoorn <[email protected]>
- Loading branch information
1 parent
3a003ea
commit 0704312
Showing
315 changed files
with
8,061 additions
and
4,034 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,6 @@ docs | |
!.yarn/releases | ||
!.yarn/sdks | ||
!.yarn/versions | ||
|
||
# typescript | ||
*.tsbuildinfo |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.