Skip to content
This repository has been archived by the owner on Dec 8, 2021. It is now read-only.

feature: support ts schema #431

Merged
merged 3 commits into from
Feb 5, 2019
Merged

feature: support ts schema #431

merged 3 commits into from
Feb 5, 2019

Conversation

maticzav
Copy link
Collaborator

@maticzav maticzav commented Feb 4, 2019

This PR adds support for importing the schema from typescript files.

)
})

test('import schema gql default', () => {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
test('import schema gql default', () => {
test('import schema gql const', () => {

@jasonkuhrt
Copy link
Member

One reason this is important, as stated by @maticzav in slack:

This is especially important for deployments using now because .graphql file cannot be imported - the deployment ignores it when preparing the bundle.

@jasonkuhrt jasonkuhrt merged commit e3fbbfa into master Feb 5, 2019
@jasonkuhrt jasonkuhrt deleted the feature/support-ts-schema branch February 5, 2019 01:43
@steida
Copy link

steida commented Feb 5, 2019

@jasonkuhrt @maticzav

Can you please describe the use case in more detail? I haven't a problem with it. Thank you.

@jasonkuhrt
Copy link
Member

jasonkuhrt commented Feb 5, 2019

@steida I'll let @maticzav expand on the now one as I'm not a zeit user myself.

However users should be able to import from TypeScript files anyways. There are quite a few examples by and of Apollo servers using the const typeDefs = gql`...` so having this start to work is good a good step. I realize that a complex project doing modular const typeDefs = gql`...` will not work yet. I think we could achieve that with a scan across the user's project. But more complicated. Lets see if users start to ask for it. Other priorities for now.

@maticzav
Copy link
Collaborator Author

maticzav commented Feb 5, 2019

Hey @steida 👋,

So, the reason why this is important is that firstly, Apollo users to my understanding had to import and parse their schema during the runtime, and secondly, deployed applications couldn't work with Now 2.0. The reason behind this is that Now uses ncc to compile lambdas out of source code, therefore, they wouldn't bundle schema because it was a runtime dependency.

I hope this gives you a good enough idea 🙂

@steida
Copy link

steida commented Feb 5, 2019

@maticzav Thank you. Btw, deployed API works for me here in https://github.com/este/este

@jasonkuhrt jasonkuhrt changed the title Feature/support ts schema feature: support ts schema Feb 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants