Skip to content

Commit 57c696b

Browse files
authored
Removed "rescript legacy" subcommand in favor of separate "rescript-legacy" binary (#7928)
* Removed "rescript legacy" subcommand in favor of separate "rescript-legacy" binary * CHANGELOG * Cleanup * Update yarn.lock
1 parent a1b3b3c commit 57c696b

File tree

41 files changed

+42
-207
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+42
-207
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ jobs:
579579
working-directory: ${{ steps.tmp-dir.outputs.path }}
580580

581581
- name: Test installation
582-
run: npx rescript -h && npx rescript legacy build && cat src/Test.res.js
582+
run: npx rescript -h && npx rescript-legacy build && cat src/Test.res.js
583583
shell: bash
584584
working-directory: ${{ steps.tmp-dir.outputs.path }}
585585

@@ -634,7 +634,7 @@ jobs:
634634
working-directory: ${{ steps.tmp-dir.outputs.path }}
635635

636636
- name: Test installation
637-
run: pnpm rescript -h && pnpm rescript legacy build && cat src/Test.res.js
637+
run: pnpm rescript -h && pnpm rescript-legacy build && cat src/Test.res.js
638638
shell: bash
639639
working-directory: ${{ steps.tmp-dir.outputs.path }}
640640

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
#### :boom: Breaking Change
1616

17+
- Removed "rescript legacy" subcommand in favor of separate "rescript-legacy" binary. https://github.com/rescript-lang/rescript/pull/7928
18+
1719
#### :eyeglasses: Spec Compliance
1820

1921
#### :rocket: New Feature

packages/playground/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"scripts": {
66
"clean": "rescript clean",
77
"test": "node ./playground_test.cjs",
8-
"build": "rescript clean && rescript legacy build && node scripts/generate_cmijs.mjs && rollup -c",
8+
"build": "rescript clean && rescript-legacy build && node scripts/generate_cmijs.mjs && rollup -c",
99
"upload-bundle": "node scripts/upload_bundle.mjs",
1010
"serve-bundle": "node serve-bundle.mjs"
1111
},

packages/playground/scripts/generate_cmijs.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
} from "./common.mjs";
2525

2626
exec("yarn rescript clean");
27-
exec("yarn rescript legacy");
27+
exec("yarn rescript-legacy build");
2828

2929
// We need to build the compiler's builtin modules as a separate cmij.
3030
// Otherwise we can't use them for compilation within the playground.

rewatch/src/build.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@ use console::style;
2222
use indicatif::{ProgressBar, ProgressStyle};
2323
use log::log_enabled;
2424
use serde::Serialize;
25-
use std::ffi::OsString;
2625
use std::fmt;
2726
use std::fs::File;
2827
use std::io::{Write, stdout};
2928
use std::path::{Path, PathBuf};
30-
use std::process::Stdio;
3129
use std::time::{Duration, Instant};
3230

3331
fn is_dirty(module: &Module) -> bool {
@@ -593,24 +591,3 @@ pub fn build(
593591
}
594592
}
595593
}
596-
597-
pub fn pass_through_legacy(mut args: Vec<OsString>) -> i32 {
598-
let project_root = helpers::get_abs_path(Path::new("."));
599-
let project_context = ProjectContext::new(&project_root).unwrap();
600-
let rescript_legacy_path = helpers::get_rescript_legacy(&project_context);
601-
602-
args.insert(0, rescript_legacy_path.into());
603-
let status = std::process::Command::new("node")
604-
.args(args)
605-
.stdout(Stdio::inherit())
606-
.stderr(Stdio::inherit())
607-
.status();
608-
609-
match status {
610-
Ok(s) => s.code().unwrap_or(0),
611-
Err(err) => {
612-
eprintln!("Error running the legacy build system: {err}");
613-
1
614-
}
615-
}
616-
}

rewatch/src/cli.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ pub enum FileExtension {
3838
// which leaks the packaging detail into the CLI UX.
3939
#[command(name = "rescript", bin_name = "rescript")]
4040
#[command(version)]
41-
#[command(
42-
after_help = "[1m[1m[4mNote:[0m If no command is provided, the [1mbuild[0m command is run by default. See `rescript help build` for more information."
43-
)]
41+
#[command(after_help = "[1m[1m[4mNotes:[0m
42+
- If no command is provided, the [1mbuild[0m command is run by default. See `rescript help build` for more information.
43+
- For the legacy (pre-v12) build system, run `rescript-legacy` instead.")]
4444
pub struct Cli {
4545
/// Verbosity:
4646
/// -v -> Debug
@@ -493,14 +493,6 @@ pub enum Command {
493493
#[command()]
494494
path: String,
495495
},
496-
/// Use the legacy build system.
497-
///
498-
/// After this command is encountered, the rest of the arguments are passed to the legacy build system.
499-
#[command(disable_help_flag = true, external_subcommand = true)]
500-
Legacy {
501-
#[arg(allow_hyphen_values = true, num_args = 0..)]
502-
legacy_args: Vec<OsString>,
503-
},
504496
}
505497

506498
impl Deref for FolderArg {

rewatch/src/helpers.rs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -377,28 +377,6 @@ pub fn get_bsc() -> PathBuf {
377377
.to_stripped_verbatim_path()
378378
}
379379

380-
pub fn get_rescript_legacy(project_context: &ProjectContext) -> PathBuf {
381-
let root_path = project_context.get_root_path();
382-
let node_modules_rescript = root_path.join("node_modules").join("rescript");
383-
let rescript_legacy_path = if node_modules_rescript.exists() {
384-
node_modules_rescript
385-
.join("cli")
386-
.join("rescript-legacy.js")
387-
.canonicalize()
388-
.map(StrippedVerbatimPath::to_stripped_verbatim_path)
389-
} else {
390-
// If the root folder / node_modules doesn't exist, something is wrong.
391-
// The only way this can happen is if we are inside the rescript repository.
392-
root_path
393-
.join("cli")
394-
.join("rescript-legacy.js")
395-
.canonicalize()
396-
.map(StrippedVerbatimPath::to_stripped_verbatim_path)
397-
};
398-
399-
rescript_legacy_path.unwrap_or_else(|_| panic!("Could not find rescript-legacy.exe"))
400-
}
401-
402380
pub fn string_ends_with_any(s: &Path, suffixes: &[&str]) -> bool {
403381
suffixes
404382
.iter()

rewatch/src/main.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,6 @@ fn main() -> Result<()> {
8888
dev.dev,
8989
)
9090
}
91-
cli::Command::Legacy { legacy_args } => {
92-
let code = build::pass_through_legacy(legacy_args);
93-
std::process::exit(code);
94-
}
9591
cli::Command::Format {
9692
stdin,
9793
check,

rewatch/testrepo/package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"packages/new-namespace",
1010
"packages/namespace-casing",
1111
"packages/with-dev-deps",
12-
"packages/compiled-by-legacy",
1312
"packages/nonexisting-dev-files",
1413
"packages/deprecated-config",
1514
"packages/file-casing",
@@ -28,10 +27,7 @@
2827
},
2928
"scripts": {
3029
"build": "../target/release/rescript build .",
31-
"build:rescript": "rescript legacy build",
3230
"watch": "../target/release/rescript watch .",
33-
"watch:rescript": "rescript legacy watch",
34-
"clean": "../target/release/rescript clean .",
35-
"clean:rescript": "rescript clean"
31+
"clean": "../target/release/rescript clean ."
3632
}
3733
}

rewatch/testrepo/packages/compiled-by-legacy/package.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)