better hygiene task definition

This commit is contained in:
João Moreno 2021-01-06 21:21:51 +01:00
parent af6d164f73
commit 271d9b8c00

View file

@ -37,18 +37,18 @@ function checkPackageJSON(actualPath) {
const rootPackageJSON = require('../package.json');
const checkIncluded = (set1, set2) => {
for (let depName in set1) {
const depVersion = set1[depName];
const rootDepVersion = set2[depName];
if (!rootDepVersion) {
// missing in root is allowed
continue;
}
if (depVersion !== rootDepVersion) {
this.emit(
'error',
`The dependency ${depName} in '${actualPath}' (${depVersion}) is different than in the root package.json (${rootDepVersion})`
);
}
const depVersion = set1[depName];
const rootDepVersion = set2[depName];
if (!rootDepVersion) {
// missing in root is allowed
continue;
}
if (depVersion !== rootDepVersion) {
this.emit(
'error',
`The dependency ${depName} in '${actualPath}' (${depVersion}) is different than in the root package.json (${rootDepVersion})`
);
}
}
};
@ -67,7 +67,5 @@ const checkPackageJSONTask = task.define('check-package-json', () => {
});
gulp.task(checkPackageJSONTask);
gulp.task(
'hygiene',
task.series(checkPackageJSONTask, () => hygiene())
);
const hygieneTask = task.define('hygiene', task.series(checkPackageJSONTask, () => hygiene()));
gulp.task(hygieneTask);