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

unable to bring directories with -, . and other non symbolic names #5008

Closed
eladb opened this issue Nov 20, 2023 · 4 comments · Fixed by #5017
Closed

unable to bring directories with -, . and other non symbolic names #5008

eladb opened this issue Nov 20, 2023 · 4 comments · Fixed by #5017
Assignees
Labels
🐛 bug Something isn't working 📚 libraries Wing Libraries

Comments

@eladb
Copy link
Contributor

eladb commented Nov 20, 2023

I tried this:

npm i @winglibs/containers

main.w:

bring containers;

then:

wing compile

This happened:

runtime error: Unexpected token '-'
  --> main.w:1:1
1 | bring containers;
  | ^
at  (/Users/eladb/playground/containers-test/main.w:1:1)
--------------------------------- ORIGINAL STACK TRACE ---------------------------------
Error: Unexpected token '-'
    at runPreflightCodeInVm (/Users/eladb/.volta/tools/image/packages/winglang/lib/node_modules/winglang/node_modules/@winglang/compiler/dist/index.js:468:11)
    at async Object.compile (/Users/eladb/.volta/tools/image/packages/winglang/lib/node_modules/winglang/node_modules/@winglang/compiler/dist/index.js:401:5)
    at async Object.compile (/Users/eladb/.volta/tools/image/packages/winglang/lib/node_modules/winglang/dist/commands/compile.js:61:16)
    at async Command.<anonymous> (/Users/eladb/.volta/tools/image/packages/winglang/lib/node_modules/winglang/dist/cli.js:47:30)

I expected this:

No response

Is there a workaround?

No response

Anything else?

No response

Wing Version

No response

Node.js Version

No response

Platform(s)

No response

Community Notes

  • Please vote by adding a 👍 reaction to the issue to help us prioritize.
  • If you are interested to work on this issue, please leave a comment.
@eladb eladb added the 🐛 bug Something isn't working label Nov 20, 2023
@eladb
Copy link
Contributor Author

eladb commented Nov 20, 2023

additional research shows that the culprit the names of the docker image directories in the container test directory: my-app, microservices-consumer, microservices-producer which contain -.

trying to create a minimal reproduction.

@eladb
Copy link
Contributor Author

eladb commented Nov 20, 2023

repro-5008.zip

./test/foo-bar/dummy.txt:

nothing

./main.w

bring "./test" as t;

@eladb
Copy link
Contributor Author

eladb commented Nov 20, 2023

This also happens if there's a directory the starts with . (e.g. .bunny) in inside the library.

eladb added a commit to winglang/winglibs that referenced this issue Nov 20, 2023
this was caused by winglang/wing#5008

as a workaround, rename the directory names to "_"
@eladb eladb changed the title unexpected token '-' when bringing containers unable to bring directories with -, . and other non symbolic names Nov 20, 2023
eladb added a commit to winglang/winglibs that referenced this issue Nov 20, 2023
this was caused by winglang/wing#5008

as a workaround, rename the directory names to "_"
@staycoolcall911 staycoolcall911 added this to the Wing Cloud 1.0 milestone Nov 20, 2023
@staycoolcall911 staycoolcall911 added the 📚 libraries Wing Libraries label Nov 20, 2023
@mergify mergify bot closed this as completed in #5017 Nov 23, 2023
mergify bot pushed a commit that referenced this issue Nov 23, 2023
…mes (#5017)

## Summary
1. Skip bringing directories where no wing file is found
2. Report a diagnostic error if directory contains non-symbolic character


Closes: #5008
Closes: #5009
Closes: #4929

## Checklist

- [x] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted)
- [x] Description explains motivation and solution
- [x] Tests added (always)
- [x] Docs updated (only required for features)
- [x] 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](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.49.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working 📚 libraries Wing Libraries
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants