From 0f5353928c70b5045b6b59a9ad99736fa5b48485 Mon Sep 17 00:00:00 2001 From: Maksym Date: Tue, 19 Mar 2024 15:13:03 +0200 Subject: [PATCH 1/2] Remove site package (#42) * Remove site package * Update changelog --- CHANGELOG.md | 3 + packages/site/.env.production.dist | 1 - packages/site/.eslintrc.js | 14 - packages/site/README.md | 43 - packages/site/gatsby-browser.tsx | 16 - packages/site/gatsby-config.ts | 23 - packages/site/gatsby-node.js | 21 - packages/site/gatsby-ssr.tsx | 14 - packages/site/package.json | 71 - packages/site/src/App.tsx | 33 - packages/site/src/Root.tsx | 32 - packages/site/src/assets/flask_fox.svg | 123 - packages/site/src/assets/logo.svg | 3 - packages/site/src/assets/metamask_fox.svg | 31 - packages/site/src/components/Buttons.tsx | 128 - packages/site/src/components/Card.tsx | 59 - packages/site/src/components/Footer.tsx | 47 - packages/site/src/components/Header.tsx | 89 - packages/site/src/components/MetaMask.tsx | 42 - packages/site/src/components/PoweredBy.tsx | 14 - packages/site/src/components/SnapLogo.tsx | 14 - packages/site/src/components/Toggle.tsx | 120 - packages/site/src/components/index.ts | 8 - packages/site/src/config/index.ts | 1 - packages/site/src/config/snap.ts | 6 - packages/site/src/config/theme.ts | 186 - packages/site/src/hooks/MetamaskContext.tsx | 132 - packages/site/src/hooks/index.ts | 1 - packages/site/src/pages/index.tsx | 338 - packages/site/src/types/custom.d.ts | 14 - packages/site/src/types/index.ts | 1 - packages/site/src/types/snap.ts | 8 - packages/site/src/types/styled.d.ts | 19 - packages/site/src/utils/button.ts | 6 - packages/site/src/utils/index.ts | 5 - packages/site/src/utils/localStorage.ts | 33 - packages/site/src/utils/metamask.ts | 17 - packages/site/src/utils/snap.ts | 79 - packages/site/src/utils/theme.ts | 27 - packages/site/static/robots.txt | 3 - packages/site/tsconfig.json | 11 - packages/snap/snap.manifest.json | 2 +- werf.yaml | 5 - yarn.lock | 8123 +------------------ 44 files changed, 423 insertions(+), 9543 deletions(-) delete mode 100644 packages/site/.env.production.dist delete mode 100644 packages/site/.eslintrc.js delete mode 100644 packages/site/README.md delete mode 100644 packages/site/gatsby-browser.tsx delete mode 100644 packages/site/gatsby-config.ts delete mode 100644 packages/site/gatsby-node.js delete mode 100644 packages/site/gatsby-ssr.tsx delete mode 100644 packages/site/package.json delete mode 100644 packages/site/src/App.tsx delete mode 100644 packages/site/src/Root.tsx delete mode 100644 packages/site/src/assets/flask_fox.svg delete mode 100644 packages/site/src/assets/logo.svg delete mode 100644 packages/site/src/assets/metamask_fox.svg delete mode 100644 packages/site/src/components/Buttons.tsx delete mode 100644 packages/site/src/components/Card.tsx delete mode 100644 packages/site/src/components/Footer.tsx delete mode 100644 packages/site/src/components/Header.tsx delete mode 100644 packages/site/src/components/MetaMask.tsx delete mode 100644 packages/site/src/components/PoweredBy.tsx delete mode 100644 packages/site/src/components/SnapLogo.tsx delete mode 100644 packages/site/src/components/Toggle.tsx delete mode 100644 packages/site/src/components/index.ts delete mode 100644 packages/site/src/config/index.ts delete mode 100644 packages/site/src/config/snap.ts delete mode 100644 packages/site/src/config/theme.ts delete mode 100644 packages/site/src/hooks/MetamaskContext.tsx delete mode 100644 packages/site/src/hooks/index.ts delete mode 100644 packages/site/src/pages/index.tsx delete mode 100644 packages/site/src/types/custom.d.ts delete mode 100644 packages/site/src/types/index.ts delete mode 100644 packages/site/src/types/snap.ts delete mode 100644 packages/site/src/types/styled.d.ts delete mode 100644 packages/site/src/utils/button.ts delete mode 100644 packages/site/src/utils/index.ts delete mode 100644 packages/site/src/utils/localStorage.ts delete mode 100644 packages/site/src/utils/metamask.ts delete mode 100644 packages/site/src/utils/snap.ts delete mode 100644 packages/site/src/utils/theme.ts delete mode 100644 packages/site/static/robots.txt delete mode 100644 packages/site/tsconfig.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 733cf0bb..1b01f0c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `@rarimo/rarime`: - `CreateIdentity` - accept `privateKeyHex` optional param for identity creation +### Removed +- `packages/site` package + ## [2.0.3] - 2024-02-06 ### Changed - `@rarimo/rarime`: diff --git a/packages/site/.env.production.dist b/packages/site/.env.production.dist deleted file mode 100644 index 3845350f..00000000 --- a/packages/site/.env.production.dist +++ /dev/null @@ -1 +0,0 @@ -SNAP_ORIGIN= diff --git a/packages/site/.eslintrc.js b/packages/site/.eslintrc.js deleted file mode 100644 index 99910b3f..00000000 --- a/packages/site/.eslintrc.js +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = { - extends: ['../../.eslintrc.js'], - - overrides: [ - { - files: ['**/*.{ts,tsx}'], - rules: { - 'jsdoc/require-jsdoc': 0, - }, - }, - ], - - ignorePatterns: ['!.eslintrc.js', 'build/'], -}; diff --git a/packages/site/README.md b/packages/site/README.md deleted file mode 100644 index 97266227..00000000 --- a/packages/site/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# TypeScript Example Snap Front-end - -This project was bootstrapped with [Gatsby](https://www.gatsbyjs.com/). - -## Available Scripts - -In the project directory, you can run: - -### `yarn start` - -Runs the app in the development mode.\ -Open [http://localhost:3500](http://localhost:3500) to view it in the browser. - -The page will reload if you make edits.\ -You will also see any lint errors in the console. - -### `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:3500`. - -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/). diff --git a/packages/site/gatsby-browser.tsx b/packages/site/gatsby-browser.tsx deleted file mode 100644 index 46d0ff83..00000000 --- a/packages/site/gatsby-browser.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { GatsbyBrowser } from 'gatsby'; -import { StrictMode } from 'react'; -import { App } from './src/App'; -import { Root } from './src/Root'; - -export const wrapRootElement: GatsbyBrowser['wrapRootElement'] = ({ - element, -}) => ( - - {element} - -); - -export const wrapPageElement: GatsbyBrowser['wrapPageElement'] = ({ - element, -}) => {element}; diff --git a/packages/site/gatsby-config.ts b/packages/site/gatsby-config.ts deleted file mode 100644 index 8725dfe7..00000000 --- a/packages/site/gatsby-config.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { GatsbyConfig } from 'gatsby'; - -const config: GatsbyConfig = { - // This is required to make use of the React 17+ JSX transform. - jsxRuntime: 'automatic', - - plugins: [ - 'gatsby-plugin-svgr', - 'gatsby-plugin-styled-components', - { - resolve: 'gatsby-plugin-manifest', - options: { - name: 'Template Snap', - icon: 'src/assets/logo.svg', - theme_color: '#6F4CFF', - background_color: '#FFFFFF', - display: 'standalone', - }, - }, - ], -}; - -export default config; diff --git a/packages/site/gatsby-node.js b/packages/site/gatsby-node.js deleted file mode 100644 index 1a73e6ef..00000000 --- a/packages/site/gatsby-node.js +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable node/no-extraneous-require */ -const webpack = require('webpack'); - -exports.onCreateWebpackConfig = ({ actions }) => { - actions.setWebpackConfig({ - resolve: { - fallback: { - crypto: require.resolve('crypto-browserify'), - buffer: require.resolve('buffer'), - os: false, - stream: false, - }, - }, - plugins: [ - new webpack.ProvidePlugin({ - process: 'process/browser', - Buffer: ['buffer', 'Buffer'], - }), - ], - }); -}; diff --git a/packages/site/gatsby-ssr.tsx b/packages/site/gatsby-ssr.tsx deleted file mode 100644 index e053edc0..00000000 --- a/packages/site/gatsby-ssr.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { GatsbySSR } from 'gatsby'; -import { StrictMode } from 'react'; -import { App } from './src/App'; -import { Root } from './src/Root'; - -export const wrapRootElement: GatsbySSR['wrapRootElement'] = ({ element }) => ( - - {element} - -); - -export const wrapPageElement: GatsbySSR['wrapPageElement'] = ({ element }) => ( - {element} -); diff --git a/packages/site/package.json b/packages/site/package.json deleted file mode 100644 index 09c95675..00000000 --- a/packages/site/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "site", - "version": "2.1.0-rc.3", - "private": true, - "license": "(MIT-0 OR Apache-2.0)", - "scripts": { - "build": "cross-env GATSBY_TELEMETRY_DISABLED=1 gatsby build", - "clean": "rimraf public", - "lint": "yarn lint:eslint && yarn lint:misc --check", - "lint:eslint": "eslint . --cache --ext js,ts", - "lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write", - "lint:misc": "prettier '**/*.json' '**/*.md' '!CHANGELOG.md' --ignore-path .gitignore", - "start": "cross-env GATSBY_TELEMETRY_DISABLED=1 gatsby develop -p 3500" - }, - "browserslist": { - "production": [ - ">0.2%", - "not dead", - "not op_mini all" - ], - "development": [ - "last 1 chrome version", - "last 1 firefox version", - "last 1 safari version" - ] - }, - "dependencies": { - "@metamask/providers": "9.0.0", - "@rarimo/rarime-connector": "workspace:^", - "buffer": "6.0.3", - "process": "0.11.10", - "react": "18.2.0", - "react-dom": "18.2.0", - "react-is": "18.2.0", - "stream-browserify": "3.0.0", - "styled-components": "5.3.3" - }, - "devDependencies": { - "@metamask/eslint-config": "10.0.0", - "@metamask/eslint-config-jest": "10.0.0", - "@metamask/eslint-config-nodejs": "10.0.0", - "@metamask/eslint-config-typescript": "10.0.0", - "@svgr/webpack": "6.4.0", - "@testing-library/dom": "8.17.1", - "@testing-library/jest-dom": "5.16.4", - "@testing-library/react": "13.3.0", - "@testing-library/user-event": "13.5.0", - "@types/jest": "27.5.2", - "@types/react": "18.0.15", - "@types/react-dom": "18.0.6", - "@types/styled-components": "5.1.25", - "@typescript-eslint/eslint-plugin": "5.33.0", - "@typescript-eslint/parser": "5.33.0", - "cross-env": "7.0.3", - "eslint": "8.21.0", - "eslint-config-prettier": "8.1.0", - "eslint-plugin-import": "2.26.0", - "eslint-plugin-jest": "26.8.2", - "eslint-plugin-jsdoc": "39.2.9", - "eslint-plugin-node": "11.1.0", - "eslint-plugin-prettier": "4.2.1", - "gatsby": "4.24.4", - "gatsby-plugin-manifest": "4.24.0", - "gatsby-plugin-styled-components": "5.24.0", - "gatsby-plugin-svgr": "3.0.0-beta.0", - "prettier": "2.2.1", - "prettier-plugin-packagejson": "2.2.18", - "rimraf": "3.0.2", - "typescript": "4.7.4" - } -} diff --git a/packages/site/src/App.tsx b/packages/site/src/App.tsx deleted file mode 100644 index 7e1d1ee1..00000000 --- a/packages/site/src/App.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { FunctionComponent, ReactNode, useContext } from 'react'; -import styled from 'styled-components'; -import { Footer, Header } from './components'; - -import { GlobalStyle } from './config/theme'; -import { ToggleThemeContext } from './Root'; - -const Wrapper = styled.div` - display: flex; - flex-direction: column; - width: 100%; - min-height: 100vh; - max-width: 100vw; -`; - -export type AppProps = { - children: ReactNode; -}; - -export const App: FunctionComponent = ({ children }) => { - const toggleTheme = useContext(ToggleThemeContext); - - return ( - <> - - -
- {children} -