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(Gatsby Recipes): Initial release #22709

Merged
merged 132 commits into from
Apr 16, 2020
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
132 commits
Select commit Hold shift + click to select a range
64cc1de
Initial commit
KyleAMathews Apr 1, 2020
b0698d9
Cleanups
KyleAMathews Apr 1, 2020
36b5421
more cleanup
KyleAMathews Apr 1, 2020
461c7ee
Add missing remark-stringify dep (#22721)
johno Apr 1, 2020
50f4e0a
WIP
KyleAMathews Apr 1, 2020
716600c
WIP
KyleAMathews Apr 1, 2020
1fc328e
update TODOs
KyleAMathews Apr 1, 2020
27ac5e2
Prettier + enable Ink's experimental mode
KyleAMathews Apr 1, 2020
92b7c04
Don't need this anymore
KyleAMathews Apr 1, 2020
353ae8f
Support running local recipes e.g. gatsby recipes ./text.mdx
KyleAMathews Apr 1, 2020
3d49140
prettier again
KyleAMathews Apr 1, 2020
faa261f
Make config slightly more robust (#22743)
johno Apr 1, 2020
904e47d
Add support for devDependencies in NPMPackage resource
KyleAMathews Apr 2, 2020
cfdb1d2
Move package to new prop name
KyleAMathews Apr 2, 2020
c0e7b83
Update todos
KyleAMathews Apr 2, 2020
f044af7
add TODO
KyleAMathews Apr 2, 2020
66ff708
recipes: Improve providers (#22764)
johno Apr 2, 2020
d3d8a7b
Improve recipes providers (#22783)
KyleAMathews Apr 3, 2020
1be1b24
Support rendering more markdown
KyleAMathews Apr 3, 2020
f00c6a3
Support more markdown tags
KyleAMathews Apr 3, 2020
140190e
Tweak providers, add more thorough tests
johno Apr 3, 2020
9df2182
Clean up file after plan test
johno Apr 3, 2020
a5db934
recipes: Add initial package json resource (#22805)
johno Apr 3, 2020
14b9548
Copy recipes on change
KyleAMathews Apr 3, 2020
98054b4
improve stylings for h2/h3
KyleAMathews Apr 3, 2020
0f1c3f3
Refactor to use xstate
KyleAMathews Apr 4, 2020
587c0ab
Update TODOs
KyleAMathews Apr 4, 2020
23d483e
Improve parsing to handle basic template strings
johno Apr 4, 2020
905b7da
Improve parsing to handle basic template strings
johno Apr 4, 2020
1231d94
Chore(Recipes): Add recipes machine tests (#22823)
KyleAMathews Apr 4, 2020
2b33c6a
feat(recipes): Add resource schema/validation support (#22830)
KyleAMathews Apr 6, 2020
4f60b91
fix(recipes): Don't duplicate plugin configuration by default (#22861)
johno Apr 6, 2020
310abd2
feat(recipes): Generate graphql schema from resources (#22864)
johno Apr 6, 2020
e22d67e
feat(recipes): Create connection types for resources (#22876)
johno Apr 6, 2020
7f7ac96
Find the root directory of the Node.js project/npm package and use th…
KyleAMathews Apr 6, 2020
bb7a4c9
Fix
KyleAMathews Apr 7, 2020
07860d6
update tests
KyleAMathews Apr 7, 2020
c88c6a5
Write e2e tests for npm package scripts & add validate/all implementa…
KyleAMathews Apr 7, 2020
fca6807
Fix recipes (#22885)
mxstbr Apr 7, 2020
fb46a1e
Fix some more recipes (#22889)
mxstbr Apr 7, 2020
c8d103e
Fix more recipes stuff (#22891)
mxstbr Apr 7, 2020
04ac784
Fix typo
KyleAMathews Apr 7, 2020
6d390c5
feat(recipes): Implement shadowable files for themes (#22909)
johno Apr 7, 2020
a08e767
feat(recipes): iterate on recipe design (#22911)
KyleAMathews Apr 8, 2020
6b67046
Squashed master
KyleAMathews Apr 8, 2020
3b3f926
add todo
KyleAMathews Apr 8, 2020
b11808b
feat(recipes): Show recap of operations & show diff for changes to fi…
KyleAMathews Apr 9, 2020
eaa0535
Merge remote-tracking branch 'origin/master' into add-recipes
KyleAMathews Apr 9, 2020
f1d245b
Fix merge barf
KyleAMathews Apr 9, 2020
bbfa77f
Remove file that came in from bad merge
KyleAMathews Apr 9, 2020
c6de714
update todos
KyleAMathews Apr 9, 2020
bc369a0
Validate resources & improve file diffing (#22986)
KyleAMathews Apr 10, 2020
63604f3
Improve diffing & just run all resource operations serially
KyleAMathews Apr 10, 2020
64625e4
feat(recipes): Import recipes from urls and begin moving parsing to t…
johno Apr 10, 2020
2d191c4
update todos
KyleAMathews Apr 10, 2020
0be2a5d
Add support for file content on remote URLs
KyleAMathews Apr 10, 2020
793c3de
Add some basic docs & new emotion recipe
KyleAMathews Apr 10, 2020
de5e40c
Small updates to README
KyleAMathews Apr 10, 2020
0d0367d
small fixes
KyleAMathews Apr 10, 2020
c36ecee
fix
KyleAMathews Apr 10, 2020
ae665f0
More todos
KyleAMathews Apr 10, 2020
f4d5b2a
Cleanup comments
KyleAMathews Apr 10, 2020
7a0f08b
Add to docs about how to upgrade gatsby-cli
KyleAMathews Apr 10, 2020
22912c3
feat(recipes): Implement basic gitignore provider (#23003)
johno Apr 10, 2020
9a4695d
Move to jest-diff for faster diffing & more control
KyleAMathews Apr 10, 2020
19ad1d0
Update snapshots & use default jest-diff export as that handles any t…
KyleAMathews Apr 10, 2020
0401a13
Chalk thinks it shouldn't output color in a child process — fix that
KyleAMathews Apr 11, 2020
9a71723
tweak TODOs
KyleAMathews Apr 11, 2020
cf8603c
update todos
KyleAMathews Apr 12, 2020
abad6f3
update todos
KyleAMathews Apr 12, 2020
44aee1a
Move mdx source for recipes to their own directory
KyleAMathews Apr 13, 2020
5efb22f
Add Sass recipe
Apr 13, 2020
4f2e2df
Add recipe for setting up local gatsby-theme-blog
Apr 13, 2020
2a2802b
Add todo around bundling
KyleAMathews Apr 13, 2020
6add891
feat(recipes): Eliminate new lines from markdown (#23064)
KyleAMathews Apr 13, 2020
a47d188
feat(recipes): Implement shadow file resource and test it (#23063)
johno Apr 13, 2020
4823995
update todos
KyleAMathews Apr 13, 2020
f3a6f66
Update README.md
shannonbux Apr 13, 2020
eb2acd7
feat(recipes): detect if port is used and use a different one (#23076)
KyleAMathews Apr 13, 2020
e5c9a3d
feat(recipes): Tell people recipes is experimental & point them to th…
KyleAMathews Apr 13, 2020
3fd10b4
Update todo
KyleAMathews Apr 13, 2020
4d80e58
feat(recipes): Use the package manager client the user specifies in t…
KyleAMathews Apr 13, 2020
32edae3
feat(recipes): Improve error handling and validation for MDX files an…
johno Apr 13, 2020
c0d111c
chore(recipes): test File resouces with remote file content (#23084)
KyleAMathews Apr 13, 2020
40b0cdc
update todos
KyleAMathews Apr 13, 2020
2ef02d1
Update todos
johno Apr 14, 2020
27376b0
feat(Recipes): Show list of recipes when one isn't passed in (#23086)
KyleAMathews Apr 14, 2020
0e482a2
update todos & add layout recipe to list"
KyleAMathews Apr 14, 2020
69bac1b
feat(recipes): Move recipes to a standalone package (#23108)
johno Apr 14, 2020
a2c264c
Prettier color
KyleAMathews Apr 14, 2020
9acdd11
feat(recipes): Format gatsby-config changes with Prettier (#23112)
KyleAMathews Apr 14, 2020
2225382
Merge branch 'add-recipes' of github.com:gatsbyjs/gatsby into add-rec…
KyleAMathews Apr 14, 2020
197f639
Bigger changes (#23078)
shannonbux Apr 14, 2020
74350b0
feat(recipes): Add more recipes (#23119)
KyleAMathews Apr 14, 2020
0ca5abb
Fix name of <GatsbyShadowFile> and document it
KyleAMathews Apr 14, 2020
feddd5a
feat(recipes): Bundle react libraries into the cli (#23122)
johno Apr 15, 2020
ca5876f
Format
KyleAMathews Apr 15, 2020
4b2d5f5
Fix linting errors
KyleAMathews Apr 15, 2020
d725570
Fix more linting
KyleAMathews Apr 15, 2020
ae658e8
update snapshots
KyleAMathews Apr 15, 2020
ba56623
Squashed commit of the following:
KyleAMathews Apr 15, 2020
b52fc38
update yarn.lock
KyleAMathews Apr 15, 2020
f583af8
Merge branch 'master' into add-recipes
KyleAMathews Apr 15, 2020
b33d513
update eslint recipe
KyleAMathews Apr 15, 2020
d9eb403
fix tests
KyleAMathews Apr 15, 2020
1834ecd
Fix telemetry data
KyleAMathews Apr 15, 2020
8064fb4
chore(recipes): Move recipes code to gatsby-recipes-core (#23138)
KyleAMathews Apr 15, 2020
d7bf2b5
Add codeowners to gatsby-recipes (#23146)
johno Apr 15, 2020
ce0c719
Use dist
KyleAMathews Apr 15, 2020
348d326
chore(recipes): fix stuff (#23154)
KyleAMathews Apr 15, 2020
189abc5
fix(recipes): Update tests and fix babel config, tweak readme (#23152)
johno Apr 15, 2020
3ac2358
Merge branch 'add-recipes' of github.com:gatsbyjs/gatsby into add-rec…
KyleAMathews Apr 15, 2020
71daa66
Make the dependency type 'development' as less repetative
KyleAMathews Apr 15, 2020
3dcc4ab
update docs for release
KyleAMathews Apr 15, 2020
6a41c60
Run prettier
KyleAMathews Apr 16, 2020
64d3651
Fix lint errors
KyleAMathews Apr 16, 2020
3dd8f6c
Update
KyleAMathews Apr 16, 2020
e856272
Have gatsby depend on recipes tag
KyleAMathews Apr 16, 2020
33ee7cf
Fix site build
KyleAMathews Apr 16, 2020
c035e6c
Add note to theme-ui recipe that people need to remove any background…
KyleAMathews Apr 16, 2020
71049cd
Fix remaining package.json inconsistency
johno Apr 16, 2020
1db306b
Remove another failing giphy
KyleAMathews Apr 16, 2020
474ce42
Fix typo in package update
johno Apr 16, 2020
bc6f0e7
Fixing building .org
KyleAMathews Apr 16, 2020
f83132b
fix another
KyleAMathews Apr 16, 2020
9bbf3f4
Remove 404ed starter
KyleAMathews Apr 16, 2020
37bf95e
chore(recipes): Move recipes readme to gatsby-recipes root, add examp…
johno Apr 16, 2020
82ee210
fix(recipes): Don't write out debug log unless env var is set (#23169)
johno Apr 16, 2020
503be2c
fix(recipes): Handle errors during package installs (#23175)
johno Apr 16, 2020
b4da4dc
use what will be stable release version of gatsby-recipes to make ler…
KyleAMathews Apr 16, 2020
8194479
Add raw arguments to the IProgram type
KyleAMathews Apr 16, 2020
9724da4
fix linting error
KyleAMathews Apr 16, 2020
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
13 changes: 13 additions & 0 deletions packages/gatsby-cli/src/create-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,19 @@ function buildLocalCommands(cli, isLocalSite) {
return cmd(args)
}),
})
cli.command({
command: `recipes`,
desc: `Run a recipe`,
handler: handlerP(
getCommandHandler(`recipes`, (args, cmd) => {
cmd(args)
// Return an empty promise to prevent handlerP from exiting early.
// The development server shouldn't ever exit until the user directly
// kills it so this is fine.
return new Promise(resolve => {})
})
),
})
}

function isLocalGatsbySite() {
Expand Down
20 changes: 18 additions & 2 deletions packages/gatsby/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
"@babel/runtime": "^7.8.7",
"@babel/traverse": "^7.8.6",
"@hapi/joi": "^15.1.1",
"@mdx-js/mdx": "^1.5.8",
"@mdx-js/react": "^1.5.8",
"@mikaelkristiansson/domready": "^1.0.10",
"@pieh/friendly-errors-webpack-plugin": "1.7.0-chalk-2",
"@pmmmwh/react-refresh-webpack-plugin": "^0.2.0",
Expand Down Expand Up @@ -64,6 +66,7 @@
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-react-hooks": "^1.7.0",
"event-source-polyfill": "^1.0.12",
"execa": "^4.0.0",
"express": "^4.17.1",
"express-graphql": "^0.9.0",
"fast-levenshtein": "^2.0.6",
Expand All @@ -83,7 +86,10 @@
"graphql": "^14.6.0",
"graphql-compose": "^6.3.8",
"graphql-playground-middleware-express": "^1.7.12",
"graphql-subscriptions": "^1.1.0",
"hasha": "^5.2.0",
"humanize-list": "^1.0.1",
"import-jsx": "^4.0.0",
"invariant": "^2.2.4",
"is-relative": "^1.0.0",
"is-relative-url": "^3.0.0",
Expand Down Expand Up @@ -120,21 +126,27 @@
"react-error-overlay": "^3.0.0",
"react-hot-loader": "^4.12.20",
"react-refresh": "^0.7.0",
"read-package-tree": "^5.3.1",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0",
"remark-stringify": "^8.0.0",
"semver": "^5.7.1",
"shallow-compare": "^1.2.2",
"sift": "^5.1.0",
"signal-exit": "^3.0.2",
"simplified-jsx-to-json": "^0.1.0",
"slugify": "^1.4.0",
"socket.io": "^2.3.0",
"stack-trace": "^0.0.10",
"string-similarity": "^1.2.2",
"style-loader": "^0.23.1",
"subscriptions-transport-ws": "^0.9.16",
"terser-webpack-plugin": "^1.4.3",
"true-case-path": "^2.2.1",
"type-of": "^2.0.1",
"unist-util-visit": "^2.0.2",
"url-loader": "^1.1.2",
"urql": "^1.9.5",
"util.promisify": "^1.0.1",
"uuid": "^3.4.0",
"v8-compile-cache": "^1.1.2",
Expand All @@ -144,6 +156,7 @@
"webpack-hot-middleware": "^2.25.0",
"webpack-merge": "^4.2.2",
"webpack-stats-plugin": "^0.3.1",
"ws": "^7.2.3",
"xstate": "^4.8.0",
"yaml-loader": "^0.5.0"
},
Expand Down Expand Up @@ -201,17 +214,20 @@
"graphql": "^14.6.0"
},
"scripts": {
"build": "npm run build:src && npm run build:internal-plugins && npm run build:rawfiles && npm run build:cjs",
"build": "npm run build:src && npm run build:internal-plugins && npm run build:rawfiles && npm run build:cjs && npm run build:recipes",
johno marked this conversation as resolved.
Show resolved Hide resolved
"postbuild": "node scripts/output-api-file.js",
"build:internal-plugins": "copyfiles -u 1 src/internal-plugins/**/package.json dist",
"build:rawfiles": "copyfiles -u 1 src/internal-plugins/**/raw_* dist",
"build:recipes": "copyfiles -u 1 src/recipes/*.mdx dist",
"build:cjs": "babel cache-dir --out-dir cache-dir/commonjs --ignore **/__tests__",
"build:src": "babel src --out-dir dist --source-maps --verbose --ignore **/gatsby-cli.js,src/internal-plugins/dev-404-page/raw_dev-404-page.js,**/__tests__ --extensions \".ts,.js\"",
"clean-test-bundles": "find test/ -type f -name bundle.js* -exec rm -rf {} +",
"prebuild": "rimraf dist && rimraf cache-dir/commonjs",
"postinstall": "node scripts/postinstall.js",
"prepare": "cross-env NODE_ENV=production npm run build",
"watch": "rimraf dist && mkdir dist && npm run build:internal-plugins && npm run build:rawfiles && npm run build:src -- --watch"
"watch": "rimraf dist && mkdir dist && npm run build:internal-plugins && npm run build:rawfiles && npm run build:recipes && npm run build:src -- --watch",
KyleAMathews marked this conversation as resolved.
Show resolved Hide resolved
"test": "jest",
"test:watch": "jest --watch"
},
"types": "index.d.ts",
"yargs": {
Expand Down
41 changes: 41 additions & 0 deletions packages/gatsby/src/commands/recipes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import telemetry from "gatsby-telemetry"
import execa from "execa"
import path from "path"
import fs from "fs"

module.exports = async (program: IProgram): Promise<void> => {
const recipe = program._[1]
telemetry.trackCli(`RECIPE_RUN`, { recipe })
KyleAMathews marked this conversation as resolved.
Show resolved Hide resolved

// Start GraphQL serve
let subprocess
const scriptPath = path.join(program.directory, `node_modules/gatsby/dist/recipes/graphql.js`)
subprocess = execa(`node`, [scriptPath], {
cwd: program.directory,
all: true,
})
process.on("exit", () =>
subprocess.kill("SIGTERM", {
forceKillAfterTimeout: 2000,
})
)
// Log server output to a file.
if (process.env.DEBUG) {
const logFile = path.join(program.directory, './recipe-server.log')
fs.writeFileSync(logFile, `\n-----\n${new Date().toJSON()}\n`)
const writeStream = fs.createWriteStream(logFile, {flags:'a'});
subprocess.stdout.pipe(writeStream)
// subprocess.stderr.pipe(writeStream)
}

let started = false
subprocess.stdout.on("data", data => {
if (!started) {
const runRecipe = require(`../recipes/index`)
runRecipe({ recipe, projectRoot: program.directory })
started = true
}
})

// Run command
}
Loading