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

feat(recipes): Export providers #27724

Merged
merged 1 commit into from
Oct 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
feat(recipes): Export providers
  • Loading branch information
ascorbic committed Oct 30, 2020
commit 23a1125fadaac980c5202438e348760a65e77721
2 changes: 1 addition & 1 deletion packages/gatsby-recipes/src/create-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { GraphQLString, GraphQLObjectType, GraphQLList } from "graphql"
import _ from "lodash"
import { ObjectTypeComposer, schemaComposer } from "graphql-compose"

import resources from "./resources"
import * as resources from "./resources"

const typeNameToHumanName = name => {
if (name.endsWith(`Connection`)) {
Expand Down
1 change: 1 addition & 0 deletions packages/gatsby-recipes/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ import startGraphQLServer from "./graphql-server"
// data = { recipe?: string, graphqlPort: number, projectRoot: string }
const recipesHandler = async data => cli(data)

export * from "./resources"
export { startGraphQLServer, recipesHandler }
2 changes: 1 addition & 1 deletion packages/gatsby-recipes/src/renderer/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Queue from "better-queue"
import lodash from "lodash"
import mitt from "mitt"

import resources from "../resources"
import * as resources from "../resources"

import RecipesReconciler from "./reconciler"
import ErrorBoundary from "./error-boundary"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Suspense } from "react"

import resources from "../resources"
import * as resources from "../resources"

import { ResourceComponent } from "./render"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import providedResources from "../resources"
import * as providedResources from "../resources"
const isResource = type => type && (type === `Input` || providedResources[type])

const extractPlan = (node, type) => {
Expand Down
47 changes: 14 additions & 33 deletions packages/gatsby-recipes/src/resources.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,14 @@
import * as fileResource from "./providers/fs/file"
import * as directoryResource from "./providers/fs/directory"
import * as gatsbyPageResource from "./providers/gatsby/page"
import * as gatsbyPluginResource from "./providers/gatsby/plugin"
import * as gatsbyShadowFileResource from "./providers/gatsby/shadow-file"
import * as gatsbySiteMetadataResource from "./providers/gatsby/site-metadata"
import * as npmPackageResource from "./providers/npm/package"
import * as npmPackageScriptResource from "./providers/npm/script"
import * as npmPackageJsonResource from "./providers/npm/package-json"
import * as gitIgnoreResource from "./providers/git/ignore"
import * as contentfulSpace from "./providers/contentful/space"
import * as contentfulEnvironment from "./providers/contentful/environment"
import * as contentfulType from "./providers/contentful/type"
import * as contentfulEntry from "./providers/contentful/entry"

const componentResourceMapping = {
File: fileResource,
Directory: directoryResource,
GatsbyPage: gatsbyPageResource,
GatsbyPlugin: gatsbyPluginResource,
GatsbyShadowFile: gatsbyShadowFileResource,
GatsbySiteMetadata: gatsbySiteMetadataResource,
NPMPackage: npmPackageResource,
NPMScript: npmPackageScriptResource,
NPMPackageJson: npmPackageJsonResource,
GitIgnore: gitIgnoreResource,
ContentfulSpace: contentfulSpace,
ContentfulEnvironment: contentfulEnvironment,
ContentfulType: contentfulType,
ContentfulEntry: contentfulEntry,
}

export default componentResourceMapping
export * as File from "./providers/fs/file"
export * as Directory from "./providers/fs/directory"
export * as GatsbyPage from "./providers/gatsby/page"
export * as GatsbyPlugin from "./providers/gatsby/plugin"
export * as GatsbyShadowFile from "./providers/gatsby/shadow-file"
export * as GatsbySiteMetadata from "./providers/gatsby/site-metadata"
export * as NPMPackage from "./providers/npm/package"
export * as NPMScript from "./providers/npm/script"
export * as NPMPackageJson from "./providers/npm/package-json"
export * as GitIgnore from "./providers/git/ignore"
export * as ContentfulSpace from "./providers/contentful/space"
export * as ContentfulEnvironment from "./providers/contentful/environment"
export * as ContentfulType from "./providers/contentful/type"
export * as ContentfulEntry from "./providers/contentful/entry"
2 changes: 1 addition & 1 deletion packages/gatsby-recipes/src/validate-recipe.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import resources from "./resources"
import * as resources from "./resources"
import _ from "lodash"

export default function validateRecipe(plan) {
Expand Down