Improvements to UMD bundle step
MODIFY
build-config/RequireJS_config_umd-bundle.js
build-config/RequireJS_config_umd-bundle.js
@@ -20,7 +20,7 @@ require.config({
include: ['readium_shared_js/globalsSetup', 'readium_js_plugins', 'readium_shared_js/views/reader_view'],
// relative to this config file (not baseUrl)
- out: "../build-output/_umd-bundle/readium-shared-js.js",
+ out: "../build-output/_umd-bundle-tmp/readium-shared-js.js",
paths: {
"readium-shared-js_all": process._RJS_rootDir(0) + '/build-config/module_exports'

MODIFY
readium-build-tools/RequireJS_function_umd-bundle_complete.js
readium-build-tools/RequireJS_function_umd-bundle_complete.js
@@ -15,6 +15,7 @@ function (data) {
console.log("========> onModuleBundleComplete [amdclean]");
var fs = module.require('fs');
var path = module.require('path');
+ var rimraf = module.require('rimraf');
var outputPath = path.dirname(data.path);
var outputFileName = path.basename(data.path);
var rootPath = path.resolve(outputPath, '../../');
@@ -32,11 +33,14 @@ function (data) {
return '_' + postNormalizedModuleName;
}
});
- cleanedCode = fs.readFileSync(configDir + '/npm_wrapper_start.template')
- + '\n' + cleanedCode + '\nreturn _' + data.name.replace(/-/g, '_') + ';\n'
- + fs.readFileSync(configDir + '/npm_wrapper_end.template');
- fs.writeFileSync(outputFile, cleanedCode);
- fs.unlinkSync(outputFile + '.map'); // Delete the source map, as it is incompatible :(
+ cleanedCode = fs.readFileSync(configDir + '/umd_wrapper_start.template') +
+ '\n' + cleanedCode + '\nreturn _' + data.name.replace(/-/g, '_') + ';\n' +
+ fs.readFileSync(configDir + '/umd_wrapper_end.template');
+ var cleanedOutputPath = path.resolve(outputPath, '../_umd-bundle');
+ fs.mkdirSync(cleanedOutputPath);
+ fs.writeFileSync(path.join(cleanedOutputPath, outputFileName), cleanedCode);
+ //fs.unlinkSync(outputFile + '.map'); // Delete the source map, as it is incompatible :(
+ rimraf.sync(outputPath); // Delete the original path as it was temporary
- console.log("done");
+ console.log("UMD bundle created.");
}

RENAME
readium-build-tools/npm_wrapper_end.template
readium-build-tools/umd_wrapper_end.template
RENAME
readium-build-tools/npm_wrapper_start.template
readium-build-tools/umd_wrapper_start.template
} else if (typeof module === 'object' && module.exports) {
module.exports = factory();
} else {
- factory();
+ root.readiumSharedJs = factory();
}
}(typeof self !== 'undefined' ? self : this, function () {
\ No newline at end of file

Improvements to UMD bundle step