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

feat(sdk): add fs module #4135

Merged
merged 30 commits into from
Oct 13, 2023
Merged

feat(sdk): add fs module #4135

merged 30 commits into from
Oct 13, 2023

Conversation

jianzs
Copy link
Contributor

@jianzs jianzs commented Sep 10, 2023

Solves #3096

Support fs module. All file paths are POSIX file paths, and will be normalized to the target platform when performing operations.

Checklist

  • Title matches Winglang's style guide
  • Description explains motivation and solution
  • Tests added (always)
  • Docs updated (only required for features)
  • Added pr/e2e-full label if this feature requires end-to-end testing

By submitting this pull request, I confirm that my contribution is made under the terms of the Wing Cloud Contribution License.

@jianzs jianzs requested a review from a team as a code owner September 10, 2023 13:46
Copy link
Collaborator

@tsuf239 tsuf239 left a comment

Choose a reason for hiding this comment

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

Great work!! just a few tiny adjustments (mostly to the js docs) and an addition of an example written in wing, and you're there! 💫

libs/wingsdk/src/fs/fs.ts Outdated Show resolved Hide resolved
libs/wingsdk/src/fs/fs.ts Outdated Show resolved Hide resolved
libs/wingsdk/src/fs/fs.ts Outdated Show resolved Hide resolved
libs/wingsdk/src/fs/fs.ts Show resolved Hide resolved
libs/wingsdk/src/fs/fs.ts Show resolved Hide resolved
libs/wingsdk/src/fs/fs.ts Show resolved Hide resolved
libs/wingsdk/test/fs/fs.test.ts Show resolved Hide resolved
libs/wingsdk/test/fs/fs.test.ts Outdated Show resolved Hide resolved
libs/wingsdk/test/fs/fs.test.ts Outdated Show resolved Hide resolved
libs/wingsdk/test/fs/fs.test.ts Outdated Show resolved Hide resolved
libs/wingsdk/src/fs/fs.ts Outdated Show resolved Hide resolved
libs/wingsdk/src/fs/fs.ts Outdated Show resolved Hide resolved
libs/wingsdk/src/fs/fs.ts Outdated Show resolved Hide resolved
libs/wingsdk/src/fs/fs.ts Outdated Show resolved Hide resolved
libs/wingsdk/src/fs/fs.ts Outdated Show resolved Hide resolved
libs/wingsdk/src/fs/fs.ts Outdated Show resolved Hide resolved
libs/wingsdk/src/fs/fs.ts Outdated Show resolved Hide resolved
libs/wingsdk/src/fs/fs.ts Outdated Show resolved Hide resolved
libs/wingsdk/src/fs/fs.ts Outdated Show resolved Hide resolved
@jianzs
Copy link
Contributor Author

jianzs commented Sep 16, 2023

Thank you all for your suggestions and comments, I will improve it as soon as possible

@monadabot monadabot added the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Oct 5, 2023
Copy link
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

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

Great job @jianzs 🙏 love the thoroughness and high quality code and testing. I love the batteries included, feel free to add more capabilities here as you see fit. I've always found fs libraries to be too puristy and I think having a rich standard library makes a difference.

Ideally but definitely not required right now, if you call these methods from preflight they will be sync, and calling them from inflight should be async.. it's not possible to do right now but putting this thought on @yoav-steinberg 's radar...

BTW, we need a process library if you'd like to take the design. (spawn, shell, etc).

examples/tests/sdk_tests/fs/json.main.w Outdated Show resolved Hide resolved
examples/tests/sdk_tests/fs/json.main.w Show resolved Hide resolved
examples/tests/sdk_tests/fs/path.main.w Show resolved Hide resolved
libs/wingsdk/src/fs/fs.ts Show resolved Hide resolved
libs/wingsdk/src/fs/fs.ts Show resolved Hide resolved
libs/wingsdk/src/fs/fs.ts Show resolved Hide resolved
@Chriscbr
Copy link
Contributor

Chriscbr commented Oct 6, 2023

@jianzs Since we're introducing some functionality that deals with paths, I've added the pr/e2e-full label so that our continuous integration runs everything on Windows as well. It should take affect on any new commits added to the branch.

@eladb eladb removed the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Oct 10, 2023
@monadabot monadabot added the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Oct 10, 2023
Copy link
Contributor

@MarkMcCulloh MarkMcCulloh left a comment

Choose a reason for hiding this comment

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

Really great work, last change needed

libs/wingsdk/src/fs/fs.ts Outdated Show resolved Hide resolved
examples/tests/sdk_tests/fs/basic.main.w Outdated Show resolved Hide resolved
Copy link
Contributor

@MarkMcCulloh MarkMcCulloh left a comment

Choose a reason for hiding this comment

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

@MarkMcCulloh MarkMcCulloh removed the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Oct 12, 2023
@monadabot monadabot added the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Oct 13, 2023
@MarkMcCulloh MarkMcCulloh removed the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Oct 13, 2023
@mergify
Copy link
Contributor

mergify bot commented Oct 13, 2023

Thanks for contributing, @jianzs! This PR will now be added to the merge queue, or immediately merged if add_fs_module is up-to-date with main and the queue is empty.

@mergify mergify bot merged commit 94e3953 into winglang:main Oct 13, 2023
23 checks passed
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.38.3.

mergify bot pushed a commit that referenced this pull request Oct 14, 2023
Following #4135, there's no more need for a fs `extern` module.

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants