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(gatsby): Remove GATSBY_BUILD_STAGE & warn against ___NODE #33501

Merged
merged 7 commits into from
Oct 13, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
3 changes: 1 addition & 2 deletions packages/babel-preset-gatsby/src/dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ export default (_?: unknown, options: IPresetOptions = {}) => {
require.resolve(`@babel/runtime/package.json`)
)

// TODO(v3): Remove process.env.GATSBY_BUILD_STAGE, needs to be passed as an option
const stage = options.stage || process.env.GATSBY_BUILD_STAGE || `test`
const stage = options.stage || `test`
const pluginBabelConfig = loadCachedConfig()
const targets = pluginBabelConfig.browserslist

Expand Down
9 changes: 7 additions & 2 deletions packages/gatsby/src/schema/infer/add-inferred-fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,13 @@ const getFieldConfigFromFieldNameConvention = ({
const linkedTypesSet = new Set()

if (foreignKey) {
// TODO: deprecate foreign keys like this (e.g. author___NODE___contact___email)
// and recommend using schema customization instead
// TODO(v5): Remove ability to use foreign keys like this (e.g. author___NODE___contact___email)
// and recommend using schema customization instead

report.warn(
`The ___NODE convention is deprecated. Please use the @link directive instead. Migration: https://gatsby.dev/node-convention-deprecation`
)
wardpeet marked this conversation as resolved.
Show resolved Hide resolved

const linkedValues = new Set(value.linkedNodes)
getDataStore()
.iterateNodes()
Expand Down
2 changes: 0 additions & 2 deletions packages/gatsby/src/schema/types/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,6 @@ export const getFilterInput = ({
)
const inputTypeComposer = typeComposer.getInputTypeComposer()

// TODO: In Gatsby v2, the NodeInput.id field is of type String, not ID.
// Remove this workaround for v3.
if (
inputTypeComposer?.hasField(`id`) &&
getNamedType(inputTypeComposer.getFieldType(`id`)).name === `ID`
Expand Down
3 changes: 1 addition & 2 deletions packages/gatsby/src/schema/types/node-interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ const getOrCreateNodeInterface = <TSource, TArgs>(
},
internal: internalTC.getTypeNonNull(),
})
// TODO: In Gatsby v2, the NodeInput.id field is of type String, not ID.
// Remove this workaround for v3.

const nodeInputTC = tc.getInputTypeComposer()
nodeInputTC.extendField(`id`, { type: `String` })
})
Expand Down
1 change: 0 additions & 1 deletion packages/gatsby/src/utils/__tests__/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ describe(`environment variables`, () => {
[
`__PATH_PREFIX__`,
`process.env.BUILD_STAGE`,
`process.env.GATSBY_BUILD_STAGE`,
`process.env.NODE_ENV`,
`process.env.PUBLIC_DIR`,
].reduce((merged, key) => {
Expand Down
4 changes: 0 additions & 4 deletions packages/gatsby/src/utils/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ module.exports = async (
const modulesThatUseGatsby = await getGatsbyDependents()
const directoryPath = withBasePath(directory)

// we will converge to build-html later on but for now this was the fastest way to get SSR to work
// TODO remove in v4 - we deprecated this in v3
process.env.GATSBY_BUILD_STAGE = suppliedStage

// We combine develop & develop-html stages for purposes of generating the
// webpack config.
const stage = suppliedStage
Expand Down