Skip to content

Commit

Permalink
Reporting for global deps on 'combined' is more informative
Browse files Browse the repository at this point in the history
  • Loading branch information
anodynos committed Feb 5, 2013
1 parent d671b4b commit 72019fe
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 18 deletions.
6 changes: 3 additions & 3 deletions build/code/DependenciesReporter.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions build/code/process/Bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/code/process/UModule.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions build/code/urequireCmd.js
@@ -1,8 +1,8 @@
#!/usr/bin/env node #!/usr/bin/env node


/*! /*!
* urequire - version 0.3.0alpha19 * urequire - version 0.3.0alpha20
* Compiled on 2013-02-04 * Compiled on 2013-02-05
* git://github.com/anodynos/urequire * git://github.com/anodynos/urequire
* Copyright(c) 2013 Agelos Pikoulas (agelos.pikoulas@gmail.com ) * Copyright(c) 2013 Agelos Pikoulas (agelos.pikoulas@gmail.com )
* Licensed MIT http://www.opensource.org/licenses/mit-license.php * Licensed MIT http://www.opensource.org/licenses/mit-license.php
Expand Down
2 changes: 1 addition & 1 deletion build/code/utils/Logger.js
@@ -1,4 +1,4 @@
var VERSION = '0.3.0alpha19'; //injected by grunt:concat var VERSION = '0.3.0alpha20'; //injected by grunt:concat


// Generated by CoffeeScript 1.4.0 // Generated by CoffeeScript 1.4.0
var Logger, _, var Logger, _,
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{ {
"name": "urequire", "name": "urequire",
"description": "Module converter: write modular code once, convert to UMD and run/test on AMD (browser/requirejs) & nodejs.", "description": "Module converter: write modular code once, convert to UMD and run/test on AMD (browser/requirejs) & nodejs.",
"version": "0.3.0alpha19", "version": "0.3.0alpha20",
"homepage": "https://github.com/anodynos/urequire", "homepage": "https://github.com/anodynos/urequire",
"author": { "author": {
"name": "Agelos Pikoulas", "name": "Agelos Pikoulas",
Expand Down
9 changes: 6 additions & 3 deletions source/code/DependenciesReporter.coffee
Expand Up @@ -27,8 +27,11 @@ class DependenciesReporter
DT = Dependency.TYPES DT = Dependency.TYPES
_B.okv dependencyTypesMessages, _B.okv dependencyTypesMessages,
DT.global, DT.global,
header: "Global-looking dependencies (not checked in this version):" header: "Global-looking dependencies (those without fileRelative (eg `./`) & not present in bundle's root):"
footer: "They are added as-is." footer: """
Note: When executing on plain nodejs, globals are `require`d as is.
When executing on Web/AMD or uRequire/UMD they use `rjs.baseUrl`/`rjs.paths`, if present.
"""


DT.notFoundInBundle, DT.notFoundInBundle,
header: "\u001b[31m Bundle-looking dependencies not found in bundle:", header: "\u001b[31m Bundle-looking dependencies not found in bundle:",
Expand All @@ -46,7 +49,7 @@ class DependenciesReporter


reportTemplate: (texts, dependenciesFound)-> """ reportTemplate: (texts, dependenciesFound)-> """
\n#{texts.header} \n#{texts.header}
#{ "'#{dependency}' @ [ #{ "'#{dependency}' dependendency appears in modules: [
#{("\n '" + #{("\n '" +
mf + "'" for mf in moduleFiles)}\n ]\n" for dependency, moduleFiles of dependenciesFound mf + "'" for mf in moduleFiles)}\n ]\n" for dependency, moduleFiles of dependenciesFound
}#{ }#{
Expand Down
24 changes: 20 additions & 4 deletions source/code/process/Bundle.coffee
Expand Up @@ -146,9 +146,9 @@ class Bundle extends BundleBase
@build.out uModule.modulePath, uModule.convertedJs @build.out uModule.modulePath, uModule.convertedJs
# @todo:5 else if String, output to this file ? # @todo:5 else if String, output to this file ?


report = @reporter.getReport(@build.interestingDepTypes) report = @reporter.getReport @build.interestingDepTypes
if not _.isEmpty(report) if not _.isEmpty(report)
l.log '\n########### urequire, final report ########### :\n', report l.log 'Report for this `build`:\n', report


if @build.template.name is 'combined' if @build.template.name is 'combined'
if haveChanges if haveChanges
Expand All @@ -158,7 +158,7 @@ class Bundle extends BundleBase
else else
@build.done true @build.done true


getRequireJSConfig: ()-> #@todo: remove & fix this! getRequireJSConfig: ()-> #@todo:(7 5 2) remove & fix this!
paths: paths:
text: "requirejs_plugins/text" text: "requirejs_plugins/text"
json: "requirejs_plugins/json" json: "requirejs_plugins/json"
Expand Down Expand Up @@ -293,7 +293,23 @@ class Bundle extends BundleBase
setTimeout (=> setTimeout (=>
l.debug 60, 'Checking r.js output file...' l.debug 60, 'Checking r.js output file...'
if _fs.existsSync build.combinedFile if _fs.existsSync build.combinedFile
l.verbose "Combined file '#{build.combinedFile}' written successfully." l.log "Combined file '#{build.combinedFile}' written successfully."

if not _.isEmpty(@getDepsVars depType:'global')
l.log """
Global bindinds: make sure the following global dependencies
#{l.prettify @getDepsVars depType:'global'}
are available when combined script '#{build.combinedFile}' is running on:
a) nodejs: they should exist as a local `nodes_modules`.
b) Web/AMD: they should be declared as `rjs.paths` (or `rjs.baseUrl`)
c) Web/Script: the binded variables (eg '_' or '$')
must be a globally loaded (i.e `window.$`) BEFORE loading '#{build.combinedFile}'
"""


# delete outputPath, used as temp directory with individual AMD files # delete outputPath, used as temp directory with individual AMD files
if Logger::debugLevel < 50 if Logger::debugLevel < 50
Expand Down
2 changes: 1 addition & 1 deletion source/code/process/UModule.coffee
Expand Up @@ -126,7 +126,7 @@ class UModule


# add remaining dependencies (eg 'untrustedRequireDependencies') to DependenciesReport # add remaining dependencies (eg 'untrustedRequireDependencies') to DependenciesReport
if @bundle.reporter if @bundle.reporter
for repData in [ (_.pick @moduleInfo, @bundle.reporter.interestingDepTypes) ] for repData in [ (_.pick @moduleInfo, @bundle.reporter.reportedDepTypes) ]
@bundle.reporter.addReportData repData, @modulePath @bundle.reporter.addReportData repData, @modulePath


# our final 'templateInfo' information follows # our final 'templateInfo' information follows
Expand Down

0 comments on commit 72019fe

Please sign in to comment.