rescript-compiler icon indicating copy to clipboard operation
rescript-compiler copied to clipboard

Rewatch cli refactor

Open Bushuo opened this issue 7 months ago • 1 comments

Upstream the changes of rescript-lang/rewatch#162

Bushuo avatar Jun 15 '25 19:06 Bushuo

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript-lang/rescript@7551
@rescript/darwin-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-arm64@7551
@rescript/darwin-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-x64@7551
@rescript/linux-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-arm64@7551
@rescript/linux-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-x64@7551
@rescript/win32-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/win32-x64@7551

commit: 834f890

pkg-pr-new[bot] avatar Jun 16 '25 20:06 pkg-pr-new[bot]

@nojaf to answer you on your comment here https://github.com/rescript-lang/rewatch/pull/162#discussion_r2125819586. I think this is a great idea. I also think the plan was to eventually replace the legacy commands with commands implemented in rewatch.

Bushuo avatar Jun 18 '25 07:06 Bushuo

Not sure if relevant here, but I still see 1.2.0 for bunx rewatch --version. At some point, this should be the rescript version?

rewatch legacy --help doesn't show any help:

(base) nojaf@nojaf-mbp tower-defense % bunx rewatch legacy --help

thread 'main' panicked at src/helpers.rs:252:14:
Could not find rescript-legacy
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I got this with bunx rewatch dump as well.

nojaf avatar Jun 18 '25 09:06 nojaf

Not sure if relevant here, but I still see 1.2.0 for bunx rewatch --version. At some point, this should be the rescript version?

I think the right time for this would be when rewatch is the default cli.

rewatch legacy --help doesn't show any help:

(base) nojaf@nojaf-mbp tower-defense % bunx rewatch legacy --help

thread 'main' panicked at src/helpers.rs:252:14:
Could not find rescript-legacy
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I got this with bunx rewatch dump as well.

I prematurely already look for a binary named rescript-legacy. I guess in this PR we can still look for rescript. I will also add tests for the legacy subcommands.

Bushuo avatar Jun 18 '25 09:06 Bushuo

If I run rewatch help instead of rewatch --help, I get

error: unrecognized subcommand '--bsc-path'

Usage: rewatch.exe [OPTIONS] [FOLDER]
       rewatch.exe <COMMAND>

(the --bsc-path option is appended by the node wrapper script)

cknitt avatar Jun 18 '25 14:06 cknitt

@Bushuo, there still seems to be something up with the legacy commands:

image

nojaf avatar Jun 27 '25 08:06 nojaf

@Bushuo, there still seems to be something up with the legacy commands:

Ok, strange, I will look into it. The legacy build and clean command seems to work though, I included a test for it. Those commands are not handled differently from format. The args are just passed to bsc.

Bushuo avatar Jun 27 '25 08:06 Bushuo

@nojaf I can reproduce it and will fix it soon.

Bushuo avatar Jun 27 '25 12:06 Bushuo