Skip to content

Commit

Permalink
Migrate from polyrepo to monorepo (#17)
Browse files Browse the repository at this point in the history
## **Description**

This PR migrates the current MetaMask design system repo which is
currently using the metamask-module-template and a polyrepo structure to
a monorepo structure. The primary goal is to streamline the module
management process by consolidating multiple repositories into a single
monorepo. The `core` module serves as a reference for the files and
structure required in the monorepo setup. This change will simplify
dependency management and improve development efficiency across modules.

<img width="444" alt="Screenshot 2024-10-08 at 2 09 12 PM"
src="https://github.com/user-attachments/assets/eb1dcb2e-4eb1-45bb-833f-4fbe3295c84f">

### Key changes:
- Updated module configuration to align with the monorepo structure.
- Consolidated files and dependencies into the monorepo format.
- Ensured consistency with the `core` module in terms of file inclusion,
structure, and build processes.

## **Related issues**

Fixes: #5

## **Manual testing steps**

1. Clone the repository and navigate to the monorepo.
2. Run all `yarn` scripts to ensure they work with the exception of
`prepare-preview-build` and `publish-previews`
3. Verify that the scriptsfunction as expected within the monorepo.
4. Ensure the build passes without issues in the monorepo format.
5. Ensure no instances of "core" remain unless links to information for
migrating packages

## **Screenshots/Recordings**

Video showing all `yarn` scripts work from `package.json` with the
exception of `prepare-preview-build` and `publish-previews` issue here:
#26

https://www.loom.com/share/4f40fa33ae45472e807137d3995c212c

## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs)
- [x] I’ve completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and/or screenshots.
  • Loading branch information
georgewrmarshall authored Oct 8, 2024
1 parent f9b3551 commit 8991031
Show file tree
Hide file tree
Showing 79 changed files with 7,759 additions and 3,265 deletions.
12 changes: 0 additions & 12 deletions .depcheckrc.json

This file was deleted.

25 changes: 25 additions & 0 deletions .depcheckrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
ignores:
# Ignore dependencies used by Yarn binaries in `.yarn`
- '@yarnpkg/*'
- 'clipanion'
- 'typanion'
# Ignore dependencies imported implicitly by TypeScript
- '@types/*'
# Ignore tools (packages which we use as executables and not libraries)
- '@lavamoat/allow-scripts'
- '@metamask/auto-changelog'
- '@metamask/create-release-branch'
- 'depcheck'
- 'eslint-interactive'
- 'rimraf'
- 'simple-git-hooks'
- 'ts-node'
- 'typedoc'
# Ignore plugins implicitly imported by tools
- 'jest-silent-reporter'
- 'prettier-plugin-packagejson'
# Ignore plugins we explicitly use with tools
- 'babel-jest'
# Ignore dependencies which plug into the NPM lifecycle
- '@lavamoat/preinstall-always-fail'
12 changes: 8 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
88 changes: 57 additions & 31 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,50 +1,76 @@
module.exports = {
root: true,

extends: ['@metamask/eslint-config'],

extends: ['@metamask/eslint-config', '@metamask/eslint-config-nodejs'],
ignorePatterns: [
'!.eslintrc.js',
'!jest.config.js',
'node_modules',
'**/dist',
'**/docs',
'**/coverage',
'merged-packages',
'scripts/create-package/package-template',
],
overrides: [
{
files: ['*.ts'],
extends: ['@metamask/eslint-config-typescript'],
files: ['*.test.{ts,js}'],
extends: ['@metamask/eslint-config-jest'],
},

{
files: ['*.js'],
files: ['*.js', '*.cjs'],
parserOptions: {
sourceType: 'script',
ecmaVersion: '2020',
},
extends: ['@metamask/eslint-config-nodejs'],
},

{
files: ['yarn.config.cjs'],
files: ['*.ts'],
extends: ['@metamask/eslint-config-typescript'],
parserOptions: {
sourceType: 'script',
ecmaVersion: 2020,
tsconfigRootDir: __dirname,
project: ['./tsconfig.packages.json'],
},
settings: {
jsdoc: {
mode: 'typescript',
},
rules: {
'@typescript-eslint/no-explicit-any': 'error',
},
extends: ['@metamask/eslint-config-nodejs'],
},

{
files: ['*.test.ts', '*.test.js'],
extends: [
'@metamask/eslint-config-jest',
'@metamask/eslint-config-nodejs',
],
files: ['*.d.ts'],
rules: {
'@typescript-eslint/naming-convention': 'warn',
'import/unambiguous': 'off',
},
},
{
files: ['scripts/**/*.ts'],
rules: {
'import/no-unassigned-import': 'off',
'n/no-sync': 'off',
// All scripts will have shebangs.
'n/shebang': 'off',
},
},
],

ignorePatterns: [
'!.eslintrc.js',
'!.prettierrc.js',
'dist/',
'docs/',
'.yarn/',
],
rules: {
camelcase: 'off',
'id-length': 'off',
'no-restricted-syntax': [
'error',
'ForInStatement',
'LabeledStatement',
'WithStatement',
],
'jsdoc/match-description': [
'off',
{ matchDescription: '^[A-Z`\\d_][\\s\\S]*[.?!`>)}]$' },
],
},
settings: {
'import/resolver': {
typescript: {},
},
jsdoc: {
mode: 'typescript',
},
},
};
5 changes: 1 addition & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ updates:
directory: '/'
schedule:
interval: 'daily'
time: '06:00'
allow:
- dependency-name: '@metamask/*'
target-branch: 'main'
versioning-strategy: 'increase-if-necessary'
open-pull-requests-limit: 10
versioning-strategy: 'increase'
41 changes: 0 additions & 41 deletions .github/workflows/create-release-pr.yml

This file was deleted.

37 changes: 37 additions & 0 deletions .github/workflows/ensure-blocking-pr-labels-absent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: 'Check for PR labels that block merging'
on:
pull_request:
types:
- opened
- synchronize
- labeled
- unlabeled

jobs:
ensure-blocking-pr-labels-absent:
runs-on: ubuntu-latest
permissions:
pull-requests: read
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Install Yarn
run: corepack enable
- name: Restore Yarn cache
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- run: yarn --immutable
- name: Run command
uses: actions/github-script@v7
with:
script: |
if (context.payload.pull_request.labels.some((label) => label.name === 'DO-NOT-MERGE')) {
core.setFailed(
"PR cannot be merged because it contains the label 'DO-NOT-MERGE'."
);
}
Loading

0 comments on commit 8991031

Please sign in to comment.