Repository navigation
chore: integration build of the v4 migration fixes (#3474, #3475, #3476, #3477) - #3478
Closed
eduardoformiga wants to merge 10 commits into
Closed
eduardoformiga wants to merge 10 commits into
eduardoformiga wants to merge 10 commits into
Conversation
Next.js treats moduleResolution as a required compiler option and, for TypeScript >= 5 with module=esnext, only accepts bundler/node16/nodenext. With "node" it rewrote every store's generated .faststore/tsconfig.json on each dev/build and logged "reconfigured your tsconfig.json". Every other package in the monorepo already uses "bundler"; aligning core removes the drift between the committed config and what Next actually type-checks with.
…ublic entry `Resolver`, `Options`, `FeatureFlags`, `PromiseType` and `ArrayElementType` were ambient (script-scoped) declarations in `src/typings/globals.ts`. Ambient types are not reachable from the emitted `index.d.ts`, so stores importing `GraphqlResolver`/`APIOptions` saw them silently degrade to implicit `any` under `strict: true`, and `GraphqlContext` was not exported at all. Turn `globals.ts` into a real module, import the helpers explicitly where they are used, and re-export `GraphqlContext`, `Resolver` and the helper types from the package entry so the published typings are self-contained. Add a unit test that compiles a consumer against the entrypoint with strict/noImplicitAny and asserts the resolver parameters are properly typed.
Type-checking the whole package graph twice, with every @types/* package loaded, took over 5s under coverage instrumentation and timed out in CI. Compile both consumer snippets in a single program with `types: []` and give the setup an explicit budget for slow runners.
Stores that extend the API (e.g. Whirlpool) type their resolvers with the `Resolver<Root, Args, Return>` signature that `@faststore/api@3` exported. In v4 the internal `Resolver` became a 4-parameter generic with the context first, so re-exporting it as-is would still break those stores (`Resolver<unknown, Args>` -> "unknown does not satisfy Record<string, any>", `Parameters<Resolver>[2]` -> "requires between 1 and 4 type arguments"). Export `Resolver` as an alias of `GraphqlResolver` with the v3 signature instead, so existing custom resolvers type-check without changes. Validated against the 16 resolver files of the Whirlpool monorepo: 115 errors on 4.6.0 -> 0 with this build.
`faststore build`/`generate` passed the codegen `documents` glob and the
output directory as absolute paths. `@graphql-tools/load` treats a pointer
that contains whitespace and is not valid SDL as a broken inline document
and throws ("Failed to parse the GraphQL document. Syntax Error: Unexpected
character: '/'"), so any store cloned under a directory with a space in its
name (e.g. `/Users/me/My Store`) could not build.
Express the documents glob, the schema and the output dir relative to the
directory codegen resolves pointers from (`process.cwd()`), so the parent
directories are never part of the pointer. Glob-special characters in the
relative segments are still escaped, and symlinks are resolved on both sides
so the relative path does not climb back through the parents.
Also alias `graphql` to its CJS build in the CLI vitest config: the code
under test and the externalized @graphql-tools packages otherwise load two
instances and fail `instanceof` checks, which prevented an end-to-end test
of the generator.
…e-check `next build` type-checks everything the `.faststore/tsconfig.json` includes. Stores keep `*.stories.tsx` and `__mocks__/` next to their components under `src/`, which is copied into `.faststore/src/customizations/src`, so the build compiled them against dev-only dependencies (`@storybook/*`, `@jest/globals`) and failed. Validated with the Whirlpool monorepo: 316 of the 331 type errors in its v4 build came from its own stories. Extend the exclude globs added in #3459 for test files to cover stories and manual mocks as well.
…lution' into chore/v4-migration-fixes
…s' into chore/v4-migration-fixes
…ies' into chore/v4-migration-fixes
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueComment |
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

0 New Issues
0 Fixed Issues
0 Accepted Issues
What's the purpose of this pull request?
Integration branch that merges the four independent fixes for the v4 migration blockers, so a single per-commit build (pkg.pr.new) can be installed in a real store and validated end-to-end before each PR is merged on its own:
@faststore/api: exportResolver(v3-compatible signature),GraphqlContextand helper types from the public entry@faststore/core:tsconfigmoduleResolution: bundler@faststore/cli: GraphQL type generation when the project path contains spaces@faststore/cli: keep store stories and Jest mocks out of the.faststoretype-checkNot meant to be merged — review and merge the individual PRs. This one exists only to produce the combined build; it will be closed afterwards.
How it works?
Plain merges of the four branches on top of
dev(no conflicts, no extra changes).How to test it?
Install the pkg.pr.new build of this PR's head commit in a store (
@faststore/cliplusresolutionsfor every@faststore/*package) and runyarn build.Starters Deploy Preview
Pending CodeSandbox / pkg.pr.new build for this PR.
References
#3474, #3475, #3476, #3477
Made with Cursor