-
Notifications
You must be signed in to change notification settings - Fork 284
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update codegen deps and remove patches (#1705)
* Update codegen dependencies to fix known bugs * Remove patch for codegen subdependencies * Changesets * Update package-lock
- Loading branch information
Showing
10 changed files
with
1,200 additions
and
1,862 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@shopify/hydrogen-codegen': patch | ||
'@shopify/cli-hydrogen': patch | ||
--- | ||
|
||
Bump Codegen dependencies to fix known bugs and remove patches. |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,2 @@ | ||
import path from 'node:path'; | ||
import fs from 'node:fs'; | ||
import {createRequire} from 'node:module'; | ||
import {fileURLToPath} from 'node:url'; | ||
|
||
/** | ||
* Patch graphql-tag-pluck to allow it to work with `#graphql` comment and other features. | ||
*/ | ||
const require = createRequire(import.meta.url); | ||
const realGqlTagPluck = require.resolve('@graphql-tools/graphql-tag-pluck'); | ||
// During tests, this file is in src/xyz.ts but in dev/prod, | ||
// the file is in dist/(esm|cjs)/xyz.js | ||
const depth = path.extname(import.meta.url) === '.ts' ? '../' : '../../'; | ||
const vendorGqlTagPluck = fileURLToPath( | ||
new URL(depth + '/vendor/graphql-tag-pluck', import.meta.url), | ||
); | ||
|
||
// Copy files sequencially to avoid `EBUSY` errors in Windows | ||
fs.copyFileSync( | ||
path.join(vendorGqlTagPluck, 'visitor.cjs'), | ||
realGqlTagPluck.replace(/index\.js$/, 'visitor.js'), | ||
); | ||
|
||
fs.copyFileSync( | ||
path.join(vendorGqlTagPluck, 'visitor.mjs'), | ||
realGqlTagPluck.replace('cjs', 'esm').replace(/index\.js$/, 'visitor.js'), | ||
); | ||
|
||
/** | ||
* Temporary patch for a bug in another package | ||
* https://github.com/dotansimha/graphql-code-generator/pull/9709 | ||
*/ | ||
const visitorPluginCommon = require.resolve( | ||
'@graphql-codegen/visitor-plugin-common', | ||
); | ||
const selectionSetToObjectFileCJS = visitorPluginCommon.replace( | ||
'index.js', | ||
'selection-set-to-object.js', | ||
); | ||
const selectionSetToObjectFileESM = selectionSetToObjectFileCJS.replace( | ||
'cjs', | ||
'esm', | ||
); | ||
|
||
fs.writeFileSync( | ||
selectionSetToObjectFileCJS, | ||
patchSelectionSet(fs.readFileSync(selectionSetToObjectFileCJS, 'utf-8')), | ||
'utf-8', | ||
); | ||
|
||
fs.writeFileSync( | ||
selectionSetToObjectFileESM, | ||
patchSelectionSet(fs.readFileSync(selectionSetToObjectFileESM, 'utf-8')), | ||
'utf-8', | ||
); | ||
|
||
function patchSelectionSet(content: string) { | ||
return content.replace('&& s.union', '&& s?.union'); | ||
} | ||
// Placeholder for subdependency patching | ||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.