Skip to content

Commit b01b62a

Browse files
authored
Merge pull request #1 from MetaMask/monorepo-set-up
Monorepo set up
2 parents a666d01 + 9bce74b commit b01b62a

File tree

26 files changed

+4747
-1
lines changed

26 files changed

+4747
-1
lines changed

.gitignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# Dependencies
4+
node_modules
5+
.pnp
6+
.pnp.js
7+
8+
# Local env files
9+
.env
10+
.env.local
11+
.env.development.local
12+
.env.test.local
13+
.env.production.local
14+
15+
# Testing
16+
coverage
17+
18+
# Turbo
19+
.turbo
20+
21+
# Vercel
22+
.vercel
23+
24+
# Build Outputs
25+
.next/
26+
out/
27+
build
28+
dist
29+
30+
31+
# Debug
32+
npm-debug.log*
33+
yarn-debug.log*
34+
yarn-error.log*
35+
36+
# Misc
37+
.DS_Store
38+
*.pem

.npmrc

Whitespace-only changes.

.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"eslint.workingDirectories": [
3+
{
4+
"mode": "auto"
5+
}
6+
]
7+
}

README.md

Lines changed: 88 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,88 @@
1-
# metamask-sdk-examples
1+
# MetaMask SDK Examples Monorepo
2+
3+
This monorepo contains various example applications demonstrating the integration of MetaMask SDK across different frameworks and platforms. Built with Turborepo for efficient development and build processes.
4+
5+
## 🚀 Getting Started
6+
7+
Clone and install dependencies:
8+
9+
```sh
10+
git clone <repository-url>
11+
cd metamask-sdk-examples && pnpm install
12+
```
13+
14+
## 📦 Repository Structure
15+
16+
```
17+
metamask-sdk-examples/
18+
├── examples/ # Example applications
19+
│ ├── react/ # React.js integration
20+
│ ├── next/ # Next.js integration
21+
│ ├── vue/ # Vue.js integration
22+
│ └── vanilla/ # Vanilla JavaScript integration
23+
├── packages/ # Shared configurations and utilities
24+
│ ├── eslint-config/ # Shared ESLint configurations
25+
│ └── tsconfig/ # Shared TypeScript configurations
26+
```
27+
28+
## 🎯 Available Examples
29+
30+
Each example in the `examples/` directory demonstrates MetaMask SDK integration in different frameworks and scenarios:
31+
32+
- **React Example**: Modern React application showcasing hooks and components
33+
- **Next.js Example**: Server-side rendering and static site generation
34+
- **Vue Example**: Vue.js integration example
35+
- **Vanilla JS**: Pure JavaScript implementation without frameworks
36+
37+
## 🛠 Development
38+
39+
### Running Individual Examples
40+
41+
To run a specific example:
42+
43+
```sh
44+
cd examples/<example-name>
45+
pnpm dev
46+
```
47+
48+
### Adding New Examples
49+
50+
1. Create a new directory in `examples/`
51+
2. Copy the example template (if available)
52+
3. Implement the MetaMask SDK integration
53+
4. Update this README with the new example details
54+
55+
## 🔧 Technical Stack
56+
57+
- **Build System**: Turborepo
58+
- **Package Manager**: pnpm
59+
- **Language**: TypeScript
60+
- **Linting**: ESLint
61+
- **Formatting**: Prettier
62+
63+
## 📚 Documentation
64+
65+
Each example includes its own README with:
66+
- Specific setup instructions
67+
- Implementation details
68+
- Best practices
69+
- Common issues and solutions
70+
71+
## 🤝 Contributing
72+
73+
We welcome contributions! To add a new example:
74+
75+
1. Fork the repository
76+
2. Create a new branch
77+
3. Add your example
78+
4. Submit a pull request
79+
80+
## 📝 License
81+
82+
This project is licensed under the MIT License - see the LICENSE file for details.
83+
84+
## 🔗 Useful Links
85+
86+
- [MetaMask SDK Documentation](https://docs.metamask.io/sdk/)
87+
- [Turborepo Documentation](https://turbo.build/repo/docs)
88+
- [Report Issues](https://github.com/yourusername/metamask-sdk-examples/issues)

examples/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
## Examples go here

package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "metamask-sdk-examples",
3+
"private": true,
4+
"scripts": {
5+
"build": "turbo build",
6+
"dev": "turbo dev",
7+
"lint": "turbo lint",
8+
"format": "prettier --write \"**/*.{ts,tsx,md}\""
9+
},
10+
"devDependencies": {
11+
"prettier": "^3.2.5",
12+
"turbo": "^2.3.3",
13+
"typescript": "5.5.4"
14+
},
15+
"packageManager": "[email protected]",
16+
"engines": {
17+
"node": ">=18"
18+
}
19+
}

packages/eslint-config/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# `@turbo/eslint-config`
2+
3+
Collection of internal eslint configurations.

packages/eslint-config/base.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import js from "@eslint/js";
2+
import eslintConfigPrettier from "eslint-config-prettier";
3+
import turboPlugin from "eslint-plugin-turbo";
4+
import tseslint from "typescript-eslint";
5+
import onlyWarn from "eslint-plugin-only-warn";
6+
7+
/**
8+
* A shared ESLint configuration for the repository.
9+
*
10+
* @type {import("eslint").Linter.Config}
11+
* */
12+
export const config = [
13+
js.configs.recommended,
14+
eslintConfigPrettier,
15+
...tseslint.configs.recommended,
16+
{
17+
plugins: {
18+
turbo: turboPlugin,
19+
},
20+
rules: {
21+
"turbo/no-undeclared-env-vars": "warn",
22+
},
23+
},
24+
{
25+
plugins: {
26+
onlyWarn,
27+
},
28+
},
29+
{
30+
ignores: ["dist/**"],
31+
},
32+
];

packages/eslint-config/next.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import js from "@eslint/js";
2+
import eslintConfigPrettier from "eslint-config-prettier";
3+
import tseslint from "typescript-eslint";
4+
import pluginReactHooks from "eslint-plugin-react-hooks";
5+
import pluginReact from "eslint-plugin-react";
6+
import globals from "globals";
7+
import pluginNext from "@next/eslint-plugin-next";
8+
import { config as baseConfig } from "./base.js";
9+
10+
/**
11+
* A custom ESLint configuration for libraries that use Next.js.
12+
*
13+
* @type {import("eslint").Linter.Config}
14+
* */
15+
export const nextJsConfig = [
16+
...baseConfig,
17+
js.configs.recommended,
18+
eslintConfigPrettier,
19+
...tseslint.configs.recommended,
20+
{
21+
...pluginReact.configs.flat.recommended,
22+
languageOptions: {
23+
...pluginReact.configs.flat.recommended.languageOptions,
24+
globals: {
25+
...globals.serviceworker,
26+
},
27+
},
28+
},
29+
{
30+
plugins: {
31+
"@next/next": pluginNext,
32+
},
33+
rules: {
34+
...pluginNext.configs.recommended.rules,
35+
...pluginNext.configs["core-web-vitals"].rules,
36+
},
37+
},
38+
{
39+
plugins: {
40+
"react-hooks": pluginReactHooks,
41+
},
42+
settings: { react: { version: "detect" } },
43+
rules: {
44+
...pluginReactHooks.configs.recommended.rules,
45+
// React scope no longer necessary with new JSX transform.
46+
"react/react-in-jsx-scope": "off",
47+
},
48+
},
49+
];
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "@repo/eslint-config",
3+
"version": "0.0.0",
4+
"type": "module",
5+
"private": true,
6+
"exports": {
7+
"./base": "./base.js",
8+
"./next-js": "./next.js",
9+
"./react-internal": "./react-internal.js"
10+
},
11+
"devDependencies": {
12+
"@next/eslint-plugin-next": "^15",
13+
"@typescript-eslint/eslint-plugin": "^8.15.0",
14+
"@typescript-eslint/parser": "^8.15.0",
15+
"eslint": "^9.15.0",
16+
"eslint-config-prettier": "^9.1.0",
17+
"eslint-plugin-only-warn": "^1.1.0",
18+
"eslint-plugin-react": "^7.37.2",
19+
"eslint-plugin-react-hooks": "^5.0.0",
20+
"eslint-plugin-turbo": "^2.3.0",
21+
"globals": "^15.12.0",
22+
"typescript": "^5.3.3",
23+
"typescript-eslint": "^8.15.0"
24+
}
25+
}

0 commit comments

Comments
 (0)