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: Deprecate gatsby-recipes #34094

Merged
merged 17 commits into from Dec 9, 2021
Merged

feat: Deprecate gatsby-recipes #34094

merged 17 commits into from Dec 9, 2021

Conversation

LekoArts
Copy link
Contributor

@LekoArts LekoArts commented Nov 29, 2021

Description

This moves gatsby-recipes into the deprecated-packages directory in this monorepo. Thus with the next release when this is merged the package will no longer receive any new publishes and the current version will stay. A possible follow-up for this PR could be changing the README of gatsby-recipes to include a snippet like:

# You can still use it like this
npx gatsby-cli@version recipes emotion

I'd need to verify first if npx in fact includes supporting specifying a specific version.

For Review

  • 144 files of the files changed are just gatsby-recipes being moved to the new directory.
  • I've changed the create-gatsby README as the instructions were not correct when I tried it out myself
  • create-gatsby and gatsby-cli relied on some functionality from recipes, I've reimplemented it where necessary

Documentation

The glossary entry was updated and one doc that mentioned a post about using recipes.

Related Issues

Partially addresses #25764 - more needs to be done but with recipes out one less culprit.

[sc-42424]

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Nov 29, 2021
@LekoArts LekoArts removed the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Nov 29, 2021
describe: `The plugin names`,
type: `string`,
}),
yargs.positional(`cmd`, {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stub was added in #27725 but never used again. So plugins positional was never working, thus I removed this here + removed plugin-add.ts handler file

@@ -9,7 +9,7 @@ import isValid from "is-valid-path"
import sysPath from "path"
import prompts from "prompts"
import url from "url"
import { updateSiteMetadata } from "gatsby-core-utils"
import { updateInternalSiteMetadata } from "gatsby-core-utils"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The naming of the function confused me with the siteMetadata from gatsby-config.js so I renamed this

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seem to be getting this error when running gatsby build now:

error (0 , _gatsbyCoreUtils.updateSiteMetadata) is not a function

TypeError: (0 , _gatsbyCoreUtils.updateSiteMetadata) is not a function
  
  - build.ts:87 build
    [project]/[gatsby]/src/commands/build.ts:87:9
  
  - create-cli.js:240 
    [project]/[gatsby-cli]/lib/create-cli.js:240:14
  
  - create-cli.js:130 
    [project]/[gatsby-cli]/lib/create-cli.js:130:24
  
  - create-cli.js:41 Object.handler
    [project]/[gatsby-cli]/lib/create-cli.js:41:19
  
  - command.js:196 Object.runCommand
    [project]/[gatsby-cli]/[yargs]/build/lib/command.js:196:48
  
  - yargs.js:1043 Object.parseArgs [as _parseArgs]
    [project]/[gatsby-cli]/[yargs]/build/lib/yargs.js:1043:55
  
  - yargs.js:584 Object.parse
    [project]/[gatsby-cli]/[yargs]/build/lib/yargs.js:584:29
  
  - create-cli.js:541 createCli
    [project]/[gatsby-cli]/lib/create-cli.js:541:136
  
  - index.js:84 Object.<anonymous>
    [project]/[gatsby-cli]/lib/index.js:84:26
  
  - loader:1101 Module._compile
    node:internal/modules/cjs/loader:1101:14
  
  - loader:1153 Object.Module._extensions..js
    node:internal/modules/cjs/loader:1153:10
  
  - loader:981 Module.load
    node:internal/modules/cjs/loader:981:32
  
  - loader:822 Function.Module._load
    node:internal/modules/cjs/loader:822:12
  
  - loader:1005 Module.require
    node:internal/modules/cjs/loader:1005:19
  
  - helpers:102 require
    node:internal/modules/cjs/helpers:102:18
  
  - gatsby.js:3 Object.<anonymous>
    [project]/[gatsby]/src/bin/gatsby.js:3:1
  

error Command failed with exit code 1.

I need to have a look into why this is happening though, as something in our build system isn't correctly pinning the version of gatsby + gatsby-cli it seems. (setting to the previous version doesn't fix the issue for some reason - should have an update tomorrow). I'm guessing (and unsure if this is always the case, but this change means that the gatsby + gatsby-cli versions must match)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn’t add gatsby-cli as a dependency to a project. It’s a global CLI package

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear we don't have it as a dependency in the package.json, however it's required in the CI system to be installed

return modifiedConfig
}

export async function addFieldToMinimalSiteMetadata(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Largely copied from gatsby-recipes

* Does a string replace by searching for beginning of "siteMetadata"
* Then it adds the name + value as the next key of that object
*/
function addField(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was previously a babel step, now it's a naive string replace

@LekoArts LekoArts changed the title Remove recipes feat: Deprecate gatsby-recipes Nov 29, 2021
wardpeet
wardpeet previously approved these changes Dec 8, 2021
Copy link
Contributor

@wardpeet wardpeet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want to spend to long reviewing it. If create-gatsby and gatsby still works as expected i'm good to merge this!

💀 Recipes 💀

wardpeet
wardpeet previously approved these changes Dec 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants