ClojureScript

Setting *main-cli-fn* when using :target :nodejs shouldn't be manditory

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: 1.7.145
  • Fix Version/s: 1.9.655
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code

Description

Currently, when you use :target :nodejs in the build options for ClojureScript, the resulting code requires you to set *main-cli-fn* to a function.

This prevents someone from writing a library that can be used by JavaScript developers because it forces code execution on require. It also makes writing a CLI tool that can be distributed using NPM less straightforward. I ran into this issue trying to create a Leiningen template for writing CLI tools that could be installed using npm install or npm link. I had a wrapper script to take care of the CLI use-case, and intended to write the ClojureScript module in a more library oriented way, but ran into issues. I could work around this by not using the wrapper script, but it got me thinking about the more general library issue.

I don't see any reason why you should be forced to set *main-cli-fn* and so I'm suggesting making it optional.

Attached is a patch that makes it optional but retains the check for whether the value it is set to is a function in the case where it is set.

This is my first time submitting a change to a project using a git patch and not a pull request, so let me know if I've made the patch wrong.

Activity

Hide
Jeremy Shoemaker added a comment -

I just noticed the priority defaulted to "Major". I don't know if I'd say it's major, so feel free to bump it down if that doesn't seem appropriate.

Show
Jeremy Shoemaker added a comment - I just noticed the priority defaulted to "Major". I don't know if I'd say it's major, so feel free to bump it down if that doesn't seem appropriate.
Hide
Ning Sun added a comment -

+1.

I was working on a clojurescript library and going to build it as a node library. Currently blocked by this.

Show
Ning Sun added a comment - +1. I was working on a clojurescript library and going to build it as a node library. Currently blocked by this.
Hide
Mike Fikes added a comment -

Patch no longer applies.

Show
Mike Fikes added a comment - Patch no longer applies.
Hide
David Nolen added a comment -

this has been fixed in master

Show
David Nolen added a comment - this has been fixed in master

People

Vote (2)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: