Skip to content

Commit

Permalink
Create playground (#12)
Browse files Browse the repository at this point in the history
* feat: add playground
  • Loading branch information
Jeday authored Aug 30, 2023
1 parent 324b323 commit 0a49836
Show file tree
Hide file tree
Showing 98 changed files with 9,210 additions and 907 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16
cache: "yarn"
cache: 'yarn'

- name: Install dependencies
run: yarn --frozen-lockfile

- name: Build
run: yarn build

env:
RPC_PROVIDER_URL_1: ${{ vars.RPC_PROVIDER_URL_1 }}
RPC_PROVIDER_URL_5: ${{ vars.RPC_PROVIDER_URL_5 }}
WALLETCONNECT_PROJECT_ID: ${{ vars.WALLETCONNECT_PROJECT_ID }}
- name: Check types
run: yarn types

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16
cache: "yarn"
cache: 'yarn'

- name: Install dependencies
run: yarn --frozen-lockfile

- name: Build
run: yarn build
run: yarn build:packages

- name: Authenticate in npm
run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
Expand Down
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"useTabs": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all"
}
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
"ethereum"
],
"scripts": {
"dev": "yarn playground:dev",
"w-info": "yarn workspaces info",
"build": "yarn workspaces foreach -pt run build",
"build:packages": "yarn workspaces foreach --no-private run build",
"types": "yarn workspaces foreach -pt run types",
"test": "yarn workspaces foreach -pt run test",
"prepare": "husky install"
Expand Down Expand Up @@ -43,7 +45,8 @@
"typescript": "^5.1.6"
},
"workspaces": [
"packages/*"
"packages/*",
"playground"
],
"release": {
"branches": [
Expand Down
44 changes: 44 additions & 0 deletions playground/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# generated
/generated

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local

# vercel
.vercel

# git
.git
**/.github

#ide
.vscode
15 changes: 15 additions & 0 deletions playground/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

# Public rpc urls
RPC_PROVIDER_URL_1 = https://rpc.ankr.com/eth
RPC_PROVIDER_URL_5 = https://rpc.ankr.com/eth_goerli

# supported networks for connecting wallet
SUPPORTED_CHAINS=1,5

# this chain uses when a wallet is not connected
DEFAULT_CHAIN=5

# WalletConnect project ID
WALLETCONNECT_PROJECT_ID=

ANALYZE_BUNDLE=false
15 changes: 15 additions & 0 deletions playground/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# dependencies
/node_modules
/.pnp

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

/public
6 changes: 6 additions & 0 deletions playground/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": ["../.eslintrc.base.json"],
"parserOptions": {
"project": "./playground/tsconfig.json"
}
}
39 changes: 39 additions & 0 deletions playground/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# generated
/generated

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
tsconfig.tsbuildinfo

# env
.env.local
.env.production
.env.development

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

#ide
.vscode
.idea

/public/runtime/
13 changes: 13 additions & 0 deletions playground/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# dependencies
/node_modules
/.pnp

# testing
/coverage

# next.js
/.next/
/out/

# production
/build
38 changes: 38 additions & 0 deletions playground/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# build env
FROM node:16-alpine as build

WORKDIR /app

RUN apk add --no-cache git=2.36.3-r0
COPY package.json yarn.lock ./

RUN yarn install --frozen-lockfile --non-interactive --ignore-scripts && yarn cache clean

COPY . .
RUN NODE_NO_BUILD_DYNAMICS=true yarn build
# public/runtime is used to inject runtime vars; it should exist and user node should have write access there for it
RUN rm -rf /app/public/runtime && mkdir /app/public/runtime && chown node /app/public/runtime

# final image
FROM node:16-alpine as base

ARG BASE_PATH=""
ARG SUPPORTED_CHAINS="1"
ARG DEFAULT_CHAIN="1"

ENV NEXT_TELEMETRY_DISABLED=1 \
BASE_PATH=$BASE_PATH \
SUPPORTED_CHAINS=$SUPPORTED_CHAINS \
DEFAULT_CHAIN=$DEFAULT_CHAIN

WORKDIR /app
RUN apk add --no-cache curl=7.83.1-r4
COPY --from=build /app /app

USER node
EXPOSE 3000

HEALTHCHECK --interval=10s --timeout=3s \
CMD curl -f http://localhost:3000/api/health || exit 1

CMD ["yarn", "start"]
7 changes: 7 additions & 0 deletions playground/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Lido Ethereum SDK Playground

This is playground for SDK development and testing build as Next.js app.

- fill `.env.local` as per `.env.example`
- `yarn install`
- `yarn dev` to launch dev app
14 changes: 14 additions & 0 deletions playground/additional.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/// <reference types="@lidofinance/theme" />
/// <reference types="styled-components/cssprop" />

declare module '*.svg' {
import React = require('react');
export const ReactComponent: React.SFC<React.SVGProps<SVGSVGElement>>;
const src: string;
export default src;
}

type RuntimeConfig = {
basePath?: string;
apiProviderUrls?: Record<number, string>;
};
4 changes: 4 additions & 0 deletions playground/build-info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"branch": "REPLACE_WITH_BRANCH",
"commit": "REPLACE_WITH_COMMIT"
}
Loading

0 comments on commit 0a49836

Please sign in to comment.