jvilk / BrowserFS

BrowserFS is an in-browser filesystem that emulates the Node JS filesystem API and supports storing and retrieving files from various backends.
Other
3.07k stars 218 forks source link

Compilation issues in Windows #222

Closed 1j01 closed 11 months ago

1j01 commented 6 years ago

Installed with npm, I get:

> tsc -p src

src/backend/Dropbox.ts(400,40): error TS2339: Property 'path' does not exist on type 'UploadErrorPath'.
src/backend/Dropbox.ts(510,40): error TS2339: Property 'path' does not exist on type 'UploadErrorPath'.

Installed with yarn I get tens of thousands of lines of

ERROR: C:/Users/Isaiah/Other Repositories/BrowserFS/src/index.ts[46, 1]: Expected linebreak to be 'LF'
ERROR: C:/Users/Isaiah/Other Repositories/BrowserFS/src/index.ts[47, 1]: Expected linebreak to be 'LF'
ERROR: C:/Users/Isaiah/Other Repositories/BrowserFS/src/typedoc.ts[1, 1]: Expected linebreak to be 'LF'
ERROR: C:/Users/Isaiah/Other Repositories/BrowserFS/src/typedoc.ts[2, 1]: Expected linebreak to be 'LF'
ERROR: C:/Users/Isaiah/Other Repositories/BrowserFS/src/typedoc.ts[3, 1]: Expected linebreak to be 'LF'

There should be a .gitattributes file, so that files are checked out with line breaks as you want them.

(I did eventually find the .tslint file to disable linebreak-style, and compile; and don't worry, I won't introduce CRLF into the repository, I have git configured with autocrlf)

Also, there are a lot of scripts; which ones should I be using?

jvilk commented 6 years ago

Yarn is recommended as it should pull in the correct version of all of the libraries. The linebreak issue is my fault; I haven't had anyone develop BrowserFS on Windows, so it hasn't been a problem until now. It looks like NPM is pulling in a newer version of Dropbox.js, which has different TypeScript types and causes the compilation failure.

Regarding scripts, I assume you mean NPM scripts? There's an npm test that builds BrowserFS and runs the unit tests, and npm run dist that builds a distributable version of BrowserFS. Those are the main two scripts you should be using.

There are so many scripts to avoid introducing something like Gulp to the project. I use npm-run-all to build flexible build pipelines out of individual NPM scripts, which can execute in parallel or serially. In general, scripts with a colon (:) in the name are internal scripts that you don't invoke directly.

1j01 commented 6 years ago

Regarding scripts, I assume you mean NPM scripts?

Yes, thanks!

Hm, on my machine the tests also fail because of line endings, so I definitely need that .gitattributes file I guess it'll be easier for me to add it since I can test the result of adding it locally...

Yarn is recommended as it should pull in the correct version of all of the libraries

It seems like a rather weak recommendation; the README says "Run yarn install (or npm install)" Also it mentions NPM as a prerequisite, and not Yarn So since I'm used to npm and I know I have it up to date, I naturally go for npm, until I realize things aren't working and there's a yarn.lock and no package-lock.json

jvilk commented 6 years ago

Good points; the documentation should be updated. I won't close this until I fix the documentation or add a package-lock.json as well.

jvilk commented 6 years ago

And yes, please add .gitattributes. We test on appveyor (Windows), but I guess that environment sidesteps the issue somehow.

1j01 commented 6 years ago

Done! https://github.com/jvilk/BrowserFS/pull/224