diff --git a/.gitignore b/.gitignore index 794fc3eee..75815ee6e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,14 @@ -__pycache__/ +# IDE Specific .vscode -*.iml .idea/codeStyles/Project.xml -*.xml + +# dotenv environment variables file +.env + +# gatsby files +.cache/ +public + +# Mac files +.DS_Store + diff --git a/assets/30s-icon.png b/assets/30s-icon.png index 095dfb35a..e96a17570 100644 Binary files a/assets/30s-icon.png and b/assets/30s-icon.png differ diff --git a/gatsby-browser.js b/gatsby-browser.js new file mode 100644 index 000000000..09c615eb2 --- /dev/null +++ b/gatsby-browser.js @@ -0,0 +1,8 @@ +/** + * Implement Gatsby's Browser APIs in this file. + * + * See: https://www.gatsbyjs.org/docs/browser-apis/ + */ + +// You can delete this file if you're not using it +export { default as wrapRootElement } from './src/docs/state/ReduxWrapper'; diff --git a/gatsby-config.js b/gatsby-config.js new file mode 100644 index 000000000..60ded18a3 --- /dev/null +++ b/gatsby-config.js @@ -0,0 +1,82 @@ +const config = require('./config'); + +module.exports = { + siteMetadata: { + title: `${config.name}`, + description: `${config.description}`, + author: `@30-seconds`, + }, + plugins: [ + `gatsby-plugin-transition-link`, + { + resolve: `gatsby-source-filesystem`, + options: { + name: `snippets`, + path: `${__dirname}/${config.snippetPath}`, + }, + }, + { + resolve: `gatsby-source-filesystem`, + options: { + name: `snippet_data`, + path: `${__dirname}/${config.snippetDataPath}`, + }, + }, + { + resolve: `gatsby-source-filesystem`, + options: { + name: `assets`, + path: `${__dirname}/${config.assetPath}`, + }, + }, + { + resolve: `gatsby-plugin-page-creator`, + options: { + path: `${__dirname}/${config.pagePath}`, + }, + }, + { + resolve: `gatsby-transformer-remark`, + options: { + plugins: [ + { + resolve: `gatsby-remark-images`, + options: { + maxWidth: 590, + }, + }, + `gatsby-remark-prismjs`, + `gatsby-remark-copy-linked-files`, + ], + }, + }, + `gatsby-plugin-sass`, + `gatsby-transformer-json`, + `gatsby-transformer-sharp`, + `gatsby-plugin-sharp`, + { + resolve: `gatsby-plugin-google-analytics`, + options: { + //trackingId: `ADD YOUR TRACKING ID HERE`, + anonymize: true, // Always set this to true, try to comply with GDPR out of the box + respectDNT: true, // Always set to true, be respectful of people who ask not to be tracked + cookieExpires: 0, // Always set to 0, minimum tracking for your users + }, + }, + { + resolve: `gatsby-plugin-manifest`, + options: { + name: `${config.name}`, + short_name: `${config.shortName}`, + start_url: `/`, + background_color: `#1e253d`, + theme_color: `#1e253d`, + display: `standalone`, + icon: `assets/30s-icon.png`, // This path is relative to the root of the site. + }, + }, + `gatsby-plugin-offline`, + `gatsby-plugin-react-helmet`, + `gatsby-plugin-netlify`, + ], +}; diff --git a/gatsby-node.js b/gatsby-node.js new file mode 100644 index 000000000..9221ea486 --- /dev/null +++ b/gatsby-node.js @@ -0,0 +1,93 @@ +const path = require(`path`); +const { createFilePath } = require(`gatsby-source-filesystem`); + +const toKebabCase = str => + str && + str + .match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g) + .map(x => x.toLowerCase()) + .join('-'); + +exports.createPages = ({ graphql, actions }) => { + const { createPage } = actions; + + const snippetPage = path.resolve(`./src/docs/templates/SnippetPage.js`); + const tagPage = path.resolve(`./src/docs/templates/TagPage.js`); + return graphql( + ` + { + allMarkdownRemark( + sort: { fields: [frontmatter___title], order: ASC } + limit: 1000 + ) { + edges { + node { + fields { + slug + } + frontmatter { + tags + } + fileAbsolutePath + } + } + } + } + `, + ).then(result => { + if (result.errors) { + throw result.errors; + } + + // Create individual snippet pages. + const snippets = result.data.allMarkdownRemark.edges; + + snippets.forEach((post, index) => { + if (post.node.fileAbsolutePath.indexOf('README') !== -1) + return; + createPage({ + path: `/snippet${post.node.fields.slug}`, + component: snippetPage, + context: { + slug: post.node.fields.slug, + }, + }); + }); + + // Create tag pages. + const tags = snippets.reduce((acc, post) => { + if (!post.node.frontmatter || !post.node.frontmatter.tags) return acc; + const primaryTag = post.node.frontmatter.tags.split(',')[0]; + if (!acc.includes(primaryTag)) acc.push(primaryTag); + return acc; + }, []); + + tags.forEach(tag => { + const tagPath = `/tag/${toKebabCase(tag)}/`; + const tagRegex = `/^\\s*${tag}/`; + createPage({ + path: tagPath, + component: tagPage, + context: { + tag, + tagRegex, + }, + }); + }); + + return null; + }); +}; + +exports.onCreateNode = ({ node, actions, getNode }) => { + const { createNodeField } = actions; + + if (node.internal.type === `MarkdownRemark`) { + const value = createFilePath({ node, getNode }); + createNodeField({ + name: `slug`, + node, + value, + }); + } +}; diff --git a/gatsby-ssr.js b/gatsby-ssr.js new file mode 100644 index 000000000..3513ab31a --- /dev/null +++ b/gatsby-ssr.js @@ -0,0 +1,8 @@ +/** + * Implement Gatsby's SSR (Server Side Rendering) APIs in this file. + * + * See: https://www.gatsbyjs.org/docs/ssr-apis/ + */ + +// You can delete this file if you're not using it +export { default as wrapRootElement } from './src/docs/state/ReduxWrapper'; diff --git a/node_modules/blob/.idea/blob.iml b/node_modules/blob/.idea/blob.iml new file mode 100644 index 000000000..0b872d82d --- /dev/null +++ b/node_modules/blob/.idea/blob.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/node_modules/blob/.idea/inspectionProfiles/profiles_settings.xml b/node_modules/blob/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 000000000..0eefe328a --- /dev/null +++ b/node_modules/blob/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/node_modules/blob/.idea/markdown-navigator.xml b/node_modules/blob/.idea/markdown-navigator.xml new file mode 100644 index 000000000..24281affb --- /dev/null +++ b/node_modules/blob/.idea/markdown-navigator.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/node_modules/blob/.idea/markdown-navigator/profiles_settings.xml b/node_modules/blob/.idea/markdown-navigator/profiles_settings.xml new file mode 100644 index 000000000..9c51dfede --- /dev/null +++ b/node_modules/blob/.idea/markdown-navigator/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/node_modules/blob/.idea/modules.xml b/node_modules/blob/.idea/modules.xml new file mode 100644 index 000000000..a24a2af4c --- /dev/null +++ b/node_modules/blob/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/node_modules/blob/.idea/vcs.xml b/node_modules/blob/.idea/vcs.xml new file mode 100644 index 000000000..9661ac713 --- /dev/null +++ b/node_modules/blob/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/node_modules/blob/.idea/workspace.xml b/node_modules/blob/.idea/workspace.xml new file mode 100644 index 000000000..31e803b98 --- /dev/null +++ b/node_modules/blob/.idea/workspace.xml @@ -0,0 +1,390 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + esprima-six + + + + + + + + + + + + + + true + DEFINITION_ORDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +