Skip to content

Commit 740d539

Browse files
committed
Fixes requirejs#95, allows name= on command line if appDir/baseUrl are in play.
1 parent 0e27ee8 commit 740d539

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

build/jslib/build.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -723,10 +723,11 @@ function (lang, logger, file, parse, optimize, pragma,
723723
' or baseUrl directories optimized.');
724724
}
725725

726-
if (config.out && !config.cssIn) {
727-
//Just one file to optimize.
728-
729-
//Set up dummy module layer to build.
726+
if (config.name && !config.modules) {
727+
//Just need to build one file, but may be part of a whole appDir/
728+
//baseUrl copy, but specified on the command line, so cannot do
729+
//the modules array setup. So create a modules section in that
730+
//case.
730731
config.modules = [
731732
{
732733
name: config.name,
@@ -736,6 +737,10 @@ function (lang, logger, file, parse, optimize, pragma,
736737
excludeShallow: config.excludeShallow
737738
}
738739
];
740+
}
741+
742+
if (config.out && !config.cssIn) {
743+
//Just one file to optimize.
739744

740745
//Does not have a build file, so set up some defaults.
741746
//Optimizing CSS should not be allowed, unless explicitly

build/tests/builds.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,30 @@ define(['build', 'env!env/file'], function (build, file) {
143143
);
144144
doh.run();
145145

146+
147+
doh.register("buildSimpleCommandLineName",
148+
[
149+
function buildSimpleCommandLineName(t) {
150+
//Do the build
151+
build([
152+
"baseUrl=../../../requirejs/tests",
153+
"optimize=none",
154+
"dir=builds/simpleCommandLineName",
155+
"name=one",
156+
"include=dimple"
157+
]);
158+
159+
t.is(nol(oneResult), nol(c("builds/simpleCommandLineName/one.js")));
160+
161+
//Reset require internal state for the contexts so future
162+
//builds in these tests will work correctly.
163+
require._buildReset();
164+
}
165+
]
166+
);
167+
doh.run();
168+
169+
146170
doh.register("buildExcludeShallow",
147171
[
148172
function buildExcludeShallow(t) {

0 commit comments

Comments
 (0)