-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Task for generating edn files #141
Comments
This is good idea I think :)
- Why are there separate options for init-fn and init-fns? Seems this could
be one?
- I wonder if we could use somehow use this to east the setting of
asset-path which is previously confused many
…On Mon, 28 Nov 2016 at 07:49, Matthew Ratzke ***@***.***> wrote:
I would be nice if there was such a task within the cljs package itself,
here is my attempt:
(boot/deftask cljs-edn
"Generate a .cljs.edn file."
[e edn VAL str "EDN file name."
i init-fn VAL sym "EDN init function."
r require VAL [sym] "Vector of namespaces to require."
f init-fns VAL [sym] "Vector of fuctions to wrap in do block."
t target VAL kw "Target platform."
d closure-defines VAL {} "A map of closure defines options."
o compiler-options VAL {} "A map of compiler options."]
(assert (:init-fn *opts*) "Must provide an edn file name.")
(assert (:init-fn *opts*) "Must provide an init-fn.")
(let [edn (:edn *opts*)
init (:init-fn *opts*)
main (symbol (namespace init))
ednstr {:require (:require *opts* [main])
:init-fns (:init-fns *opts* [init])
:compiler-options (:compiler-options *opts*
{:target (:target *opts*)
:closure-defines (:closure-defines *opts*)})}
tmp (boot/tmp-dir!)
fname (str edn ".cljs.edn")
fedn (io/file tmp fname)]
(boot/with-pre-wrap fileset
(util/info (str "Generating EDN file: " fname "\n"))
(doto fedn (spit ednstr))
(-> fileset (boot/add-resource tmp) boot/commit!))))
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#141>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAF82H7rQNZJRB3-ARkxwko1kmukxa6Kks5rCiT7gaJpZM4K9UKo>
.
|
@martinklepsch init-fn is an easy option which will extract the ns and populate require for you, init-fns overrides that portion of the edn file. Essentially one version is automatic and the other is manual. |
Ah cool that sounds great 👍
…On Mon, 28 Nov 2016 at 10:28, Matthew Ratzke ***@***.***> wrote:
@martinklepsch <https://github.com/martinklepsch> init-fn is an easy
option which will extract the ns and populate require for you, init-fns
overrides that portion of the edn file. Essentially one version is
automatic and the other is manual.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#141 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAF82JoxdEJrSvtg0ePznoLn638ehq5Iks5rCkpGgaJpZM4K9UKo>
.
|
Boot-cljs already adds require to any namespace in |
@Deraen @martinklepsch created PR #142 |
what problem does this solve? why is parameterizing a task like this better than just writing the edn file? |
@mobileink there are lots of cases where I would like to generate an entry-point as part of a build. Usually for frameworks like express/feathers.js when generating server files or for cases where I am using boot for things other than building projects, like project management tasks which generate project files, etc. |
This is no longer a goal. All the options can now be provided as task options with the latest release. Using Boot-cljs without .cljs.edn can still be problematic (and slow) as in this case all the .cljs files in fileset will be compiled, but I have some ideas on how to fix that eventually: #169 |
I would be nice if there was such a task within the cljs package itself, here is my attempt:
The text was updated successfully, but these errors were encountered: