Open mgonto opened 10 years ago
Oh yah, it should definitely fetch the latest tag, which would probably be: 2.1.1
@yields do you mind looking into this one? I think it's related to gh-resolve
.
$ echo "require('jquery/jquery:dist/jquery.js')" | duo -t js
building : from stdin/Users/matt/Projects/duo/node_modules/duo-package/node_modules/semver/semver.js:273
throw new TypeError('Invalid Version: ' + version);
^
TypeError: Invalid Version: 1.0
at new SemVer (/Users/matt/Projects/duo/node_modules/duo-package/node_modules/semver/semver.js:273:11)
at compare (/Users/matt/Projects/duo/node_modules/duo-package/node_modules/semver/semver.js:460:10)
at arrange (/Users/matt/Projects/duo/node_modules/duo-package/node_modules/gh-resolve/index.js:133:13)
at Array.sort (native)
at /Users/matt/Projects/duo/node_modules/duo-package/node_modules/gh-resolve/index.js:69:31
at ChildProcess.exithandler (child_process.js:720:7)
at ChildProcess.EventEmitter.emit (events.js:110:17)
at maybeClose (child_process.js:992:16)
at Process.ChildProcess._handle.onexit (child_process.js:1059:5)
Exactly that one!.
And what about getting the main from bower.json
or package.json
? Do you want me to put that in another issue?
we probably won't support that unless we go all out on browserify support, which is part of a larger discussion
@MatthewMueller why? I think just getting the main from bower.json
is a pretty good compromise.
Main file from package.json
does have other requires from browserify which would make it not work with Duo, I agree.
However, main from bower.json
is always the JS file to use. Why not support it?
Thanks!
Yah, bower.json
probably wouldn't be too tough, feel free to open another issue to get the main from bower.json
. We can chat about it more there :-)
Getting main
from bower.json
right now is the way to go. It's user-friendly: "just require this thing".
IMHO duo should embrace the ecosystem that is already there. bower.json support could be replaced with anything else in the future.
Example: CodeMirror's bower.json
With the current version (0.8.4), the only way to include the target main files is to knowing exactly the relative path of them. Example:
// js
require('codemirror/CodeMirror:lib/codemirror.js');
/* css */
@import 'codemirror/CodeMirror:lib/codemirror.css';
But there is a .css
and a .js
file defined as main files on bower.json. Why can't we just require codemirror/CodeMirror
in the source files like this?
// js
require('codemirror/CodeMirror');
/* css */
@import 'codemirror/CodeMirror';
It sounds totally feasible and removes complexity for the developer.
Hey,
I was trying to require
jquery/jquery
for example. Doingrequire('jquery/jquery')
tries to fetch tag version1.0
. I think it should actually fetch the last available tag based on Semver. What do you guys think?Also, I see that jQuery has a
bower.json
and apackage.json
, both specifying main files. However,duo
tries to findindex.js
on root. Shouldn't it parse the available package definition json to search for the main files?Thanks for all the hard work and great tool :)