Skip to content

Commit 3675cb2

Browse files
authored
Merge pull request #4269 from BuckleScript/no_symlink_in_bsb_init
not running npm link
2 parents 2747402 + b59846c commit 3675cb2

File tree

9 files changed

+14
-188
lines changed

9 files changed

+14
-188
lines changed

jscomp/bsb/bsb_theme_init.ml

Lines changed: 2 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -47,64 +47,7 @@ let replace s env : string =
4747

4848
let (//) = Filename.concat
4949

50-
(* TODO: Check Ext_io.write_file may overwrite, duplicate with Bsb_config_parse *)
51-
let get_bs_platform_version_if_exists dir =
52-
match
53-
Ext_json_parse.parse_json_from_file
54-
(Filename.concat dir Literals.package_json) with
55-
| Obj {map}
56-
->
57-
(match Map_string.find_exn map Bsb_build_schemas.version with
58-
| Str {str} -> str
59-
| _ -> assert false)
60-
| _ -> assert false
61-
62-
let run_npm_link cwd dirname =
63-
let bs_platform_dir =
64-
Filename.concat Literals.node_modules Bs_version.package_name in
65-
if Sys.file_exists bs_platform_dir
66-
then
67-
if get_bs_platform_version_if_exists bs_platform_dir = Bs_version.version then
68-
begin
69-
Format.fprintf Format.std_formatter
70-
"bs-platform already exists(version match), no need symlink@."
71-
end
72-
else
73-
begin
74-
Format.fprintf Format.err_formatter
75-
"bs-platform already exists, but version mismatch with running bsb@.";
76-
exit 2
77-
end
78-
else
79-
(* if Ext_sys.is_windows_or_cygwin then *)
80-
begin
81-
let npm_link = "npm link bs-platform" in
82-
let exit_code = Sys.command npm_link in
83-
if exit_code <> 0 then
84-
begin
85-
prerr_endline ("failed to run : " ^ npm_link);
86-
exit exit_code
87-
end
88-
end
89-
(* else
90-
begin
91-
(* symlink bs-platform and bsb,bsc,bsrefmt to .bin directory
92-
we did not run npm link bs-platform for efficiency reasons
93-
*)
94-
Format.fprintf Format.std_formatter "Symlink bs-platform in %s @." (cwd//dirname);
95-
let (//) = Filename.concat in
96-
let node_bin = "node_modules" // ".bin" in
97-
Bsb_build_util.mkp node_bin;
98-
let p = ".." // Bs_version.package_name // "lib" in
99-
let link a =
100-
Unix.symlink (p//a) (node_bin // a) in
101-
link "bsb" ;
102-
link "bsc" ;
103-
link "bsrefmt";
104-
Unix.symlink
105-
(Filename.dirname (Filename.dirname Sys.executable_name))
106-
(Filename.concat "node_modules" Bs_version.package_name)
107-
end *)
50+
10851

10952
let enter_dir cwd x action =
11053
Unix.chdir x ;
@@ -167,8 +110,7 @@ let init_sample_project ~cwd ~theme name =
167110
"bsb" , Filename.current_dir_name // "node_modules" // ".bin" // "bsb"
168111
];
169112
let action = fun _ ->
170-
process_themes env theme Filename.current_dir_name Bsb_templates.root;
171-
run_npm_link cwd name
113+
process_themes env theme Filename.current_dir_name Bsb_templates.root
172114
in
173115
begin match name with
174116
| "." ->

jscomp/common/bs_version.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* You should have received a copy of the GNU Lesser General Public License
2323
* along with this program; if not, write to the Free Software
2424
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
25-
let version = "7.3.0-dev.1"
25+
let version = "7.3.0-dev.2"
2626
let header =
2727
"// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE"
2828
let package_name = "bs-platform"

lib/4.06.1/bsb.ml

Lines changed: 3 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ end = struct
5353
* You should have received a copy of the GNU Lesser General Public License
5454
* along with this program; if not, write to the Free Software
5555
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
56-
let version = "7.3.0-dev.1"
56+
let version = "7.3.0-dev.2"
5757
let header =
5858
"// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE"
5959
let package_name = "bs-platform"
@@ -16156,64 +16156,7 @@ let replace s env : string =
1615616156

1615716157
let (//) = Filename.concat
1615816158

16159-
(* TODO: Check Ext_io.write_file may overwrite, duplicate with Bsb_config_parse *)
16160-
let get_bs_platform_version_if_exists dir =
16161-
match
16162-
Ext_json_parse.parse_json_from_file
16163-
(Filename.concat dir Literals.package_json) with
16164-
| Obj {map}
16165-
->
16166-
(match Map_string.find_exn map Bsb_build_schemas.version with
16167-
| Str {str} -> str
16168-
| _ -> assert false)
16169-
| _ -> assert false
16170-
16171-
let run_npm_link cwd dirname =
16172-
let bs_platform_dir =
16173-
Filename.concat Literals.node_modules Bs_version.package_name in
16174-
if Sys.file_exists bs_platform_dir
16175-
then
16176-
if get_bs_platform_version_if_exists bs_platform_dir = Bs_version.version then
16177-
begin
16178-
Format.fprintf Format.std_formatter
16179-
"bs-platform already exists(version match), no need symlink@."
16180-
end
16181-
else
16182-
begin
16183-
Format.fprintf Format.err_formatter
16184-
"bs-platform already exists, but version mismatch with running bsb@.";
16185-
exit 2
16186-
end
16187-
else
16188-
(* if Ext_sys.is_windows_or_cygwin then *)
16189-
begin
16190-
let npm_link = "npm link bs-platform" in
16191-
let exit_code = Sys.command npm_link in
16192-
if exit_code <> 0 then
16193-
begin
16194-
prerr_endline ("failed to run : " ^ npm_link);
16195-
exit exit_code
16196-
end
16197-
end
16198-
(* else
16199-
begin
16200-
(* symlink bs-platform and bsb,bsc,bsrefmt to .bin directory
16201-
we did not run npm link bs-platform for efficiency reasons
16202-
*)
16203-
Format.fprintf Format.std_formatter "Symlink bs-platform in %s @." (cwd//dirname);
16204-
let (//) = Filename.concat in
16205-
let node_bin = "node_modules" // ".bin" in
16206-
Bsb_build_util.mkp node_bin;
16207-
let p = ".." // Bs_version.package_name // "lib" in
16208-
let link a =
16209-
Unix.symlink (p//a) (node_bin // a) in
16210-
link "bsb" ;
16211-
link "bsc" ;
16212-
link "bsrefmt";
16213-
Unix.symlink
16214-
(Filename.dirname (Filename.dirname Sys.executable_name))
16215-
(Filename.concat "node_modules" Bs_version.package_name)
16216-
end *)
16159+
1621716160

1621816161
let enter_dir cwd x action =
1621916162
Unix.chdir x ;
@@ -16276,8 +16219,7 @@ let init_sample_project ~cwd ~theme name =
1627616219
"bsb" , Filename.current_dir_name // "node_modules" // ".bin" // "bsb"
1627716220
];
1627816221
let action = fun _ ->
16279-
process_themes env theme Filename.current_dir_name Bsb_templates.root;
16280-
run_npm_link cwd name
16222+
process_themes env theme Filename.current_dir_name Bsb_templates.root
1628116223
in
1628216224
begin match name with
1628316225
| "." ->

lib/4.06.1/unstable/bsb_native.ml

Lines changed: 3 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ end = struct
5353
* You should have received a copy of the GNU Lesser General Public License
5454
* along with this program; if not, write to the Free Software
5555
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
56-
let version = "7.3.0-dev.1"
56+
let version = "7.3.0-dev.2"
5757
let header =
5858
"// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE"
5959
let package_name = "bs-platform"
@@ -16311,64 +16311,7 @@ let replace s env : string =
1631116311

1631216312
let (//) = Filename.concat
1631316313

16314-
(* TODO: Check Ext_io.write_file may overwrite, duplicate with Bsb_config_parse *)
16315-
let get_bs_platform_version_if_exists dir =
16316-
match
16317-
Ext_json_parse.parse_json_from_file
16318-
(Filename.concat dir Literals.package_json) with
16319-
| Obj {map}
16320-
->
16321-
(match Map_string.find_exn map Bsb_build_schemas.version with
16322-
| Str {str} -> str
16323-
| _ -> assert false)
16324-
| _ -> assert false
16325-
16326-
let run_npm_link cwd dirname =
16327-
let bs_platform_dir =
16328-
Filename.concat Literals.node_modules Bs_version.package_name in
16329-
if Sys.file_exists bs_platform_dir
16330-
then
16331-
if get_bs_platform_version_if_exists bs_platform_dir = Bs_version.version then
16332-
begin
16333-
Format.fprintf Format.std_formatter
16334-
"bs-platform already exists(version match), no need symlink@."
16335-
end
16336-
else
16337-
begin
16338-
Format.fprintf Format.err_formatter
16339-
"bs-platform already exists, but version mismatch with running bsb@.";
16340-
exit 2
16341-
end
16342-
else
16343-
(* if Ext_sys.is_windows_or_cygwin then *)
16344-
begin
16345-
let npm_link = "npm link bs-platform" in
16346-
let exit_code = Sys.command npm_link in
16347-
if exit_code <> 0 then
16348-
begin
16349-
prerr_endline ("failed to run : " ^ npm_link);
16350-
exit exit_code
16351-
end
16352-
end
16353-
(* else
16354-
begin
16355-
(* symlink bs-platform and bsb,bsc,bsrefmt to .bin directory
16356-
we did not run npm link bs-platform for efficiency reasons
16357-
*)
16358-
Format.fprintf Format.std_formatter "Symlink bs-platform in %s @." (cwd//dirname);
16359-
let (//) = Filename.concat in
16360-
let node_bin = "node_modules" // ".bin" in
16361-
Bsb_build_util.mkp node_bin;
16362-
let p = ".." // Bs_version.package_name // "lib" in
16363-
let link a =
16364-
Unix.symlink (p//a) (node_bin // a) in
16365-
link "bsb" ;
16366-
link "bsc" ;
16367-
link "bsrefmt";
16368-
Unix.symlink
16369-
(Filename.dirname (Filename.dirname Sys.executable_name))
16370-
(Filename.concat "node_modules" Bs_version.package_name)
16371-
end *)
16314+
1637216315

1637316316
let enter_dir cwd x action =
1637416317
Unix.chdir x ;
@@ -16431,8 +16374,7 @@ let init_sample_project ~cwd ~theme name =
1643116374
"bsb" , Filename.current_dir_name // "node_modules" // ".bin" // "bsb"
1643216375
];
1643316376
let action = fun _ ->
16434-
process_themes env theme Filename.current_dir_name Bsb_templates.root;
16435-
run_npm_link cwd name
16377+
process_themes env theme Filename.current_dir_name Bsb_templates.root
1643616378
in
1643716379
begin match name with
1643816380
| "." ->

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316198,7 +316198,7 @@ end = struct
316198316198
* You should have received a copy of the GNU Lesser General Public License
316199316199
* along with this program; if not, write to the Free Software
316200316200
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
316201-
let version = "7.3.0-dev.1"
316201+
let version = "7.3.0-dev.2"
316202316202
let header =
316203316203
"// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE"
316204316204
let package_name = "bs-platform"

lib/4.06.1/unstable/js_refmt_compiler.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316198,7 +316198,7 @@ end = struct
316198316198
* You should have received a copy of the GNU Lesser General Public License
316199316199
* along with this program; if not, write to the Free Software
316200316200
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
316201-
let version = "7.3.0-dev.1"
316201+
let version = "7.3.0-dev.2"
316202316202
let header =
316203316203
"// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE"
316204316204
let package_name = "bs-platform"

lib/4.06.1/whole_compiler.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303960,7 +303960,7 @@ end = struct
303960303960
* You should have received a copy of the GNU Lesser General Public License
303961303961
* along with this program; if not, write to the Free Software
303962303962
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
303963-
let version = "7.3.0-dev.1"
303963+
let version = "7.3.0-dev.2"
303964303964
let header =
303965303965
"// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE"
303966303966
let package_name = "bs-platform"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"coverage": "nyc --timeout=3000 --reporter=html mocha jscomp/test/*test.js && open ./coverage/index.html"
1919
},
2020
"name": "bs-platform",
21-
"version": "7.3.0-dev.1",
21+
"version": "7.3.0-dev.2",
2222
"description": "bucklescript compiler, ocaml standard libary by bucklescript and its required runtime support",
2323
"repository": {
2424
"type": "git",

scripts/ciTest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ function main() {
150150
throw new Error(`init theme ${theme} failed`);
151151
}
152152
cp.exec(
153-
`npm install && npm run clean && npm run build`,
153+
`npm link bs-platform && npm install && npm run clean && npm run build`,
154154
{ cwd: path.join(themesDir, theme) },
155155
function(error, stdout, stderr) {
156156
console.log(stdout);

0 commit comments

Comments
 (0)