Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .github/workflows/publish-dapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,16 @@ jobs:
cache: 'yarn'
- name: Install npm dependencies
run: yarn --immutable
- name: Set snap origin
run: |
echo GATSBY_SNAP_ORIGIN=npm:@metamask/${{ github.event.repository.name }}-snap >> .env.production
- name: Run build script
run: yarn build
env:
GATSBY_PATH_PREFIX: ${{ github.event.repository.name }}/${{ inputs.destination_dir }}/
SNAP_ORIGIN: npm:@metamask/${{ github.event.repository.name }}-snap
PATH_PREFIX: ${{ github.event.repository.name }}/${{ inputs.destination_dir }}/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now used by webpack! See webpack.config.js

- name: Deploy to `${{ inputs.destination_dir }}` directory of `gh-pages` branch
uses: peaceiris/actions-gh-pages@de7ea6f8efb354206b205ef54722213d99067935
with:
# This `PUBLISH_DOCS_TOKEN` needs to be manually set per-repository.
# Look in the repository settings under "Environments", and set this token in the `github-pages` environment.
personal_token: ${{ secrets.PUBLISH_DOCS_TOKEN }}
publish_dir: ./packages/site/public
publish_dir: ./packages/site/dist
destination_dir: ${{ inputs.destination_dir }}
3 changes: 0 additions & 3 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ jobs:
with:
path: |
./packages/*/dist
./packages/*/public
./node_modules/.yarn-state.yml
key: ${{ github.sha }}

Expand All @@ -51,7 +50,6 @@ jobs:
with:
path: |
./packages/*/dist
./packages/*/public
./node_modules/.yarn-state.yml
key: ${{ github.sha }}
- name: Dry Run Publish
Expand All @@ -76,7 +74,6 @@ jobs:
with:
path: |
./packages/*/dist
./packages/*/public
./node_modules/.yarn-state.yml
key: ${{ github.sha }}
- name: Publish
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ organization, you probably want to run `./scripts/cleanup.sh` to remove some
files that will not work properly outside the MetaMask GitHub organization.

Note that the `action-publish-release.yml` workflow contains a step that
publishes the frontend of this snap (contained in the `public/` directory) to
publishes the frontend of this snap (contained in the `dist/` directory) to
GitHub pages. If you do not want to publish the frontend to GitHub pages,
simply remove the step named "Publish to GitHub Pages" in that workflow.

Expand Down
9 changes: 2 additions & 7 deletions packages/site/.depcheckrc.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{
"ignore-patterns": [".cache/"],
"ignores": [
"@metamask/auto-changelog",
"@svgr/webpack",
"gatsby-plugin-*",
"react-scripts"
]
"ignore-patterns": ["dist/", "public/", ".cache/"],
"ignores": ["@swc/core", "webpack-cli", "webpack-dev-server"]
}
1 change: 0 additions & 1 deletion packages/site/.env.production

This file was deleted.

2 changes: 1 addition & 1 deletion packages/site/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
extends: ['../../.eslintrc.js'],

ignorePatterns: ['!.eslintrc.js', '.cache/', 'public/'],
ignorePatterns: ['!.eslintrc.js', 'dist/'],
};
3 changes: 1 addition & 2 deletions packages/site/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
.cache/
public/
dist/
48 changes: 12 additions & 36 deletions packages/site/README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,19 @@
# TypeScript Example Snap Front-end
# Simple Snap Keyring Site

This project was bootstrapped with [Gatsby](https://www.gatsbyjs.com/).
This package contains the browser UI used to install and test the Simple Snap
Keyring snap.

## Available Scripts
## Scripts

In the project directory, you can run:
`yarn start` runs the Webpack dev server at
[http://localhost:8000](http://localhost:8000).

### `yarn start`
`yarn build` creates a production build in `dist/`.

Runs the app in the development mode.\
Open [http://localhost:8000](http://localhost:8000) to view it in the browser.
## Environment Variables

The page will reload if you make edits.\
You will also see any lint errors in the console.
`SNAP_ORIGIN` defines the snap origin installed by the site. It defaults to
`local:http://localhost:8080`.

### `yarn build`

Builds the app for production to the `public` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://www.gatsbyjs.com/docs/how-to/previews-deploys-hosting/) for more information.

## Environment variables

Gatsby has built-in support for loading environment variables into the browser and Functions. Loading environment variables into Node.js requires a small code snippet.

In development, Gatsby will load environment variables from a file named `.env.development`. For builds, it will load from `.env.production`.

By default you can use the `SNAP_ORIGIN` variable (used in `src/config/snap.ts`) to define a production origin for you snap (eg. `npm:MyPackageName`). If not defined it will defaults to `local:http://localhost:8080`.

A `.env` file template is available, to use it rename `.env.production.dist` to `.env.production`

To learn more visit [Gatsby documentation](https://www.gatsbyjs.com/docs/how-to/local-development/environment-variables/)

## Learn More

You can learn more in the [Gatsby documentation](https://www.gatsbyjs.com/docs/).

To learn React, check out the [React documentation](https://reactjs.org/).
`PATH_PREFIX` defines the public asset prefix for static deployments, such as
GitHub Pages subdirectories.
17 changes: 0 additions & 17 deletions packages/site/gatsby-browser.tsx

This file was deleted.

122 changes: 0 additions & 122 deletions packages/site/gatsby-config.ts

This file was deleted.

26 changes: 0 additions & 26 deletions packages/site/gatsby-node.js

This file was deleted.

15 changes: 0 additions & 15 deletions packages/site/gatsby-ssr.tsx

This file was deleted.

Loading
Loading