Skip to content

Commit c0e72ff

Browse files
authored
Remove dev, create-sourcedirs & build -w (#8202)
* Remove dev, create-sourcedirs & build -w * Add changelog * Update cli_help test
1 parent 02b3e5b commit c0e72ff

4 files changed

Lines changed: 4 additions & 117 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
- `js-post-build` command now runs in the directory containing the `rescript.json` where it is defined, instead of the unpredictable build invocation directory. This provides consistent behavior in monorepos. https://github.com/rescript-lang/rescript/pull/8195
2323
- Remove support for deprecated `bs-dependencies`, `bs-dev-dependencies`, and `bsc-flags` configuration options. Use `dependencies`, `dev-dependencies`, and `compiler-flags` instead. https://github.com/rescript-lang/rescript/pull/8196
2424
- `bsc`: remove legacy `-uncurried` flag. https://github.com/rescript-lang/rescript/pull/8201
25+
- Remove deprecated cli flags `--dev`, `--create-sourcedirs` and `build -w`. https://github.com/rescript-lang/rescript/pull/8202
2526

2627
#### :eyeglasses: Spec Compliance
2728

rewatch/src/cli.rs

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -194,21 +194,6 @@ pub struct AfterBuildArg {
194194
pub after_build: Option<String>,
195195
}
196196

197-
#[derive(Args, Debug, Clone, Copy)]
198-
pub struct CreateSourceDirsArg {
199-
/// Deprecated: source_dirs.json is now always created.
200-
#[arg(short, long, num_args = 0..=1, default_missing_value = "true", hide = true)]
201-
pub create_sourcedirs: Option<bool>,
202-
}
203-
204-
#[derive(Args, Debug, Clone, Copy)]
205-
pub struct DevArg {
206-
/// Deprecated: Build development dependencies
207-
/// This is the flag no longer does anything and will be removed in future versions.
208-
#[arg(long, default_value_t = false, num_args = 0..=1, hide = true)]
209-
pub dev: bool,
210-
}
211-
212197
#[derive(Args, Debug, Clone)]
213198
pub struct WarnErrorArg {
214199
/// Override warning configuration from rescript.json.
@@ -228,22 +213,12 @@ pub struct BuildArgs {
228213
#[command(flatten)]
229214
pub after_build: AfterBuildArg,
230215

231-
#[command(flatten)]
232-
pub create_sourcedirs: CreateSourceDirsArg,
233-
234-
#[command(flatten)]
235-
pub dev: DevArg,
236-
237216
#[command(flatten)]
238217
pub warn_error: WarnErrorArg,
239218

240219
/// Disable output timing
241220
#[arg(short, long, default_value_t = false, num_args = 0..=1)]
242221
pub no_timing: bool,
243-
244-
/// Watch mode (deprecated, use `rescript watch` instead)
245-
#[arg(short, default_value_t = false, num_args = 0..=1, hide = true)]
246-
pub watch: bool,
247222
}
248223

249224
#[cfg(test)]
@@ -395,12 +370,6 @@ pub struct WatchArgs {
395370
#[command(flatten)]
396371
pub after_build: AfterBuildArg,
397372

398-
#[command(flatten)]
399-
pub create_sourcedirs: CreateSourceDirsArg,
400-
401-
#[command(flatten)]
402-
pub dev: DevArg,
403-
404373
#[command(flatten)]
405374
pub warn_error: WarnErrorArg,
406375
}
@@ -411,8 +380,6 @@ impl From<BuildArgs> for WatchArgs {
411380
folder: build_args.folder,
412381
filter: build_args.filter,
413382
after_build: build_args.after_build,
414-
create_sourcedirs: build_args.create_sourcedirs,
415-
dev: build_args.dev,
416383
warn_error: build_args.warn_error,
417384
}
418385
}
@@ -428,9 +395,6 @@ pub enum Command {
428395
Clean {
429396
#[command(flatten)]
430397
folder: FolderArg,
431-
432-
#[command(flatten)]
433-
dev: DevArg,
434398
},
435399
/// Format ReScript files.
436400
Format {
@@ -451,9 +415,6 @@ pub enum Command {
451415
/// Files to format. If no files are provided, all files are formatted.
452416
#[arg(group = "format_input_mode")]
453417
files: Vec<String>,
454-
455-
#[command(flatten)]
456-
dev: DevArg,
457418
},
458419
/// Print the compiler arguments for a ReScript source file.
459420
CompilerArgs {
@@ -487,21 +448,6 @@ impl Deref for AfterBuildArg {
487448
}
488449
}
489450

490-
impl CreateSourceDirsArg {
491-
/// Returns true if the flag was explicitly passed on the command line.
492-
pub fn was_explicitly_set(&self) -> bool {
493-
self.create_sourcedirs.is_some()
494-
}
495-
}
496-
497-
impl Deref for DevArg {
498-
type Target = bool;
499-
500-
fn deref(&self) -> &Self::Target {
501-
&self.dev
502-
}
503-
}
504-
505451
impl Deref for WarnErrorArg {
506452
type Target = Option<String>;
507453

rewatch/src/main.rs

Lines changed: 3 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -29,42 +29,21 @@ fn main() -> Result<()> {
2929
}))
3030
.expect("Failed to initialize logger");
3131

32-
let mut command = cli.command;
33-
34-
if let cli::Command::Build(build_args) = &command
35-
&& build_args.watch
36-
{
37-
log::warn!("`rescript build -w` is deprecated. Please use `rescript watch` instead.");
38-
command = cli::Command::Watch(build_args.clone().into());
39-
}
40-
4132
let is_tty: bool = Term::stdout().is_term() && Term::stderr().is_term();
4233
let plain_output = !is_tty;
4334

4435
// The 'normal run' mode will show the 'pretty' formatted progress. But if we turn off the log
4536
// level, we should never show that.
4637
let show_progress = log_level_filter == LevelFilter::Info;
4738

48-
match command {
39+
match cli.command {
4940
cli::Command::CompilerArgs { path } => {
5041
println!("{}", build::get_compiler_args(Path::new(&path))?);
5142
std::process::exit(0);
5243
}
5344
cli::Command::Build(build_args) => {
5445
let _lock = get_lock(&build_args.folder);
5546

56-
if build_args.dev.dev {
57-
log::warn!(
58-
"`--dev no longer has any effect. Please remove it from your command. It will be removed in a future version."
59-
);
60-
}
61-
62-
if build_args.create_sourcedirs.was_explicitly_set() {
63-
log::warn!(
64-
"`--create-sourcedirs` is deprecated: source_dirs.json is now always created. Please remove this flag from your command."
65-
);
66-
}
67-
6847
match build::build(
6948
&build_args.filter,
7049
Path::new(&build_args.folder as &str),
@@ -89,18 +68,6 @@ fn main() -> Result<()> {
8968
cli::Command::Watch(watch_args) => {
9069
let _lock = get_lock(&watch_args.folder);
9170

92-
if *watch_args.dev {
93-
log::warn!(
94-
"`--dev no longer has any effect. Please remove it from your command. It will be removed in a future version."
95-
);
96-
}
97-
98-
if watch_args.create_sourcedirs.was_explicitly_set() {
99-
log::warn!(
100-
"`--create-sourcedirs` is deprecated: source_dirs.json is now always created. Please remove this flag from your command."
101-
);
102-
}
103-
10471
match watcher::start(
10572
&watch_args.filter,
10673
show_progress,
@@ -117,30 +84,11 @@ fn main() -> Result<()> {
11784
Ok(_) => Ok(()),
11885
}
11986
}
120-
cli::Command::Clean { folder, dev } => {
87+
cli::Command::Clean { folder } => {
12188
let _lock = get_lock(&folder);
122-
123-
if dev.dev {
124-
log::warn!(
125-
"`--dev no longer has any effect. Please remove it from your command. It will be removed in a future version."
126-
);
127-
}
128-
12989
build::clean::clean(Path::new(&folder as &str), show_progress, plain_output)
13090
}
131-
cli::Command::Format {
132-
stdin,
133-
check,
134-
files,
135-
dev,
136-
} => {
137-
if dev.dev {
138-
log::warn!(
139-
"`--dev no longer has any effect. Please remove it from your command. It will be removed in a future version."
140-
);
141-
}
142-
format::format(stdin, check, files)
143-
}
91+
cli::Command::Format { stdin, check, files } => format::format(stdin, check, files),
14492
}
14593
}
14694

tests/build_tests/cli_help/input.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,6 @@ await test(["build", "--help"], {
113113
status: 0,
114114
});
115115

116-
await test(["build", "-w", "--help"], {
117-
stdout: buildHelp,
118-
stderr: "",
119-
status: 0,
120-
});
121-
122-
await test(["-w", "--help"], { stdout: cliHelp, stderr: "", status: 0 });
123-
124116
// Shows cli help with --help arg even if there are invalid arguments after it
125117
await test(["--help", "-w"], { stdout: cliHelp, stderr: "", status: 0 });
126118

0 commit comments

Comments
 (0)