Update gulpfile.js
Fixed gulpfile syntax for newer systems
This commit is contained in:
parent
9d2a6813c9
commit
91318c4e09
|
@ -10,43 +10,45 @@ build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not came
|
||||||
// Stefan rocks!
|
// Stefan rocks!
|
||||||
let syncVersionsSubtask = build.subTask('version-sync', function (gulp, buildOptions, done) {
|
let syncVersionsSubtask = build.subTask('version-sync', function (gulp, buildOptions, done) {
|
||||||
this.log('Synching versions');
|
this.log('Synching versions');
|
||||||
|
|
||||||
// import gulp utilits to write error messages
|
// import gulp utilits to write error messages
|
||||||
const gutil = require('gulp-util');
|
const gutil = require('gulp-util');
|
||||||
|
|
||||||
// import file system utilities form nodeJS
|
// import file system utilities form nodeJS
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
// read package.json
|
// read package.json
|
||||||
var pkgConfig = require('./package.json');
|
var pkgConfig = require('./package.json');
|
||||||
|
|
||||||
// read configuration of web part solution file
|
// read configuration of web part solution file
|
||||||
var pkgSolution = require('./config/package-solution.json');
|
var pkgSolution = require('./config/package-solution.json');
|
||||||
|
|
||||||
// log old version
|
// log old version
|
||||||
this.log('package-solution.json version:\t' + pkgSolution.solution.version);
|
this.log('package-solution.json version:\t' + pkgSolution.solution.version);
|
||||||
|
|
||||||
// Generate new MS compliant version number
|
// Generate new MS compliant version number
|
||||||
var newVersionNumber = pkgConfig.version.split('-')[0] + '.0';
|
var newVersionNumber = pkgConfig.version.split('-')[0] + '.0';
|
||||||
|
|
||||||
if (pkgSolution.solution.version !== newVersionNumber) {
|
if (pkgSolution.solution.version !== newVersionNumber) {
|
||||||
// assign newly generated version number to web part version
|
// assign newly generated version number to web part version
|
||||||
pkgSolution.solution.version = newVersionNumber;
|
pkgSolution.solution.version = newVersionNumber;
|
||||||
|
|
||||||
// log new version
|
// log new version
|
||||||
this.log('New package-solution.json version:\t' + pkgSolution.solution.version);
|
this.log('New package-solution.json version:\t' + pkgSolution.solution.version);
|
||||||
|
|
||||||
// write changed package-solution file
|
fs.writeFile('./config/package-solution.json', JSON.stringify(pkgSolution, null, 4), function (err, result) {
|
||||||
fs.writeFile('./config/package-solution.json', JSON.stringify(pkgSolution, null, 4));
|
if (err) this.log('error', err);
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.log('package-solution.json version is up-to-date');
|
this.log('package-solution.json version is up-to-date');
|
||||||
}
|
}
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
let syncVersionTask = build.task('version-sync', syncVersionsSubtask);
|
let syncVersionTask = build.task('version-sync', syncVersionsSubtask);
|
||||||
build.rig.addPreBuildTask(syncVersionTask);
|
build.rig.addPreBuildTask(syncVersionTask);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue