diff --git a/.env.example b/.env.example index 0be8cfa8..f2d82af8 100644 --- a/.env.example +++ b/.env.example @@ -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= diff --git a/.eslintrc.json b/.eslintrc.json index d3d7b492..c7814194 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -2,15 +2,25 @@ "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" + }, + "overrides": [ + { + "files": ["*.ts", "*.tsx"], + "extends": [ + "plugin:@typescript-eslint/recommended", + "plugin:prettier/recommended" + ], + "parser": "@typescript-eslint/parser", + "plugins": ["@typescript-eslint"] + } + ], + "root": true } diff --git a/.gitignore b/.gitignore index 2782dfc9..a4347a26 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/env.d.ts b/env.d.ts index af597ce2..9097b241 100644 --- a/env.d.ts +++ b/env.d.ts @@ -2,5 +2,7 @@ declare namespace NodeJS { interface ProcessEnv { readonly APP_URL?: string; readonly NEXT_PUBLIC_API_URL?: string; + readonly POLKACHU_USER?: string; + readonly POLKACHU_PASSWORD?: string; } } diff --git a/jsconfig.json b/jsconfig.json new file mode 100644 index 00000000..fc8520e7 --- /dev/null +++ b/jsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "./tsconfig.json" +} diff --git a/next.config.js b/next.config.js index f9ad4743..bf552181 100644 --- a/next.config.js +++ b/next.config.js @@ -1,4 +1,5 @@ -/* eslint-disable @typescript-eslint/no-var-requires */ +/// +/// const APP_URL = process.env.APP_URL || @@ -48,6 +49,10 @@ let nextConfig = { "uuid", ] : [], + webpack: (config, { dev, isServer }) => { + if (dev && isServer) checkEnv(); + return config; + }, }; /** @see https://docs.sentry.io/platforms/javascript/guides/nextjs */ @@ -79,3 +84,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; +} diff --git a/package.json b/package.json index 023552f4..d3ba8862 100644 --- a/package.json +++ b/package.json @@ -3,11 +3,11 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "next dev", "build": "next build", + "dev": "next dev", + "lint": "next lint", "postinstall": "git submodule init && git submodule update --remote && tsx ./src/scripts/codegen.ts", "start": "next start", - "lint": "next lint", "test": "jest", "test:e2e": "playwright test --project=chromium" }, diff --git a/tsconfig.json b/tsconfig.json index 3e52c048..24f970dc 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,34 +1,35 @@ { "compilerOptions": { - "target": "es2020", - "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, - "skipLibCheck": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "noEmit": true, "esModuleInterop": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, + "forceConsistentCasingInFileNames": true, + "incremental": true, "isolatedModules": true, "jsx": "preserve", - "incremental": true, + "lib": ["dom", "dom.iterable", "esnext"], + "module": "esnext", + "moduleResolution": "node", + "noEmit": true, + "paths": { + "@/*": ["./src/*"] + }, "plugins": [ { "name": "next" } ], - "paths": { - "@/*": ["./src/*"] - } + "resolveJsonModule": true, + "skipLibCheck": true, + "strict": true, + "target": "es2020" }, + "exclude": ["node_modules"], "include": [ "next-env.d.ts", - "**/*.ts", - "**/*.tsx", ".next/types/**/*.ts", - "window.d.ts" - ], - "exclude": ["node_modules"] + "env.d.ts", + "window.d.ts", + "**/*.ts", + "**/*.tsx" + ] }