Skip to content

Commit 7e7a3ba

Browse files
Initial Commit
0 parents  commit 7e7a3ba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+22863
-0
lines changed

.editorconfig

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

.eslintrc.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
module.exports = {
2+
root: true,
3+
4+
parserOptions: {
5+
sourceType: 'module',
6+
},
7+
8+
extends: ['@metamask/eslint-config'],
9+
10+
overrides: [
11+
{
12+
files: ['*.js'],
13+
extends: ['@metamask/eslint-config-nodejs'],
14+
},
15+
16+
{
17+
files: ['*.ts', '*.tsx'],
18+
extends: ['@metamask/eslint-config-typescript'],
19+
},
20+
21+
{
22+
files: ['*.test.ts', '*.test.js'],
23+
extends: ['@metamask/eslint-config-jest'],
24+
rules: {
25+
'@typescript-eslint/no-shadow': [
26+
'error',
27+
{ allow: ['describe', 'expect', 'it'] },
28+
],
29+
},
30+
},
31+
],
32+
33+
ignorePatterns: [
34+
'!.prettierrc.js',
35+
'**/!.eslintrc.js',
36+
'**/dist*/',
37+
'**/*__GENERATED__*',
38+
'**/build',
39+
'**/public',
40+
'**/.cache',
41+
],
42+
};

.github/CODEOWNERS

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/snaps-devs

.github/dependabot.yml

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://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
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

.github/workflows/build-lint-test.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Build, Lint, and Test
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
prepare:
8+
name: Prepare
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- name: Use Node.js
13+
uses: actions/setup-node@v3
14+
with:
15+
node-version-file: '.nvmrc'
16+
cache: 'yarn'
17+
- name: Install Yarn dependencies
18+
run: yarn --immutable
19+
20+
build:
21+
name: Build
22+
runs-on: ubuntu-latest
23+
needs:
24+
- prepare
25+
steps:
26+
- uses: actions/checkout@v3
27+
- name: Use Node.js
28+
uses: actions/setup-node@v3
29+
with:
30+
node-version-file: '.nvmrc'
31+
cache: 'yarn'
32+
- run: yarn --immutable --immutable-cache
33+
- run: yarn build
34+
- name: Cache snap build
35+
uses: actions/cache@v3
36+
with:
37+
path: ./packages/snap/dist
38+
key: snap-${{ runner.os }}-${{ github.sha }}
39+
- name: Require clean working directory
40+
shell: bash
41+
run: |
42+
if ! git diff --exit-code; then
43+
echo "Working tree dirty at end of job"
44+
exit 1
45+
fi
46+
47+
lint:
48+
name: Lint
49+
runs-on: ubuntu-latest
50+
needs:
51+
- prepare
52+
steps:
53+
- uses: actions/checkout@v3
54+
- name: Use Node.js
55+
uses: actions/setup-node@v3
56+
with:
57+
node-version-file: '.nvmrc'
58+
cache: 'yarn'
59+
- run: yarn --immutable --immutable-cache
60+
- run: yarn lint
61+
- name: Require clean working directory
62+
shell: bash
63+
run: |
64+
if ! git diff --exit-code; then
65+
echo "Working tree dirty at end of job"
66+
exit 1
67+
fi
68+
69+
e2e-test:
70+
name: End-to-end Test
71+
runs-on: ubuntu-latest
72+
needs:
73+
- prepare
74+
- build
75+
steps:
76+
- uses: actions/checkout@v3
77+
- name: Use Node.js
78+
uses: actions/setup-node@v3
79+
with:
80+
node-version-file: '.nvmrc'
81+
cache: 'yarn'
82+
- name: Restore snap build cache
83+
uses: actions/cache@v3
84+
with:
85+
path: ./packages/snap/dist
86+
key: snap-${{ runner.os }}-${{ github.sha }}
87+
- run: yarn install --immutable
88+
- name: Run e2e tests
89+
run: yarn workspace snap run test
90+
- name: Require clean working directory
91+
shell: bash
92+
run: |
93+
if ! git diff --exit-code; then
94+
echo "Working tree dirty at end of job"
95+
exit 1
96+
fi

.github/workflows/main.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Main
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
jobs:
9+
check-workflows:
10+
name: Check workflows
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Download actionlint
15+
id: download-actionlint
16+
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/7fdc9630cc360ea1a469eed64ac6d78caeda1234/scripts/download-actionlint.bash) 1.6.23
17+
shell: bash
18+
- name: Check workflow files
19+
run: ${{ steps.download-actionlint.outputs.executable }} -color
20+
shell: bash
21+
22+
build-lint-test:
23+
name: Build, lint, and test
24+
uses: ./.github/workflows/build-lint-test.yml
25+
26+
all-jobs-completed:
27+
name: All jobs completed
28+
runs-on: ubuntu-latest
29+
needs:
30+
- check-workflows
31+
- build-lint-test
32+
outputs:
33+
PASSED: ${{ steps.set-output.outputs.PASSED }}
34+
steps:
35+
- name: Set PASSED output
36+
id: set-output
37+
run: echo "PASSED=true" >> "$GITHUB_OUTPUT"
38+
39+
all-jobs-pass:
40+
name: All jobs pass
41+
if: ${{ always() }}
42+
runs-on: ubuntu-latest
43+
needs: all-jobs-completed
44+
steps:
45+
- name: Check that all jobs have passed
46+
run: |
47+
passed="${{ needs.all-jobs-completed.outputs.PASSED }}"
48+
if [[ $passed != "true" ]]; then
49+
exit 1
50+
fi

.gitignore

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
.DS_Store
2+
dist/
3+
build/
4+
coverage/
5+
.cache/
6+
public/
7+
8+
# Logs
9+
logs
10+
*.log
11+
npm-debug.log*
12+
yarn-debug.log*
13+
yarn-error.log*
14+
lerna-debug.log*
15+
16+
# Diagnostic reports (https://nodejs.org/api/report.html)
17+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
18+
19+
# Runtime data
20+
pids
21+
*.pid
22+
*.seed
23+
*.pid.lock
24+
25+
# Coverage directory used by tools like istanbul
26+
coverage
27+
*.lcov
28+
29+
# nyc test coverage
30+
.nyc_output
31+
32+
# node-waf configuration
33+
.lock-wscript
34+
35+
# Compiled binary addons (https://nodejs.org/api/addons.html)
36+
build/Release
37+
38+
# Dependency directories
39+
node_modules/
40+
41+
# TypeScript cache
42+
*.tsbuildinfo
43+
44+
# Optional npm cache directory
45+
.npm
46+
47+
# Optional eslint cache
48+
.eslintcache
49+
50+
# Microbundle cache
51+
.rpt2_cache/
52+
.rts2_cache_cjs/
53+
.rts2_cache_es/
54+
.rts2_cache_umd/
55+
56+
# Optional REPL history
57+
.node_repl_history
58+
59+
# Output of 'npm pack'
60+
*.tgz
61+
62+
# Yarn Integrity file
63+
.yarn-integrity
64+
65+
# dotenv environment variables file
66+
.env
67+
.env.test
68+
69+
# Stores VSCode versions used for testing VSCode extensions
70+
.vscode-test
71+
72+
# yarn v2
73+
.yarn/cache
74+
.yarn/unplugged
75+
.yarn/build-state.yml
76+
.yarn/install-state.gz
77+
.pnp.*

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lts/*

.prettierrc.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// All of these are defaults except singleQuote, but we specify them
2+
// for explicitness
3+
module.exports = {
4+
quoteProps: 'as-needed',
5+
singleQuote: true,
6+
tabWidth: 2,
7+
trailingComma: 'all',
8+
};

.vscode/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"json.schemas": [
3+
{
4+
"fileMatch": ["snap.manifest.json"],
5+
"url": "https://raw.githubusercontent.com/MetaMask/SIPs/main/assets/sip-9/snap.manifest.schema.json"
6+
}
7+
]
8+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* eslint-disable */
2+
//prettier-ignore
3+
module.exports = {
4+
name: "@yarnpkg/plugin-allow-scripts",
5+
factory: function (require) {
6+
var plugin=(()=>{var l=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var p=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(o,e)=>(typeof require<"u"?require:o)[e]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var u=(t,o)=>{for(var e in o)l(t,e,{get:o[e],enumerable:!0})},f=(t,o,e,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of a(o))!c.call(t,i)&&i!==e&&l(t,i,{get:()=>o[i],enumerable:!(r=s(o,i))||r.enumerable});return t};var m=t=>f(l({},"__esModule",{value:!0}),t);var g={};u(g,{default:()=>d});var n=p("@yarnpkg/shell"),x={hooks:{afterAllInstalled:async()=>{let t=await(0,n.execute)("yarn run allow-scripts");t!==0&&process.exit(t)}}},d=x;return m(g);})();
7+
return plugin;
8+
}
9+
};

.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

Lines changed: 28 additions & 0 deletions
Large diffs are not rendered by default.

.yarn/releases/yarn-3.2.1.cjs

Lines changed: 786 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
enableScripts: false
2+
3+
enableTelemetry: 0
4+
5+
logFilters:
6+
- code: YN0004
7+
level: discard
8+
9+
nodeLinker: node-modules
10+
11+
plugins:
12+
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
13+
spec: '@yarnpkg/plugin-workspace-tools'
14+
- path: .yarn/plugins/@yarnpkg/plugin-allow-scripts.cjs
15+
spec: 'https://raw.githubusercontent.com/LavaMoat/LavaMoat/main/packages/yarn-plugin-allow-scripts/bundles/@yarnpkg/plugin-allow-scripts.js'
16+
17+
yarnPath: .yarn/releases/yarn-3.2.1.cjs

0 commit comments

Comments
 (0)