Skip to content

Commit

Permalink
feat: sync staging → main
Browse files Browse the repository at this point in the history
Signed-off-by: Griko Nibras <[email protected]>
  • Loading branch information
grikomsn committed Nov 30, 2023
2 parents a22908f + 41beb13 commit db9f5d3
Show file tree
Hide file tree
Showing 42 changed files with 1,424 additions and 411 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ NEXT_PUBLIC_API_URL=https://api.skip.money

# development API
# NEXT_PUBLIC_API_URL=https://solve-dev.skip.money

POLKACHU_USER=
POLKACHU_PASSWORD=
27 changes: 19 additions & 8 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,26 @@
"extends": [
"next/core-web-vitals",
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"plugin:@tanstack/eslint-plugin-query/recommended"
"plugin:@tanstack/eslint-plugin-query/recommended",
"plugin:prettier/recommended"
],
"plugins": ["@typescript-eslint", "prettier", "simple-import-sort"],
"parser": "@typescript-eslint/parser",
"plugins": ["simple-import-sort"],
"rules": {
"simple-import-sort/imports": "warn",
"@next/next/no-img-element": "off",
"simple-import-sort/exports": "warn",
"@next/next/no-img-element": "off"
}
"simple-import-sort/imports": "warn"
},
"ignorePatterns": ["node_modules/", ".next/", "out/", "src/chains/"],
"overrides": [
{
"files": ["*.ts", "*.tsx"],
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"]
}
],
"root": true
}
18 changes: 0 additions & 18 deletions .github/workflows/branches.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Deploy (dev.ibc.fun)
on:
push:
branches: [main]
repository_dispatch:
types: [deploy-dev]
workflow_dispatch:

jobs:
sync:
runs-on: ubuntu-latest
steps:
- id: checkout
name: Checkout
uses: actions/checkout@v3
with:
ref: dev

- id: pull-main
name: Pull latest 'main'
run: git pull origin main

- id: diff-check
name: Check if 'dev' is behind 'main'
run: git diff --exit-code origin/main

- id: fast-forward
if: steps.diff-check.outcome == 'failure'
name: Fast forward 'main' → 'dev'
run: git merge --ff-only origin/main

- id: push-dev
if: steps.diff-check.outcome == 'failure'
name: Push latest 'dev'
run: git push --set-upstream origin dev
59 changes: 18 additions & 41 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,47 +1,24 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

.DS_Store
.env*
!.env.example

src/chains/
tests/downloads/

# dependencies
/node_modules
/.pnp
.next
.pnp
.pnp.js

# testing
/coverage

# 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

# vercel
.sentryclirc
.turbo
.vercel

# typescript
.vscode
*.log
*.pem
*.tsbuildinfo
build
coverage
next-env.d.ts
/test-results/
/playwright-report/
/playwright/.cache/
node_modules
out
playwright-report
playwright/.cache/
src/chains/
test-results/
tests/downloads/

# Sentry Config File
.sentryclirc
!.env.example
2 changes: 1 addition & 1 deletion chain-registry
Submodule chain-registry updated 127 files
3 changes: 3 additions & 0 deletions env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
declare namespace NodeJS {
interface ProcessEnv {
readonly APP_URL?: string;
readonly NEXT_PUBLIC_API_URL?: string;
readonly POLKACHU_USER?: string;
readonly POLKACHU_PASSWORD?: string;
}
}
3 changes: 3 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./tsconfig.json"
}
48 changes: 39 additions & 9 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
/* eslint-disable @typescript-eslint/no-var-requires */
/// <reference path="./env.d.ts" />
/// <reference path="./vercel.d.ts" />

const APP_URL =
process.env.APP_URL ||
(process.env.VERCEL && `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`) ||
`${process.env.PROTOCOL || "http"}://${process.env.HOST || "localhost"}:${
process.env.PORT || 3000
}`;

/**
* @type {import('next').NextConfig}
* @see https://nextjs.org/docs/pages/api-reference/next-config-js
*/
let nextConfig = {
productionBrowserSourceMaps: true,
rewrites: async () => {
return [
{
source: "/nodes/:chainID/:path*",
destination: "/api/proxy",
},
];
env: {
APP_URL,
},
eslint: {
ignoreDuringBuilds: Boolean(process.env.VERCEL),
},
productionBrowserSourceMaps: true,
rewrites: async () => [],
transpilePackages:
process.env.NODE_ENV === "test"
? [
Expand All @@ -38,6 +45,10 @@ let nextConfig = {
"uuid",
]
: [],
webpack: (config, { dev, isServer }) => {
if (dev && isServer) checkEnv();
return config;
},
};

/** @see https://docs.sentry.io/platforms/javascript/guides/nextjs */
Expand Down Expand Up @@ -69,3 +80,22 @@ const sentryOptions = {
nextConfig = withSentryConfig(nextConfig, sentryWebpackConfig, sentryOptions);

module.exports = nextConfig;

function checkEnv() {
if (checkEnv.once) return;

const log = require("next/dist/build/output/log");

if (!process.env.NEXT_PUBLIC_API_URL) {
log.warn(
'env NEXT_PUBLIC_API_URL is not set, using SKIP_API_URL from "@skip-router/core"',
);
}
if (!process.env.POLKACHU_USER || !process.env.POLKACHU_PASSWORD) {
log.warn(
"env POLKACHU_USER or POLKACHU_PASSWORD is not set, /nodes/[chainID] will not work",
);
}

checkEnv.once = true;
}
Loading

1 comment on commit db9f5d3

@vercel
Copy link

@vercel vercel bot commented on db9f5d3 Nov 30, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.