Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[enhance] qml2js: output package.json for plugins.

  • Loading branch information...
commit 2dbcceff25e2e6711c6608968f1f5d947a327034 1 parent 9bf96df
Arthur Azevedo de Amorim arthuraa authored
3  Makefile
View
@@ -144,7 +144,8 @@ define install-plugin
@mkdir -p "$(STDLIB_DIR)/$*.opp"
@$(INSTALL) $(BUILD_DIR)/$(PLUGINS_DIR)/$*.opp/*.bypass "$(STDLIB_DIR)/$*.opp/";
@$(INSTALL) $(BUILD_DIR)/$(PLUGINS_DIR)/$*.opp/*NodeJsPackage.js "$(STDLIB_DIR)/$*.opp/";
-@$(if $(wildcard $(BUILD_DIR)/$(PLUGINS_DIR)/$*.opp/*MLRuntime.*), $(INSTALL) $(BUILD_DIR)/$(PLUGINS_DIR)/$*.opp/*MLRuntime.* "$(STDLIB_DIR)/$*.opp/")
+@$(INSTALL) $(BUILD_DIR)/$(PLUGINS_DIR)/$*.opp/package.json "$(STDLIB_DIR)/$*.opp/";
+@$(if $(wildcard $(BUILD_DIR)/$(PLUGINS_DIR)/$*.opp/*MLRuntime.*), $(INSTALL) $(BUILD_DIR)/$*.opp/*MLRuntime.* "$(STDLIB_DIR)/$*.opp/")
endef
13 compiler/libbsl/bslregister.ml
View
@@ -866,6 +866,17 @@ let make_iterator rename =
in
{ BR.output = output }
+let output_package_json () =
+ let path = Filename.dirname !nodejspackage in
+ let dest = Filename.concat path "package.json" in
+ let main = Filename.basename !nodejspackage in
+ let oc = handle_open_out dest in
+ Printf.fprintf oc "{\n";
+ Printf.fprintf oc " \"name\": \"%s\",\n" !opp_dir;
+ Printf.fprintf oc " \"version\": \"0.0.0\",\n";
+ Printf.fprintf oc " \"main\": \"%s\"\n" main;
+ Printf.fprintf oc "}\n";
+ handle_close_out dest oc
(* after finalization of register session, actually produce files *)
let files_generation ( finalized_t : BR.finalized_t ) =
@@ -880,6 +891,8 @@ let files_generation ( finalized_t : BR.finalized_t ) =
output !nodejspackage BR.out_nodejs_package finalized_t ;
+ output_package_json ();
+
output !jskeys BR.out_js_keys finalized_t ;
output !marshalplugin BR.out_ml_marshal_plugin finalized_t ;
7 compiler/qml2js/qml2js.ml
View
@@ -218,7 +218,7 @@ struct
let oc = open_out_gen [Open_wronly; Open_creat; Open_trunc] 0o600 filename in
let package_name = (Filename.basename env_opt.compilation_directory) in
Printf.fprintf oc "{\n";
- Printf.fprintf oc " \"name\": %S,\n" package_name;
+ Printf.fprintf oc " \"name\": \"%s\",\n" package_name;
Printf.fprintf oc " \"version\": \"0.0.0\",\n";
Printf.fprintf oc " \"main\": \"a.js\"\n";
Printf.fprintf oc "}\n";
@@ -365,7 +365,7 @@ check-node-dependencies \"mongodb formidable nodemailer simplesmtp imap\" || exi
EOF
if [ $? -ne 0 ]; then exit $?; fi;
-NODE_PATH=\"$NODE_PATH:/usr/local/lib/node_modules\" node \"$0\" \"$@\"; exit $?;
+NODE_PATH=\"$NODE_PATH:/usr/local/lib/node_modules:%s:%s\" node \"$0\" \"$@\"; exit $?;
if (process.version < '%s') {
console.error('Your version of node seems to be too old. Please upgrade to a more recent version of node (>= %s)');
@@ -375,7 +375,8 @@ if (process.version < '%s') {
}
*/
-" stdlib_qmljs_path min_node_version min_node_version max_node_version;
+" stdlib_qmljs_path stdlib_path min_node_version
+ min_node_version max_node_version;
let is_from_stdlib opx = String.is_prefix stdlib_path opx in
let load_oc = linking_generation_js_init env_opt generated_files oc in
let js_file opx = Filename.concat opx "a.js" in
Please sign in to comment.
Something went wrong with that request. Please try again.