Skip to content

Commit

Permalink
move synapse json elsewhere
Browse files Browse the repository at this point in the history
  • Loading branch information
inodb committed Apr 1, 2022
1 parent 8a0160b commit cfd4bca
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion lib/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ function mergeCaseData(
}

export async function fetchData(): Promise<LoadDataResult> {
const res = await fetch('/processed_syn_data.json');
// in development we use local processed syn data. In production we use
// other URL (too large to serve thru next max 250MB limit)
const processedSynURL = process.env.NODE_ENV === 'development'? '/processed_syn_data.json' : 'https://htan-synapse-json.surge.sh/processed_syn_data.json';
const res = await fetch(processedSynURL);

// const json = await res.json();
const text = await res.text();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"dev": "yarn run gunzip && next dev",
"gunzip": "gunzip -c public/processed_syn_data.json.gz > public/processed_syn_data.json",
"build": "yarn run gunzip && export NODE_OPTIONS=--max_old_space_size=6144 && next build",
"build": "export NODE_OPTIONS=--max_old_space_size=6144 && next build",
"start": "yarn run gunzip && next start",
"processSynapseJSON": "npx ncc run data/processSynapseJSON.ts",
"prettierPreCommit": "STAGED_AND_CHANGED_FILES=$(git diff HEAD --name-only --cached --diff-filter=d) && ([ -z \"$STAGED_AND_CHANGED_FILES\" ] && echo \"Nothing to prettify\" || (yarn run prettier --write $(echo $STAGED_AND_CHANGED_FILES) && git add -f $(echo $STAGED_AND_CHANGED_FILES)))",
Expand Down
3 changes: 2 additions & 1 deletion pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import fs from 'fs';
import process from 'process';
import path from 'path';
import zlib from 'zlib';

import PreReleaseBanner from '../components/PreReleaseBanner';
import HomePage, { IHomePropsProps } from '../components/HomePage';
Expand Down Expand Up @@ -44,7 +45,7 @@ export const getStaticProps: GetStaticProps = async (context) => {
getContent('card-6', 'homepage'),
]);

const processedSynapseData = await fs.readFileSync(path.join(process.cwd(), 'public/processed_syn_data.json'), 'utf8')
const processedSynapseData = await zlib.gunzipSync(await fs.readFileSync(path.join(process.cwd(), 'public/processed_syn_data.json.gz'))).toString()
const files = fillInEntities(
(JSON.parse(processedSynapseData) as any) as LoadDataResult
);
Expand Down

0 comments on commit cfd4bca

Please sign in to comment.