Skip to content

Move rescript and bsc wrapper scripts into cli folder #7083

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 6, 2024
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ clean-rewatch:
cargo clean --manifest-path rewatch/Cargo.toml && rm -f rewatch/rewatch

clean:
(cd runtime && ../rescript clean)
(cd runtime && ../cli/rescript clean)
dune clean

clean-all: clean clean-gentype clean-rewatch
Expand Down
2 changes: 1 addition & 1 deletion bsc → cli/bsc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"use strict";

var child_process = require("child_process");
var { bsc_exe } = require("./cli/bin_path");
var { bsc_exe } = require("./bin_path");

var delegate_args = process.argv.slice(2);

Expand Down
10 changes: 5 additions & 5 deletions rescript → cli/rescript
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
* and its content are file/directories with regard to project root
*/

var { bsc_exe, rescript_exe } = require("./cli/bin_path.js");
var bsb = require("./cli/rescript_bsb.js");
var { bsc_exe, rescript_exe } = require("./bin_path.js");
var bsb = require("./rescript_bsb.js");

var cwd = process.cwd();
process.env.BSB_PROJECT_ROOT = cwd;
Expand Down Expand Up @@ -87,7 +87,7 @@ if (helpArgIndex !== -1 && (firstPositionalArgIndex === -1 || helpArgIndex <= fi
console.log(helpMessage);

} else if (argPatterns.version.includes(args[0])) {
console.log(require("./package.json").version);
console.log(require("../package.json").version);

} else if (firstPositionalArgIndex !== -1) {
const subcmd = args[firstPositionalArgIndex];
Expand All @@ -107,15 +107,15 @@ if (helpArgIndex !== -1 && (firstPositionalArgIndex === -1 || helpArgIndex <= fi
break;
}
case "format": {
require("./cli/rescript_format.js").main(
require("./rescript_format.js").main(
subcmdArgs,
rescript_exe,
bsc_exe
);
break;
}
case "dump": {
require("./cli/rescript_dump.js").main(
require("./rescript_dump.js").main(
subcmdArgs,
rescript_exe,
bsc_exe
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
"node": ">=18"
},
"bin": {
"bsc": "bsc",
"bsc": "cli/bsc",
"bstracing": "lib/bstracing",
"rescript": "rescript",
"rescript": "cli/rescript",
"rewatch": "cli/rewatch"
},
"scripts": {
Expand All @@ -56,8 +56,6 @@
"CHANGELOG.md",
"CREDITS.md",
"ninja.COPYING",
"bsc",
"rescript",
"darwin",
"darwinarm64",
"linux",
Expand Down
4 changes: 2 additions & 2 deletions packages/artifacts.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ COPYING.LESSER
CREDITS.md
LICENSE
README.md
bsc
cli/bin_path.js
cli/bsc
cli/rescript
cli/rescript_arg.js
cli/rescript_bsb.js
cli/rescript_dump.js
Expand Down Expand Up @@ -863,7 +864,6 @@ linuxarm64/rescript.exe
linuxarm64/rewatch.exe
ninja.COPYING
package.json
rescript
win32/bsb_helper.exe
win32/bsc.exe
win32/ninja.exe
Expand Down
2 changes: 1 addition & 1 deletion scripts/buildRuntime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ rm -f lib/es6/*.js lib/js/*.js lib/ocaml/*
mkdir -p lib/es6 lib/js lib/ocaml
mkdir -p runtime/lib/es6 runtime/lib/js

(cd runtime && ../rescript build)
(cd runtime && ../cli/rescript build)

cp runtime/lib/es6/*.js lib/es6
cp runtime/lib/js/*.js lib/js
Expand Down
2 changes: 1 addition & 1 deletion scripts/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ shopt -s extglob
dune build @fmt --auto-promote

files=$(find runtime tests -type f \( -name "*.res" -o -name "*.resi" \) ! -name "syntaxErrors*")
./rescript format $files
./cli/rescript format $files
4 changes: 2 additions & 2 deletions scripts/format_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ case "$(uname -s)" in
fi

echo "Checking ReScript code formatting..."
files=$(find runtime tests -type f \( -name "*.res" -o -name "*.resi" \) ! -name "syntaxErrors*")
if ./rescript format -check $files; then
files=$(find runtime tests -type f \( -name "*.res" -o -name "*.resi" \) ! -name "syntaxErrors*" ! -path "tests/gentype_tests/typescript-react-example/node_modules/*")
if ./cli/rescript format -check $files; then
printf "${successGreen}✅ ReScript code formatting ok.${reset}\n"
else
printf "${warningYellow}⚠️ ReScript code formatting issues found.${reset}\n"
Expand Down
2 changes: 1 addition & 1 deletion tests/build_tests/cli_compile_status/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const path = require("path");
const child_process = require("child_process");
const { normalizeNewlines } = require("../utils.js");

const rescriptPath = path.join(__dirname, "..", "..", "..", "rescript")
const rescriptPath = path.join(__dirname, "..", "..", "..", "cli", "rescript")

// Shows compile time for `rescript build` command
let out = child_process.spawnSync("node", [rescriptPath, "build"], {
Expand Down
2 changes: 1 addition & 1 deletion tests/build_tests/cli_help/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const assert = require("assert");
const path = require("path");
const { exec, normalizeNewlines } = require("../utils.js");

const rescriptPath = path.join(__dirname, "..", "..", "..", "rescript")
const rescriptPath = path.join(__dirname, "..", "..", "..", "cli", "rescript")

const cliHelp =
"Usage: rescript <options> <subcommand>\n" +
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.