Makefile.js
function generateDistFiles(config) {
	// Delete package.json from the cache since it can get updated by npm version
	delete require.cache[require.resolve('./package.json')];

	var pkg = require('./package.json'),
		distFilename = DIST_DIR + config.name + '.js',
		minDistFilename = distFilename.replace(/\.js$/, '.min.js'),
		minDistSourcemapFilename = minDistFilename + '.map',
		distTestingFilename = DIST_DIR + config.name + '-testing' + '.js';

	// Add copyrights and version info
	var versionComment = '/*! ' + config.name + ' v' + pkg.version + ' */\n',
		testingVersionComment = '/*! ' + config.name + '-testing v' + pkg.version + ' */\n',
		copyrightComment = cat('./config/copyright.txt');

	// concatenate files together and add version/copyright notices
	(versionComment + copyrightComment + cat(config.files)).to(distFilename);
	(testingVersionComment + copyrightComment + cat(config.testingFiles)).to(distTestingFilename);

	// create minified version with source maps
	var result = uglifyjs.minify(distFilename, {
		output: {
			comments: /^!/
		},
		outSourceMap: path.basename(minDistSourcemapFilename)
	});
	result.code.to(minDistFilename);
	result.map.to(minDistSourcemapFilename);

	// create filenames with version in them
	cp(distFilename, distFilename.replace('.js', '-' + pkg.version + '.js'));
	cp(minDistFilename, minDistFilename.replace('.min.js', '-' + pkg.version + '.min.js'));
	cp(distTestingFilename, distTestingFilename.replace('.js', '-' + pkg.version + '.js'));
}
function generateDistFiles(config) {
	// Delete package.json from the cache since it can get updated by npm version
	delete require.cache[require.resolve('./package.json')];

	var pkg = require('./package.json'),
		distFilename = DIST_DIR + config.name + '.js',
		minDistFilename = distFilename.replace(/\.js$/, '.min.js'),
		minDistSourcemapFilename = minDistFilename + '.map',
		distTestingFilename = DIST_DIR + config.name + '-testing' + '.js';

	// Add copyrights and version info
	var versionComment = '/*! ' + config.name + ' v' + pkg.version + ' */\n',
		testingVersionComment = '/*! ' + config.name + '-testing v' + pkg.version + ' */\n',
		copyrightComment = cat('./config/copyright.txt');

	// concatenate files together and add version/copyright notices
	(versionComment + copyrightComment + cat(config.files)).to(distFilename);
	(testingVersionComment + copyrightComment + cat(config.testingFiles)).to(distTestingFilename);

	// create minified version with source maps
	var result = uglifyjs.minify(distFilename, {
		output: {
			comments: /^!/
		},
		outSourceMap: path.basename(minDistSourcemapFilename)
	});
	result.code.to(minDistFilename);
	result.map.to(minDistSourcemapFilename);

	// create filenames with version in them
	cp(distFilename, distFilename.replace('.js', '-' + pkg.version + '.js'));
	cp(minDistFilename, minDistFilename.replace('.min.js', '-' + pkg.version + '.min.js'));
	cp(distTestingFilename, distTestingFilename.replace('.js', '-' + pkg.version + '.js'));
}
function generateDistFiles ( config ) { // Delete package.json from the cache since it can get updated by npm version delete require . cache [ require . resolve ( './package.json' ) ] ; var pkg = require ( './package.json' ) , distFilename = DIST_DIR + config . name + '.js' , minDistFilename = distFilename . replace ( / \.js$ / , '.min.js' ) , minDistSourcemapFilename = minDistFilename + '.map' , distTestingFilename = DIST_DIR + config . name + '-testing' + '.js' ; // Add copyrights and version info var versionComment = '/*! ' + config . name + ' v' + pkg . version + ' */\n' , testingVersionComment = '/*! ' + config . name + '-testing v' + pkg . version + ' */\n' , copyrightComment = cat ( './config/copyright.txt' ) ; // concatenate files together and add version/copyright notices ( versionComment + copyrightComment + cat ( config . files ) ) . to ( distFilename ) ; ( testingVersionComment + copyrightComment + cat ( config . testingFiles ) ) . to ( distTestingFilename ) ; // create minified version with source maps var result = uglifyjs . minify ( distFilename , { output : { comments : / ^! / } , outSourceMap : path . basename ( minDistSourcemapFilename ) } ) ; result . code . to ( minDistFilename ) ; result . map . to ( minDistSourcemapFilename ) ; // create filenames with version in them cp ( distFilename , distFilename . replace ( '.js' , '-' + pkg . version + '.js' ) ) ; cp ( minDistFilename , minDistFilename . replace ( '.min.js' , '-' + pkg . version + '.min.js' ) ) ; cp ( distTestingFilename , distTestingFilename . replace ( '.js' , '-' + pkg . version + '.js' ) ) ; }
Generate distribution files for a single package
@param Object config The distribution configuration
@returns {void}
@private
Generate distribution files for a single package