Skip to content

Commit 8fcb2e4

Browse files
kantheshakumavisdependabot[bot]whymarrhrekmarks
authored
Migrate json rpc middleware stream repo (#1709)
## Explanation <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> We would like to migrate most MetaMask libraries into core monorepo to make them easier to maintain. In this PR, we are migrating json-rpc-middleware-stream into core monorepo. In the process of migration, we don't want to remove / loose the original GIT history, but to preserve the history of the library as though the entire project had been located in a merged-packages/json-rpc-middleware-stream directory all along. We chose to place json-rpc-middleware-stream initially in the merged-packages and not packages so we can hide it from Yarn, ESLint, Prettier, and TypeScript. This allows us to clean it up and conform it to how we've configured this repo before we properly incorporate it. ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? For example: * Fixes #12345 * Related to #67890 --> Fixes https://app.zenhub.com/workspaces/shared-libraries-621e46b4d7103800171d1b02/issues/gh/metamask/core/1680 ## Changelog <!-- If you're making any consumer-facing changes, list those changes here as if you were updating a changelog, using the template below as a guide. (CATEGORY is one of BREAKING, ADDED, CHANGED, DEPRECATED, REMOVED, or FIXED. For security-related issues, follow the Security Advisory process.) Please take care to name the exact pieces of the API you've added or changed (e.g. types, interfaces, functions, or methods). If there are any breaking changes, make sure to offer a solution for consumers to follow once they upgrade to the changes. Finally, if you're only making changes to development scripts or tests, you may replace the template below with "None". --> ### `@metamask/json-rpc-middleware-stream` - **Migration**: migrating to core monorepo ## Checklist - [ ] I've updated the test suite for new or updated code as appropriate - [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [ ] I've highlighted breaking changes using the "BREAKING" category above as appropriate --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: kumavis <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Whymarrh Whitby <[email protected]> Co-authored-by: Erik Marks <[email protected]> Co-authored-by: Mark Stacey <[email protected]> Co-authored-by: ryanml <[email protected]> Co-authored-by: Zbyszek Tenerowicz <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Jyoti Puri <[email protected]> Co-authored-by: github-actions <[email protected]> Co-authored-by: Zach Pomerantz <[email protected]> Co-authored-by: legobeat <[email protected]> Co-authored-by: legobt <[email protected]> Co-authored-by: Frederik Bolding <[email protected]>
1 parent 53c6b76 commit 8fcb2e4

28 files changed

+9273
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"ignores": [
3+
"@lavamoat/allow-scripts",
4+
"@lavamoat/preinstall-always-fail",
5+
"@metamask/auto-changelog",
6+
"@types/*",
7+
"@yarnpkg/cli",
8+
"@yarnpkg/core",
9+
"@yarnpkg/fslib",
10+
"clipanion",
11+
"prettier-plugin-packagejson",
12+
"ts-node",
13+
"typedoc"
14+
]
15+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
module.exports = {
2+
root: true,
3+
4+
extends: ['@metamask/eslint-config'],
5+
6+
overrides: [
7+
{
8+
files: ['*.ts'],
9+
extends: ['@metamask/eslint-config-typescript'],
10+
},
11+
12+
{
13+
files: ['*.js'],
14+
parserOptions: {
15+
sourceType: 'script',
16+
},
17+
extends: ['@metamask/eslint-config-nodejs'],
18+
},
19+
20+
{
21+
files: ['*.test.ts', '*.test.js'],
22+
extends: ['@metamask/eslint-config-jest'],
23+
rules: {
24+
'import/no-nodejs-modules': 'off',
25+
},
26+
},
27+
],
28+
29+
ignorePatterns: ['!.eslintrc.js', '!.prettierrc.js', 'dist/'],
30+
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
* text=auto
2+
3+
yarn.lock linguist-generated=false
4+
5+
# yarn v3
6+
# See: https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
7+
/.yarn/releases/** binary
8+
/.yarn/plugins/** binary
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Lines starting with '#' are comments.
2+
# Each line is a file pattern followed by one or more owners.
3+
4+
* @MetaMask/devs
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Please see the documentation for all configuration options:
2+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
3+
4+
version: 2
5+
updates:
6+
- package-ecosystem: 'npm'
7+
directory: '/'
8+
schedule:
9+
interval: 'daily'
10+
time: '06:00'
11+
allow:
12+
- dependency-name: '@metamask/*'
13+
target-branch: 'main'
14+
versioning-strategy: 'increase-if-necessary'
15+
open-pull-requests-limit: 10
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Build, Lint, and Test
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
jobs:
9+
build-lint-test:
10+
name: Build, Lint, and Test
11+
runs-on: ubuntu-20.04
12+
strategy:
13+
matrix:
14+
node-version: [16.x, 18.x, 20.x]
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Use Node.js ${{ matrix.node-version }}
18+
uses: actions/setup-node@v2
19+
with:
20+
node-version: ${{ matrix.node-version }}
21+
- name: Get Yarn cache directory
22+
run: echo "::set-output name=YARN_CACHE_DIR::$(yarn config get cacheFolder)"
23+
id: yarn-cache-dir
24+
- name: Get Yarn version
25+
run: echo "::set-output name=YARN_VERSION::$(yarn --version)"
26+
id: yarn-version
27+
- name: Cache yarn dependencies
28+
uses: actions/cache@v2
29+
with:
30+
path: ${{ steps.yarn-cache-dir.outputs.YARN_CACHE_DIR }}
31+
key: yarn-cache-${{ runner.os }}-${{ steps.yarn-version.outputs.YARN_VERSION }}-${{ hashFiles('yarn.lock') }}
32+
- run: yarn --immutable
33+
- run: yarn build
34+
- run: yarn lint
35+
- run: yarn test
36+
- name: Validate RC changelog
37+
if: ${{ startsWith(github.head_ref, 'release/') }}
38+
run: yarn auto-changelog validate --rc
39+
- name: Validate changelog
40+
if: ${{ !startsWith(github.head_ref, 'release/') }}
41+
run: yarn auto-changelog validate
42+
- name: Require clean working directory
43+
shell: bash
44+
run: |
45+
if ! git diff --exit-code; then
46+
echo "Working tree dirty at end of job"
47+
exit 1
48+
fi
49+
all-jobs-pass:
50+
name: All jobs pass
51+
runs-on: ubuntu-20.04
52+
needs:
53+
- build-lint-test
54+
steps:
55+
- run: echo "Great success!"
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Create Release Pull Request
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
base-branch:
7+
description: 'The base branch for git operations and the pull request.'
8+
default: 'main'
9+
required: true
10+
release-type:
11+
description: 'A SemVer version diff, i.e. major, minor, patch, prerelease etc. Mutually exclusive with "release-version".'
12+
required: false
13+
release-version:
14+
description: 'A specific version to bump to. Mutually exclusive with "release-type".'
15+
required: false
16+
17+
jobs:
18+
create-release-pr:
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: write
22+
pull-requests: write
23+
steps:
24+
- uses: actions/checkout@v2
25+
with:
26+
# This is to guarantee that the most recent tag is fetched.
27+
# This can be configured to a more reasonable value by consumers.
28+
fetch-depth: 0
29+
# We check out the specified branch, which will be used as the base
30+
# branch for all git operations and the release PR.
31+
ref: ${{ github.event.inputs.base-branch }}
32+
- name: Get Node.js version
33+
id: nvm
34+
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
35+
- uses: actions/setup-node@v2
36+
with:
37+
node-version: ${{ steps.nvm.outputs.NODE_VERSION }}
38+
- uses: MetaMask/action-create-release-pr@v1
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
with:
42+
release-type: ${{ github.event.inputs.release-type }}
43+
release-version: ${{ github.event.inputs.release-version }}
44+
artifacts-path: gh-action__release-authors
45+
# Upload the release author artifact for use in subsequent workflows
46+
- uses: actions/upload-artifact@v2
47+
with:
48+
name: release-authors
49+
path: gh-action__release-authors
50+
if-no-files-found: error
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Publish Release
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
7+
jobs:
8+
publish-release:
9+
permissions:
10+
contents: write
11+
if: |
12+
github.event.pull_request.merged == true &&
13+
startsWith(github.event.pull_request.head.ref, 'release/')
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
with:
18+
# We check out the release pull request's base branch, which will be
19+
# used as the base branch for all git operations.
20+
ref: ${{ github.event.pull_request.base.ref }}
21+
- name: Get Node.js version
22+
id: nvm
23+
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
24+
- uses: actions/setup-node@v2
25+
with:
26+
node-version: ${{ steps.nvm.outputs.NODE_VERSION }}
27+
- uses: MetaMask/action-publish-release@v1
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
.DS_Store
2+
dist/
3+
coverage/
4+
5+
# Logs
6+
logs
7+
*.log
8+
npm-debug.log*
9+
yarn-debug.log*
10+
yarn-error.log*
11+
lerna-debug.log*
12+
13+
# Diagnostic reports (https://nodejs.org/api/report.html)
14+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
15+
16+
# Runtime data
17+
pids
18+
*.pid
19+
*.seed
20+
*.pid.lock
21+
22+
# Coverage directory used by tools like istanbul
23+
coverage
24+
*.lcov
25+
26+
# nyc test coverage
27+
.nyc_output
28+
29+
# node-waf configuration
30+
.lock-wscript
31+
32+
# Compiled binary addons (https://nodejs.org/api/addons.html)
33+
build/Release
34+
35+
# Dependency directories
36+
node_modules/
37+
38+
# TypeScript cache
39+
*.tsbuildinfo
40+
41+
# Optional npm cache directory
42+
.npm
43+
44+
# Optional eslint cache
45+
.eslintcache
46+
47+
# Microbundle cache
48+
.rpt2_cache/
49+
.rts2_cache_cjs/
50+
.rts2_cache_es/
51+
.rts2_cache_umd/
52+
53+
# Optional REPL history
54+
.node_repl_history
55+
56+
# Output of 'npm pack'
57+
*.tgz
58+
59+
# Yarn Integrity file
60+
.yarn-integrity
61+
62+
# dotenv environment variables file
63+
.env
64+
.env.test
65+
66+
# Stores VSCode versions used for testing VSCode extensions
67+
.vscode-test
68+
69+
# Yarn v3 files (w/o zero-install)
70+
# https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
71+
.pnp.*
72+
.yarn/*
73+
!.yarn/patches
74+
!.yarn/plugins
75+
!.yarn/releases
76+
!.yarn/sdks
77+
!.yarn/versions

0 commit comments

Comments
 (0)