mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 05:37:34 +03:00
Merge pull request #6119 from boennemann/chore-grunt-release
Dynamically build file patterns for release task
This commit is contained in:
commit
ac53fc9c3f
44
Gruntfile.js
44
Gruntfile.js
@ -21,23 +21,6 @@ var _ = require('lodash'),
|
||||
mochaPath = path.resolve(cwd + '/node_modules/grunt-mocha-cli/node_modules/mocha/bin/mocha'),
|
||||
emberPath = path.resolve(cwd + '/core/client/node_modules/.bin/ember'),
|
||||
|
||||
// ## Build File Patterns
|
||||
// A list of files and patterns to include when creating a release zip.
|
||||
// This is read from the `.npmignore` file and all patterns are inverted as the `.npmignore`
|
||||
// file defines what to ignore, whereas we want to define what to include.
|
||||
buildGlob = (function () {
|
||||
/*jslint stupid:true */
|
||||
return fs.readFileSync('.npmignore', {encoding: 'utf8'}).split('\n').map(function (pattern) {
|
||||
if (pattern[0] === '!') {
|
||||
return pattern.substr(1);
|
||||
}
|
||||
return '!' + pattern;
|
||||
}).filter(function (pattern) {
|
||||
// Remove empty patterns
|
||||
return pattern !== '!';
|
||||
});
|
||||
}()),
|
||||
|
||||
// ## Grunt configuration
|
||||
|
||||
configureGrunt = function (grunt) {
|
||||
@ -402,16 +385,6 @@ var _ = require('lodash'),
|
||||
}
|
||||
},
|
||||
|
||||
// ### grunt-contrib-copy
|
||||
// Copy files into their correct locations as part of building assets, or creating release zips
|
||||
copy: {
|
||||
release: {
|
||||
expand: true,
|
||||
src: buildGlob,
|
||||
dest: '<%= paths.releaseBuild %>/'
|
||||
}
|
||||
},
|
||||
|
||||
// ### grunt-contrib-compress
|
||||
// Zip up files for builds / releases
|
||||
compress: {
|
||||
@ -928,7 +901,22 @@ var _ = require('lodash'),
|
||||
' - Copy files to release-folder/#/#{version} directory\n' +
|
||||
' - Clean out unnecessary files (travis, .git*, etc)\n' +
|
||||
' - Zip files in release-folder to dist-folder/#{version} directory',
|
||||
['init', 'shell:ember:prod', 'clean:release', 'shell:dedupe', 'shell:shrinkwrap', 'copy:release', 'compress:release']);
|
||||
function () {
|
||||
grunt.config.set('copy.release', {
|
||||
expand: true,
|
||||
// #### Build File Patterns
|
||||
// A list of files and patterns to include when creating a release zip.
|
||||
// This is read from the `.npmignore` file and all patterns are inverted as the `.npmignore`
|
||||
// file defines what to ignore, whereas we want to define what to include.
|
||||
src: fs.readFileSync('.npmignore', 'utf8').split('\n').filter(Boolean).map(function (pattern) {
|
||||
return pattern[0] === '!' ? pattern.substr(1) : '!' + pattern;
|
||||
}),
|
||||
dest: '<%= paths.releaseBuild %>/'
|
||||
});
|
||||
|
||||
grunt.task.run(['init', 'shell:ember:prod', 'clean:release', 'shell:dedupe', 'shell:shrinkwrap', 'copy:release', 'compress:release']);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
module.exports = configureGrunt;
|
||||
|
Loading…
Reference in New Issue
Block a user