diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6df388f946..92049f74e7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -332,12 +332,12 @@ jobs: - name: Build runtime/stdlib with rewatch if: ${{ runner.os != 'Windows' }} - run: ./scripts/buildRuntimeRewatch.sh + run: ./scripts/buildRuntime.sh shell: bash - name: Build runtime/stdlib with bsb (Windows) if: ${{ runner.os == 'Windows' }} - run: ./scripts/buildRuntime.sh + run: ./scripts/buildRuntimeLegacy.sh shell: bash - name: Check for changes in lib folder @@ -510,7 +510,7 @@ jobs: - name: Build website if: steps.diffcheck.outputs.clean == 'false' run: | - npm ci + npm ci npm run build - name: Commit and push @@ -569,7 +569,7 @@ jobs: working-directory: ${{ steps.tmp-dir.outputs.path }} - name: Test installation - run: npx rescript -h && npx rescript 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 }} @@ -581,7 +581,7 @@ jobs: working-directory: rewatch/testrepo - name: Run rewatch integration tests - run: ./rewatch/tests/suite-ci.sh node_modules/.bin/rewatch + run: ./rewatch/tests/suite-ci.sh node_modules/.bin/rescript shell: bash publish: diff --git a/CHANGELOG.md b/CHANGELOG.md index 40de08b975..5d6124294d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,10 @@ #### :boom: Breaking Change -- The legacy rescript cli can be called through rewatch via `rewatch legacy`. Arguments to rewatch need to be passed after the subcommand. Argument `--compiler-args` is now a subcommand `compiler-args`. https://github.com/rescript-lang/rescript/pull/7551 +- New `rewatch` based build system. https://github.com/rescript-lang/rescript/pull/7551 https://github.com/rescript-lang/rescript/pull/7593 + - The new `rewatch` based build system is now the default and is exposed through the `rescript` command. The `rewatch` command has been removed. + - The previous Ninja-based build system is now available via the `rescript legacy` subcommand. + - Argument `--compiler-args` is now a subcommand `compiler-args`. - Remove `String.getSymbol` from standard library. https://github.com/rescript-lang/rescript/pull/7571 - Remove `String.getSymbolUnsafe` from standard library. https://github.com/rescript-lang/rescript/pull/7571 - Remove `String.setSymbol` from standard library. https://github.com/rescript-lang/rescript/pull/7571 diff --git a/Makefile b/Makefile index 032b80f314..7bd8b5f95d 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,6 @@ dce: rewatch: cargo build --manifest-path rewatch/Cargo.toml --release - cp rewatch/target/release/rewatch rewatch ./scripts/copyExes.js --rewatch ninja/ninja: @@ -53,10 +52,10 @@ reanalyze: reanalyze.exe -set-exit-code -all-cmt _build/default/compiler _build/default/tests -exclude-paths compiler/outcome_printer,compiler/ml,compiler/frontend,compiler/ext,compiler/depends,compiler/core,compiler/common,compiler/cmij,compiler/bsb_helper,compiler/bsb lib-bsb: - ./scripts/buildRuntime.sh + ./scripts/buildRuntimeLegacy.sh lib: - ./scripts/buildRuntimeRewatch.sh + ./scripts/buildRuntime.sh artifacts: lib ./scripts/npmPack.js --updateArtifactList diff --git a/analysis/examples/example-project/package.json b/analysis/examples/example-project/package.json index b948ffc3a9..e5b47fcad1 100644 --- a/analysis/examples/example-project/package.json +++ b/analysis/examples/example-project/package.json @@ -6,6 +6,6 @@ "scripts": { "build": "rescript", "start": "rescript build -w", - "clean": "rescript clean -with-deps" + "clean": "rescript clean" } } diff --git a/analysis/examples/larger-project/package.json b/analysis/examples/larger-project/package.json index 1426ee18c6..6117fd6087 100644 --- a/analysis/examples/larger-project/package.json +++ b/analysis/examples/larger-project/package.json @@ -5,7 +5,7 @@ "scripts": { "start": "rescript build -w", "build": "rescript build", - "clean": "rescript clean -with-deps" + "clean": "rescript clean" }, "devDependencies": { "react": "^16.13.1", diff --git a/cli/common/bins.js b/cli/common/bins.js index 91a699771e..1844607281 100644 --- a/cli/common/bins.js +++ b/cli/common/bins.js @@ -22,7 +22,7 @@ export const { ninja_exe, rescript_editor_analysis_exe, rescript_tools_exe, + rescript_legacy_exe, rescript_exe, - rewatch_exe, }, } = mod; diff --git a/cli/common/bsb.js b/cli/common/bsb.js index 8f229f1aa7..b38d462887 100644 --- a/cli/common/bsb.js +++ b/cli/common/bsb.js @@ -7,7 +7,7 @@ import * as os from "node:os"; import * as path from "node:path"; import { WebSocket } from "#lib/minisocket"; -import { rescript_exe } from "./bins.js"; +import { rescript_legacy_exe } from "./bins.js"; const cwd = process.cwd(); const lockFileName = path.join(cwd, ".bsb.lock"); @@ -50,7 +50,7 @@ function acquireBuild(args, options) { return null; } try { - ownerProcess = child_process.spawn(rescript_exe, args, { + ownerProcess = child_process.spawn(rescript_legacy_exe, args, { stdio: "inherit", ...options, }); diff --git a/cli/rescript-legacy.js b/cli/rescript-legacy.js new file mode 100755 index 0000000000..c464f468a6 --- /dev/null +++ b/cli/rescript-legacy.js @@ -0,0 +1,135 @@ +#!/usr/bin/env node + +// @ts-check + +// This script is supposed to be running in project root directory +// It matters since we need read .sourcedirs(location) +// and its content are file/directories with regard to project root + +import * as fs from "node:fs"; +import * as tty from "node:tty"; + +import { bsc_exe, rescript_legacy_exe } from "./common/bins.js"; +import * as bsb from "./common/bsb.js"; + +const cwd = process.cwd(); +process.env.BSB_PROJECT_ROOT = cwd; + +if (process.env.FORCE_COLOR === undefined) { + if (tty.isatty(1)) { + process.env.FORCE_COLOR = "1"; + process.env.NINJA_ANSI_FORCED = "1"; + } +} else { + if ( + process.env.FORCE_COLOR === "1" && + process.env.NINJA_ANSI_FORCED === undefined + ) { + process.env.NINJA_ANSI_FORCED = "1"; + } + if (process.argv.includes("-verbose")) { + console.log(`FORCE_COLOR: "${process.env.FORCE_COLOR}"`); + } +} + +const helpMessage = `Usage: rescript + +\`rescript\` is equivalent to \`rescript build\` + +Options: + -v, -version display version number + -h, -help display help + +Subcommands: + build + clean + format + dump + help + +Run \`rescript -h\` for subcommand help. Examples: + rescript build -h + rescript format -h`; + +function onUncaughtException(err) { + console.error("Uncaught Exception", err); + bsb.releaseBuild(); + process.exit(1); +} + +function exitProcess() { + bsb.releaseBuild(); + process.exit(0); +} + +process.on("uncaughtException", onUncaughtException); + +// OS signal handlers +// Ctrl+C +process.on("SIGINT", exitProcess); +// kill pid +try { + process.on("SIGUSR1", exitProcess); + process.on("SIGUSR2", exitProcess); + process.on("SIGTERM", exitProcess); + process.on("SIGHUP", exitProcess); +} catch (_e) { + // Deno might throw an error here, see https://github.com/denoland/deno/issues/9995 + // TypeError: Windows only supports ctrl-c (SIGINT) and ctrl-break (SIGBREAK). +} + +const args = process.argv.slice(2); +const argPatterns = { + help: ["help", "-h", "-help", "--help"], + version: ["version", "-v", "-version", "--version"], +}; + +const helpArgIndex = args.findIndex(arg => argPatterns.help.includes(arg)); +const firstPositionalArgIndex = args.findIndex(arg => !arg.startsWith("-")); + +if ( + helpArgIndex !== -1 && + (firstPositionalArgIndex === -1 || helpArgIndex <= firstPositionalArgIndex) +) { + console.log(helpMessage); +} else if (argPatterns.version.includes(args[0])) { + const packageSpec = JSON.parse( + fs.readFileSync(new URL("../package.json", import.meta.url), "utf-8"), + ); + + console.log(packageSpec.version); +} else if (firstPositionalArgIndex !== -1) { + const subcmd = args[firstPositionalArgIndex]; + const subcmdArgs = args.slice(firstPositionalArgIndex + 1); + + switch (subcmd) { + case "info": { + bsb.info(subcmdArgs); + break; + } + case "clean": { + bsb.clean(subcmdArgs); + break; + } + case "build": { + bsb.build(subcmdArgs); + break; + } + case "format": { + const mod = await import("./rescript-legacy/format.js"); + await mod.main(subcmdArgs, rescript_legacy_exe, bsc_exe); + break; + } + case "dump": { + const mod = await import("./rescript-legacy/dump.js"); + mod.main(subcmdArgs, rescript_legacy_exe, bsc_exe); + break; + } + default: { + console.error(`Error: Unknown command "${subcmd}".\n${helpMessage}`); + process.exit(2); + } + } +} else { + bsb.build(args); +} diff --git a/cli/rescript/dump.js b/cli/rescript-legacy/dump.js similarity index 81% rename from cli/rescript/dump.js rename to cli/rescript-legacy/dump.js index bd1201e354..3acf52a251 100644 --- a/cli/rescript/dump.js +++ b/cli/rescript-legacy/dump.js @@ -16,10 +16,10 @@ const specs = []; /** * @param {string[]} argv - * @param {string} rescript_exe + * @param {string} rescript_legacy_exe * @param {string} bsc_exe */ -export function main(argv, rescript_exe, bsc_exe) { +export function main(argv, rescript_legacy_exe, bsc_exe) { let target; arg.parse_exn(dump_usage, argv, specs, xs => { if (xs.length !== 1) { @@ -34,9 +34,13 @@ export function main(argv, rescript_exe, bsc_exe) { process.exit(2); } - let output = child_process.spawnSync(rescript_exe, ["build", "--", target], { - encoding: "utf-8", - }); + let output = child_process.spawnSync( + rescript_legacy_exe, + ["build", "--", target], + { + encoding: "utf-8", + }, + ); if (output.status !== 0) { console.log(output.stdout); console.error(output.stderr); diff --git a/cli/rescript/format.js b/cli/rescript-legacy/format.js similarity index 98% rename from cli/rescript/format.js rename to cli/rescript-legacy/format.js index 072d340d76..9fc1759b8d 100644 --- a/cli/rescript/format.js +++ b/cli/rescript-legacy/format.js @@ -143,10 +143,10 @@ async function formatFiles(files, bsc_exe, isSupportedFile, checkFormatting) { /** * @param {string[]} argv - * @param {string} rescript_exe + * @param {string} rescript_legacy_exe * @param {string} bsc_exe */ -export async function main(argv, rescript_exe, bsc_exe) { +export async function main(argv, rescript_legacy_exe, bsc_exe) { const isSupportedFile = hasExtension(formattedFileExtensions); const isSupportedStd = hasExtension(formattedStdExtensions); @@ -179,7 +179,7 @@ export async function main(argv, rescript_exe, bsc_exe) { // -all // TODO: check the rest arguments const output = child_process.spawnSync( - rescript_exe, + rescript_legacy_exe, ["info", "-list-files"], { encoding: "utf-8", diff --git a/cli/rescript.js b/cli/rescript.js index 98d8900ab2..731b33143a 100755 --- a/cli/rescript.js +++ b/cli/rescript.js @@ -2,134 +2,46 @@ // @ts-check -// This script is supposed to be running in project root directory -// It matters since we need read .sourcedirs(location) -// and its content are file/directories with regard to project root - -import * as tty from "node:tty"; -import * as fs from "node:fs"; - +import * as child_process from "node:child_process"; import { bsc_exe, rescript_exe } from "./common/bins.js"; -import * as bsb from "./common/bsb.js"; - -const cwd = process.cwd(); -process.env.BSB_PROJECT_ROOT = cwd; - -if (process.env.FORCE_COLOR === undefined) { - if (tty.isatty(1)) { - process.env.FORCE_COLOR = "1"; - process.env.NINJA_ANSI_FORCED = "1"; - } -} else { - if ( - process.env.FORCE_COLOR === "1" && - process.env.NINJA_ANSI_FORCED === undefined - ) { - process.env.NINJA_ANSI_FORCED = "1"; - } - if (process.argv.includes("-verbose")) { - console.log(`FORCE_COLOR: "${process.env.FORCE_COLOR}"`); - } -} - -const helpMessage = `Usage: rescript - -\`rescript\` is equivalent to \`rescript build\` - -Options: - -v, -version display version number - -h, -help display help - -Subcommands: - build - clean - format - dump - help - -Run \`rescript -h\` for subcommand help. Examples: - rescript build -h - rescript format -h`; - -function onUncaughtException(err) { - console.error("Uncaught Exception", err); - bsb.releaseBuild(); - process.exit(1); -} - -function exitProcess() { - bsb.releaseBuild(); - process.exit(0); -} - -process.on("uncaughtException", onUncaughtException); - -// OS signal handlers -// Ctrl+C -process.on("SIGINT", exitProcess); -// kill pid -try { - process.on("SIGUSR1", exitProcess); - process.on("SIGUSR2", exitProcess); - process.on("SIGTERM", exitProcess); - process.on("SIGHUP", exitProcess); -} catch (_e) { - // Deno might throw an error here, see https://github.com/denoland/deno/issues/9995 - // TypeError: Windows only supports ctrl-c (SIGINT) and ctrl-break (SIGBREAK). -} const args = process.argv.slice(2); -const argPatterns = { - help: ["help", "-h", "-help", "--help"], - version: ["version", "-v", "-version", "--version"], -}; -const helpArgIndex = args.findIndex(arg => argPatterns.help.includes(arg)); const firstPositionalArgIndex = args.findIndex(arg => !arg.startsWith("-")); -if ( - helpArgIndex !== -1 && - (firstPositionalArgIndex === -1 || helpArgIndex <= firstPositionalArgIndex) -) { - console.log(helpMessage); -} else if (argPatterns.version.includes(args[0])) { - const packageSpec = JSON.parse( - fs.readFileSync(new URL("../package.json", import.meta.url), "utf-8") - ); - - console.log(packageSpec.version); -} else if (firstPositionalArgIndex !== -1) { - const subcmd = args[firstPositionalArgIndex]; - const subcmdArgs = args.slice(firstPositionalArgIndex + 1); - - switch (subcmd) { - case "info": { - bsb.info(subcmdArgs); - break; - } - case "clean": { - bsb.clean(subcmdArgs); - break; - } - case "build": { - bsb.build(subcmdArgs); - break; - } - case "format": { - const mod = await import("./rescript/format.js"); - await mod.main(subcmdArgs, rescript_exe, bsc_exe); - break; - } - case "dump": { - const mod = await import("./rescript/dump.js"); - mod.main(subcmdArgs, rescript_exe, bsc_exe); - break; - } - default: { - console.error(`Error: Unknown command "${subcmd}".\n${helpMessage}`); - process.exit(2); +try { + if (firstPositionalArgIndex !== -1) { + const subcommand = args[firstPositionalArgIndex]; + const subcommandWithArgs = args.slice(firstPositionalArgIndex); + + if ( + subcommand === "build" || + subcommand === "watch" || + subcommand === "clean" || + subcommand === "compiler-args" + ) { + child_process.execFileSync( + rescript_exe, + [...subcommandWithArgs, "--bsc-path", bsc_exe], + { + stdio: "inherit", + }, + ); + } else { + child_process.execFileSync(rescript_exe, [...args], { + stdio: "inherit", + }); } + } else { + // no subcommand means build subcommand + child_process.execFileSync(rescript_exe, [...args, "--bsc-path", bsc_exe], { + stdio: "inherit", + }); + } +} catch (err) { + if (err.status !== undefined) { + process.exit(err.status); // Pass through the exit code + } else { + process.exit(1); // Generic error } -} else { - bsb.build(args); } diff --git a/cli/rewatch.js b/cli/rewatch.js deleted file mode 100755 index d7e65e077e..0000000000 --- a/cli/rewatch.js +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env node - -// @ts-check - -import * as child_process from "node:child_process"; -import { rewatch_exe, bsc_exe } from "./common/bins.js"; - -const args = process.argv.slice(2); - -const firstPositionalArgIndex = args.findIndex((arg) => !arg.startsWith("-")); - -try { - if (firstPositionalArgIndex !== -1) { - const subcommand = args[firstPositionalArgIndex]; - const subcommandWithArgs = args.slice(firstPositionalArgIndex); - - if ( - subcommand === "build" || - subcommand === "watch" || - subcommand === "clean" || - subcommand === "compiler-args" - ) { - child_process.execFileSync( - rewatch_exe, - [...subcommandWithArgs, "--bsc-path", bsc_exe], - { - stdio: "inherit", - } - ); - } else { - child_process.execFileSync(rewatch_exe, [...args], { - stdio: "inherit", - }); - } - } else { - // no subcommand means build subcommand - child_process.execFileSync(rewatch_exe, [...args, "--bsc-path", bsc_exe], { - stdio: "inherit", - }); - } -} catch (err) { - if (err.status !== undefined) { - process.exit(err.status); // Pass through the exit code - } else { - process.exit(1); // Generic error - } -} diff --git a/compiler/bsb_exe/dune b/compiler/bsb_exe/dune index 4478ba2cc4..0c22a4930c 100644 --- a/compiler/bsb_exe/dune +++ b/compiler/bsb_exe/dune @@ -5,7 +5,7 @@ (executable (name rescript_main) - (public_name rescript) + (public_name rescript-legacy) (package rescript) (enabled_if (<> %{profile} browser)) diff --git a/compiler/syntax/src/res_scanner.ml b/compiler/syntax/src/res_scanner.ml index a49ea8a5ee..3c66812bc1 100644 --- a/compiler/syntax/src/res_scanner.ml +++ b/compiler/syntax/src/res_scanner.ml @@ -61,7 +61,7 @@ let position scanner = } (* Small debugging util - ❯ echo 'let msg = "hello"' | ./lib/rescript.exe + ❯ echo 'let msg = "hello"' | ./lib/rescript-legacy.exe let msg = "hello" ^-^ let 0-3 let msg = "hello" diff --git a/lib_dev/process.js b/lib_dev/process.js index c2d506b08b..0dbddd4881 100644 --- a/lib_dev/process.js +++ b/lib_dev/process.js @@ -1,7 +1,7 @@ import * as child_process from "node:child_process"; import * as fs from "node:fs/promises"; import * as path from "node:path"; -import { bsc_exe, rescript_exe } from "#cli/bins"; +import { bsc_exe, rescript_legacy_exe } from "#cli/bins"; /** * @typedef {{ @@ -158,7 +158,10 @@ export function setup(cwd = process.cwd()) { * @return {Promise} */ rescript(command, args = [], options = {}) { - const cliPath = path.join(import.meta.dirname, "../cli/rescript.js"); + const cliPath = path.join( + import.meta.dirname, + "../cli/rescript-legacy.js", + ); return exec("node", [cliPath, command, ...args].filter(Boolean), options); }, @@ -181,7 +184,7 @@ export function setup(cwd = process.cwd()) { * @return {Promise} */ execBuild(args = [], options = {}) { - return exec(rescript_exe, ["build", ...args], options); + return exec(rescript_legacy_exe, ["build", ...args], options); }, /** @@ -192,7 +195,7 @@ export function setup(cwd = process.cwd()) { * @return {Promise} */ execClean(args = [], options = {}) { - return exec(rescript_exe, ["clean", ...args], options); + return exec(rescript_legacy_exe, ["clean", ...args], options); }, /** diff --git a/package.json b/package.json index aca5a88df1..b82b02f895 100644 --- a/package.json +++ b/package.json @@ -41,8 +41,8 @@ "bsc": "cli/bsc.js", "bstracing": "cli/bstracing.js", "rescript": "cli/rescript.js", - "rescript-tools": "cli/rescript-tools.js", - "rewatch": "cli/rewatch.js" + "rescript-legacy": "cli/rescript-legacy.js", + "rescript-tools": "cli/rescript-tools.js" }, "scripts": { "test": "node scripts/test.js -all", diff --git a/packages/@rescript/darwin-arm64/bin.d.ts b/packages/@rescript/darwin-arm64/bin.d.ts index 1a78d275d7..e64a217712 100644 --- a/packages/@rescript/darwin-arm64/bin.d.ts +++ b/packages/@rescript/darwin-arm64/bin.d.ts @@ -3,11 +3,11 @@ export const binDir: string; export const binPaths: BinaryPaths; export type BinaryPaths = { - bsb_helper_exe: string, - bsc_exe: string, - ninja_exe: string, - rescript_exe: string, - rescript_tools_exe: string, - rescript_editor_analysis_exe: string, - rewatch_exe: string, + bsb_helper_exe: string; + bsc_exe: string; + ninja_exe: string; + rescript_legacy_exe: string; + rescript_tools_exe: string; + rescript_editor_analysis_exe: string; + rescript_exe: string; }; diff --git a/packages/@rescript/darwin-arm64/bin.js b/packages/@rescript/darwin-arm64/bin.js index 0bae072013..7b6f5bed04 100644 --- a/packages/@rescript/darwin-arm64/bin.js +++ b/packages/@rescript/darwin-arm64/bin.js @@ -8,11 +8,11 @@ export const binPaths = { bsb_helper_exe: path.join(binDir, "bsb_helper.exe"), bsc_exe: path.join(binDir, "bsc.exe"), ninja_exe: path.join(binDir, "ninja.exe"), - rescript_exe: path.join(binDir, "rescript.exe"), + rescript_legacy_exe: path.join(binDir, "rescript-legacy.exe"), rescript_tools_exe: path.join(binDir, "rescript-tools.exe"), rescript_editor_analysis_exe: path.join( binDir, "rescript-editor-analysis.exe", ), - rewatch_exe: path.join(binDir, "rewatch.exe"), + rescript_exe: path.join(binDir, "rescript.exe"), }; diff --git a/packages/@rescript/darwin-arm64/package.json b/packages/@rescript/darwin-arm64/package.json index 5015e16f9d..9cf7e758da 100644 --- a/packages/@rescript/darwin-arm64/package.json +++ b/packages/@rescript/darwin-arm64/package.json @@ -32,10 +32,10 @@ "./bin/bsb_helper.exe", "./bin/bsc.exe", "./bin/ninja.exe", - "./bin/rescript.exe", + "./bin/rescript-legacy.exe", "./bin/rescript-editor-analysis.exe", "./bin/rescript-tools.exe", - "./bin/rewatch.exe" + "./bin/rescript.exe" ] }, "engines": { diff --git a/packages/@rescript/darwin-x64/bin.d.ts b/packages/@rescript/darwin-x64/bin.d.ts index 1a78d275d7..e64a217712 100644 --- a/packages/@rescript/darwin-x64/bin.d.ts +++ b/packages/@rescript/darwin-x64/bin.d.ts @@ -3,11 +3,11 @@ export const binDir: string; export const binPaths: BinaryPaths; export type BinaryPaths = { - bsb_helper_exe: string, - bsc_exe: string, - ninja_exe: string, - rescript_exe: string, - rescript_tools_exe: string, - rescript_editor_analysis_exe: string, - rewatch_exe: string, + bsb_helper_exe: string; + bsc_exe: string; + ninja_exe: string; + rescript_legacy_exe: string; + rescript_tools_exe: string; + rescript_editor_analysis_exe: string; + rescript_exe: string; }; diff --git a/packages/@rescript/darwin-x64/bin.js b/packages/@rescript/darwin-x64/bin.js index 0bae072013..7b6f5bed04 100644 --- a/packages/@rescript/darwin-x64/bin.js +++ b/packages/@rescript/darwin-x64/bin.js @@ -8,11 +8,11 @@ export const binPaths = { bsb_helper_exe: path.join(binDir, "bsb_helper.exe"), bsc_exe: path.join(binDir, "bsc.exe"), ninja_exe: path.join(binDir, "ninja.exe"), - rescript_exe: path.join(binDir, "rescript.exe"), + rescript_legacy_exe: path.join(binDir, "rescript-legacy.exe"), rescript_tools_exe: path.join(binDir, "rescript-tools.exe"), rescript_editor_analysis_exe: path.join( binDir, "rescript-editor-analysis.exe", ), - rewatch_exe: path.join(binDir, "rewatch.exe"), + rescript_exe: path.join(binDir, "rescript.exe"), }; diff --git a/packages/@rescript/darwin-x64/package.json b/packages/@rescript/darwin-x64/package.json index 753167a9e5..6a4e7e408f 100644 --- a/packages/@rescript/darwin-x64/package.json +++ b/packages/@rescript/darwin-x64/package.json @@ -32,10 +32,10 @@ "./bin/bsb_helper.exe", "./bin/bsc.exe", "./bin/ninja.exe", - "./bin/rescript.exe", + "./bin/rescript-legacy.exe", "./bin/rescript-editor-analysis.exe", "./bin/rescript-tools.exe", - "./bin/rewatch.exe" + "./bin/rescript.exe" ] }, "engines": { diff --git a/packages/@rescript/linux-arm64/bin.d.ts b/packages/@rescript/linux-arm64/bin.d.ts index 1a78d275d7..e64a217712 100644 --- a/packages/@rescript/linux-arm64/bin.d.ts +++ b/packages/@rescript/linux-arm64/bin.d.ts @@ -3,11 +3,11 @@ export const binDir: string; export const binPaths: BinaryPaths; export type BinaryPaths = { - bsb_helper_exe: string, - bsc_exe: string, - ninja_exe: string, - rescript_exe: string, - rescript_tools_exe: string, - rescript_editor_analysis_exe: string, - rewatch_exe: string, + bsb_helper_exe: string; + bsc_exe: string; + ninja_exe: string; + rescript_legacy_exe: string; + rescript_tools_exe: string; + rescript_editor_analysis_exe: string; + rescript_exe: string; }; diff --git a/packages/@rescript/linux-arm64/bin.js b/packages/@rescript/linux-arm64/bin.js index 0bae072013..7b6f5bed04 100644 --- a/packages/@rescript/linux-arm64/bin.js +++ b/packages/@rescript/linux-arm64/bin.js @@ -8,11 +8,11 @@ export const binPaths = { bsb_helper_exe: path.join(binDir, "bsb_helper.exe"), bsc_exe: path.join(binDir, "bsc.exe"), ninja_exe: path.join(binDir, "ninja.exe"), - rescript_exe: path.join(binDir, "rescript.exe"), + rescript_legacy_exe: path.join(binDir, "rescript-legacy.exe"), rescript_tools_exe: path.join(binDir, "rescript-tools.exe"), rescript_editor_analysis_exe: path.join( binDir, "rescript-editor-analysis.exe", ), - rewatch_exe: path.join(binDir, "rewatch.exe"), + rescript_exe: path.join(binDir, "rescript.exe"), }; diff --git a/packages/@rescript/linux-arm64/package.json b/packages/@rescript/linux-arm64/package.json index 4d2391b32f..682093c125 100644 --- a/packages/@rescript/linux-arm64/package.json +++ b/packages/@rescript/linux-arm64/package.json @@ -32,10 +32,10 @@ "./bin/bsb_helper.exe", "./bin/bsc.exe", "./bin/ninja.exe", - "./bin/rescript.exe", + "./bin/rescript-legacy.exe", "./bin/rescript-editor-analysis.exe", "./bin/rescript-tools.exe", - "./bin/rewatch.exe" + "./bin/rescript.exe" ] }, "engines": { diff --git a/packages/@rescript/linux-x64/bin.d.ts b/packages/@rescript/linux-x64/bin.d.ts index 1a78d275d7..e64a217712 100644 --- a/packages/@rescript/linux-x64/bin.d.ts +++ b/packages/@rescript/linux-x64/bin.d.ts @@ -3,11 +3,11 @@ export const binDir: string; export const binPaths: BinaryPaths; export type BinaryPaths = { - bsb_helper_exe: string, - bsc_exe: string, - ninja_exe: string, - rescript_exe: string, - rescript_tools_exe: string, - rescript_editor_analysis_exe: string, - rewatch_exe: string, + bsb_helper_exe: string; + bsc_exe: string; + ninja_exe: string; + rescript_legacy_exe: string; + rescript_tools_exe: string; + rescript_editor_analysis_exe: string; + rescript_exe: string; }; diff --git a/packages/@rescript/linux-x64/bin.js b/packages/@rescript/linux-x64/bin.js index 0bae072013..7b6f5bed04 100644 --- a/packages/@rescript/linux-x64/bin.js +++ b/packages/@rescript/linux-x64/bin.js @@ -8,11 +8,11 @@ export const binPaths = { bsb_helper_exe: path.join(binDir, "bsb_helper.exe"), bsc_exe: path.join(binDir, "bsc.exe"), ninja_exe: path.join(binDir, "ninja.exe"), - rescript_exe: path.join(binDir, "rescript.exe"), + rescript_legacy_exe: path.join(binDir, "rescript-legacy.exe"), rescript_tools_exe: path.join(binDir, "rescript-tools.exe"), rescript_editor_analysis_exe: path.join( binDir, "rescript-editor-analysis.exe", ), - rewatch_exe: path.join(binDir, "rewatch.exe"), + rescript_exe: path.join(binDir, "rescript.exe"), }; diff --git a/packages/@rescript/linux-x64/package.json b/packages/@rescript/linux-x64/package.json index 58a531e342..3b5223c31f 100644 --- a/packages/@rescript/linux-x64/package.json +++ b/packages/@rescript/linux-x64/package.json @@ -32,10 +32,10 @@ "./bin/bsb_helper.exe", "./bin/bsc.exe", "./bin/ninja.exe", - "./bin/rescript.exe", + "./bin/rescript-legacy.exe", "./bin/rescript-editor-analysis.exe", "./bin/rescript-tools.exe", - "./bin/rewatch.exe" + "./bin/rescript.exe" ] }, "engines": { diff --git a/packages/@rescript/win32-x64/bin.d.ts b/packages/@rescript/win32-x64/bin.d.ts index 1a78d275d7..e64a217712 100644 --- a/packages/@rescript/win32-x64/bin.d.ts +++ b/packages/@rescript/win32-x64/bin.d.ts @@ -3,11 +3,11 @@ export const binDir: string; export const binPaths: BinaryPaths; export type BinaryPaths = { - bsb_helper_exe: string, - bsc_exe: string, - ninja_exe: string, - rescript_exe: string, - rescript_tools_exe: string, - rescript_editor_analysis_exe: string, - rewatch_exe: string, + bsb_helper_exe: string; + bsc_exe: string; + ninja_exe: string; + rescript_legacy_exe: string; + rescript_tools_exe: string; + rescript_editor_analysis_exe: string; + rescript_exe: string; }; diff --git a/packages/@rescript/win32-x64/bin.js b/packages/@rescript/win32-x64/bin.js index 0bae072013..7b6f5bed04 100644 --- a/packages/@rescript/win32-x64/bin.js +++ b/packages/@rescript/win32-x64/bin.js @@ -8,11 +8,11 @@ export const binPaths = { bsb_helper_exe: path.join(binDir, "bsb_helper.exe"), bsc_exe: path.join(binDir, "bsc.exe"), ninja_exe: path.join(binDir, "ninja.exe"), - rescript_exe: path.join(binDir, "rescript.exe"), + rescript_legacy_exe: path.join(binDir, "rescript-legacy.exe"), rescript_tools_exe: path.join(binDir, "rescript-tools.exe"), rescript_editor_analysis_exe: path.join( binDir, "rescript-editor-analysis.exe", ), - rewatch_exe: path.join(binDir, "rewatch.exe"), + rescript_exe: path.join(binDir, "rescript.exe"), }; diff --git a/packages/@rescript/win32-x64/package.json b/packages/@rescript/win32-x64/package.json index 3a7e57a7a8..c6846881cb 100644 --- a/packages/@rescript/win32-x64/package.json +++ b/packages/@rescript/win32-x64/package.json @@ -32,10 +32,10 @@ "./bin/bsb_helper.exe", "./bin/bsc.exe", "./bin/ninja.exe", - "./bin/rescript.exe", + "./bin/rescript-legacy.exe", "./bin/rescript-editor-analysis.exe", "./bin/rescript-tools.exe", - "./bin/rewatch.exe" + "./bin/rescript.exe" ] }, "engines": { diff --git a/packages/artifacts.txt b/packages/artifacts.txt index d963e87546..b302331583 100644 --- a/packages/artifacts.txt +++ b/packages/artifacts.txt @@ -9,11 +9,11 @@ cli/bstracing.js cli/common/args.js cli/common/bins.js cli/common/bsb.js +cli/rescript-legacy.js +cli/rescript-legacy/dump.js +cli/rescript-legacy/format.js cli/rescript-tools.js cli/rescript.js -cli/rescript/dump.js -cli/rescript/format.js -cli/rewatch.js docs/docson/build-schema.json lib/es6/Belt.js lib/es6/Belt_Array.js diff --git a/packages/playground/package.json b/packages/playground/package.json index c36b14bd40..a384310433 100644 --- a/packages/playground/package.json +++ b/packages/playground/package.json @@ -3,9 +3,9 @@ "name": "playground", "type": "commonjs", "scripts": { - "clean": "rescript clean", + "clean": "rescript legacy clean", "test": "node ./playground_test.cjs", - "build": "rescript clean && rescript build && node scripts/generate_cmijs.mjs && rollup -c", + "build": "rescript legacy clean && rescript legacy build && node scripts/generate_cmijs.mjs && rollup -c", "upload-bundle": "node scripts/upload_bundle.mjs" }, "dependencies": { diff --git a/packages/playground/scripts/generate_cmijs.mjs b/packages/playground/scripts/generate_cmijs.mjs index 56b29f50f0..3a6e2db33a 100644 --- a/packages/playground/scripts/generate_cmijs.mjs +++ b/packages/playground/scripts/generate_cmijs.mjs @@ -23,8 +23,8 @@ import { playgroundPackagesDir, } from "./common.mjs"; -exec("yarn rescript clean"); -exec("yarn rescript"); +exec("yarn rescript legacy clean"); +exec("yarn rescript legacy"); // We need to build the compiler's builtin modules as a separate cmij. // Otherwise we can't use them for compilation within the playground. @@ -58,7 +58,7 @@ function buildCmij(pkgDir, pkgName) { } /** - * @param {string} basename + * @param {string} basename * @return {boolean} */ function isCmij(basename) { diff --git a/rewatch/postinstall.js b/rewatch/postinstall.js deleted file mode 100644 index 5b15cd4da3..0000000000 --- a/rewatch/postinstall.js +++ /dev/null @@ -1,55 +0,0 @@ -const path = require("path"); -const fs = require("fs"); - -const installMacLinuxBinary = (binary) => { - const source = path.join(__dirname, binary); - if (fs.existsSync(source)) { - // mac and linux support extension-less executables - // so just overwrite the shell script - const target = path.join(__dirname, "rewatch"); - fs.renameSync(source, target); - - // The binary should be executable in the bundle, but just in case - fs.chmodSync(target, 0777); - } else { - // assume we're in dev mode - nothing will break if the script - // isn't overwritten, it will just be slower - } -}; - -const installWindowsBinary = () => { - const source = path.join(__dirname, "rewatch-windows.exe"); - if (fs.existsSync(source)) { - const target = path.join(__dirname, "rewatch.exe"); - fs.renameSync(source, target); - - // windows scripts use a different file extension to executables - // so we delete the script to make sure windows uses the exe now - const windowsScript = path.join(__dirname, "rewatch.cmd"); - fs.unlinkSync(windowsScript); - } else { - // assume we're in dev mode - nothing will break if the script - // isn't overwritten, it will just be slower - } -}; - -switch (process.platform) { - case "linux": - if (process.arch === "arm64") { - installMacLinuxBinary("rewatch-linux-arm64"); - } else { - installMacLinuxBinary("rewatch-linux"); - } - break; - case "darwin": - installMacLinuxBinary("rewatch-macos"); - break; - case "win32": - installWindowsBinary(); - break; - default: - // This won't break the installation because the shell script remains - // but that script will throw an error in this case anyway - console.warn(`No release available for "${process.platform}"`); - process.exit(1); -} diff --git a/rewatch/src/helpers.rs b/rewatch/src/helpers.rs index 9b6661c2e4..b808909af3 100644 --- a/rewatch/src/helpers.rs +++ b/rewatch/src/helpers.rs @@ -227,20 +227,20 @@ pub fn get_rescript_legacy(root_path: &Path, workspace_root: Option) -> match ( root_path .join(&bin_dir) - .join("rescript.js") + .join("rescript-legacy.js") .canonicalize() .map(StrippedVerbatimPath::to_stripped_verbatim_path), workspace_root.map(|workspace_root| { workspace_root .join(&bin_dir) - .join("rescript.js") + .join("rescript-legacy.js") .canonicalize() .map(StrippedVerbatimPath::to_stripped_verbatim_path) }), ) { (Ok(path), _) => path, (_, Some(Ok(path))) => path, - _ => panic!("Could not find rescript.exe"), + _ => panic!("Could not find rescript-legacy.exe"), } } diff --git a/rewatch/testrepo/package.json b/rewatch/testrepo/package.json index 2ed3978be5..6f1fc22144 100644 --- a/rewatch/testrepo/package.json +++ b/rewatch/testrepo/package.json @@ -13,14 +13,14 @@ ] }, "dependencies": { - "rescript": "12.0.0-alpha.13" + "rescript": "https://pkg.pr.new/rescript-lang/rescript@6cac813" }, "scripts": { "build": "../target/release/rewatch build .", - "build:rescript": "rescript build -with-deps", + "build:rescript": "rescript legacy build", "watch": "../target/release/rewatch watch .", - "watch:rescript": "rescript watch -with-deps", + "watch:rescript": "rescript legacy watch", "clean": "../target/release/rewatch clean .", - "clean:rescript": "rescript clean" + "clean:rescript": "rescript legacy clean" } } diff --git a/rewatch/testrepo/yarn.lock b/rewatch/testrepo/yarn.lock index beb6bf912d..2a52b20be7 100644 --- a/rewatch/testrepo/yarn.lock +++ b/rewatch/testrepo/yarn.lock @@ -5,37 +5,37 @@ __metadata: version: 8 cacheKey: 10c0 -"@rescript/darwin-arm64@npm:12.0.0-alpha.13": - version: 12.0.0-alpha.13 - resolution: "@rescript/darwin-arm64@npm:12.0.0-alpha.13" +"@rescript/darwin-arm64@https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-arm64@6cac813afdfe7b86803256838ac3ce09f7eed641": + version: 12.0.0-alpha.15 + resolution: "@rescript/darwin-arm64@https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-arm64@6cac813afdfe7b86803256838ac3ce09f7eed641" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@rescript/darwin-x64@npm:12.0.0-alpha.13": - version: 12.0.0-alpha.13 - resolution: "@rescript/darwin-x64@npm:12.0.0-alpha.13" +"@rescript/darwin-x64@https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-x64@6cac813afdfe7b86803256838ac3ce09f7eed641": + version: 12.0.0-alpha.15 + resolution: "@rescript/darwin-x64@https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-x64@6cac813afdfe7b86803256838ac3ce09f7eed641" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@rescript/linux-arm64@npm:12.0.0-alpha.13": - version: 12.0.0-alpha.13 - resolution: "@rescript/linux-arm64@npm:12.0.0-alpha.13" +"@rescript/linux-arm64@https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-arm64@6cac813afdfe7b86803256838ac3ce09f7eed641": + version: 12.0.0-alpha.15 + resolution: "@rescript/linux-arm64@https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-arm64@6cac813afdfe7b86803256838ac3ce09f7eed641" conditions: os=linux & cpu=arm64 languageName: node linkType: hard -"@rescript/linux-x64@npm:12.0.0-alpha.13": - version: 12.0.0-alpha.13 - resolution: "@rescript/linux-x64@npm:12.0.0-alpha.13" +"@rescript/linux-x64@https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-x64@6cac813afdfe7b86803256838ac3ce09f7eed641": + version: 12.0.0-alpha.15 + resolution: "@rescript/linux-x64@https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-x64@6cac813afdfe7b86803256838ac3ce09f7eed641" conditions: os=linux & cpu=x64 languageName: node linkType: hard -"@rescript/win32-x64@npm:12.0.0-alpha.13": - version: 12.0.0-alpha.13 - resolution: "@rescript/win32-x64@npm:12.0.0-alpha.13" +"@rescript/win32-x64@https://pkg.pr.new/rescript-lang/rescript/@rescript/win32-x64@6cac813afdfe7b86803256838ac3ce09f7eed641": + version: 12.0.0-alpha.15 + resolution: "@rescript/win32-x64@https://pkg.pr.new/rescript-lang/rescript/@rescript/win32-x64@6cac813afdfe7b86803256838ac3ce09f7eed641" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -87,15 +87,15 @@ __metadata: languageName: unknown linkType: soft -"rescript@npm:12.0.0-alpha.13": - version: 12.0.0-alpha.13 - resolution: "rescript@npm:12.0.0-alpha.13" +"rescript@https://pkg.pr.new/rescript-lang/rescript@6cac813": + version: 12.0.0-alpha.15 + resolution: "rescript@https://pkg.pr.new/rescript-lang/rescript@6cac813" dependencies: - "@rescript/darwin-arm64": "npm:12.0.0-alpha.13" - "@rescript/darwin-x64": "npm:12.0.0-alpha.13" - "@rescript/linux-arm64": "npm:12.0.0-alpha.13" - "@rescript/linux-x64": "npm:12.0.0-alpha.13" - "@rescript/win32-x64": "npm:12.0.0-alpha.13" + "@rescript/darwin-arm64": "https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-arm64@6cac813afdfe7b86803256838ac3ce09f7eed641" + "@rescript/darwin-x64": "https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-x64@6cac813afdfe7b86803256838ac3ce09f7eed641" + "@rescript/linux-arm64": "https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-arm64@6cac813afdfe7b86803256838ac3ce09f7eed641" + "@rescript/linux-x64": "https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-x64@6cac813afdfe7b86803256838ac3ce09f7eed641" + "@rescript/win32-x64": "https://pkg.pr.new/rescript-lang/rescript/@rescript/win32-x64@6cac813afdfe7b86803256838ac3ce09f7eed641" dependenciesMeta: "@rescript/darwin-arm64": optional: true @@ -111,9 +111,9 @@ __metadata: bsc: cli/bsc.js bstracing: cli/bstracing.js rescript: cli/rescript.js + rescript-legacy: cli/rescript-legacy.js rescript-tools: cli/rescript-tools.js - rewatch: cli/rewatch.js - checksum: 10c0/97ad8615b1a1cbace61e050b65a10bbe280c77b4fe693b99aee7d3c6bb0b2ebd284db16a7aec3d65179267dc610a9737fdf74197f6322b1281113fd588fe1b32 + checksum: 10c0/9ffce64bb8d440ba97ac038e7421a2eb92a6902c0a004101533fdd508990c939bcd1b8aa1da6914fcf678aeefd9f98bd613c675adf46ddfcdd81dd56024ae969 languageName: node linkType: hard @@ -121,6 +121,6 @@ __metadata: version: 0.0.0-use.local resolution: "testrepo@workspace:." dependencies: - rescript: "npm:12.0.0-alpha.13" + rescript: "https://pkg.pr.new/rescript-lang/rescript@6cac813" languageName: unknown linkType: soft diff --git a/scripts/buildRuntime.sh b/scripts/buildRuntime.sh index 42ace88baf..e23f14f402 100755 --- a/scripts/buildRuntime.sh +++ b/scripts/buildRuntime.sh @@ -11,3 +11,6 @@ cp runtime/lib/es6/*.js lib/es6 cp runtime/lib/js/*.js lib/js cp runtime/lib/bs/*.@(cmi|cmj|cmt|cmti) lib/ocaml/ cp runtime/*.@(res|resi) lib/ocaml/ +# overwrite the stdlib build artifacts to the testrepo +mkdir -p rewatch/testrepo/node_modules/rescript/lib/ocaml +cp -rf lib/ocaml rewatch/testrepo/node_modules/rescript/lib/ocaml \ No newline at end of file diff --git a/scripts/buildRuntimeRewatch.sh b/scripts/buildRuntimeLegacy.sh similarity index 51% rename from scripts/buildRuntimeRewatch.sh rename to scripts/buildRuntimeLegacy.sh index 2d2bd014af..1d3c6a541f 100755 --- a/scripts/buildRuntimeRewatch.sh +++ b/scripts/buildRuntimeLegacy.sh @@ -2,7 +2,7 @@ set -e shopt -s extglob -(cd runtime && ../cli/rewatch.js clean && ../cli/rewatch.js build) +(cd runtime && ../cli/rescript-legacy.js clean && ../cli/rescript-legacy.js build) rm -f lib/es6/*.js lib/js/*.js lib/ocaml/* mkdir -p lib/es6 lib/js lib/ocaml @@ -11,6 +11,3 @@ cp runtime/lib/es6/*.js lib/es6 cp runtime/lib/js/*.js lib/js cp runtime/lib/bs/*.@(cmi|cmj|cmt|cmti) lib/ocaml/ cp runtime/*.@(res|resi) lib/ocaml/ -# overwrite the stdlib build artifacts to the testrepo -mkdir -p rewatch/testrepo/node_modules/rescript/lib/ocaml -cp -rf lib/ocaml rewatch/testrepo/node_modules/rescript/lib/ocaml \ No newline at end of file diff --git a/scripts/copyExes.js b/scripts/copyExes.js index 3e54761753..9020a3d5ab 100755 --- a/scripts/copyExes.js +++ b/scripts/copyExes.js @@ -34,7 +34,7 @@ const shouldCopyNinja = args.values.all || args.values.ninja; const shouldCopyRewatch = args.values.all || args.values.rewatch; if (shouldCopyCompiler) { - copyExe(compilerBinDir, "rescript"); + copyExe(compilerBinDir, "rescript-legacy"); copyExe(compilerBinDir, "rescript-editor-analysis"); copyExe(compilerBinDir, "rescript-tools"); copyExe(compilerBinDir, "bsc"); @@ -46,17 +46,18 @@ if (shouldCopyNinja) { } if (shouldCopyRewatch) { - copyExe(rewatchDir, "rewatch"); + copyExe(path.join(rewatchDir, "target", "release"), "rewatch", "rescript"); } /** * @param {string} dir * @param {string} exe + * @param {string | undefined} renamed */ -function copyExe(dir, exe) { +function copyExe(dir, exe, renamed) { const ext = process.platform === "win32" ? ".exe" : ""; const src = path.join(dir, exe + ext); - const dest = path.join(binDir, `${exe}.exe`); + const dest = path.join(binDir, `${renamed ?? exe}.exe`); // For some reason, the copy operation fails in Windows CI if the file already exists. if (process.platform === "win32" && fs.existsSync(dest)) { diff --git a/scripts/format.sh b/scripts/format.sh index a1bbd91607..d8d743a7e4 100755 --- a/scripts/format.sh +++ b/scripts/format.sh @@ -5,6 +5,6 @@ shopt -s extglob dune build @fmt --auto-promote files=$(find runtime tests -type f \( -name "*.res" -o -name "*.resi" \) ! -name "syntaxErrors*" ! -name "generated_mocha_test.res" ! -path "tests/syntax_tests*" ! -path "tests/analysis_tests/tests*" ! -path "*/node_modules/*") -./cli/rescript.js format $files +./cli/rescript-legacy.js format $files yarn format diff --git a/scripts/format_check.sh b/scripts/format_check.sh index b7daf67d4f..68ac076216 100755 --- a/scripts/format_check.sh +++ b/scripts/format_check.sh @@ -18,7 +18,7 @@ case "$(uname -s)" in echo "Checking ReScript code formatting..." files=$(find runtime tests -type f \( -name "*.res" -o -name "*.resi" \) ! -name "syntaxErrors*" ! -name "generated_mocha_test.res" ! -path "tests/syntax_tests*" ! -path "tests/analysis_tests/tests*" ! -path "*/node_modules/*") - if ./cli/rescript.js format -check $files; then + if ./cli/rescript-legacy.js format -check $files; then printf "${successGreen}✅ ReScript code formatting ok.${reset}\n" else printf "${warningYellow}⚠️ ReScript code formatting issues found. Run 'make format' to fix.${reset}\n" diff --git a/scripts/res/package.json b/scripts/res/package.json index 92da8de2bc..1168ebeb80 100644 --- a/scripts/res/package.json +++ b/scripts/res/package.json @@ -3,9 +3,9 @@ "type": "module", "private": true, "scripts": { - "build": "rescript", - "clean": "rescript clean -with-deps", - "dev": "rescript -w", + "build": "rescript legacy build", + "clean": "rescript legacy clean", + "dev": "rescript legacy -w", "apidocs:generate": "yarn build && node GenApiDocs.res.js" }, "dependencies": { diff --git a/tests/analysis_tests/tests-generic-jsx-transform/package.json b/tests/analysis_tests/tests-generic-jsx-transform/package.json index e4afaad6f8..7a4f4861f8 100644 --- a/tests/analysis_tests/tests-generic-jsx-transform/package.json +++ b/tests/analysis_tests/tests-generic-jsx-transform/package.json @@ -2,8 +2,8 @@ "name": "@tests/generic-jsx-transform", "private": true, "scripts": { - "build": "rescript", - "clean": "rescript clean -with-deps" + "build": "rescript legacy build", + "clean": "rescript legacy clean" }, "dependencies": { "rescript": "workspace:^" diff --git a/tests/analysis_tests/tests-incremental-typechecking/package.json b/tests/analysis_tests/tests-incremental-typechecking/package.json index 37e133730d..cd410d8afa 100644 --- a/tests/analysis_tests/tests-incremental-typechecking/package.json +++ b/tests/analysis_tests/tests-incremental-typechecking/package.json @@ -2,8 +2,8 @@ "name": "@tests/incremental-typechecking", "private": true, "scripts": { - "build": "rescript", - "clean": "rescript clean -with-deps" + "build": "rescript legacy build", + "clean": "rescript legacy clean" }, "dependencies": { "rescript": "workspace:^" diff --git a/tests/analysis_tests/tests-reanalyze/deadcode/package.json b/tests/analysis_tests/tests-reanalyze/deadcode/package.json index ec9305fdb8..c9ff3996f7 100644 --- a/tests/analysis_tests/tests-reanalyze/deadcode/package.json +++ b/tests/analysis_tests/tests-reanalyze/deadcode/package.json @@ -2,8 +2,8 @@ "name": "@tests/reanalyze-deadcode", "private": true, "scripts": { - "build": "rescript", - "clean": "rescript clean -with-deps" + "build": "rescript legacy build", + "clean": "rescript legacy clean" }, "dependencies": { "@rescript/react": "link:../../../dependencies/rescript-react", diff --git a/tests/analysis_tests/tests-reanalyze/termination/package.json b/tests/analysis_tests/tests-reanalyze/termination/package.json index 3f50de7763..02b2adf3e5 100644 --- a/tests/analysis_tests/tests-reanalyze/termination/package.json +++ b/tests/analysis_tests/tests-reanalyze/termination/package.json @@ -2,8 +2,8 @@ "name": "@tests/reanalyze-termination", "private": true, "scripts": { - "build": "rescript", - "clean": "rescript clean -with-deps" + "build": "rescript legacy build", + "clean": "rescript legacy clean" }, "dependencies": { "rescript": "workspace:^" diff --git a/tests/analysis_tests/tests/package.json b/tests/analysis_tests/tests/package.json index 2ada6a7cb0..01bbe0ecbb 100644 --- a/tests/analysis_tests/tests/package.json +++ b/tests/analysis_tests/tests/package.json @@ -2,8 +2,8 @@ "name": "@tests/analysis", "private": true, "scripts": { - "build": "rescript", - "clean": "rescript clean -with-deps" + "build": "rescript legacy build", + "clean": "rescript legacy clean" }, "dependencies": { "@rescript/react": "link:../../dependencies/rescript-react", diff --git a/tests/docstring_tests/package.json b/tests/docstring_tests/package.json index e59fa76a42..1cedbd5360 100644 --- a/tests/docstring_tests/package.json +++ b/tests/docstring_tests/package.json @@ -3,8 +3,8 @@ "type": "module", "private": true, "scripts": { - "build": "rescript", - "clean": "rescript clean -with-deps", + "build": "rescript legacy build", + "clean": "rescript legacy clean", "dev": "rescript -w" }, "dependencies": { diff --git a/tests/gentype_tests/typescript-react-example/package.json b/tests/gentype_tests/typescript-react-example/package.json index 721b4bf4ba..b72e3819ed 100644 --- a/tests/gentype_tests/typescript-react-example/package.json +++ b/tests/gentype_tests/typescript-react-example/package.json @@ -2,9 +2,9 @@ "name": "@tests/gentype-react-example", "private": true, "scripts": { - "start": "rescript build -w", - "build": "rescript", - "clean": "rescript clean", + "start": "rescript legacy build -w", + "build": "rescript legacy build", + "clean": "rescript legacy clean", "typecheck": "tsc", "check": "biome check --changed --no-errors-on-unmatched ." }, diff --git a/tests/tools_tests/package.json b/tests/tools_tests/package.json index f1f0ea9a57..01d0070301 100644 --- a/tests/tools_tests/package.json +++ b/tests/tools_tests/package.json @@ -2,8 +2,8 @@ "name": "@tests/tools", "private": true, "scripts": { - "build": "rescript", - "clean": "rescript clean -with-deps", + "build": "rescript legacy build", + "clean": "rescript legacy clean", "dev": "rescript -w" }, "dependencies": { diff --git a/yarn.lock b/yarn.lock index 13a6d70b5f..7252b6809e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2535,8 +2535,8 @@ __metadata: bsc: cli/bsc.js bstracing: cli/bstracing.js rescript: cli/rescript.js + rescript-legacy: cli/rescript-legacy.js rescript-tools: cli/rescript-tools.js - rewatch: cli/rewatch.js languageName: unknown linkType: soft