refact(Gruntfile.js): Use grunt-mkdir to create the dist folder ;
This commit is contained in:
20
Gruntfile.js
20
Gruntfile.js
@@ -19,11 +19,6 @@ module.exports = function(grunt) {
|
|||||||
javaTestFiles: 'org.junit.runner.JUnitCore com.facebook.csslayout.LayoutEngineTest com.facebook.csslayout.LayoutCachingTest com.facebook.csslayout.CSSNodeTest'
|
javaTestFiles: 'org.junit.runner.JUnitCore com.facebook.csslayout.LayoutEngineTest com.facebook.csslayout.LayoutCachingTest com.facebook.csslayout.CSSNodeTest'
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create the dist folder if it doesn't exist. It is deleted by the 'clean' task.
|
|
||||||
if (!fs.existsSync(config.distFolder)){
|
|
||||||
fs.mkdirSync(config.distFolder);
|
|
||||||
}
|
|
||||||
|
|
||||||
// C compilation configuration
|
// C compilation configuration
|
||||||
if (isWindows) {
|
if (isWindows) {
|
||||||
// Windows build, assumes cl is in the path (see https://msdn.microsoft.com/en-us/library/f2ccy3wt.aspx).
|
// Windows build, assumes cl is in the path (see https://msdn.microsoft.com/en-us/library/f2ccy3wt.aspx).
|
||||||
@@ -41,9 +36,16 @@ module.exports = function(grunt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
grunt.initConfig({
|
grunt.initConfig({
|
||||||
|
|
||||||
config: config,
|
config: config,
|
||||||
|
|
||||||
|
mkdir: {
|
||||||
|
dist: {
|
||||||
|
options: {
|
||||||
|
create: ['<%= config.distFolder %>']
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
clean: {
|
clean: {
|
||||||
dist: ['<%= config.distFolder %>'],
|
dist: ['<%= config.distFolder %>'],
|
||||||
cTest: config.cTestClean,
|
cTest: config.cTestClean,
|
||||||
@@ -163,13 +165,13 @@ module.exports = function(grunt) {
|
|||||||
grunt.registerTask('test-javascript', ['eslint', 'karma']);
|
grunt.registerTask('test-javascript', ['eslint', 'karma']);
|
||||||
|
|
||||||
// Packages the JavaScript as a single UMD module and minifies
|
// Packages the JavaScript as a single UMD module and minifies
|
||||||
grunt.registerTask('package-javascript', ['includereplace', 'uglify']);
|
grunt.registerTask('package-javascript', ['mkdir:dist', 'includereplace', 'uglify']);
|
||||||
|
|
||||||
// Packages the Java as a JAR
|
// Packages the Java as a JAR
|
||||||
grunt.registerTask('package-java', ['shell:javaPackage']);
|
grunt.registerTask('package-java', ['mkdir:dist', 'shell:javaPackage']);
|
||||||
|
|
||||||
// Packages the C code as a single header
|
// Packages the C code as a single header
|
||||||
grunt.registerTask('package-c', ['concat']);
|
grunt.registerTask('package-c', ['mkdir:dist', 'concat']);
|
||||||
|
|
||||||
// Default build, performs the full works!
|
// Default build, performs the full works!
|
||||||
grunt.registerTask('build', ['test-javascript', 'transpile', 'clean:dist', 'package-javascript', 'package-java', 'package-c']);
|
grunt.registerTask('build', ['test-javascript', 'transpile', 'clean:dist', 'package-javascript', 'package-java', 'package-c']);
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
"grunt-execute": "^0.2.2",
|
"grunt-execute": "^0.2.2",
|
||||||
"grunt-include-replace": "^3.1.0",
|
"grunt-include-replace": "^3.1.0",
|
||||||
"grunt-karma": "^0.12.0",
|
"grunt-karma": "^0.12.0",
|
||||||
|
"grunt-mkdir": "^0.1.2",
|
||||||
"grunt-shell": "^1.1.2",
|
"grunt-shell": "^1.1.2",
|
||||||
"jasmine-core": "^2.2.0",
|
"jasmine-core": "^2.2.0",
|
||||||
"karma": "^0.13.8",
|
"karma": "^0.13.8",
|
||||||
|
Reference in New Issue
Block a user