Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move
test-snaps
site to this repository (#1549)
* Add test-snaps site * Move files around and fix some breaking changes * Add license and update changelog * Remove SCSS in favour of CSS * Fix some issues with snaps * Deploy test-snaps to GitHub Pages on release * Fix secrets name * Update icon * Use publish_dir in action * Use icon without padding * Fix Rollup watch command * Fix BIP-44 snap invalid coin type * Fix copy issues * Fix workflow file * Remove unused workflow file * Add basic README * Update LavaMoat policies * Pin eslint-plugin-import to 2.26.0 as workaround for regression import-js/eslint-plugin-import#2775 * Revert "Pin eslint-plugin-import to 2.26.0 as workaround for regression" This reverts commit 457d6fa. * Swap out Gatsby for plain Webpack * Build test-snaps in CI * Revert some changes to yarn.lock * Update LavaMoat policies * Fix lint issues * Update snap shasums * Fix verify-tsconfig script * Fix workflow name * Fix `@metamask/providers` version * Revert change to .yarnrc.yml * Fix `@metamask/providers` version again
- Loading branch information
Showing
111 changed files
with
3,840 additions
and
32 deletions.
There are no files selected for viewing
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
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,49 @@ | ||
name: Publish to GitHub Pages | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
build_script: | ||
required: true | ||
type: string | ||
destination_dir: | ||
required: true | ||
type: string | ||
publish_dir: | ||
required: true | ||
type: string | ||
secrets: | ||
PUBLISH_PAGES_TOKEN: | ||
required: true | ||
|
||
jobs: | ||
publish-environment: | ||
name: Publish to GitHub Pages | ||
runs-on: ubuntu-latest | ||
environment: github-pages | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Ensure `build_script` is not empty | ||
if: ${{ inputs.destination_dir == '' }} | ||
run: exit 1 | ||
- name: Ensure `destination_dir` is not empty | ||
if: ${{ inputs.destination_dir == '' }} | ||
run: exit 1 | ||
- name: Ensure `publish_dir` is not empty | ||
if: ${{ inputs.publish_dir == '' }} | ||
run: exit 1 | ||
- uses: actions/checkout@v3 | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: '.nvmrc' | ||
- run: yarn --immutable | ||
- name: Run build script | ||
run: ${{ inputs.build_script }} | ||
- name: Deploy to `${{ inputs.destination_dir }}` directory of `gh-pages` branch | ||
uses: peaceiris/actions-gh-pages@de7ea6f8efb354206b205ef54722213d99067935 | ||
with: | ||
personal_token: ${{ secrets.PUBLISH_PAGES_TOKEN }} | ||
publish_dir: ${{ inputs.publish_dir }} | ||
destination_dir: ${{ inputs.destination_dir }} |
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
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
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
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
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,7 @@ | ||
module.exports = { | ||
extends: ['../../.eslintrc.js'], | ||
|
||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
}, | ||
}; |
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,14 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/swcrc", | ||
"jsc": { | ||
"parser": { | ||
"syntax": "typescript", | ||
"tsx": true | ||
}, | ||
"transform": { | ||
"react": { | ||
"runtime": "automatic" | ||
} | ||
} | ||
} | ||
} |
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,9 @@ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
[Unreleased]: https://github.com/MetaMask/snaps/ |
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,15 @@ | ||
ISC License | ||
|
||
Copyright (c) 2023 MetaMask | ||
|
||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted, provided that the above | ||
copyright notice and this permission notice appear in all copies. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
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,5 @@ | ||
# `@metamask/test-snaps` | ||
|
||
The test snaps website for MetaMask Snaps, used for (automated) end-to-end | ||
testing. The test snaps website is a simple static website, containing a way to | ||
interact with [the example snaps](../examples), to test their functionality. |
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,14 @@ | ||
const deepmerge = require('deepmerge'); | ||
|
||
const baseConfig = require('../../jest.config.base'); | ||
|
||
module.exports = deepmerge(baseConfig, { | ||
coverageThreshold: { | ||
global: { | ||
branches: 0, | ||
functions: 0, | ||
lines: 0, | ||
statements: 0, | ||
}, | ||
}, | ||
}); |
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,89 @@ | ||
{ | ||
"name": "@metamask/test-snaps", | ||
"version": "0.35.2-flask.1", | ||
"private": true, | ||
"description": "The test snaps website for MetaMask Snaps, used for end-to-end testing.", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/MetaMask/snaps.git" | ||
}, | ||
"license": "ISC", | ||
"sideEffects": false, | ||
"files": [], | ||
"scripts": { | ||
"test": "jest --passWithNoTests && yarn posttest", | ||
"posttest": "jest-it-up", | ||
"test:ci": "yarn test", | ||
"start": "yarn workspaces foreach --parallel --verbose --interlaced --all --include \"@metamask/test-snaps\" --include \"@metamask/example-snaps\" run start:test", | ||
"start:test": "cross-env NODE_ENV=development webpack serve", | ||
"build": "cross-env NODE_ENV=production webpack", | ||
"build:clean": "yarn clean && yarn build", | ||
"build:post-tsc": "yarn build", | ||
"clean": "rimraf 'dist'", | ||
"lint:eslint": "eslint . --cache --ext js,ts,jsx,tsx", | ||
"lint:misc": "prettier --no-error-on-unmatched-pattern --loglevel warn \"**/*.json\" \"**/*.md\" \"**/*.html\" \"!CHANGELOG.md\" --ignore-path ../../.gitignore", | ||
"lint": "yarn lint:eslint && yarn lint:misc --check && yarn lint:changelog", | ||
"lint:ci": "yarn lint", | ||
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write", | ||
"lint:changelog": "yarn auto-changelog validate" | ||
}, | ||
"dependencies": { | ||
"@metamask/snaps-utils": "workspace:^", | ||
"@metamask/utils": "^6.0.1", | ||
"@popperjs/core": "^2.11.8", | ||
"@reduxjs/toolkit": "^1.9.5", | ||
"bootstrap": "^5.2.2", | ||
"gl-matrix": "^3.4.3", | ||
"react": "^18.2.0", | ||
"react-bootstrap": "^2.5.0", | ||
"react-dom": "^18.2.0", | ||
"react-redux": "^8.0.5", | ||
"simplex-noise": "^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"@metamask/auto-changelog": "^3.1.0", | ||
"@metamask/eslint-config": "^11.0.0", | ||
"@metamask/eslint-config-jest": "^11.0.0", | ||
"@metamask/eslint-config-nodejs": "^11.0.1", | ||
"@metamask/eslint-config-typescript": "^11.0.0", | ||
"@metamask/providers": "^11.0.0", | ||
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10", | ||
"@swc/core": "^1.3.66", | ||
"@swc/jest": "^0.2.26", | ||
"@types/jest": "^27.5.1", | ||
"@types/node": "^20.3.1", | ||
"@types/webpack-env": "^1.18.1", | ||
"@typescript-eslint/eslint-plugin": "^5.42.1", | ||
"@typescript-eslint/parser": "^5.42.1", | ||
"copy-webpack-plugin": "^11.0.0", | ||
"cross-env": "^7.0.3", | ||
"css-loader": "^6.7.3", | ||
"deepmerge": "^4.2.2", | ||
"eslint": "^8.27.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-jest": "^27.1.5", | ||
"eslint-plugin-jsdoc": "^39.6.2", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"favicons": "^7.1.2", | ||
"favicons-webpack-plugin": "^6.0.0", | ||
"html-webpack-plugin": "^5.5.0", | ||
"jest": "^29.0.2", | ||
"jest-it-up": "^2.0.0", | ||
"prettier": "^2.7.1", | ||
"rimraf": "^4.1.2", | ||
"style-loader": "^3.3.2", | ||
"swc-loader": "^0.2.3", | ||
"terser-webpack-plugin": "^5.3.9", | ||
"ts-node": "^10.9.1", | ||
"tsconfig-paths-webpack-plugin": "^4.0.1", | ||
"typescript": "~4.8.4", | ||
"webpack": "^5.86.0", | ||
"webpack-cli": "^5.1.4", | ||
"webpack-dev-server": "^4.13.3" | ||
}, | ||
"engines": { | ||
"node": ">=16.0.0" | ||
} | ||
} |
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,23 @@ | ||
import { FunctionComponent } from 'react'; | ||
import { Container, Row } from 'react-bootstrap'; | ||
|
||
import { Logo } from './components'; | ||
import { InstalledSnaps, snaps } from './features'; | ||
|
||
export const App: FunctionComponent = () => { | ||
return ( | ||
<Container fluid> | ||
<Logo /> | ||
|
||
<Row className="gx-3 gy-3 row-cols-xs-1 row-cols-sm-2 row-cols-lg-3"> | ||
{/* Installed Snaps list */} | ||
<InstalledSnaps /> | ||
|
||
{/* Snap test UI */} | ||
{Object.values(snaps).map((Component, index) => ( | ||
<Component key={`snap-${index}`} /> | ||
))} | ||
</Row> | ||
</Container> | ||
); | ||
}; |
Oops, something went wrong.