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

Support reading schema from workspace #2549

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

prestonp
Copy link

Description

This PR modifies the Github Action. The desired change is to support reading the new schema from a statically generated file which is not checked into the source code.

We use nexusjs which is a code-first graphql schema system. We produce the graphql schema file as a codegen step.

Opened this PR to address our use case which has been described in #2120. I would be happy to drive/refactor this change for general usage but not sure about the ergonomics for specifying "read schema from fs".

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as
    expected)
  • This change requires a documentation update

How Has This Been Tested?

Used a workflow that runs a forked version of the graphql-inspector action. Note that we generate services/graphql/generated/schema.graphql in a previous workflow step.

- name: GraphQL Inspector
        uses: Strawberry-Jam-Manufacturers/graphql-inspector@preston/schema-fs
        with:
          schema: "services/graphql/generated/schema.graphql"
          endpoint: "https://<staging host>/graphql"

Checklist:

  • I have followed the
    CONTRIBUTING doc and the
    style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Further comments

I did the least amount of work to solve my use case but I'd like to open discussion if this makes sense to support in a general sense.

Sorry, something went wrong.

@changeset-bot
Copy link

changeset-bot bot commented Jun 23, 2023

⚠️ No Changeset found

Latest commit: 4aea993

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

package.json Outdated
@@ -76,7 +76,7 @@
"@types/express": "4.17.17",
"@types/node": "20.2.5",
"@types/yargs": "17.0.24",
"@zeit/ncc": "0.22.3",
"@vercel/ncc": "0.36.1",
Copy link
Author

Choose a reason for hiding this comment

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

I updated this package because @zeii/ncc is deprecated and did not work for pnpm action

> graphql-inspector-mono-repository@ action /Users/preston/projects/graphql-inspector
> ncc build packages/action/src/action.ts --out action --minify --transpile-only

ncc: Version 0.22.3
ncc: Compiling file index.js
ncc: Using [email protected] (local user-provided)
Error: Module parse failed: Unexpected token (79:32)
File was processed with these loaders:
 * ./node_modules/.pnpm/@[email protected]/node_modules/@zeit/ncc/dist/ncc/loaders/empty-loader.js
 * ./node_modules/.pnpm/@[email protected]/node_modules/@zeit/ncc/dist/ncc/loaders/relocate-loader.js
 * ./node_modules/.pnpm/@[email protected]/node_modules/@zeit/ncc/dist/ncc/loaders/uncacheable.js
 * ./node_modules/.pnpm/@[email protected]/node_modules/@zeit/ncc/dist/ncc/loaders/ts-loader.js
 * ./node_modules/.pnpm/@[email protected]/node_modules/@zeit/ncc/dist/ncc/loaders/shebang-loader.js
You may need an additional loader to handle the result of these loaders.
|     }
|     let [schemaRef, schemaPath] = schemaPointer.split(':');
>     if (useMerge && pullRequest?.state === 'open') {
|         ref = `refs/pull/${pullRequest.number}/merge`;
|         workspace = undefined;
    at /Users/preston/projects/graphql-inspector/node_modules/.pnpm/@[email protected]/node_modules/@zeit/ncc/dist/ncc/index.js.cache.js:3:63173
    at eval (eval at create (/Users/preston/projects/graphql-inspector/node_modules/.pnpm/@[email protected]/node_modules/@zeit/ncc/dist/ncc/index.js.cache.js:1:275040), <anonymous>:13:1)
 ELIFECYCLE  Command failed with exit code 1.

@nitruxa
Copy link

nitruxa commented Sep 15, 2023

is this one alive?

* Support reading the new schema from workspace dir
* Upgrade ncc for rebuilding the action via `pnpm action`
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

2 participants