Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth0_V1 #1

Merged
merged 22 commits into from
Dec 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# NoteCards

# Copyright
This code is not open source.
Please contact rturgeon13@gmail.com if you are interesting in acquiring a license.

All code is owned by Reed Turgeon.
6 changes: 4 additions & 2 deletions client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ typings/
# Output of 'npm pack'
*.tgz

# dotenv environment variable files
.env*
# dotenv environment variables file
.env
.env.*
!.env.EXAMPLE

# gatsby files
.cache/
Expand Down
4 changes: 0 additions & 4 deletions client/.prettierignore

This file was deleted.

43 changes: 43 additions & 0 deletions client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# React
Plugins & Packages: </br>

1. react
2. react-dom
3. react-helmet
4. @react/router

# Gatsby
- [Main Docs](https://www.gatsbyjs.org/docs/)
- [Search Plugins](https://www.gatsbyjs.org/plugins/)

Plugins & Packages: </br>

1. gatsby
2. gatsby-plugin-react-helmet
3. "gatsby-source-filesystem

# Styling
Plugins & Packages: </br>

1. gatsby-plugin-sass

# Auth0
- [Starter Repo Title: auth0-blog / gatsby-auth0](https://github.com/auth0-blog/gatsby-auth0)

Plugins & Packages: </br>

1. auth0-js

# Contentful
Plugins & Packages: </br>

1. @contentful/rich-text-react-renderer
2. gatsby-source-contentful

# Markdown
Plugins & Packages: </br>

1. gatsby-source-filesystem
2. gatsby-transformer-remark


36 changes: 30 additions & 6 deletions client/gatsby-browser.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
/**
* Implement Gatsby's Browser APIs in this file.
*
* See: https://www.gatsbyjs.org/docs/browser-apis/
*/
import React from "react"
import { silentAuth } from "./src/utils/auth"

// You can delete this file if you're not using it
class SessionCheck extends React.Component {
constructor(props) {
super(props)
this.state = {
loading: true,
}
}

handleCheckSession = () => {
this.setState({ loading: false })
}

componentDidMount() {
silentAuth(this.handleCheckSession)
}

render() {
return (
this.state.loading === false && (
<React.Fragment>{this.props.children}</React.Fragment>
)
)
}
}

export const wrapRootElement = ({ element }) => {
return <SessionCheck>{element}</SessionCheck>
}
74 changes: 57 additions & 17 deletions client/gatsby-config.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,72 @@
// configure options for a Gatsby site, with metadata for project title, description, plugins, etc.

// -- //
require('dotenv').config()
console.log(process.env)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do a project search for console.log()'s next time

console.log('Space ID:',process.env.CONTENTFUL_SPACE_ID)
console.log('Access Token:',process.env.CONTENTFUL_ACCESS_TOKEN)
module.exports = {
siteMetadata: {
title: `Gatsby Default Starter`,
description: `Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need.`,
author: `@gatsbyjs`,
// title: `Gatsby Default Starter`,
title: `NoteCards`,
subTitle: `The Proving Ground`,
description: `Description`,
author: `Reed Turgeon`,
},
plugins: [
`gatsby-plugin-react-helmet`,
// ACCESS: Markdown Data Plugin
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images`,
},
name: 'src',
path: `${__dirname}/src/`
}
},
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,

// TRANSFORM: Markdown File into usefull html
`gatsby-transformer-remark`,

// SASS Plugin
`gatsby-plugin-sass`,

// Images
// `gatsby-plugin-sharp`,
// `gatsby-transformer-sharp`,

{
resolve: `gatsby-plugin-manifest`,
resolve: `gatsby-source-contentful`,
options: {
name: `gatsby-starter-default`,
short_name: `starter`,
start_url: `/`,
background_color: `#663399`,
theme_color: `#663399`,
display: `minimal-ui`,
icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
// Learn about environment variables: https://gatsby.dev/env-vars

// spaceId: process.env.CONTENTFUL_SPACE_ID,
spaceId: 'dr9akv6vk3ki',

// accessToken: process.env.CONTENTFUL_ACCESS_TOKEN,
accessToken: 'wagOJCJBBQCL7W2km6YGHl8Sph1UkVdr490kY3VXed8',
},
},


`gatsby-plugin-react-helmet`,
// {
// resolve: `gatsby-source-filesystem`,
// options: {
// name: `images`,
// path: `${__dirname}/src/images`,
// },
// },
// {
// resolve: `gatsby-plugin-manifest`,
// options: {
// name: `gatsby-starter-default`,
// short_name: `starter`,
// start_url: `/`,
// background_color: `#663399`,
// theme_color: `#663399`,
// display: `minimal-ui`,
// icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
// },
// },
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more, visit: https://gatsby.dev/offline
// `gatsby-plugin-offline`,
Expand Down
42 changes: 36 additions & 6 deletions client/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,37 @@
/**
* Implement Gatsby's Node APIs in this file.
*
* See: https://www.gatsbyjs.org/docs/node-apis/
*/
// ./gatsby-node.js
// Implement the Gatsby API “onCreatePage”. This is
// called after every page is created.
exports.onCreatePage = async ({ page, actions }) => {
const { createPage } = actions

// You can delete this file if you're not using it
// page.matchPath is a special key that's used for matching pages
// only on the client.
if (page.path.match(/^\/app/)) {
page.matchPath = "/app/*"

// Update the page.
createPage(page)
}
}

exports.onCreateWebpackConfig = ({ stage, loaders, actions }) => {
if (stage === "build-html") {
/*
* During the build step, `auth0-js` will break because it relies on
* browser-specific APIs. Fortunately, we don’t need it during the build.
* Using Webpack’s null loader, we’re able to effectively ignore `auth0-js`
* during the build. (See `src/utils/auth.js` to see how we prevent this
* from breaking the app.)
*/
actions.setWebpackConfig({
module: {
rules: [
{
test: /auth0-js/,
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ask about auth0-js vs auth-spa-js

use: loaders.null(),
},
],
},
})
}
}
7 changes: 0 additions & 7 deletions client/gatsby-ssr.js

This file was deleted.

Loading