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

fix(recipes): Update tests and fix babel config, tweak readme #23152

Merged
merged 3 commits into from
Apr 15, 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
7 changes: 7 additions & 0 deletions packages/gatsby-recipes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@
"resolutions": {
"graphql": "^14.6.0"
},
"jest": {
"testPathIgnorePatterns": [
"/.cache/",
"dist"
],
"testEnvironment": "node"
},
"scripts": {
"build": "babel src --out-dir dist --ignore \"**/__tests__\" --extensions \".ts,.js,.tsx\"",
"build:watch": "npm run build -- --watch",
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby-recipes/recipes/cypress.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ First, we'll want to install Cypress and additional dependencies.
---

<NPMPackage name="cypress" dependencyType="devDependency" />
<NPMPackage name="gatsby-cypress" dependencyType="devDepdendency" />
<NPMPackage name="gatsby-cypress" dependencyType="devDependency" />
<NPMPackage name="start-server-and-test" dependencyType="devDependency" />

---
Expand Down
6 changes: 3 additions & 3 deletions packages/gatsby-recipes/src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Here's how you would write the `gatsby recipes emotion` recipe you just ran:

Install necessary NPM packages

<!-- // refer to the API in this doc to see what APIs are available, like `NPMPackage` -->
<!-- refer to the API in this doc to see what APIs are available, like `NPMPackage` -->

<NPMPackage name="gatsby-plugin-emotion" />
<NPMPackage name="@emotion/core" />
Expand Down Expand Up @@ -145,7 +145,7 @@ Soon will support options.
- **theme** the name of the theme (or plugin) which provides the file you'd like to shadow
- **path** the path to the file within the theme. E.g. the example file above lives at `node_modules/gatsby-theme-blog/src/components/seo.js`

#### `<NPMPackage`
#### `<NPMPackage>`

`<NPMPackage name="lodash" version="latest" />`

Expand All @@ -166,7 +166,7 @@ Soon will support options.

#### `<File>`

<File path="test.md" content="https://raw.githubusercontent.com/KyleAMathews/test-recipes/master/gatsby-receipe-sass.mdx" />
<File path="test.md" content="https://raw.githubusercontent.com/KyleAMathews/test-recipes/master/gatsby-recipe-jest.mdx" />

##### props

Expand Down

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

3 changes: 3 additions & 0 deletions packages/gatsby-recipes/src/providers/gatsby/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const addPluginToConfig = (src, pluginName) => {

const { code } = babel.transform(src, {
plugins: [addPlugins.plugin],
configFile: false,
})

return code
Expand All @@ -87,6 +88,7 @@ const getPluginsFromConfig = src => {

babel.transform(src, {
plugins: [getPlugins.plugin],
configFile: false,
})

return getPlugins.state
Expand Down Expand Up @@ -130,6 +132,7 @@ const destroy = async ({ root }, { name }) => {

const { code } = babel.transform(configSrc, {
plugins: [addPlugins.plugin],
configFile: false,
})

await fs.writeFile(configPath, code)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ Object {
"diff": "- Original - 1
+ Modified + 1

@@ -4,6 +4,6 @@
 },
 Object {
 \\"name\\": \\"test\\",
 \\"scripts\\": Object {
- \\"apple\\": \\"foot\\",
Expand Down
6 changes: 4 additions & 2 deletions packages/gatsby-recipes/src/todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@ John
- [x] print pretty error when there's parsing errors of mdx files
- [x] Move mdx recipes to its own package `gatsby-recipes` & pull them from unpkg
- [x] add CODEOWNERS file for recipes
- [ ] give proper npm permissions to `gatsby-recipes`
- [x] give proper npm permissions to `gatsby-recipes`
- [x] validate that the first step of recipes don't have any resources. They should just be for the title/description
- [x] handle not finding a recipe
- [x] test modifying gatsby-config.js from default starter
- [ ] getting tests passing
- [x] get tests passing
- [ ] add emotion screenshot and add to readme
- [x] make note about using gists for paths and using the "raw" link

## Near-ish future

Expand Down