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

Detect list of files used by a Wing project #3730

Open
Chriscbr opened this issue Aug 7, 2023 · 5 comments
Open

Detect list of files used by a Wing project #3730

Chriscbr opened this issue Aug 7, 2023 · 5 comments
Labels
⌨️ cli CLI 🛠️ compiler Compiler 🛫 console Console 📚 libraries Wing Libraries 🕹️ simulator Related to the `sim` compilation target

Comments

@Chriscbr
Copy link
Contributor

Chriscbr commented Aug 7, 2023

We would like to have a general way to track changes to a Wing project so that the Wing Console and other CLI commands (like wing compile --watch or wing test --watch) can detect when a Wing project has changed and needs to be refreshed. The solution should also solve the case when a user adds a new .w file into their project (i.e. uses bring on a file that hasn't been compiled before)

It's possible this could be some kind of function exposed by @winglang/compiler that lists all files in the project given an entrypoint file passed as an argument (i.e. main.w or *.main.w), or a custom watcher that takes an entrypoint and explicitly notifies (e.g. using callbacks or an EventEmitter when a file in the project has changed.

P1: detect changes whenever Wing source files have changed
P2: detect changes whenever the package.json file has changed, or when extern JS files have changed

@monadabot monadabot added this to Wing Aug 7, 2023
@github-project-automation github-project-automation bot moved this to 🆕 New - not properly defined in Wing Aug 7, 2023
@staycoolcall911 staycoolcall911 moved this from 🆕 New - not properly defined to 🤝 Backlog - handoff to owners in Wing Aug 8, 2023
@skyrpex
Copy link
Contributor

skyrpex commented Aug 29, 2023

Yes! The current watch mechanism is not optimal at all.

IMO, the compile method from libs/wingcompiler/src/compile.ts should return an object similar to

interface CompileResult {
  /** The output directory **/
  outputDir: string;
  /** The compilation dependencies (aka the files) **/
  dependencies: string[];
  // ... errors and warnings too?
}

I don't know if wingc already has a mechanism to report such data but if it can print json to stdout, we should be able to build it.

@tsuf239
Copy link
Contributor

tsuf239 commented Oct 8, 2023

closed #3956 as a duplicate, when implementing this, please make sure that the solution also fits the case described there (creating a react website with wing file at the same directory level/ one folder down)

@staycoolcall911 staycoolcall911 added the 📚 libraries Wing Libraries label Nov 15, 2023
@Chriscbr Chriscbr added 🛫 console Console 🕹️ simulator Related to the `sim` compilation target labels Feb 29, 2024
@Chriscbr
Copy link
Contributor Author

(Added the console/simulator labels since not having a good watching mechanism impacts the DX of those tools)

@Chriscbr Chriscbr added this to the Winglang Stable Release milestone Apr 30, 2024
mergify bot pushed a commit that referenced this issue May 7, 2024
…rectory (#6416)

This allows users to watch arbitrary places for file changes. This is mostly an escape hatch for #3730, but even when that is implemented there will probably continue to be a desire to watch arbitrary stuff.
 

*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)*.
Copy link

Hi,

This issue hasn't seen activity in 90 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days.
Feel free to re-open this issue when there's an update or relevant information to be added.
Thanks!

@github-actions github-actions bot added the Stale label Jul 30, 2024
@tsuf239 tsuf239 removed the Stale label Jul 30, 2024
@Chriscbr
Copy link
Contributor Author

I ran into this while working on a winglib. The scenario was I was testing out an example, and I was importing a module from a parent directory, like in the snippet below.

bring cloud;
bring "../hello.w" as hello;

new hello.Hello();

Unfortunately, when I made changes to "hello.w", the console didn't auto-update which was a bit confusing (also the "Reset" button doesn't re-compile the app so it didn't help).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⌨️ cli CLI 🛠️ compiler Compiler 🛫 console Console 📚 libraries Wing Libraries 🕹️ simulator Related to the `sim` compilation target
Projects
Status: 🤝 Backlog - handoff to owners
Development

No branches or pull requests

4 participants