mixu / gluejs

Build CommonJS modules for the browser via a chainable API
http://mixu.net/gluejs/
165 stars 13 forks source link

Paths should be relative to working directory #8

Open jamesarosen opened 11 years ago

jamesarosen commented 11 years ago

What Happened?

I've installed gluejs locally:

"devDependencies": {
  "gluejs": "~0.2.0"
}

Then I ran the following in node (with /my_project/ as the working directory):

new Glue()
  .basepath('./src')
  .include('./src')
  .replace({ jquery: 'window.jQuery' })
  .export('MyLibrary')
  .render(function (err, txt) {
    fs.writeFile('./assets/insistent_cat.js', txt);
  });

I get the following error:

Error: ENOENT, no such file or directory '/my_project/node_modules/gluejs/lib/src'
    at Object.fs.statSync (fs.js:524:18)
    at Group.include (/my_project/node_modules/gluejs/lib/group.js:21:26)
    at Array.forEach (native)
    at Group.include (/my_project/node_modules/gluejs/lib/group.js:19:9)
    at Renderer.include (/my_project/node_modules/gluejs/lib/glue.js:42:55)
    at repl:1:30
    at REPLServer.self.eval (repl.js:111:21)
    at rli.on.e (repl.js:260:20)
    at REPLServer.self.eval (repl.js:118:5)
    at Interface.<anonymous> (repl.js:250:12)

What Did You Expect?

I expected .basepath('./src'), .include('./src'), and fs.writeFile('./assets/insistent_cat.js', txt); all to be relative to the current working directory.

jbeard4 commented 11 years ago

I just hit this today. +1

moll commented 10 years ago

I'd also say local paths should have ./ prepended to them to distinguish them from modules in node_modules.