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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ jobs:
working-directory: ${{ steps.tmp-dir.outputs.path }}

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

Expand Down Expand Up @@ -634,7 +634,7 @@ jobs:
working-directory: ${{ steps.tmp-dir.outputs.path }}

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

Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#### :boom: Breaking Change

- Removed "rescript legacy" subcommand in favor of separate "rescript-legacy" binary. https://github.com/rescript-lang/rescript/pull/7928

#### :eyeglasses: Spec Compliance

#### :rocket: New Feature
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"clean": "rescript clean",
"test": "node ./playground_test.cjs",
"build": "rescript clean && rescript legacy build && node scripts/generate_cmijs.mjs && rollup -c",
"build": "rescript clean && rescript-legacy build && node scripts/generate_cmijs.mjs && rollup -c",
"upload-bundle": "node scripts/upload_bundle.mjs",
"serve-bundle": "node serve-bundle.mjs"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/scripts/generate_cmijs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
} from "./common.mjs";

exec("yarn rescript clean");
exec("yarn rescript legacy");
exec("yarn rescript-legacy build");

// We need to build the compiler's builtin modules as a separate cmij.
// Otherwise we can't use them for compilation within the playground.
Expand Down
23 changes: 0 additions & 23 deletions rewatch/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ use console::style;
use indicatif::{ProgressBar, ProgressStyle};
use log::log_enabled;
use serde::Serialize;
use std::ffi::OsString;
use std::fmt;
use std::fs::File;
use std::io::{Write, stdout};
use std::path::{Path, PathBuf};
use std::process::Stdio;
use std::time::{Duration, Instant};

fn is_dirty(module: &Module) -> bool {
Expand Down Expand Up @@ -593,24 +591,3 @@ pub fn build(
}
}
}

pub fn pass_through_legacy(mut args: Vec<OsString>) -> i32 {
let project_root = helpers::get_abs_path(Path::new("."));
let project_context = ProjectContext::new(&project_root).unwrap();
let rescript_legacy_path = helpers::get_rescript_legacy(&project_context);

args.insert(0, rescript_legacy_path.into());
let status = std::process::Command::new("node")
.args(args)
.stdout(Stdio::inherit())
.stderr(Stdio::inherit())
.status();

match status {
Ok(s) => s.code().unwrap_or(0),
Err(err) => {
eprintln!("Error running the legacy build system: {err}");
1
}
}
}
14 changes: 3 additions & 11 deletions rewatch/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ pub enum FileExtension {
// which leaks the packaging detail into the CLI UX.
#[command(name = "rescript", bin_name = "rescript")]
#[command(version)]
#[command(
after_help = "Note: If no command is provided, the build command is run by default. See `rescript help build` for more information."
)]
#[command(after_help = "Notes:
- If no command is provided, the build command is run by default. See `rescript help build` for more information.
- For the legacy (pre-v12) build system, run `rescript-legacy` instead.")]
pub struct Cli {
/// Verbosity:
/// -v -> Debug
Expand Down Expand Up @@ -493,14 +493,6 @@ pub enum Command {
#[command()]
path: String,
},
/// Use the legacy build system.
///
/// After this command is encountered, the rest of the arguments are passed to the legacy build system.
#[command(disable_help_flag = true, external_subcommand = true)]
Legacy {
#[arg(allow_hyphen_values = true, num_args = 0..)]
legacy_args: Vec<OsString>,
},
}

impl Deref for FolderArg {
Expand Down
22 changes: 0 additions & 22 deletions rewatch/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,28 +377,6 @@ pub fn get_bsc() -> PathBuf {
.to_stripped_verbatim_path()
}

pub fn get_rescript_legacy(project_context: &ProjectContext) -> PathBuf {
let root_path = project_context.get_root_path();
let node_modules_rescript = root_path.join("node_modules").join("rescript");
let rescript_legacy_path = if node_modules_rescript.exists() {
node_modules_rescript
.join("cli")
.join("rescript-legacy.js")
.canonicalize()
.map(StrippedVerbatimPath::to_stripped_verbatim_path)
} else {
// If the root folder / node_modules doesn't exist, something is wrong.
// The only way this can happen is if we are inside the rescript repository.
root_path
.join("cli")
.join("rescript-legacy.js")
.canonicalize()
.map(StrippedVerbatimPath::to_stripped_verbatim_path)
};

rescript_legacy_path.unwrap_or_else(|_| panic!("Could not find rescript-legacy.exe"))
}

pub fn string_ends_with_any(s: &Path, suffixes: &[&str]) -> bool {
suffixes
.iter()
Expand Down
4 changes: 0 additions & 4 deletions rewatch/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ fn main() -> Result<()> {
dev.dev,
)
}
cli::Command::Legacy { legacy_args } => {
let code = build::pass_through_legacy(legacy_args);
std::process::exit(code);
}
cli::Command::Format {
stdin,
check,
Expand Down
6 changes: 1 addition & 5 deletions rewatch/testrepo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"packages/new-namespace",
"packages/namespace-casing",
"packages/with-dev-deps",
"packages/compiled-by-legacy",
"packages/nonexisting-dev-files",
"packages/deprecated-config",
"packages/file-casing",
Expand All @@ -28,10 +27,7 @@
},
"scripts": {
"build": "../target/release/rescript build .",
"build:rescript": "rescript legacy build",
"watch": "../target/release/rescript watch .",
"watch:rescript": "rescript legacy watch",
"clean": "../target/release/rescript clean .",
"clean:rescript": "rescript clean"
"clean": "../target/release/rescript clean ."
}
}
9 changes: 0 additions & 9 deletions rewatch/testrepo/packages/compiled-by-legacy/package.json

This file was deleted.

13 changes: 0 additions & 13 deletions rewatch/testrepo/packages/compiled-by-legacy/rescript.json

This file was deleted.

9 changes: 0 additions & 9 deletions rewatch/testrepo/packages/compiled-by-legacy/src/Main.mjs

This file was deleted.

1 change: 0 additions & 1 deletion rewatch/testrepo/packages/compiled-by-legacy/src/Main.res

This file was deleted.

9 changes: 0 additions & 9 deletions rewatch/testrepo/packages/compiled-by-legacy/src/Main.res.js

This file was deleted.

1 change: 0 additions & 1 deletion rewatch/testrepo/packages/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"author": "",
"license": "MIT",
"dependencies": {
"@testrepo/compiled-by-legacy": "*",
"@testrepo/dep01": "*"
}
}
1 change: 0 additions & 1 deletion rewatch/testrepo/rescript.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"@testrepo/new-namespace",
"@testrepo/namespace-casing",
"@testrepo/with-dev-deps",
"@testrepo/compiled-by-legacy",
"@testrepo/nonexisting-dev-files",
"@testrepo/deprecated-config",
"@testrepo/file-casing",
Expand Down
7 changes: 0 additions & 7 deletions rewatch/testrepo/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ __metadata:
languageName: node
linkType: hard

"@testrepo/compiled-by-legacy@npm:*, @testrepo/compiled-by-legacy@workspace:packages/compiled-by-legacy":
version: 0.0.0-use.local
resolution: "@testrepo/compiled-by-legacy@workspace:packages/compiled-by-legacy"
languageName: unknown
linkType: soft

"@testrepo/dep01@npm:*, @testrepo/dep01@workspace:packages/dep01":
version: 0.0.0-use.local
resolution: "@testrepo/dep01@workspace:packages/dep01"
Expand Down Expand Up @@ -126,7 +120,6 @@ __metadata:
version: 0.0.0-use.local
resolution: "@testrepo/main@workspace:packages/main"
dependencies:
"@testrepo/compiled-by-legacy": "npm:*"
"@testrepo/dep01": "npm:*"
languageName: unknown
linkType: soft
Expand Down
6 changes: 3 additions & 3 deletions rewatch/tests/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ bold "Test: It should format all files"
git diff --name-only ./
error_output=$("$REWATCH_EXECUTABLE" format)
git_diff_file_count=$(git diff --name-only ./ | wc -l | xargs)
if [ $? -eq 0 ] && [ $git_diff_file_count -eq 9 ];
if [ $? -eq 0 ] && [ $git_diff_file_count -eq 8 ];
then
success "Test package formatted. Got $git_diff_file_count changed files."
git restore .
else
error "Error formatting test package"
echo "Expected 9 files to be changed, got $git_diff_file_count"
echo "Expected 8 files to be changed, got $git_diff_file_count"
echo $error_output
exit 1
fi
Expand Down Expand Up @@ -62,7 +62,7 @@ bold "Test: it should format dev package as well"

error_output=$("$REWATCH_EXECUTABLE" format --dev)
git_diff_file_count=$(git diff --name-only ./ | wc -l | xargs)
if [ $? -eq 0 ] && [ $git_diff_file_count -eq 10 ];
if [ $? -eq 0 ] && [ $git_diff_file_count -eq 9 ];
then
success "All packages (including dev) were formatted. Got $git_diff_file_count changed files."
git restore .
Expand Down
3 changes: 0 additions & 3 deletions rewatch/tests/legacy-utils.sh

This file was deleted.

53 changes: 0 additions & 53 deletions rewatch/tests/legacy.sh

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Cleaned 0/115
Cleaned 0/114
Parsed 2 source files
Compiled 2 modules

Expand Down
4 changes: 2 additions & 2 deletions rewatch/tests/snapshots/clean-rebuild.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Cleaned 0/0
Parsed 112 source files
Compiled 112 modules
Parsed 111 source files
Compiled 111 modules

The field 'bs-dependencies' found in the package config of '@testrepo/deprecated-config' is deprecated and will be removed in a future version.
Use 'dependencies' instead.
Expand Down
2 changes: 1 addition & 1 deletion rewatch/tests/snapshots/dependency-cycle.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Cleaned 0/115
Cleaned 0/114
Parsed 1 source files
Compiled 0 modules

Expand Down
2 changes: 1 addition & 1 deletion rewatch/tests/snapshots/remove-file.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Cleaned 1/115
Cleaned 1/114
Parsed 0 source files
Compiled 1 modules

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Cleaned 2/115
Cleaned 2/114
Parsed 2 source files
Compiled 3 modules

Expand Down
2 changes: 1 addition & 1 deletion rewatch/tests/snapshots/rename-file-internal-dep.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Cleaned 2/115
Cleaned 2/114
Parsed 2 source files
Compiled 2 modules

Expand Down
2 changes: 1 addition & 1 deletion rewatch/tests/snapshots/rename-file-with-interface.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
 No implementation file found for interface file (skipping): src/ModuleWithInterface.resi
Cleaned 2/115
Cleaned 2/114
Parsed 1 source files
Compiled 2 modules

Expand Down
2 changes: 1 addition & 1 deletion rewatch/tests/snapshots/rename-file.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Cleaned 1/115
Cleaned 1/114
Parsed 1 source files
Compiled 1 modules

Expand Down
2 changes: 1 addition & 1 deletion rewatch/tests/snapshots/rename-interface-file.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
 No implementation file found for interface file (skipping): src/ModuleWithInterface2.resi
Cleaned 1/115
Cleaned 1/114
Parsed 1 source files
Compiled 2 modules

Expand Down
Loading
Loading