Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix issue #19

  • Loading branch information...
commit 797e99eb5f2a57c64f47e2a67abf7679b42c8aa7 1 parent 6aff2ca
@azer authored
View
1  example-project/node_modules/dependency/node_modules/vehicles/index.js
@@ -0,0 +1 @@
+module.exports = require('./lib/vehicles');
View
1  example-project/node_modules/dependency/node_modules/vehicles/lib/vehicles.js
@@ -0,0 +1 @@
+module.exports = ['car', 'boat', 'truck'];
View
5 example-project/node_modules/dependency/node_modules/vehicles/package.json
@@ -0,0 +1,5 @@
+{
+ "name":"vehicles",
+ "directories":{ "lib":"./lib" },
+ "main":"index"
+}
View
3  example-project/node_modules/dependency/package.json
@@ -5,7 +5,8 @@
"subdependency":"*",
"fruits":"*",
"sibling":"*",
- "vegetables":"*"
+ "vegetables":"*",
+ "vehicles":"*"
},
"main":"lib/f"
}
View
15 lib/manifest.js
@@ -36,6 +36,19 @@ function find(packageName, workingdir, callback){
});
}
+function fix(manifest){
+
+ var lib = manifest.directories && manifest.directories.lib,
+ main = manifest.main;
+
+ if( lib && main && ( main.substring(0, lib.length) != lib && ( './' + main ).substring(0, lib.length) != lib ) ){
+ delete manifest.directories.lib;
+ }
+
+ return manifest;
+
+}
+
function read(filename, callback){
logging.debug('Reading the manifest @ "%s"', filename);
@@ -63,7 +76,7 @@ function read(filename, callback){
}
- callback(error, manifest);
+ callback(error, fix(manifest));
});
View
2  lib/modules.js
@@ -149,8 +149,10 @@ function modules(pkg, options, callback){
lib = join('lib');
if(pkg.dirs && pkg.dirs.lib){
+
base = join(pkg.dirs.lib);
dirs.push(base);
+
} else if (pkg.manifest.main) {
base = pkg.wd;
View
10 lib/package.js
@@ -156,7 +156,14 @@ function main(options, buildOptions, callback){
return;
}
- construct({ 'manifest': manifestObj, 'ignore':options.ignore, 'wd': path.normalize(path.dirname(manifestPath)), 'parents': options.parents, 'parent': options.parent }, function(error, pkgobj){
+ var constructOptions = {
+ 'manifest': manifestObj,
+ 'ignore':options.ignore,
+ 'wd': path.normalize(path.dirname(manifestPath)),
+ 'parents': options.parents, 'parent': options.parent
+ };
+
+ construct(constructOptions, function(error, pkgobj){
if(error){
callback(error);
@@ -174,4 +181,3 @@ module.exports = main;
module.exports.id = id();
module.exports.content = content;
module.exports.construct = construct;
-
View
6 package.json
@@ -1,6 +1,6 @@
{
"name":"one",
- "version":"1.7.8",
+ "version":"1.7.9",
"description":"Transform NodeJS packages into single stand-alone script files.",
"author":"Azer Koculu <azer@kodfabrik.com>",
"keywords":["build","commonjs","browser"],
@@ -15,11 +15,13 @@
"optimist":"0.x",
"combiner":"1.2.x",
"mustache":"0.x",
- "highkick":"1.x",
"log4js":"0.4.1",
"genpkg":"0.x",
"boxcars":"0.x"
},
+ "devDependencies":{
+ "highkick":"1.x"
+ },
"scripts":{
"test":"./node_modules/highkick/bin/highkick test/main.js"
}
View
1  test/build.js
@@ -108,6 +108,7 @@ function test_moduleCtx(mod, callback){
assertListContent(mod.packages.fruits.index.call(), ['apple', 'orange']);
assertListContent(mod.packages.vegetables.index.call(), ['tomato', 'potato']);
+ assertListContent(mod.packages.vehicles.index.call(), ['car', 'boat', 'truck']);
callback();
}
View
7 test/package.js
@@ -142,7 +142,7 @@ function testContent(callback){
pkgdict = Object.keys(pkg.pkgdict);
- assert.equal(pkgdict.length, 7);
+ assert.equal(pkgdict.length, 8);
assert.equal(pkgdict[0], 'example-project');
assert.equal(pkgdict[1], 'dependency');
@@ -150,7 +150,8 @@ function testContent(callback){
assert.equal(pkgdict[3], 'fruits');
assert.equal(pkgdict[4], 'sibling');
assert.equal(pkgdict[5], 'vegetables');
- assert.equal(pkgdict[6], 'assert');
+ assert.equal(pkgdict[6], 'vehicles');
+ assert.equal(pkgdict[7], 'assert');
assert.ok(assertListContent( moduleFilenames(pkg.modules), ['web.js', 'a.js', 'b.js']));
@@ -162,6 +163,8 @@ function testContent(callback){
assert.ok(assertListContent( moduleFilenames(pkg.pkgdict.vegetables.modules ), ['lib/index.js']));
+ assert.ok(assertListContent( moduleFilenames(pkg.pkgdict.vehicles.modules ), ['index.js', 'lib/vehicles.js']));
+
assert.ok(assertListContent( moduleFilenames(pkg.pkgdict.sibling.modules), ['p/index.js', 'p/r.js', 's/t.js', 'n.js']));
callback();
Please sign in to comment.
Something went wrong with that request. Please try again.