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

Resolve Windows FS Issues #810

Merged
merged 6 commits into from
Jan 15, 2019
Merged

Resolve Windows FS Issues #810

merged 6 commits into from
Jan 15, 2019

Conversation

trevor-scheer
Copy link
Member

This PR should resolve the codegen issues on Windows that have been reported in the long-running codegen issue thread #719

Thanks to @patrys for really digging in and suggesting some changes!

Pending set up of Appveyor, I'd appreciate if any of our Windows users could test out this change.
cc: @chenglabs @ZenSoftware @jbaxleyiii @patrys

Copy link
Contributor

@jbaxleyiii jbaxleyiii left a comment

Choose a reason for hiding this comment

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

This looks good, I'll try it out on windows and let you know!

@@ -188,8 +189,8 @@ export abstract class ProjectCommand extends Command {
// In this case, we don't want to look to the .dir since that's the parent
const rootURI =
filepath === process.cwd()
? `file://${filepath}`
: `file://${parse(filepath).dir}`;
? Uri.file(filepath)
Copy link
Contributor

Choose a reason for hiding this comment

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

YAS

@@ -37,69 +37,6 @@ exports[`client:codegen generates operation IDs for swift files when flag is set
}"
`;

exports[`client:codegen writes TypeScript global types to a custom path when globalTypesFile is set 1`] = `
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was this removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

This was a result of muddying up, then deleting, and finally regenerating this test snap. The test is skipped, so the snap is obsolete. Side note: doesn't jest normally find these and remove them with -u?

Can totally revert this change!

@steabert
Copy link

Is there a way to apply this fix easily while waiting for the next apollo version? I'm not familiar with specifying a github url for packages belonging to a monorepo, maybe someone here knows a way to do that?

@TimKnipe
Copy link

What I've been doing is go into node_modules/apollo/lib/Command.js and find the 2 "file://" references and change them to "file:///"

Yeah, i have to redo this every time i add or update packages as it gets overwritten.

@treylon
Copy link

treylon commented Dec 19, 2018

@steabert You can also use the linux subsystem for windows for now and prefix your script generation command with wsl to execute it via the shell. Works like a charm for me without having to edit any files. If you have not enabled it see here: https://docs.microsoft.com/en-us/windows/wsl/install-win10

wsl yarn run [generation-script-name]

@jhalborg
Copy link

jhalborg commented Jan 7, 2019

Could this please be prioritized soon? We're holding off on upgrading to 2.0+ pending this change, which again halts further work using some new Apollo Platform features.

@JakeDawkins JakeDawkins changed the base branch from master to pipelines January 11, 2019 18:43
* Convert "string" URIs to actual Uri objects
* Don't manually build URIs, hand off to Uri constructor instead
* Switch usages of path.relative to path.posix.relative
@JakeDawkins JakeDawkins force-pushed the trevor/fix-windows-paths branch from a476603 to 8fd101a Compare January 14, 2019 21:53
@JakeDawkins JakeDawkins merged commit 02f0180 into pipelines Jan 15, 2019
@jhalborg
Copy link

Wohoo @JakeDawkins ! 🙌

When can we expect this on NPM, and which version number should we look for?

JakeDawkins pushed a commit that referenced this pull request Jan 16, 2019
* Resolve Windows FS Issues
* Convert "string" URIs to actual Uri objects
* Don't manually build URIs, hand off to Uri constructor instead
* QoL debug script and snapshot update
* Updates snapshots
* Add windows node 10 job to pipeline config
JakeDawkins pushed a commit that referenced this pull request Jan 16, 2019
* Resolve Windows FS Issues
* Convert "string" URIs to actual Uri objects
* Don't manually build URIs, hand off to Uri constructor instead
* QoL debug script and snapshot update
* Updates snapshots
* Add windows node 10 job to pipeline config
@JakeDawkins
Copy link
Contributor

JakeDawkins commented Jan 16, 2019

@jhalborg @steabert @TimKnipe @treylon @patrys Thanks for all the feedback! These changes should be live now in version 2.2.0 of the cli!

@JakeDawkins JakeDawkins deleted the trevor/fix-windows-paths branch January 16, 2019 16:58
@JakeDawkins
Copy link
Contributor

@jhalborg @steabert @TimKnipe @treylon @patrys sorry, I had to unpublish because of a config issue. I'll try to get it back out today!

@jhalborg
Copy link

@JakeDawkins - Any news?

@NateScarlet
Copy link
Contributor

NateScarlet commented Jan 23, 2019

Not work with apollo/2.3.0 win32-x64 node-v10.9.0
Still got error when mkdir, added variable log in apollo\lib\generate.js

E:\Dev\taskboard [master ↑1 +0 ~76 -0 | +0 ~3 -0 !]> npx apollo client:codegen --globalTypesFile frontend/src/types/graphql-global.ts --target typescript types
// rootPath: E:\Dev\taskboard
// sourcePath: file:///e%3A/Dev/taskboard/frontend/src/graphql/acceptanceNode.gql
// toPath(sourcePath): /e:/Dev/taskboard/frontend/src/graphql/acceptanceNode.gql
  √ Loading Apollo Project
  × Generating query files with 'typescript' target
    → ENOENT: no such file or directory, mkdir '..\..\e:\Dev\taskboard\frontend\src\graphql\types'
// rootPath: E:\Dev\taskboard
// sourcePath: file:///e%3A/Dev/taskboard/frontend/src/graphql/acceptanceNode.gql
// toPath(sourcePath): /e:/Dev/taskboard/frontend/src/graphql/acceptanceNode.gql
(node:10344) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, mkdir '..\..\e:\Dev\taskboard\frontend\src\graphql\types'
    at Object.mkdirSync (fs.js:729:3)
    at generatedFiles.forEach (E:\Dev\taskboard\node_modules\apollo\lib\generate.js:101:38)
    at Array.forEach (<anonymous>)
    at Object.generate [as default] (E:\Dev\taskboard\node_modules\apollo\lib\generate.js:94:28)
    at write (E:\Dev\taskboard\node_modules\apollo\lib\commands\client\codegen.js:64:54)
    at GraphQLClientProject.project.onDiagnostics [as _onDiagnostics] (E:\Dev\taskboard\node_modules\apollo\lib\commands\client\codegen.js:81:29)
    at GraphQLClientProject.validate (E:\Dev\taskboard\node_modules\apollo-language-server\lib\project\client.js:122:18)
    at GraphQLClientProject.validateIfNeeded (E:\Dev\taskboard\node_modules\apollo-language-server\lib\project\base.js:127:14)
    at Timeout.setTimeout [as _onTimeout] (E:\Dev\taskboard\node_modules\apollo-language-server\lib\project\base.js:119:22)
    at ontimeout (timers.js:424:11)

@JakeDawkins
Copy link
Contributor

@jhalborg Sorry for not responding. My notification settings are messed up 🙃

I released these changes with 2.3.0, but you may run into @NateScarlet's issue. I'll look into that and maybe cut a patch release for it if needed

JakeDawkins pushed a commit that referenced this pull request Jan 24, 2019
@jhalborg
Copy link

@JakeDawkins That would be great!

@JakeDawkins
Copy link
Contributor

@jhalborg 2.3.1 should have the fixes for the issue mentioned above!

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.

8 participants