This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// __IS_SERVER__ declared via Webpack globals | |
// const __IS_SERVER__ = typeof process === 'object' && process + '' === '[object process]'; | |
if (__IS_SERVER__) { | |
const RRNL = require('react-relay-network-modern/node8'); // eslint-disable-line | |
const graphql = require('graphql').graphql; // eslint-disable-line | |
const schema = require('schema').default; // eslint-disable-line | |
return new RRNL.RelayNetworkLayer([ | |
RRNL.cacheMiddleware({ | |
size: 100, | |
ttl: 900000, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// client | |
import { RelayNetworkLayer } from 'react-relay-network-modern'; | |
import RelaySSR from 'react-relay-network-modern-ssr/client'; | |
const relaySSR = new RelaySSR(window.relayData); | |
const network = new RelayNetworkLayer([ | |
relaySSR.getMiddleware(), | |
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* @flow */ | |
/* eslint-disable */ | |
import mongoose from 'mongoose'; | |
export type MongoId = typeof mongoose.Types.ObjectId | { | |
toString(): string, | |
}; | |
export type MongoOrScalarId = MongoId | string | number; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* @flow */ | |
const fs = require('fs'); | |
// Add support for optionalChaining in relay-compiler 1.4 | |
const filename = './node_modules/relay-compiler/bin/relay-compiler'; | |
fs.readFile(filename, 'utf8', (err, data) => { | |
if (err) { | |
return console.log(err); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function itemTrackingHelper(relayContext, item) { | |
const {title, description} = unmaskFragmentData({ | |
relayContext, | |
relayData: item, | |
fragmentPropName: 'item', | |
fragment: itemTrackingHelperFragment | |
}); | |
} | |
const itemTrackingHelperFragment = graphql` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* @flow */ | |
/* eslint-disable no-use-before-define, react/no-unused-prop-types */ | |
import * as React from 'react'; | |
import areEqual from 'fbjs/lib/areEqual'; | |
// forked from https://github.com/robrichard/relay-query-lookup-renderer | |
// import type { CacheConfig, Disposable } from 'RelayCombinedEnvironmentTypes'; | |
// import type { RelayEnvironmentInterface as ClassicEnvironment } from 'RelayEnvironment'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react"; | |
declare class RelayComponentClass<Props> extends React$Component<Props, any> { | |
static getFragment: Function; | |
}; | |
declare type createFragmentContainer = <TBase>( | |
Component: Class<React$Component<TBase, any>> | (props: TBase) => React.Node, | |
fragmentSpec: any | |
) => Class<RelayComponentClass<TBase>>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable no-use-before-define, camelcase */ | |
import cp from 'child_process'; | |
import fsExtra from 'fs-extra'; | |
import hashFiles from 'hash-files'; | |
import chalk from 'chalk'; | |
import { | |
repositoryName, | |
rootDir, | |
buildEnv, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import path from 'path'; | |
import express from 'express'; | |
import { merge } from 'lodash'; | |
import graphqlHTTP from 'express-graphql'; | |
import PrettyError from 'pretty-error'; | |
import expressHttpProxy from 'express-http-proxy'; | |
import bodyParser from 'body-parser'; | |
import raven from 'raven'; | |
import morgan from 'morgan'; | |
import { PORT, PUBLIC_URL } from 'config'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"ram": "yarn ram-check-disk && yarn ram-create-disk && yarn ram-link-node-modules && yarn ram-link-build && yarn install && yarn start", | |
"ram-check-disk": "[ -d /Volumes/npm_ram_disk ] && echo 'Disk already mounted!' && yarn build && exit 1 || exit 0", | |
"ram-create-disk": "diskutil erasevolume hfsx npm_ram_disk `hdiutil attach -nomount ram://1600000`", | |
"ram-link-node-modules": "mkdir /Volumes/npm_ram_disk/node_modules && rm -r -f ./node_modules && ln -s /Volumes/npm_ram_disk/node_modules ./node_modules", | |
"ram-link-build": "mkdir /Volumes/npm_ram_disk/build && rm -r -f ./build && ln -s /Volumes/npm_ram_disk/build ./build", | |
} | |
} |