jakejs / jake

JavaScript build tool, similar to Make or Rake. Built to work with Node.js.
http://jakejs.com
Apache License 2.0
1.97k stars 190 forks source link

Support LiveScript Jakefiles #366

Closed bmundt6 closed 4 years ago

bmundt6 commented 4 years ago

Pretty self-explanatory; in addition to Jakefile.js and Jakefile.coffee, also allow Jakefile.ls.

mde commented 4 years ago

I've reimplemented this in the current refactor branch: https://github.com/jakejs/jake/tree/post-v10-refactor Can you pull it, and verify that it actually works?

bmundt6 commented 4 years ago

The refactor branch is not working for me either. In fact it does not even accept the coffeescript Jakefile. My test setup is this: { jake } = require 'jake' Running just jake yields:

jake aborted.
Error: No Jakefile. Specify a valid path with -f/--jakefile, or place one in the current directory.

Running jake -f Jakefile.coffee yields:

jake aborted.
Jakefile.coffee:1
(function (exports, require, module, __filename, __dirname) { { jake } = require 'jake'
mde commented 4 years ago

Could you provide me with a minimal repo with a CS/LS Jakefile, and the proper dependencies? Ideally we'd have tests for this, but let's start with a repo that ought to work.

bmundt6 commented 4 years ago

Here is a test repo for you: https://github.com/bmundt6/jake_coffee_lsc_test

mde commented 4 years ago

Thank you. (Sorry, I closed the issue by mistake.)

mde commented 4 years ago

I was not able to repro your issue for LiveScript, although your repo did help me find a bug in the CoffeeScript implementation. I changed and tweaked somethings, mostly removing the old library names of 'LiveScript' and 'coffee-script', but the fundamental approach is still the same, so I suspect it will not fix your specific issue.

I think it might have something to do with where you're putting the Jake lib and executable — submodules are often problematic, from what I've seen. Here's my basic test, which works as expected:

dargo:work mde$ git clone https://github.com/bmundt6/jake_coffee_lsc_test.git
Cloning into 'jake_coffee_lsc_test'...
remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (10/10), done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 10 (delta 2), reused 10 (delta 2), pack-reused 0
Unpacking objects: 100% (10/10), done.
dargo:work mde$ cd jake_coffee_lsc_test/
dargo:jake_coffee_lsc_test mde$ npm install git://github.com/jakejs/jake.git#post-v10-refactor
npm WARN jake_coffee_lsc_test@1.0.0 No repository field.

+ jake@10.3.2
added 28 packages from 56 contributors and audited 38 packages in 4.447s
found 0 vulnerabilities

dargo:jake_coffee_lsc_test mde$ npm install livescript
npm WARN jake_coffee_lsc_test@1.0.0 No repository field.

+ livescript@1.6.0
updated 1 package and audited 38 packages in 2.1s
found 0 vulnerabilities

dargo:jake_coffee_lsc_test mde$ npm install coffeescript
npm WARN jake_coffee_lsc_test@1.0.0 No repository field.

+ coffeescript@2.4.1
updated 1 package and audited 38 packages in 1.435s
found 0 vulnerabilities

dargo:jake_coffee_lsc_test mde$ ./node_modules/.bin/jake -f Jakefile.ls
Starting 'default'...
it works!
Finished 'default' after 1 ms
dargo:jake_coffee_lsc_test mde$ ./node_modules/.bin/jake -f Jakefile.coffee
Starting 'default'...
it works!
Finished 'default' after 0 ms

I'm happy to help you debug, but honestly, Jake is intended primarily as a productivity tool for building real-world applications, and CS/LS are both considerably far afield from any mainstream uses.

bmundt6 commented 4 years ago

Installing jake through npm as you specified made it work - I didn't even know that was possible, nice tip!

Thank you for your time, closing.

mde commented 4 years ago

Implemented in. 10.4.