Skip to content

Commit

Permalink
feat(Router and Authentication): Initial Auth work with Graphcool
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenfitzpatrick committed Jan 23, 2018
1 parent 9a3e8a8 commit 5be9130
Show file tree
Hide file tree
Showing 37 changed files with 4,583 additions and 1,369 deletions.
31 changes: 25 additions & 6 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,18 +1,37 @@
{
"presets": [
[
"env",
"@babel/preset-env",
{
"modules": false
"modules": false,
"loose": true,
"useBuiltIns": "usage",
"targets": {
"browsers": ["last 2 Chrome versions"]
}
}
],
"react"
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread"
],
"plugins": ["transform-class-properties", "transform-object-rest-spread"],
"env": {
"test": {
"presets": [["env"], "react"],
"plugins": ["transform-class-properties", "transform-object-rest-spread"]
"presets": [["@babel/preset-env"], "@babel/preset-react"],
"plugins": [
"@babel/plugin-proposal-class-properties"
// "@babel/plugin-proposal-object-rest-spread"
]
}
}

// require.resolve('babel-plugin-transform-runtime'),
// - {
// - helpers: false,
// - polyfill: false,
// - regenerator: true,
// - },
// require('@babel/plugin-syntax-dynamic-import').default,
}
5 changes: 1 addition & 4 deletions build-utils/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ const config = {
{
test: /\.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/,
options: {
compact: true
}
exclude: /node_modules/
}
]
},
Expand Down
11 changes: 10 additions & 1 deletion build-utils/webpack.dev.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const webpack = require('webpack');

const commonPaths = require('./common-paths');

const config = {
Expand All @@ -9,7 +11,14 @@ const config = {
publicPath: '/',
open: true,
historyApiFallback: true
}
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('development')
}
})
]
};

module.exports = config;
39 changes: 39 additions & 0 deletions build-utils/webpack.prod.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,45 @@
const webpack = require('webpack');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
.BundleAnalyzerPlugin;
const commonPaths = require('./common-paths');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');

const config = {
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')
}
}),
new webpack.optimize.ModuleConcatenationPlugin(),
new UglifyJsPlugin({
sourceMap: true,
cache: true,
parallel: true,
uglifyOptions: {
output: {
comments: false,
beautify: false
},
compress: {
warnings: false,
comparisons: false,
drop_console: true,
ecma: 8
},
mangle: {
eval: false
},
warnings: false
}
}),
//Add Bundle JS Analyzer
new BundleAnalyzerPlugin({
analyzerMode: 'static',
openAnalyzer: true,
generateStatsFile: false
})
],
devtool: ''
};

Expand Down
14 changes: 14 additions & 0 deletions graphcool/enums.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,17 @@ enum RESULT {
Loss
Void
}

# added by email-password template: (please uncomment)
# type User @model {
# # Required system field:
# id: ID! @isUnique # read-only (managed by Graphcool)
#
# # Optional system fields (remove if not needed):
# createdAt: DateTime! # read-only (managed by Graphcool)
# updatedAt: DateTime! # read-only (managed by Graphcool)
#
# email: String! @isUnique
# password: String!
# }
#
21 changes: 21 additions & 0 deletions graphcool/graphcool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,24 @@ permissions:
# rootTokens:
# - mytoken


# added by email-password template: (please uncomment)
functions:
signup:
type: resolver
schema: src/email-password/signup.graphql
handler:
code: src/email-password/signup.ts

authenticate:
type: resolver
schema: src/email-password/authenticate.graphql
handler:
code: src/email-password/authenticate.ts

loggedInUser:
type: resolver
schema: src/email-password/loggedInUser.graphql
handler:
code: src/email-password/loggedInUser.ts

216 changes: 216 additions & 0 deletions graphcool/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions graphcool/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{
"name": "mybettingslips",
"name": "mybettingslipsgraphql",
"version": "1.0.0",
"description": "My Graphcool Service"
"description": "My Graphcool Service",
"dependencies": {
"bcryptjs": "^2.4.3",
"graphcool-lib": "^0.1.0",
"graphql-request": "^1.4.0",
"validator": "^9.0.0"
}
}
Loading

0 comments on commit 5be9130

Please sign in to comment.