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

Improves fslib #363

Merged
merged 4 commits into from
Aug 19, 2019
Merged

Improves fslib #363

merged 4 commits into from
Aug 19, 2019

Conversation

arcanis
Copy link
Member

@arcanis arcanis commented Aug 19, 2019

What's the problem this PR addresses?

  • The fslib didn't account for some families of functions (appendFile, readFile, writeFile) being allowed to consume file descriptors.

  • It also didn't implement appendFile at all.

How did you fix it?

I've added a new type, FSPath<T>, which encompasses T | number. This type is then used as input for the specific functions referenced above. Since most fake fs layers are abstracted under the ProxiedFS abstract, most of them don't have to deal with this as the fds will just be forwarded untransformed.

Of note: TypeScript doesn't prevent a subclass from implementing a subset of an abstract method, meaning that it'll not report it if a subclass of FakeFS<T> uses T as parameter for the relevant functions rather than FSPath<T>. It'll crash at runtime, however, as they'll still receive integers.

Which packages would need a new release (if any)?

berry-fslib, berry-pnp, berry-core, berry-cli

Have you run yarn version [major|minor|patch] --deferred in those packages?

  • Yes

@arcanis arcanis merged commit 5ca76f8 into master Aug 19, 2019
@arcanis arcanis deleted the mael/fslib-improvements branch August 26, 2019 15:01
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.

1 participant