volojs / volo

Create front end projects from templates, add dependencies, and automate the resulting projects
https://volojs.github.io/
Other
1.41k stars 99 forks source link

Copy directory in addition to js file #92

Closed dshimkoski closed 12 years ago

dshimkoski commented 12 years ago

Assuming we have a module named X with the following contents:

- x.js
- x/subfileA
- x/subfileB
- doc/xyz.txt

And we run this command:

volo add ../module/x

The install directory will then contain:

- x.js
- x/subfileA
- x/subfileB

This way CSS, etc., can be modularized inside of directory x and we still get to use short module names without having to adjust require's package config.

jrburke commented 12 years ago

Directory copying is done if the package.json in the "module" directory has a "main" and that main module has local AMD dependency references, or if the package.json sets volo.type to be "directory".

If the project that receives the "add"'d dependency has "amd": {} in its package.json, then an adapter module "module.js" will be written out that points to the "main" module inside the "module" directory.

This approach means that there is no need for an additional requirejs config for a package.

Since there is a way to get this behavior, going to close this as already supported.

dshimkoski commented 12 years ago

Neato! I wasn't aware of the amd property trick. Will read the docs with my eyes plugged in next time. Thanks!