ckknight / gorillascript

GorillaScript is a compile-to-JavaScript language designed to empower the user while attempting to prevent some common errors.
MIT License
300 stars 34 forks source link

Smarter directory path handling in compiler #123

Open btmills opened 11 years ago

btmills commented 11 years ago

Imagine I have a folder structure something like this:

project/
  index.js
  src/
    index.gs
    config.gs
  app/
    index.js
    config.js

index.js is simply require('./app');, and the GorillaScript files are compiled one-to-one from src to app. Currently to accomplish something like make continuously from the projet root directory, the command is cd src; gorilla -cwo ../app/ *.gs. This has two disadvantages as I see it:

  1. The cd src is necessary rather than watching src/*.gs because the latter will result in the scripts being output to app/src/ rather than app/.
  2. The target selection is not "smart" in that I must specify *.gs. This means that, for example, models stored in src/models/ would require another separate compiler command.

I would like to be able to write (executing from the project root) gorilla -cwo app src. The compiler would then recursively look for all of the GorillaScript source files underneath src/ and output them underneath app/ with the same folder structure.