VulcanJS/vulcan-next

RFC: Windows support

eric-burel opened this issue · 3 comments

Describe the problem you want to solve or enhancement you want to bring

Support WIndows as much as possible. This is an umbrella issue for all trouble you can encounter when installing Vulcan Next on Windows.

Current issues:

Mongo

  • $(pwd) (current directory) command is not working when running Mongo with Docker
  • Actually, I am not even sure you can dockerize Mongo on Windows
  • Relevant doc: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/
  • We should enhance the documentation/learn tutorial accordingly after finding the best pattern for Windows users

Questions to the community

I am not coding on Windows at all so any help from the community is more than welcome!

A user reported issues with Cypress, namely the environment loading function not working properly (we have a Cypress plugin that lruns Next.js "loadEnv" logic) in Visual Studio environment.

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at validateString (internal/validators.js:124:11)
    at Object.join (path.js:424:7)
    at loadEnvConfig (C:\Users\redacted\vulcan-next\node_modules\@next\env\dist\index.js:1:3274)
    at module.exports (C:\Users\redacted\vulcan-next\cypress\plugins\load-env.js:12:33)

Edit: this one issue is now fixed, I was using "process.env.PWD" instead of "process.cwd()"

Additionally, when running yarn run dev:test, whether in Visual Studio or not, this stack trace appears.

(node:20144) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, realpath 'C:\Users\dania\Documents\GitHub\Voting-And-Stamps\#'
    at Function.realpathSync.native (fs.js:1855:3)
    at Object.getProjectDir (C:\Users\redacted\Documents\GitHub\Voting-And-Stamps\node_modules\next\dist\lib\get-project-dir.js:39:46)
    at nextDev (C:\Users\redacted\Documents\GitHub\Voting-And-Stamps\node_modules\next\dist\cli\next-dev.js:84:37)
    at C:\Users\redacted\Documents\GitHub\Voting-And-Stamps\node_modules\next\dist\bin\next:119:34
    ```
    
    When I use `yarn run dev` instead and run a barebones Cypress test, I get this error:
    
    ```
    expected { Object (errors, data) } to have property 'length'
cypress/integration/integration/example.spec.js:19:1
  17 |         // https://on.cypress.io/assertions
  18 |         expect(response).property('status').to.equal(200)
> 19 |         expect(response).property('body').to.have.length(500)
     | ^
  20 |         expect(response).to.include.keys('headers', 'duration')
  21 |         })
  22 |     })

I've fixed running Jest

Now I need to fix running Mongo via the Docker command, as the "volume" path is not correct for windows. I'll probably create another command for Windows that uses a generic path like "C:/Documents/VulcanMongo" or use powershell -Command pwd (https://stackoverflow.com/questions/921741/windows-equivalent-to-unix-pwd).
I couldn't compute the right path though, the command echo "$pwd/.mongo works in the powershell but not if I add it to package.json. See https://stackoverflow.com/questions/46604827/pwd-in-npm-script as well.

Then I'll be able to test Cypress.