Permalink
Browse files

fix issue #19

  • Loading branch information...
azer committed Jul 26, 2012
1 parent 6aff2ca commit 797e99eb5f2a57c64f47e2a67abf7679b42c8aa7

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -142,15 +142,16 @@ 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');
assert.equal(pkgdict[2], 'subdependency');
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();

0 comments on commit 797e99e

Please sign in to comment.