Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-cory committed Apr 7, 2016
0 parents commit 5908570
Show file tree
Hide file tree
Showing 25 changed files with 978 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"passPerPreset": true,
"presets": [
{
"plugins": [
"./build/babelRelayPlugin"
]
},
"react",
"es2015",
"stage-0"
]
}
52 changes: 52 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

# Logs and databases #
######################
*.log
*.sql
*.sqlite

# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Build Systems #
#################
node_modules/
bower_components/
.sass-cache
*.css.map
dist/

# Random #
##########
.Ulysses-Group.plist
.idea/
*.sublime-project
*.sublime-workspace
npm-debug.log

# Project Specific #
####################
sandbox/
src/constants/config.js
src/constants/client_secret.json
src/data/schema.graphql
src/data/schema.json
31 changes: 31 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
BSD License

For Relay Starter Kit software

Copyright (c) 2013-2015, Facebook, Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name Facebook nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 changes: 33 additions & 0 deletions PATENTS
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Additional Grant of Patent Rights Version 2

"Software" means the Relay Starter Kit software distributed by Facebook, Inc.

Facebook, Inc. ("Facebook") hereby grants to each recipient of the Software
("you") a perpetual, worldwide, royalty-free, non-exclusive, irrevocable
(subject to the termination provision below) license under any Necessary
Claims, to make, have made, use, sell, offer to sell, import, and otherwise
transfer the Software. For avoidance of doubt, no license is granted under
Facebook's rights in any patent claims that are infringed by (i) modifications
to the Software made by you or any third party or (ii) the Software in
combination with any software or other technology.

The license granted hereunder will terminate, automatically and without notice,
if you (or any of your subsidiaries, corporate affiliates or agents) initiate
directly or indirectly, or take a direct financial interest in, any Patent
Assertion: (i) against Facebook or any of its subsidiaries or corporate
affiliates, (ii) against any party if such Patent Assertion arises in whole or
in part from any software, technology, product or service of Facebook or any of
its subsidiaries or corporate affiliates, or (iii) against any party relating
to the Software. Notwithstanding the foregoing, if Facebook or any of its
subsidiaries or corporate affiliates files a lawsuit alleging patent
infringement against you in the first instance, and you respond by filing a
patent infringement counterclaim in that lawsuit against that party that is
unrelated to the Software, the license granted hereunder will not terminate
under section (i) of this paragraph due to such counterclaim.

A "Necessary Claim" is a claim of a patent owned by Facebook that is
necessarily infringed by the Software standing alone.

A "Patent Assertion" is any lawsuit or other action alleging direct, indirect,
or contributory infringement or inducement to infringe any patent, including a
cross-claim or counterclaim.
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Relay Starter Kit

This kit includes an app server, a GraphQL server, and a transpiler that you can use to get started building an app with Relay. For a walkthrough, see the [Relay tutorial](https://facebook.github.io/relay/docs/tutorial.html).

## Installation

```
npm install
```

## Running

Start a local server:

```
npm start
```

## Developing

Any changes you make to files in the `js/` directory will cause the server to
automatically rebuild the app and refresh your browser.

If at any time you make changes to `data/schema.js`, stop the server,
regenerate `data/schema.json`, and restart the server:

```
npm run update-schema
npm start
```

## License

Relay Starter Kit is [BSD licensed](./LICENSE). We also provide an additional [patent grant](./PATENTS).
40 changes: 40 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "relay-starter-kit",
"private": true,
"description": "A quick way to get up and running with Relay",
"repository": "facebook/relay-starter-kit",
"version": "0.1.0",
"scripts": {
"start": "babel-node ./server.js",
"update-schema": "babel-node ./scripts/updateSchema.js"
},
"dependencies": {
"babel-core": "^6.5.2",
"babel-loader": "6.2.3",
"babel-polyfill": "6.5.0",
"babel-preset-es2015": "6.5.0",
"babel-preset-react": "6.5.0",
"babel-preset-stage-0": "6.5.0",
"babel-relay-plugin": "0.7.3",
"classnames": "2.2.3",
"express": "4.13.4",
"express-graphql": "0.4.9",
"graphql": "0.4.17",
"graphql-relay": "0.3.6",
"react": "0.14.7",
"react-dom": "0.14.7",
"react-relay": "0.7.3",
"webpack": "1.12.13",
"webpack-dev-server": "1.14.1"
},
"devDependencies": {
"babel-cli": "6.5.1",
"babel-plugin-transform-class-properties": "^6.6.0",
"file-loader": "^0.8.5",
"googleapis": "^4.0.0",
"jsonfile": "^2.2.3",
"node-schedule": "^1.1.0",
"url-loader": "^0.5.7",
"webpack-isomorphic-tools": "^2.2.44"
}
}
18 changes: 18 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Alex Cory</title>
</head>
<body>
<div id="root"></div>
<script type="text/javascript">
// Force `fetch` polyfill to workaround Chrome not displaying request body
// in developer tools for the native `fetch`.
self.fetch = null;
</script>
<script src="http://localhost:3000/webpack-dev-server.js"></script>
<script src="src/app.js"></script>
</body>
</html>
29 changes: 29 additions & 0 deletions scripts/updateSchema.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env babel-node --optional es7.asyncFunctions

import fs from 'fs';
import path from 'path';
import { Schema } from '../src/data/schema';
import { graphql } from 'graphql';
import { introspectionQuery, printSchema } from 'graphql/utilities';

// Save JSON of full schema introspection for Babel Relay Plugin to use
(async () => {
var result = await (graphql(Schema, introspectionQuery));
if (result.errors) {
console.error(
'ERROR introspecting schema: ',
JSON.stringify(result.errors, null, 2)
);
} else {
fs.writeFileSync(
path.join(__dirname, '../src/data/schema.json'),
JSON.stringify(result, null, 2)
);
}
})();

// Save user readable type system shorthand of schema
fs.writeFileSync(
path.join(__dirname, '../src/data/schema.graphql'),
printSchema(Schema)
);
80 changes: 80 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import express from 'express';
import graphQLHTTP from 'express-graphql';
import path from 'path';
import webpack from 'webpack';
import WebpackDevServer from 'webpack-dev-server';
import {Schema} from './src/data/schema';
// var Webpack_isomorphic_tools_plugin = require('webpack-isomorphic-tools/plugin')

const APP_PORT = 3000;
const GRAPHQL_PORT = 8080;

// Expose a GraphQL endpoint
var graphQLServer = express();
graphQLServer.use('/', graphQLHTTP({
graphiql: true,
pretty: true,
schema: Schema,
}));
graphQLServer.listen(GRAPHQL_PORT, () => console.log(
`GraphQL Server is now running on http://localhost:${GRAPHQL_PORT}`
));



// var webpack_isomorphic_tools_plugin =
// // webpack-isomorphic-tools settings reside in a separate .js file
// // (because they will be used in the web server code too).
// new Webpack_isomorphic_tools_plugin(require('./webpack-isomorphic-tools-configuration'))
// // also enter development mode since it's a development webpack configuration
// // (see below for explanation)
// .development()

// Serve the Relay app
var compiler = webpack({
context: __dirname + '/src',
entry: path.resolve(__dirname, 'src', 'app.jsx'),
output: {
filename: 'app.js',
path: '/',
publicPath: '/'
},
module: {
loaders: [
{
test: /.js[x]?$/,
loader: 'babel-loader',
exclude: /node_modules/
},
/* For Loading Images in CSS/SCSS Files */
{
test: /\.jpe?g$|\.gif$|\.png$|\.ico|\.svg$|\.woff$|\.ttf$|.mp4$/,
loader: 'url-loader?limit=8192'
// loader: 'file-loader?name=images/[name].[ext]'
},
/* For loading images and video files */
// {
// test: webpack_isomorphic_tools_plugin.regular_expression('images'),
// loader: 'url-loader?limit=10240', // any image below or equal to 10K will be converted to inline base64 instead
// }
]
},
resolve: {
moduleDirectories: ['node_modules', './src'],
extensions: ['', '.js', '.json', '.jsx']
},
// plugins: [
// webpack_isomorphic_tools_plugin
// ]
});
var app = new WebpackDevServer(compiler, {
contentBase: '/public/',
proxy: {'/graphql': `http://localhost:${GRAPHQL_PORT}`},
publicPath: '/src/',
stats: {colors: true}
});
// Serve static resources
app.use('/', express.static(path.resolve(__dirname, 'public')));
app.listen(APP_PORT, () => {
console.log(`App is now running on http://localhost:${APP_PORT}`);
});
41 changes: 41 additions & 0 deletions src/apis/google-drive/GoogleDoc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// var google = require('googleapis');
// import authorize from './authorize.js'

export default class GoogleDoc {
constructor(data) {
this._fileId = data.id || null
this._fileUrl = data.alternateLink || null
this._rawUrl = this.fileId ? `https://drive.google.com/uc?export=view&id=${this.fileId}` : null;
this._thumb = data.null
this._description = data.description || null
this._downloadUrl = data.webContentLink || null

}

get fileId() {
return this._fileId
}

get fileUrl() {
return this._fileUrl
}

get rawUrl() {
return this._rawUrl
}

get thumb() {
return this._thumb
}

get description() {
return this._description
}


// set fileId(fileId) {
// this._fileId = fileId
// }

// get data(auth, )
}
1 change: 1 addition & 0 deletions src/apis/google-drive/cache/googleDocs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"id":"0B5LhVy_zkvWqSTMxVTA3LWhRanc","title":"scubadiving1.jpg","parents":[{"id":"0B5LhVy_zkvWqc2N1ZTNPeFFFLTA"}],"imageMediaMetadata":{"width":960,"height":720}},{"id":"0B5LhVy_zkvWqTWF6aXN4c3liRk0","title":"backpacking1.jpg","parents":[{"id":"0B5LhVy_zkvWqc2N1ZTNPeFFFLTA"}],"imageMediaMetadata":{"width":960,"height":720}},{"id":"0B5LhVy_zkvWqZW9kcklCQWlrWXM","title":"kayaking1.mp4","parents":[{"id":"0B5LhVy_zkvWqc2N1ZTNPeFFFLTA"}],"videoMediaMetadata":{"width":1280,"height":720,"durationMillis":"99683"}},{"id":"0B5LhVy_zkvWqcnhwMkJBR2JzelE","title":"mountainbiking.mov","parents":[{"id":"0B5LhVy_zkvWqc2N1ZTNPeFFFLTA"}],"videoMediaMetadata":{"width":1920,"height":1080,"durationMillis":"30561"}},{"id":"0B5LhVy_zkvWqMnEtNzJ5ekFEWlk","title":"ziplining1.jpg","parents":[{"id":"0B5LhVy_zkvWqc2N1ZTNPeFFFLTA"}],"imageMediaMetadata":{"width":2048,"height":1356}},{"id":"0B5LhVy_zkvWqUTFGVDQzeUhocE0","title":"scubadiving2.jpg","parents":[{"id":"0B5LhVy_zkvWqc2N1ZTNPeFFFLTA"}],"imageMediaMetadata":{"width":1643,"height":918}},{"id":"0B5LhVy_zkvWqemJ4aThKVTBjOG8","title":"wakeboarding2.mp4","parents":[{"id":"0B5LhVy_zkvWqc2N1ZTNPeFFFLTA"}],"videoMediaMetadata":{"width":1280,"height":720,"durationMillis":"23382"}},{"id":"0B5LhVy_zkvWqNm1PWkdtOThlZWc","title":"mtbiking.JPG","description":"Mountain biking at Town Run in Indianapolis, IN","parents":[{"id":"0B5LhVy_zkvWqc2N1ZTNPeFFFLTA"}],"imageMediaMetadata":{"width":2048,"height":2048}},{"id":"0B5LhVy_zkvWqV3B1WThoRWZQZzg","title":"skydiving1.VOB","parents":[{"id":"0B5LhVy_zkvWqc2N1ZTNPeFFFLTA"}],"videoMediaMetadata":{"width":720,"height":480,"durationMillis":"272806"}},{"id":"0B5LhVy_zkvWqaUNyVmhFZzRIUzA","title":"lostcoast.jpg","parents":[{"id":"0B5LhVy_zkvWqc2N1ZTNPeFFFLTA"}],"imageMediaMetadata":{"width":640,"height":640}},{"id":"0B5LhVy_zkvWqMEhfOUNNamkyUGs","title":"wakeboarding1.mp4","parents":[{"id":"0B5LhVy_zkvWqc2N1ZTNPeFFFLTA"}],"videoMediaMetadata":{"width":1280,"height":720,"durationMillis":"64992"}},{"id":"0B5LhVy_zkvWqVUFaRkFoRmxmUHM","title":"skateboarding1.MOV","parents":[{"id":"0B5LhVy_zkvWqc2N1ZTNPeFFFLTA"}],"videoMediaMetadata":{"width":1920,"height":1080,"durationMillis":"7500"}},{"id":"0B5LhVy_zkvWqRHNaOWFGYnFIWTA","title":"wakeboarding2.jpg","parents":[{"id":"0B5LhVy_zkvWqc2N1ZTNPeFFFLTA"}],"imageMediaMetadata":{"width":720,"height":540}},{"id":"0B5LhVy_zkvWqYmZhSFBtNGlKVlU","title":"snowboardingme.jpg","parents":[{"id":"0B5LhVy_zkvWqc2N1ZTNPeFFFLTA"}],"imageMediaMetadata":{"width":1080,"height":1080}},{"id":"0B5LhVy_zkvWqMTVjSURpNVFaOGM","title":"wakeboarding.jpg","parents":[{"id":"0B5LhVy_zkvWqc2N1ZTNPeFFFLTA"}],"imageMediaMetadata":{"width":612,"height":612}},{"id":"0B5LhVy_zkvWqamx5aFZTZExjb1E","title":"snowboarding1.MOV","description":"360 at Heavenly Ski Resort in South Lake Tahoe","parents":[{"id":"0B5LhVy_zkvWqc2N1ZTNPeFFFLTA"}],"videoMediaMetadata":{"width":1920,"height":1080,"durationMillis":"8505"}}]
Binary file added src/apis/google-drive/cache/snowboarding123.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 5908570

Please sign in to comment.