diff --git a/CHANGELOG.md b/CHANGELOG.md index eff6690bb7..22fe0b922e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ # 11.0.0-rc.2 (Unreleased) +#### :rocket: New Feature + +- `rescript build` will always build its dependency by default. The argument `-with-deps` is not needed anymore. https://github.com/rescript-lang/rescript-compiler/pull/6350 + #### :bug: Bug Fix - Fixed outcome printer resolution of uncurried config. https://github.com/rescript-lang/rescript-compiler/pull/6353 diff --git a/jscomp/bsb/bsb_exception.ml b/jscomp/bsb/bsb_exception.ml index c6bd9fbdc2..ed3bc22134 100644 --- a/jscomp/bsb/bsb_exception.ml +++ b/jscomp/bsb/bsb_exception.ml @@ -66,8 +66,7 @@ let print (fmt : Format.formatter) (x : error) = Format.fprintf fmt "File \"bsconfig.json\", line 1\n\ @{Error:@} package @{%s@} not found or built %s\n\ - - Did you install it?\n\ - - If you did, did you run `rescript build -with-deps`?" name in_json + - Did you install it?" name in_json | Json_config (pos, s) -> Format.fprintf fmt "File %S, line %d:\n\ diff --git a/jscomp/bsb_exe/rescript_main.ml b/jscomp/bsb_exe/rescript_main.ml index d3d03c16e7..8d041534f4 100644 --- a/jscomp/bsb_exe/rescript_main.ml +++ b/jscomp/bsb_exe/rescript_main.ml @@ -28,8 +28,6 @@ let separator = "--" let watch_mode = ref false -let make_world = ref false - let do_install = ref false let force_regenerate = ref false @@ -109,24 +107,6 @@ let install_target () = let eid = Bsb_unix.run_command_execv install_command in if eid <> 0 then Bsb_unix.command_fatal_error install_command eid -(** check if every dependency installation dierctory is there - This is in hot path, so we want it to be fast. - The heuristics is that if the installation directory is not there, - we definitely need build the world. - If it is there, we do not check if it is up-to-date, since that's - going be slow, user can use `-with-deps` to enforce such check -*) -let check_deps_installation_directory (config_opt : Bsb_config_types.t option) : - bool = - match config_opt with - | Some { bs_dependencies; bs_dev_dependencies } -> - not - (Ext_list.for_all bs_dependencies (fun x -> - Ext_sys.is_directory_no_exn x.package_install_path) - && Ext_list.for_all bs_dev_dependencies (fun x -> - Ext_sys.is_directory_no_exn x.package_install_path)) - | None -> false - let build_subcommand ~start argv argv_len = let i = Ext_array.rfind_with_index argv Ext_string.equal separator in @@ -135,10 +115,10 @@ let build_subcommand ~start argv argv_len = ~argv [| ("-w", unit_set_spec watch_mode, "Watch mode"); - ("-with-deps", unit_set_spec make_world, "Build dependencies explicitly"); + ("-with-deps", unit_set_spec (ref true), "*deprecated* This is the default behavior now. This option will be removed in a future release"); ( "-install", unit_set_spec do_install, - "*internal* Install public interface files for dependencies " ); + "*internal* Install public interface files for dependencies" ); (* This should be put in a subcommand previously it works with the implication `bsb && bsb -install` *) @@ -162,15 +142,8 @@ let build_subcommand ~start argv argv_len = | _ -> let config_opt = Bsb_ninja_regen.regenerate_ninja ~package_kind:Toplevel - ~per_proj_dir:Bsb_global_paths.cwd ~forced:!force_regenerate - in - let implict_build = check_deps_installation_directory config_opt in - (match (!make_world, implict_build) with - | true, _ -> - Bsb_world.make_world_deps Bsb_global_paths.cwd config_opt ninja_args - | false, true -> - Bsb_world.make_world_deps Bsb_global_paths.cwd config_opt [||] - | false, false -> ()); + ~per_proj_dir:Bsb_global_paths.cwd ~forced:!force_regenerate in + Bsb_world.make_world_deps Bsb_global_paths.cwd config_opt ninja_args; if !do_install then install_target (); if !watch_mode then exit 0 (* let the watcher do the build*) else ninja_command_exit ninja_args @@ -179,8 +152,8 @@ let clean_subcommand ~start argv = Bsb_arg.parse_exn ~usage:clean_usage ~start ~argv [| ( "-with-deps", - unit_set_spec make_world, - "*internal* Clean dependencies too" ); + unit_set_spec (ref true), + "*deprecated* This is the default behavior now. This option will be removed in a future release" ); ("-verbose", call_spec Bsb_log.verbose, "Set the output to be verbose"); |] failed_annon; @@ -226,10 +199,8 @@ let () = (* specialize this path which is used in watcher *) let config_opt = Bsb_ninja_regen.regenerate_ninja ~package_kind:Toplevel ~forced:false - ~per_proj_dir:Bsb_global_paths.cwd - in - if !make_world || check_deps_installation_directory config_opt then - Bsb_world.make_world_deps Bsb_global_paths.cwd config_opt [||]; + ~per_proj_dir:Bsb_global_paths.cwd in + Bsb_world.make_world_deps Bsb_global_paths.cwd config_opt [||]; ninja_command_exit [||]) else match argv.(1) with diff --git a/jscomp/build_tests/case/package.json b/jscomp/build_tests/case/package.json index 898b6615c6..619a22e950 100644 --- a/jscomp/build_tests/case/package.json +++ b/jscomp/build_tests/case/package.json @@ -2,7 +2,7 @@ "name": "case", "version": "0.1.0", "scripts": { - "clean": "rescript clean -with-deps", + "clean": "rescript clean", "build": "rescript build", "watch": "rescript build -w" }, diff --git a/jscomp/build_tests/case2/package.json b/jscomp/build_tests/case2/package.json index 904aebe85d..a082d7015b 100644 --- a/jscomp/build_tests/case2/package.json +++ b/jscomp/build_tests/case2/package.json @@ -2,7 +2,7 @@ "name": "case2", "version": "0.1.0", "scripts": { - "clean": "rescript clean -with-deps", + "clean": "rescript clean", "build": "rescript build", "watch": "rescript build -w" }, diff --git a/jscomp/build_tests/case3/package.json b/jscomp/build_tests/case3/package.json index 9e2e287019..0c46a3dfde 100644 --- a/jscomp/build_tests/case3/package.json +++ b/jscomp/build_tests/case3/package.json @@ -2,7 +2,7 @@ "name": "case3", "version": "0.1.0", "scripts": { - "clean": "rescript clean -with-deps", + "clean": "rescript clean", "build": "rescript build", "watch": "rescript build -w" }, diff --git a/jscomp/build_tests/custom_namespace/input.js b/jscomp/build_tests/custom_namespace/input.js index a1201cbe5b..f100581dbc 100644 --- a/jscomp/build_tests/custom_namespace/input.js +++ b/jscomp/build_tests/custom_namespace/input.js @@ -4,7 +4,7 @@ var path = require("path"); var assert = require("assert"); var rescript_exe = require("../../../scripts/bin_path").rescript_exe; -child_process.execSync(`${rescript_exe} clean -with-deps && ${rescript_exe} build`, { +child_process.execSync(`${rescript_exe} clean && ${rescript_exe} build`, { cwd: __dirname, }); diff --git a/jscomp/build_tests/custom_namespace/package.json b/jscomp/build_tests/custom_namespace/package.json index 0afe9e776b..ff3881a660 100644 --- a/jscomp/build_tests/custom_namespace/package.json +++ b/jscomp/build_tests/custom_namespace/package.json @@ -2,7 +2,7 @@ "name": "namespace", "version": "0.1.0", "scripts": { - "clean": "rescript clean -with-deps", + "clean": "rescript clean", "build": "rescript build", "watch": "rescript build -w" }, diff --git a/jscomp/build_tests/cycle/package.json b/jscomp/build_tests/cycle/package.json index d05af4c597..488bf6bcd2 100644 --- a/jscomp/build_tests/cycle/package.json +++ b/jscomp/build_tests/cycle/package.json @@ -2,7 +2,7 @@ "name": "cycle", "version": "0.1.0", "scripts": { - "clean": "rescript clean -with-deps", + "clean": "rescript clean", "build": "rescript build", "watch": "rescript build -w" }, diff --git a/jscomp/build_tests/cycle1/input.js b/jscomp/build_tests/cycle1/input.js index 9c9b0a8dbc..c8453f94b6 100644 --- a/jscomp/build_tests/cycle1/input.js +++ b/jscomp/build_tests/cycle1/input.js @@ -5,7 +5,7 @@ const fs = require('fs') const path = require('path') var rescript_exe = require("../../../scripts/bin_path").rescript_exe -cp.execSync(`${rescript_exe} clean -with-deps`, { cwd: __dirname, }); +cp.execSync(`${rescript_exe} clean`, { cwd: __dirname, }); var output = cp.spawnSync(rescript_exe, { encoding: "utf8", shell: true }); diff --git a/jscomp/build_tests/devdeps/input.js b/jscomp/build_tests/devdeps/input.js deleted file mode 100644 index 97de262636..0000000000 --- a/jscomp/build_tests/devdeps/input.js +++ /dev/null @@ -1,33 +0,0 @@ -//@ts-check - -var cp = require("child_process"); -var assert = require("assert"); -var targetOne = `test/test.cmj`; -var targetTwo = `src/demo.cmj`; -var rescript_exe = require("../../../scripts/bin_path").rescript_exe - - -cp.exec( - `${rescript_exe} build -- -t commands ${targetOne}`, - { encoding: "ascii" }, - function (err, output) { - if (err !== null) { - console.error("unexpected"); - throw err; - } - assert(output.split("\n").some((x) => x.includes("weird"))); - cp.exec( - `${rescript_exe} build -- -t commands ${targetTwo}`, - { encoding: "ascii" }, - function (err, output) { - if (err !== null) { - console.error("unexpected"); - throw err; - } - assert(output.split("\n").some((x) => x.includes("weird")) === false); - } - ); - - } -); - diff --git a/jscomp/build_tests/devdeps/node_modules/weird/bsconfig.json b/jscomp/build_tests/devdeps/node_modules/weird/bsconfig.json deleted file mode 100644 index a8c265c5a1..0000000000 --- a/jscomp/build_tests/devdeps/node_modules/weird/bsconfig.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name" : "weird", - "sources" : "." -} \ No newline at end of file diff --git a/jscomp/build_tests/devdeps/node_modules/weird/package.json b/jscomp/build_tests/devdeps/node_modules/weird/package.json deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/jscomp/build_tests/devdeps/package-lock.json b/jscomp/build_tests/devdeps/package-lock.json deleted file mode 100644 index aeb405016b..0000000000 --- a/jscomp/build_tests/devdeps/package-lock.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "devdeps", - "version": "0.1.0", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "name": "devdeps", - "version": "0.1.0", - "license": "MIT", - "dependencies": { - "rescript": "file:../../.." - }, - "devDependencies": { - "bs-platform": "^5.0.5" - } - }, - "../../..": { - "version": "10.0.0", - "hasInstallScript": true, - "license": "SEE LICENSE IN LICENSE", - "bin": { - "bsc": "bsc", - "bstracing": "lib/bstracing", - "rescript": "rescript" - }, - "devDependencies": { - "mocha": "^7.2.0", - "nyc": "^15.0.0" - } - }, - "node_modules/bs-platform": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/bs-platform/-/bs-platform-5.2.1.tgz", - "integrity": "sha512-3ISP+RBC/NYILiJnphCY0W3RTYpQ11JGa2dBBLVug5fpFZ0qtSaL3ZplD8MyjNeXX2bC7xgrWfgBSn8Tc9om7Q==", - "dev": true, - "hasInstallScript": true, - "bin": { - "bsb": "lib/bsb", - "bsc": "lib/bsc", - "bstracing": "lib/bstracing" - } - }, - "node_modules/rescript": { - "resolved": "../../..", - "link": true - } - }, - "dependencies": { - "bs-platform": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/bs-platform/-/bs-platform-5.2.1.tgz", - "integrity": "sha512-3ISP+RBC/NYILiJnphCY0W3RTYpQ11JGa2dBBLVug5fpFZ0qtSaL3ZplD8MyjNeXX2bC7xgrWfgBSn8Tc9om7Q==", - "dev": true - }, - "rescript": { - "version": "file:../../..", - "requires": { - "mocha": "^7.2.0", - "nyc": "^15.0.0" - } - } - } -} diff --git a/jscomp/build_tests/devonly/package.json b/jscomp/build_tests/devonly/package.json index 0cb91838dc..18aeaf4fa2 100644 --- a/jscomp/build_tests/devonly/package.json +++ b/jscomp/build_tests/devonly/package.json @@ -2,7 +2,7 @@ "name": "devonly", "version": "0.1.0", "scripts": { - "clean": "rescript clean -with-deps", + "clean": "rescript clean", "build": "rescript build", "watch": "rescript build -w" }, diff --git a/jscomp/build_tests/duplicated_symlinked_packages/a/package.json b/jscomp/build_tests/duplicated_symlinked_packages/a/package.json index 204c7c3f1b..3bfbac807f 100644 --- a/jscomp/build_tests/duplicated_symlinked_packages/a/package.json +++ b/jscomp/build_tests/duplicated_symlinked_packages/a/package.json @@ -4,7 +4,7 @@ "scripts": { "build": "rescript build", "start": "rescript build -w", - "clean": "rescript clean -with-deps" + "clean": "rescript clean" }, "keywords": [ "BuckleScript" diff --git a/jscomp/build_tests/duplicated_symlinked_packages/b/package.json b/jscomp/build_tests/duplicated_symlinked_packages/b/package.json index c7de682d62..21032b3ede 100644 --- a/jscomp/build_tests/duplicated_symlinked_packages/b/package.json +++ b/jscomp/build_tests/duplicated_symlinked_packages/b/package.json @@ -4,7 +4,7 @@ "scripts": { "build": "rescript build", "start": "rescript build -w", - "clean": "rescript clean -with-deps" + "clean": "rescript clean" }, "keywords": [ "BuckleScript" diff --git a/jscomp/build_tests/duplicated_symlinked_packages/c/package.json b/jscomp/build_tests/duplicated_symlinked_packages/c/package.json index 7dd155cf21..0eb39d1031 100644 --- a/jscomp/build_tests/duplicated_symlinked_packages/c/package.json +++ b/jscomp/build_tests/duplicated_symlinked_packages/c/package.json @@ -4,7 +4,7 @@ "scripts": { "build": "rescript build", "start": "rescript build -w", - "clean": "rescript clean -with-deps" + "clean": "rescript clean" }, "keywords": [ "BuckleScript" diff --git a/jscomp/build_tests/duplicated_symlinked_packages/input.js b/jscomp/build_tests/duplicated_symlinked_packages/input.js index ad80c4849f..66c2e0e9e4 100644 --- a/jscomp/build_tests/duplicated_symlinked_packages/input.js +++ b/jscomp/build_tests/duplicated_symlinked_packages/input.js @@ -12,7 +12,7 @@ function postProcessErrorOutput (output) { output = output.replace(new RegExp(__dirname, 'gi'), '.') return output } -child_process.execSync(`${rescript_exe} clean -with-deps`,{cwd:__dirname}) +child_process.execSync(`${rescript_exe} clean`,{cwd:__dirname}) child_process.exec(rescript_exe, {cwd: __dirname}, (err, stdout, stderr) => { const actualErrorOutput = postProcessErrorOutput(stderr.toString()) if (updateTests) { diff --git a/jscomp/build_tests/duplicated_symlinked_packages/package.json b/jscomp/build_tests/duplicated_symlinked_packages/package.json index 081c040d74..365f79e5cc 100644 --- a/jscomp/build_tests/duplicated_symlinked_packages/package.json +++ b/jscomp/build_tests/duplicated_symlinked_packages/package.json @@ -2,7 +2,7 @@ "name": "duplicated-symlinked-packages", "version": "0.1.0", "scripts": { - "clean": "rescript clean -with-deps", + "clean": "rescript clean", "build": "rescript build", "watch": "rescript build -w" }, diff --git a/jscomp/build_tests/exports/package.json b/jscomp/build_tests/exports/package.json index cd635a2973..8ee100cf4d 100644 --- a/jscomp/build_tests/exports/package.json +++ b/jscomp/build_tests/exports/package.json @@ -2,7 +2,7 @@ "name": "exports", "version": "0.1.0", "scripts": { - "clean": "rescript clean -with-deps", + "clean": "rescript clean", "build": "rescript build", "watch": "rescript build -w" }, diff --git a/jscomp/build_tests/hyphen2/package.json b/jscomp/build_tests/hyphen2/package.json index 5ccd3a7392..28ed7a112e 100644 --- a/jscomp/build_tests/hyphen2/package.json +++ b/jscomp/build_tests/hyphen2/package.json @@ -2,7 +2,7 @@ "name": "hyphen2", "version": "0.1.0", "scripts": { - "clean": "rescript clean -with-deps", + "clean": "rescript clean", "build": "rescript build", "watch": "rescript build -w" }, diff --git a/jscomp/build_tests/install/package.json b/jscomp/build_tests/install/package.json index cc2f43b321..7ed8983cb4 100644 --- a/jscomp/build_tests/install/package.json +++ b/jscomp/build_tests/install/package.json @@ -2,7 +2,7 @@ "name": "install", "version": "0.1.0", "scripts": { - "clean": "rescript clean -with-deps", + "clean": "rescript clean", "build": "rescript build", "install": "rescript build -install", "watch": "rescript build -w" diff --git a/jscomp/build_tests/nested/package.json b/jscomp/build_tests/nested/package.json index ca296ee78c..9aa6fb8598 100644 --- a/jscomp/build_tests/nested/package.json +++ b/jscomp/build_tests/nested/package.json @@ -2,7 +2,7 @@ "name": "nested", "version": "0.1.0", "scripts": { - "clean": "rescript clean -with-deps", + "clean": "rescript clean", "build": "rescript build", "watch": "rescript build -w" }, diff --git a/jscomp/build_tests/nnest/package.json b/jscomp/build_tests/nnest/package.json index ca296ee78c..9aa6fb8598 100644 --- a/jscomp/build_tests/nnest/package.json +++ b/jscomp/build_tests/nnest/package.json @@ -2,7 +2,7 @@ "name": "nested", "version": "0.1.0", "scripts": { - "clean": "rescript clean -with-deps", + "clean": "rescript clean", "build": "rescript build", "watch": "rescript build -w" }, diff --git a/jscomp/build_tests/ns/package.json b/jscomp/build_tests/ns/package.json index b1bb64129e..b3a92351f4 100644 --- a/jscomp/build_tests/ns/package.json +++ b/jscomp/build_tests/ns/package.json @@ -2,7 +2,7 @@ "name": "ns", "version": "0.1.0", "scripts": { - "clean": "rescript clean -with-deps", + "clean": "rescript clean", "build": "rescript build", "watch": "rescript build -w" }, diff --git a/jscomp/build_tests/post-build/package.json b/jscomp/build_tests/post-build/package.json index 40ef7c6a29..2ad2b88c93 100644 --- a/jscomp/build_tests/post-build/package.json +++ b/jscomp/build_tests/post-build/package.json @@ -2,7 +2,7 @@ "name": "post-build", "version": "0.1.0", "scripts": { - "clean": "rescript clean -with-deps", + "clean": "rescript clean", "build": "rescript build", "watch": "rescript build -w" }, diff --git a/jscomp/build_tests/rerror/input.js b/jscomp/build_tests/rerror/input.js index 426b544d23..77fb6044ba 100644 --- a/jscomp/build_tests/rerror/input.js +++ b/jscomp/build_tests/rerror/input.js @@ -1,7 +1,7 @@ var child_process = require("child_process"); var assert = require("assert"); var rescript_exe = require("../../../scripts/bin_path").rescript_exe; -child_process.spawnSync(`${rescript_exe} clean -with-deps`, { +child_process.spawnSync(`${rescript_exe} clean`, { cwd: __dirname, encoding: "utf8", }); diff --git a/jscomp/build_tests/rerror/package.json b/jscomp/build_tests/rerror/package.json index f2a1c06e89..36908590fb 100644 --- a/jscomp/build_tests/rerror/package.json +++ b/jscomp/build_tests/rerror/package.json @@ -2,7 +2,7 @@ "name": "rerror", "version": "0.1.0", "scripts": { - "clean": "rescript clean -with-deps", + "clean": "rescript clean", "build": "rescript", "watch": "rescript build -w" }, diff --git a/jscomp/build_tests/super_errors/expected/modules1.res.expected b/jscomp/build_tests/super_errors/expected/modules1.res.expected index 1ea2fe29e5..309f16af3d 100644 --- a/jscomp/build_tests/super_errors/expected/modules1.res.expected +++ b/jscomp/build_tests/super_errors/expected/modules1.res.expected @@ -7,7 +7,5 @@ The module or file Foo can't be found. - If it's a third-party dependency: - - Did you list it in bsconfig.json? - - Did you run `rescript build` instead of `rescript build -with-deps` - (latter builds third-parties)? - - Did you include the file's directory in bsconfig.json? \ No newline at end of file + - Did you add it to the "bs-dependencies" or "bs-dev-dependencies" in bsconfig.json? + - Did you include the file's directory to the "sources" in bsconfig.json? \ No newline at end of file diff --git a/jscomp/build_tests/uncurried-always/input.js b/jscomp/build_tests/uncurried-always/input.js index 086ace1115..3d512d1e61 100644 --- a/jscomp/build_tests/uncurried-always/input.js +++ b/jscomp/build_tests/uncurried-always/input.js @@ -5,5 +5,5 @@ const fs = require('fs') const path = require('path') var rescript_exe = require("../../../scripts/bin_path").rescript_exe -cp.execSync(`${rescript_exe} clean -with-deps`, { cwd: __dirname, }); +cp.execSync(`${rescript_exe} clean`, { cwd: __dirname, }); cp.execSync(`${rescript_exe}`, { cwd: __dirname, }); diff --git a/jscomp/build_tests/devdeps/.gitignore b/jscomp/build_tests/weird_deps/.gitignore similarity index 100% rename from jscomp/build_tests/devdeps/.gitignore rename to jscomp/build_tests/weird_deps/.gitignore diff --git a/jscomp/build_tests/devdeps/README.md b/jscomp/build_tests/weird_deps/README.md similarity index 100% rename from jscomp/build_tests/devdeps/README.md rename to jscomp/build_tests/weird_deps/README.md diff --git a/jscomp/build_tests/weird_deps/bsconfig.json b/jscomp/build_tests/weird_deps/bsconfig.json new file mode 100644 index 0000000000..64a146c503 --- /dev/null +++ b/jscomp/build_tests/weird_deps/bsconfig.json @@ -0,0 +1,22 @@ +{ + "name": "weird_devdeps", + "version": "0.1.0", + "sources": [{ + "dir" : "src", + "subdirs" : true + }, + { + "dir" : "test", + "type" : "dev" + } +], + "package-specs": { + "module": "commonjs", + "in-source": true + }, + "suffix": ".bs.js", + "bs-dependencies": [ + "weird" + ], + "warnings": {"error":"+101"} +} diff --git a/jscomp/build_tests/weird_deps/input.js b/jscomp/build_tests/weird_deps/input.js new file mode 100644 index 0000000000..6e2a156015 --- /dev/null +++ b/jscomp/build_tests/weird_deps/input.js @@ -0,0 +1,24 @@ +//@ts-check + +var cp = require("child_process"); +var assert = require("assert"); +var rescript_exe = require("../../../scripts/bin_path").rescript_exe; + +var out = cp.spawnSync(rescript_exe, { + cwd: __dirname, + encoding: "utf8", +}); + +if (out.stdout !== "") { + assert.fail(out.stdout); +} else { + assert.equal( + out.stderr, + [ + 'File "bsconfig.json", line 1', + "Error: package weird not found or built ", + "- Did you install it?", + "", + ].join("\n") + ); +} diff --git a/jscomp/build_tests/weird_deps/package-lock.json b/jscomp/build_tests/weird_deps/package-lock.json new file mode 100644 index 0000000000..4eb41c87e0 --- /dev/null +++ b/jscomp/build_tests/weird_deps/package-lock.json @@ -0,0 +1,13 @@ +{ + "name": "weird_deps", + "version": "0.1.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "weird_deps", + "version": "0.1.0", + "license": "MIT" + } + } +} diff --git a/jscomp/build_tests/devdeps/package.json b/jscomp/build_tests/weird_deps/package.json similarity index 54% rename from jscomp/build_tests/devdeps/package.json rename to jscomp/build_tests/weird_deps/package.json index a64f246beb..7c028a9906 100644 --- a/jscomp/build_tests/devdeps/package.json +++ b/jscomp/build_tests/weird_deps/package.json @@ -1,8 +1,8 @@ { - "name": "devdeps", + "name": "weird_deps", "version": "0.1.0", "scripts": { - "clean": "rescript clean -with-deps", + "clean": "rescript clean", "build": "rescript build", "watch": "rescript build -w" }, @@ -10,8 +10,5 @@ "BuckleScript" ], "author": "", - "license": "MIT", - "devDependencies": { - "bs-platform": "^5.0.5" - } + "license": "MIT" } \ No newline at end of file diff --git a/jscomp/build_tests/devdeps/src/demo.res b/jscomp/build_tests/weird_deps/src/demo.res similarity index 100% rename from jscomp/build_tests/devdeps/src/demo.res rename to jscomp/build_tests/weird_deps/src/demo.res diff --git a/jscomp/build_tests/devdeps/test/test.res b/jscomp/build_tests/weird_deps/test/test.res similarity index 100% rename from jscomp/build_tests/devdeps/test/test.res rename to jscomp/build_tests/weird_deps/test/test.res diff --git a/jscomp/build_tests/weird_devdeps/.gitignore b/jscomp/build_tests/weird_devdeps/.gitignore new file mode 100644 index 0000000000..1c2bb277a5 --- /dev/null +++ b/jscomp/build_tests/weird_devdeps/.gitignore @@ -0,0 +1,26 @@ +*.exe +*.obj +*.out +*.compile +*.native +*.byte +*.cmo +*.annot +*.cmi +*.cmx +*.cmt +*.cmti +*.cma +*.a +*.cmxa +*.obj +*~ +*.annot +*.cmj +*.bak +lib/bs +*.mlast +*.mliast +.vscode +.merlin +.bsb.lock \ No newline at end of file diff --git a/jscomp/build_tests/weird_devdeps/README.md b/jscomp/build_tests/weird_devdeps/README.md new file mode 100644 index 0000000000..1c02d2a072 --- /dev/null +++ b/jscomp/build_tests/weird_devdeps/README.md @@ -0,0 +1,16 @@ + + +# Build +``` +npm run build +``` + +# Watch + +``` +npm run watch +``` + + +# Editor +If you use `vscode`, Press `Windows + Shift + B` it will build automatically \ No newline at end of file diff --git a/jscomp/build_tests/devdeps/bsconfig.json b/jscomp/build_tests/weird_devdeps/bsconfig.json similarity index 92% rename from jscomp/build_tests/devdeps/bsconfig.json rename to jscomp/build_tests/weird_devdeps/bsconfig.json index 04e9b0a7ff..9b8640aff3 100644 --- a/jscomp/build_tests/devdeps/bsconfig.json +++ b/jscomp/build_tests/weird_devdeps/bsconfig.json @@ -1,5 +1,5 @@ { - "name": "devdeps", + "name": "weird_devdeps", "version": "0.1.0", "sources": [{ "dir" : "src", diff --git a/jscomp/build_tests/weird_devdeps/input.js b/jscomp/build_tests/weird_devdeps/input.js new file mode 100644 index 0000000000..6e2a156015 --- /dev/null +++ b/jscomp/build_tests/weird_devdeps/input.js @@ -0,0 +1,24 @@ +//@ts-check + +var cp = require("child_process"); +var assert = require("assert"); +var rescript_exe = require("../../../scripts/bin_path").rescript_exe; + +var out = cp.spawnSync(rescript_exe, { + cwd: __dirname, + encoding: "utf8", +}); + +if (out.stdout !== "") { + assert.fail(out.stdout); +} else { + assert.equal( + out.stderr, + [ + 'File "bsconfig.json", line 1', + "Error: package weird not found or built ", + "- Did you install it?", + "", + ].join("\n") + ); +} diff --git a/jscomp/build_tests/weird_devdeps/package-lock.json b/jscomp/build_tests/weird_devdeps/package-lock.json new file mode 100644 index 0000000000..5688c31658 --- /dev/null +++ b/jscomp/build_tests/weird_devdeps/package-lock.json @@ -0,0 +1,34 @@ +{ + "name": "weird_devdeps", + "version": "0.1.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "weird_devdeps", + "version": "0.1.0", + "license": "MIT" + }, + "../../..": { + "name": "rescript", + "version": "11.0.0-rc.2", + "extraneous": true, + "hasInstallScript": true, + "license": "SEE LICENSE IN LICENSE", + "bin": { + "bsc": "bsc", + "bstracing": "lib/bstracing", + "rescript": "rescript" + }, + "devDependencies": { + "mocha": "^10.1.0", + "nyc": "^15.0.0", + "prettier": "^2.7.1", + "rollup": "^0.49.2" + }, + "engines": { + "node": ">=10" + } + } + } +} diff --git a/jscomp/build_tests/weird_devdeps/package.json b/jscomp/build_tests/weird_devdeps/package.json new file mode 100644 index 0000000000..b7116d34eb --- /dev/null +++ b/jscomp/build_tests/weird_devdeps/package.json @@ -0,0 +1,14 @@ +{ + "name": "weird_devdeps", + "version": "0.1.0", + "scripts": { + "clean": "rescript clean", + "build": "rescript build", + "watch": "rescript build -w" + }, + "keywords": [ + "BuckleScript" + ], + "author": "", + "license": "MIT" +} \ No newline at end of file diff --git a/jscomp/build_tests/weird_devdeps/src/demo.res b/jscomp/build_tests/weird_devdeps/src/demo.res new file mode 100644 index 0000000000..9af096591d --- /dev/null +++ b/jscomp/build_tests/weird_devdeps/src/demo.res @@ -0,0 +1 @@ +let () = Js.log("Hello, BuckleScript") diff --git a/jscomp/build_tests/weird_devdeps/test/test.res b/jscomp/build_tests/weird_devdeps/test/test.res new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/jscomp/build_tests/weird_devdeps/test/test.res @@ -0,0 +1 @@ + diff --git a/jscomp/build_tests/weird_names/package.json b/jscomp/build_tests/weird_names/package.json index 3ad2923e99..4759556a0c 100644 --- a/jscomp/build_tests/weird_names/package.json +++ b/jscomp/build_tests/weird_names/package.json @@ -2,7 +2,7 @@ "name": "weird_names", "version": "0.1.0", "scripts": { - "clean": "rescript clean -with-deps", + "clean": "rescript clean", "build": "rescript build", "watch": "rescript build -w" }, diff --git a/jscomp/build_tests/x-y/package.json b/jscomp/build_tests/x-y/package.json index 19ab447311..b614a74983 100644 --- a/jscomp/build_tests/x-y/package.json +++ b/jscomp/build_tests/x-y/package.json @@ -2,7 +2,7 @@ "name": "x-y", "version": "0.1.0", "scripts": { - "clean": "rescript clean -with-deps", + "clean": "rescript clean", "build": "rescript", "watch": "rescript build -w" }, diff --git a/jscomp/build_tests/zerocycle/package.json b/jscomp/build_tests/zerocycle/package.json index e44e7f662d..0329044793 100644 --- a/jscomp/build_tests/zerocycle/package.json +++ b/jscomp/build_tests/zerocycle/package.json @@ -2,7 +2,7 @@ "name": "zerocycle", "version": "0.1.0", "scripts": { - "clean": "rescript clean -with-deps", + "clean": "rescript clean", "build": "rescript build", "watch": "rescript build -w" }, diff --git a/jscomp/gentype_tests/typescript-react-example/package.json b/jscomp/gentype_tests/typescript-react-example/package.json index b8a0cec5b8..8ff3dda051 100644 --- a/jscomp/gentype_tests/typescript-react-example/package.json +++ b/jscomp/gentype_tests/typescript-react-example/package.json @@ -10,7 +10,7 @@ "scripts": { "start": "rescript build -w", "build": "rescript", - "clean": "rescript clean -with-deps", + "clean": "rescript clean", "tsc": "tsc -p tsconfig.json" }, "devDependencies": { diff --git a/jscomp/ml/typetexp.ml b/jscomp/ml/typetexp.ml index 7825b4eef5..5e632574eb 100644 --- a/jscomp/ml/typetexp.ml +++ b/jscomp/ml/typetexp.ml @@ -993,11 +993,9 @@ let report_error env ppf = function Format.fprintf ppf "@[\ @{The module or file %a can't be found.@}@,\ @[- If it's a third-party dependency:@,\ - - Did you list it in bsconfig.json?@,\ - - @[Did you run `rescript build` instead of `rescript build -with-deps`@ (latter builds third-parties)@]?\ - @]@,\ - - Did you include the file's directory in bsconfig.json?@]\ - @]" + - Did you add it to the \"bs-dependencies\" or \"bs-dev-dependencies\" in bsconfig.json?@]@,\ + - Did you include the file's directory to the \"sources\" in bsconfig.json?@,\ + " Printtyp.longident lid end end;