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(create-gatsby): Add create-gatsby #27703

Merged
merged 102 commits into from Nov 12, 2020
Merged
Show file tree
Hide file tree
Changes from 98 commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
02fbd5a
Add create-gatsby
ascorbic Oct 28, 2020
619bde0
add question and readme, update some wording
gillkyle Oct 28, 2020
b22b22a
Update readme
ascorbic Oct 29, 2020
8af6b11
Update handling of questions
ascorbic Oct 29, 2020
f88cd03
Stylish!
ascorbic Oct 29, 2020
3b8fd3b
Update message
ascorbic Oct 29, 2020
80f7886
Update messages
ascorbic Oct 29, 2020
25a58b0
Catch ctrl^c
ascorbic Oct 29, 2020
3c9f73a
v0.0.0-2
ascorbic Oct 29, 2020
c396348
Add test
ascorbic Oct 29, 2020
75a498b
Fix test
ascorbic Oct 30, 2020
d644922
feat(gatsby): Add "gatsby plugin add" command
ascorbic Oct 30, 2020
512addb
Load readme from local package
ascorbic Oct 30, 2020
e7f321f
ensure skipped steps are actually skipped
gillkyle Oct 30, 2020
3d14984
attempt to add some more tests
gillkyle Oct 30, 2020
6075fcb
Move command to cli
ascorbic Nov 2, 2020
7e374d7
Merge branch 'feat/plugin-add' into feat/create-gatsby
ascorbic Nov 2, 2020
8e458f5
Try to install plugins
ascorbic Nov 2, 2020
99de6b7
feat(create-gatsby): add wip plugin configuration forms (#27801)
gillkyle Nov 3, 2020
ab52e27
Install plugins
ascorbic Nov 3, 2020
f6e61fb
Merge remote-tracking branch 'origin' into feat/create-gatsby
ascorbic Nov 3, 2020
02b67d7
Merge remote-tracking branch 'origin' into feat/create-gatsby
ascorbic Nov 3, 2020
0984586
Add error handling
ascorbic Nov 3, 2020
e1b7a6d
Return, don't exit
ascorbic Nov 3, 2020
be319d9
Fix tests
ascorbic Nov 3, 2020
2494e6f
Resolve themes relative to root
ascorbic Nov 3, 2020
650a1ae
Change back to original dir
ascorbic Nov 3, 2020
43c33ff
Use starter with canary
ascorbic Nov 3, 2020
43cffa9
v0.0.0-3
ascorbic Nov 3, 2020
f19acf2
Fix to force publish
ascorbic Nov 3, 2020
64ef9a3
Working!
ascorbic Nov 4, 2020
8345e09
Change from review
ascorbic Nov 4, 2020
69277f0
Fix package name
ascorbic Nov 4, 2020
abb8e5b
Use gatsby-source-wordpress-experimental
ascorbic Nov 4, 2020
a995905
Add schema import script
ascorbic Nov 4, 2020
e09907b
v0.0.0-4
ascorbic Nov 4, 2020
1cbc9f1
Add dep
ascorbic Nov 4, 2020
24d6507
v0.0.0-5
ascorbic Nov 4, 2020
0a07e46
handle peer dependencies
Nov 5, 2020
a41a557
forgot to save a file
Nov 5, 2020
1bac85f
Merge remote-tracking branch 'upstream/master' into feat/create-gatsby
Nov 5, 2020
4256b59
bump core-utils dependency
Nov 5, 2020
420b436
update styling and text to match Flo's design, in progress
Nov 5, 2020
f035a43
use magenta for all actions to be taken
Nov 5, 2020
d3f30a7
add final prompts
Nov 5, 2020
1a328ab
consistent coloring
Nov 5, 2020
1968063
consistent coloring
Nov 5, 2020
a1843e3
consistent coloring
Nov 5, 2020
42f7adf
Initial input test
ascorbic Nov 6, 2020
297a217
Layout helpers
ascorbic Nov 6, 2020
554de6f
Merge branch 'feat/create-gatsby' of github.com:gatsbyjs/gatsby into …
ascorbic Nov 6, 2020
ca42b48
Add custom textinput prompt
ascorbic Nov 6, 2020
e0c7679
Fixes to hint
ascorbic Nov 6, 2020
d7f1dea
Fix error
ascorbic Nov 6, 2020
81d2a16
Add select control
ascorbic Nov 6, 2020
157fc87
update options for gatsby new
Nov 6, 2020
78d7290
Tab to end
ascorbic Nov 6, 2020
d448089
Merge branch 'feat/create-gatsby' of github.com:gatsbyjs/gatsby into …
ascorbic Nov 6, 2020
2f1e3b9
update tests
Nov 6, 2020
0e32a63
send both tabs
Nov 6, 2020
3009490
it was the right hex code, or not
Nov 6, 2020
60f4718
order shouldn't matter but I'm very confused
Nov 6, 2020
28fbe82
will slash tab work
Nov 6, 2020
d776210
Formatting fixes
ascorbic Nov 6, 2020
62e31a3
v0.0.0-6
ascorbic Nov 6, 2020
cd28154
Merge remote-tracking branch 'origin' into feat/create-gatsby
ascorbic Nov 6, 2020
3a5ea9c
Merge remote-tracking branch 'origin' into feat/create-gatsby
ascorbic Nov 6, 2020
239c70d
Merge branch 'feat/create-gatsby' of github.com:gatsbyjs/gatsby into …
ascorbic Nov 6, 2020
53e1c86
use down inside of tab
Nov 6, 2020
efe5490
test enter
Nov 6, 2020
1813dcb
trying one more thing, but suspect it's unrelated
Nov 6, 2020
0c57475
Merge remote-tracking branch 'origin' into feat/create-gatsby
ascorbic Nov 9, 2020
2df4153
Update packages/create-gatsby/src/cmses.json
ascorbic Nov 9, 2020
67c4f7a
Update packages/create-gatsby/src/styles.json
ascorbic Nov 9, 2020
e7c9c97
one more time
Nov 9, 2020
5933b4d
bane of my existence
Nov 9, 2020
5e731f7
try different keys for different OS
Nov 9, 2020
27a5241
somehow bypasses linter
Nov 9, 2020
92f4cc8
remove console.log
Nov 9, 2020
4448f4a
add fake plugin schemas for other cmses
gillkyle Nov 10, 2020
9982f1f
Merge branch 'feat/create-gatsby' of github.com:gatsbyjs/gatsby into …
gillkyle Nov 10, 2020
e02ae70
Fix test
ascorbic Nov 10, 2020
a733952
Longer tick
ascorbic Nov 10, 2020
6c1a620
Add description to form inputs
ascorbic Nov 10, 2020
45179cd
Test changes
ascorbic Nov 10, 2020
c117389
increase interval
Nov 10, 2020
b7011c3
add initial working test
Nov 10, 2020
bad4884
missing return type
Nov 10, 2020
aca9fe8
not sure why linter keeps skipping these diles
Nov 10, 2020
addd312
all tests except project name exists
Nov 10, 2020
771193d
just in case it's a timeout thing
Nov 10, 2020
aff6d4d
does a single question pass
Nov 10, 2020
f4a189f
have CI run individual questions and see if we falter
Nov 10, 2020
2d69168
Test
ascorbic Nov 11, 2020
0aa99ad
Burn it with fire :fire:
ascorbic Nov 11, 2020
a8ea7b8
Move components into plugin
ascorbic Nov 11, 2020
8cd0a48
Replace Prismic with Dato
ascorbic Nov 11, 2020
43ea67b
Install plugins at the start
ascorbic Nov 11, 2020
009ed62
Add support for plugin dependencies (#27995)
ascorbic Nov 12, 2020
531638c
Apply suggestions from code review
ascorbic Nov 12, 2020
04e8dd0
Remove broken tests :cry:
ascorbic Nov 12, 2020
cc862b3
Merge branch 'feat/create-gatsby' of github.com:gatsbyjs/gatsby into …
ascorbic Nov 12, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/create-gatsby/.gitignore
@@ -0,0 +1,2 @@
node_modules
lib
21 changes: 21 additions & 0 deletions packages/create-gatsby/README.md
@@ -0,0 +1,21 @@
# create-gatsby (alpha)

Create Gatsby apps in an interactive CLI experience that does the plumbing for you.

## Quick Overview

Create a new Gatsby app by running the following command:

```shell
npm init gatsby
```

or

```shell
yarn create gatsby
```

It will ask you questions about what you're building, and set up a Gatsby project for you.

_Note: this package is different from the Gatsby CLI, it is intended solely to create new sites. The Gatsby CLI supports a similar functionality legacy functionality with the `gatsby new` command._
ascorbic marked this conversation as resolved.
Show resolved Hide resolved
44 changes: 44 additions & 0 deletions packages/create-gatsby/package.json
@@ -0,0 +1,44 @@
{
"name": "create-gatsby",
"version": "0.0.0-6",
"main": "lib/index.js",
"bin": "lib/cli.js",
"license": "MIT",
"scripts": {
gillkyle marked this conversation as resolved.
Show resolved Hide resolved
"build": "tsc",
"watch": "tsc --watch",
"prepare": "yarn build",
"import-plugin-options": "node ./scripts/import-options-schema.js"
},
"homepage": "https://github.com/gatsbyjs/gatsby/tree/master/packages/create-gatsby#readme",
"dependencies": {
"@babel/runtime": "^7.12.1",
"ansi-wordwrap": "^1.0.2",
"common-tags": "^1.8.0",
"enquirer": "^2.3.6",
"execa": "^4.0.3",
"fs-extra": "^9.0.1",
"gatsby-core-utils": "^1.4.0-next.0",
"stream-filter": "^2.1.0",
"string-length": "^4.0.1",
"terminal-link": "^2.1.1"
},
"files": [
"lib"
],
"devDependencies": {
"@types/configstore": "^4.0.0",
"@types/fs-extra": "^9.0.2",
"@types/node": "^14.14.5",
"eslint": "^7.12.1",
"joi": "^17.2.1",
"prettier": "^2.1.2",
"typescript": "^4.0.5"
},
"repository": {
"type": "git",
"url": "https://github.com/gatsbyjs/gatsby.git",
"directory": "packages/create-gatsby"
},
"author": "Matt Kane <matt@gatsbyjs.com>"
}
93 changes: 93 additions & 0 deletions packages/create-gatsby/scripts/import-options-schema.js
@@ -0,0 +1,93 @@
#!/usr/bin/env node

const path = require("path")
const fs = require("fs-extra")
const pluginPath= process.argv[2]
const Joi = require("joi")
ascorbic marked this conversation as resolved.
Show resolved Hide resolved
async function run() {
if(!pluginPath) {
console.error("Please pass a path to the plugin directory")
return
}


const rootDir = path.resolve(pluginPath)
if(!fs.existsSync(rootDir)) {
console.error(`The plugin directory ${rootDir} does not exist`)
return
}

const stat = await fs.stat(rootDir)

if(!stat.isDirectory()) {
console.error(`The plugin path ${rootDir} is not a directory`)
return
}

let pluginName

try {
const { name } = require(path.resolve(rootDir, "package.json"))
if(!name) {
console.error("Plugin package.json does not have a name field")
return
}
pluginName = name

} catch (e) {
console.error("Could not open package.json. Are you sure the plugin directory is correct?")
return
}

const gatsbyNodePath = path.resolve(rootDir, "gatsby-node.js")

if(!fs.existsSync(gatsbyNodePath)) {
console.error(`Could not find gatsby-node.js in ${gatsbyNodePath}. Are you sure this is a plugin directory?`)
return
}

let pluginOptionsSchema

try {
const gatsbyNode = require(gatsbyNodePath)
pluginOptionsSchema = gatsbyNode.pluginOptionsSchema
} catch(e) {
console.error(`Could not load gatsby-node.js. You may need to build the plugin first.`)
console.log("Error was:", e.message)
return
}

if(!pluginOptionsSchema) {
console.error("The plugin does not include a pluginOptionsSchema")
return
}

let optionsSchema

try {
const schema = pluginOptionsSchema({ Joi })
optionsSchema = schema.describe()
} catch (e) {
console.error("Failed to generate schema")
console.error(e.message)
return
}

const schemataPath = path.resolve(__dirname, "..", "src", "plugin-schemas.json")

if(!fs.existsSync(schemataPath)) {
console.error("Could not find output file")
return
}

const json = await fs.readJSON(schemataPath)

json[pluginName] = optionsSchema

console.log(`Writing "${pluginName} to schemataPath`)
await fs.writeJSON(schemataPath, json)


}

run()