Skip to content

Commit

Permalink
Fix build, packages sync, pnpm support
Browse files Browse the repository at this point in the history
  • Loading branch information
zeekay committed Jul 16, 2024
1 parent 992e708 commit a1c53af
Show file tree
Hide file tree
Showing 9 changed files with 646 additions and 16,419 deletions.
6 changes: 3 additions & 3 deletions instrumentation.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ const sdk = new NodeSDK({
[SemanticResourceAttributes.SERVICE_NAME]: 'blockscout_frontend',
[SemanticResourceAttributes.SERVICE_VERSION]: process.env.NEXT_PUBLIC_GIT_TAG || process.env.NEXT_PUBLIC_GIT_COMMIT_SHA || 'unknown_version',
[SemanticResourceAttributes.SERVICE_INSTANCE_ID]:
process.env.NEXT_PUBLIC_APP_INSTANCE ||
process.env.NEXT_PUBLIC_APP_HOST?.replace('.blockscout.com', '').replaceAll('-', '_') ||
'unknown_app',
process.env.NEXT_PUBLIC_APP_INSTANCE ||
process.env.NEXT_PUBLIC_APP_HOST?.replace('.blockscout.com', '').replaceAll('-', '_') ||
'unknown_app',
}),
spanProcessor: new SimpleSpanProcessor(traceExporter),
traceExporter,
Expand Down
40 changes: 35 additions & 5 deletions nextjs/nextjs-routes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

// prettier-ignore
declare module "nextjs-routes" {
import type {
GetServerSidePropsContext as NextGetServerSidePropsContext,
GetServerSidePropsResult as NextGetServerSidePropsResult
} from "nextjs";

export type Route =
| StaticRoute<"/404">
| StaticRoute<"/account/api-key">
Expand Down Expand Up @@ -80,6 +85,33 @@ declare module "nextjs-routes" {
* route({ pathname: "/foos/[foo]", query: { foo: "bar" }}) will produce "/foos/bar".
*/
export declare function route(r: Route): string;

/**
* Nearly identical to GetServerSidePropsContext from next, but further narrows
* types based on nextjs-route's route data.
*/
export type GetServerSidePropsContext<
Pathname extends Route["pathname"] = Route["pathname"],
Preview extends NextGetServerSidePropsContext["previewData"] = NextGetServerSidePropsContext["previewData"]
> = Omit<NextGetServerSidePropsContext, 'params' | 'query' | 'defaultLocale' | 'locale' | 'locales'> & {
params: Extract<Route, { pathname: Pathname }>["query"];
query: Query;
defaultLocale?: undefined;
locale?: Locale;
locales?: undefined;
};

/**
* Nearly identical to GetServerSideProps from next, but further narrows
* types based on nextjs-route's route data.
*/
export type GetServerSideProps<
Props extends { [key: string]: any } = { [key: string]: any },
Pathname extends Route["pathname"] = Route["pathname"],
Preview extends NextGetServerSideProps["previewData"] = NextGetServerSideProps["previewData"]
> = (
context: GetServerSidePropsContext<Pathname, Preview>
) => Promise<NextGetServerSidePropsResult<Props>>
}

// prettier-ignore
Expand All @@ -94,13 +126,12 @@ declare module "next/link" {
} from "react";
export * from "next/dist/client/link";

type Query = { query?: { [key: string]: string | string[] | undefined } };
type StaticRoute = Exclude<Route, { query: any }>["pathname"];

export interface LinkProps
extends Omit<NextLinkProps, "href" | "locale">,
AnchorHTMLAttributes<HTMLAnchorElement> {
href: Route | StaticRoute | Query;
href: Route | StaticRoute | Omit<Route, "pathname">
locale?: false;
}

Expand Down Expand Up @@ -128,7 +159,6 @@ declare module "next/router" {

type NextTransitionOptions = NonNullable<Parameters<Router["push"]>[2]>;
type StaticRoute = Exclude<Route, { query: any }>["pathname"];
type Query = { query?: { [key: string]: string | string[] | undefined } };

interface TransitionOptions extends Omit<NextTransitionOptions, "locale"> {
locale?: false;
Expand All @@ -150,12 +180,12 @@ declare module "next/router" {
locale?: Locale;
locales?: undefined;
push(
url: Route | StaticRoute | Query,
url: Route | StaticRoute | Omit<Route, "pathname">,
as?: string,
options?: TransitionOptions
): Promise<boolean>;
replace(
url: Route | StaticRoute | Query,
url: Route | StaticRoute | Omit<Route, "pathname">,
as?: string,
options?: TransitionOptions
): Promise<boolean>;
Expand Down
20 changes: 15 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,27 @@
"favicon:generate:dev": "./tools/scripts/favicon-generator.dev.sh"
},
"dependencies": {
"@chakra-ui/anatomy": "^2.2.2",
"@chakra-ui/lazy-utils": "2.0.5",
"@chakra-ui/react": "2.7.1",
"@chakra-ui/styled-system": "^2.9.2",
"@chakra-ui/system": "^2.6.2",
"@chakra-ui/theme-tools": "^2.0.18",
"@chakra-ui/utils": "^2.0.14",
"@emotion/react": "^11.10.4",
"@emotion/styled": "^11.10.4",
"@graphiql/toolkit": "^0.8.0",
"@metamask/post-message-stream": "^7.0.0",
"@metamask/providers": "^10.2.1",
"@monaco-editor/react": "^4.4.6",
"@next/bundle-analyzer": "^14.0.1",
"@opentelemetry/api": "^1.9.0",
"@opentelemetry/auto-instrumentations-node": "^0.39.4",
"@opentelemetry/exporter-metrics-otlp-proto": "^0.45.1",
"@opentelemetry/exporter-trace-otlp-http": "^0.45.0",
"@opentelemetry/auto-instrumentations-node": "^0.48.0",
"@opentelemetry/exporter-metrics-otlp-proto": "^0.52.1",
"@opentelemetry/exporter-trace-otlp-http": "^0.52.1",
"@opentelemetry/resources": "^1.18.0",
"@opentelemetry/sdk-metrics": "^1.25.1",
"@opentelemetry/sdk-node": "^0.45.0",
"@opentelemetry/sdk-metrics": "^1.18.0",
"@opentelemetry/sdk-node": "^0.52.1",
"@opentelemetry/sdk-trace-node": "^1.18.0",
"@opentelemetry/semantic-conventions": "^1.18.0",
"@sentry/cli": "^2.21.2",
Expand All @@ -55,8 +61,10 @@
"@tanstack/react-query-devtools": "^5.4.3",
"@types/papaparse": "^5.3.5",
"@types/react-scroll": "^1.8.4",
"@wagmi/core": "^1.3.3",
"@web3modal/ethereum": "^2.6.2",
"@web3modal/react": "^2.6.2",
"abitype": "^1.0.5",
"bignumber.js": "^9.1.0",
"blo": "^1.1.1",
"chakra-react-select": "^4.4.3",
Expand All @@ -65,6 +73,7 @@
"dappscout-iframe": "^0.1.0",
"dayjs": "^1.11.5",
"dom-to-image": "^2.6.0",
"dotenv": "^16.4.5",
"framer-motion": "^6.5.1",
"gradient-avatar": "^1.0.2",
"graphiql": "^2.2.0",
Expand Down Expand Up @@ -111,6 +120,7 @@
"@types/dom-to-image": "^2.6.4",
"@types/jest": "^29.2.0",
"@types/js-cookie": "^3.0.2",
"@types/lodash": "^4.17.7",
"@types/mixpanel-browser": "^2.38.1",
"@types/node": "18.11.18",
"@types/phoenix": "^1.5.4",
Expand Down
Loading

0 comments on commit a1c53af

Please sign in to comment.