Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- `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
- 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
- `bsc`: remove legacy `-uncurried` flag. https://github.com/rescript-lang/rescript/pull/8201
- Remove deprecated cli flags `--dev`, `--create-sourcedirs` and `build -w`. https://github.com/rescript-lang/rescript/pull/8202

#### :eyeglasses: Spec Compliance

Expand Down
54 changes: 0 additions & 54 deletions rewatch/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,21 +194,6 @@ pub struct AfterBuildArg {
pub after_build: Option<String>,
}

#[derive(Args, Debug, Clone, Copy)]
pub struct CreateSourceDirsArg {
/// Deprecated: source_dirs.json is now always created.
#[arg(short, long, num_args = 0..=1, default_missing_value = "true", hide = true)]
pub create_sourcedirs: Option<bool>,
}

#[derive(Args, Debug, Clone, Copy)]
pub struct DevArg {
/// Deprecated: Build development dependencies
/// This is the flag no longer does anything and will be removed in future versions.
#[arg(long, default_value_t = false, num_args = 0..=1, hide = true)]
pub dev: bool,
}

#[derive(Args, Debug, Clone)]
pub struct WarnErrorArg {
/// Override warning configuration from rescript.json.
Expand All @@ -228,22 +213,12 @@ pub struct BuildArgs {
#[command(flatten)]
pub after_build: AfterBuildArg,

#[command(flatten)]
pub create_sourcedirs: CreateSourceDirsArg,

#[command(flatten)]
pub dev: DevArg,

#[command(flatten)]
pub warn_error: WarnErrorArg,

/// Disable output timing
#[arg(short, long, default_value_t = false, num_args = 0..=1)]
pub no_timing: bool,

/// Watch mode (deprecated, use `rescript watch` instead)
#[arg(short, default_value_t = false, num_args = 0..=1, hide = true)]
pub watch: bool,
}

#[cfg(test)]
Expand Down Expand Up @@ -395,12 +370,6 @@ pub struct WatchArgs {
#[command(flatten)]
pub after_build: AfterBuildArg,

#[command(flatten)]
pub create_sourcedirs: CreateSourceDirsArg,

#[command(flatten)]
pub dev: DevArg,

#[command(flatten)]
pub warn_error: WarnErrorArg,
}
Expand All @@ -411,8 +380,6 @@ impl From<BuildArgs> for WatchArgs {
folder: build_args.folder,
filter: build_args.filter,
after_build: build_args.after_build,
create_sourcedirs: build_args.create_sourcedirs,
dev: build_args.dev,
warn_error: build_args.warn_error,
}
}
Expand All @@ -428,9 +395,6 @@ pub enum Command {
Clean {
#[command(flatten)]
folder: FolderArg,

#[command(flatten)]
dev: DevArg,
},
/// Format ReScript files.
Format {
Expand All @@ -451,9 +415,6 @@ pub enum Command {
/// Files to format. If no files are provided, all files are formatted.
#[arg(group = "format_input_mode")]
files: Vec<String>,

#[command(flatten)]
dev: DevArg,
},
/// Print the compiler arguments for a ReScript source file.
CompilerArgs {
Expand Down Expand Up @@ -487,21 +448,6 @@ impl Deref for AfterBuildArg {
}
}

impl CreateSourceDirsArg {
/// Returns true if the flag was explicitly passed on the command line.
pub fn was_explicitly_set(&self) -> bool {
self.create_sourcedirs.is_some()
}
}

impl Deref for DevArg {
type Target = bool;

fn deref(&self) -> &Self::Target {
&self.dev
}
}

impl Deref for WarnErrorArg {
type Target = Option<String>;

Expand Down
58 changes: 3 additions & 55 deletions rewatch/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,42 +29,21 @@ fn main() -> Result<()> {
}))
.expect("Failed to initialize logger");

let mut command = cli.command;

if let cli::Command::Build(build_args) = &command
&& build_args.watch
{
log::warn!("`rescript build -w` is deprecated. Please use `rescript watch` instead.");
command = cli::Command::Watch(build_args.clone().into());
}

let is_tty: bool = Term::stdout().is_term() && Term::stderr().is_term();
let plain_output = !is_tty;

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

match command {
match cli.command {
cli::Command::CompilerArgs { path } => {
println!("{}", build::get_compiler_args(Path::new(&path))?);
std::process::exit(0);
}
cli::Command::Build(build_args) => {
let _lock = get_lock(&build_args.folder);

if build_args.dev.dev {
log::warn!(
"`--dev no longer has any effect. Please remove it from your command. It will be removed in a future version."
);
}

if build_args.create_sourcedirs.was_explicitly_set() {
log::warn!(
"`--create-sourcedirs` is deprecated: source_dirs.json is now always created. Please remove this flag from your command."
);
}

match build::build(
&build_args.filter,
Path::new(&build_args.folder as &str),
Expand All @@ -89,18 +68,6 @@ fn main() -> Result<()> {
cli::Command::Watch(watch_args) => {
let _lock = get_lock(&watch_args.folder);

if *watch_args.dev {
log::warn!(
"`--dev no longer has any effect. Please remove it from your command. It will be removed in a future version."
);
}

if watch_args.create_sourcedirs.was_explicitly_set() {
log::warn!(
"`--create-sourcedirs` is deprecated: source_dirs.json is now always created. Please remove this flag from your command."
);
}

match watcher::start(
&watch_args.filter,
show_progress,
Expand All @@ -117,30 +84,11 @@ fn main() -> Result<()> {
Ok(_) => Ok(()),
}
}
cli::Command::Clean { folder, dev } => {
cli::Command::Clean { folder } => {
let _lock = get_lock(&folder);

if dev.dev {
log::warn!(
"`--dev no longer has any effect. Please remove it from your command. It will be removed in a future version."
);
}

build::clean::clean(Path::new(&folder as &str), show_progress, plain_output)
}
cli::Command::Format {
stdin,
check,
files,
dev,
} => {
if dev.dev {
log::warn!(
"`--dev no longer has any effect. Please remove it from your command. It will be removed in a future version."
);
}
format::format(stdin, check, files)
}
cli::Command::Format { stdin, check, files } => format::format(stdin, check, files),
}
}

Expand Down
8 changes: 0 additions & 8 deletions tests/build_tests/cli_help/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,6 @@ await test(["build", "--help"], {
status: 0,
});

await test(["build", "-w", "--help"], {
stdout: buildHelp,
stderr: "",
status: 0,
});

await test(["-w", "--help"], { stdout: cliHelp, stderr: "", status: 0 });

// Shows cli help with --help arg even if there are invalid arguments after it
await test(["--help", "-w"], { stdout: cliHelp, stderr: "", status: 0 });

Expand Down
Loading