anko / eslisp

un-opinionated S-expression syntax and macro system for JavaScript
ISC License
528 stars 31 forks source link

Remove `eslc` indirection, update LiveScript dependency #40

Closed dead-claudia closed 8 years ago

dead-claudia commented 8 years ago

@anko

It's unlikely at this stage that any consumers are depending on the location of the binary, and it's not even documented within this repo at all, but hardcoded throughout the docs tests. The executable indirection is removed to now point to the corresponding file in lib. All the former references to the old binary now run node lib/cli.js.

This will also open up the possibility of making this buildable on Windows platforms, as it's now almost trivial to drop make as a required dependency instead aliasing everything to npm run, as lsc works with directories as well as files, and there's rimraf (already a dev dependency) to replace make clean, and lsc creates nonexistent directories before compiling from a source directory.

Also, the newest minor update of LiveScript is purely additive and bug fixes except for generators no longer being automatically hushed, which shouldn't affect this repo.

http://livescript.net/#changelog

dead-claudia commented 8 years ago

Yeah...I had to add that dependency to get both Travis and my local tests to stop screaming at me. Don't know why that wasn't already added. :frowning:

anko commented 8 years ago

The eslc binary fails on Linux with this: without a shebang line to specify it should be run with node, the kernel tries to run it as a shell file.

We could fix it by adding a conditional to the build, prepending that line to lib/cli.js

diff --git a/makefile b/makefile
index 353da54..35f55b7 100644
--- a/makefile
+++ b/makefile
@@ -9,7 +9,10 @@ all: $(LIB)

 lib/%.js: src/%.ls
    @mkdir -p lib/
-   lsc --output lib --bare --compile "$<"
+   @if [ "$@" = "lib/cli.js" ] ; then \
+       echo "#!/usr/bin/env node" > $@ ;\
+   fi
+   lsc --output lib --bare --compile --print "$<" >> $@

 clean:
    @rm -rf lib/

—but I'd like to minimise logic in the build process. Having bin/eslc clearly denote the executable entry-point is clearer, and easier to maintain e.g. if eslisp needs more executables later.

What do you think?


The missing uuid dependency is my fault! I had accidentally removed it, and because I have Travis set up to cache node_modules/ since 8d57061, it didn't catch the mistake right away either.

I think it's best to disable that cache altogether actually. I've had to manually delete Travis' cache a few times for similar issues too.


Getting eslisp to build on Windows would be neat, but I have no Windows machine to test it on, or a good understanding of what's necessary. If you do, could you create an issue about it?

anko commented 8 years ago

For reference, I've cherry-picked the b110323 uuid dependency fix to master (as a56105f), and updated LiveScript in https://github.com/anko/eslisp/commit/78293f430a6bcde701cbf56ae6264296fbee9deb.

dead-claudia commented 8 years ago

Good point. On that note, I'll just make a new PR that just cleans up the eslc binary.