diff --git a/Build/Gruntfile.js b/Build/Gruntfile.js index 1c3ac0f3a3ea83fbc5bab3fcba2b4f72e90ec369..4ab01d6b2f5c2784694d02e9c867c89e3d8848d7 100644 --- a/Build/Gruntfile.js +++ b/Build/Gruntfile.js @@ -454,11 +454,6 @@ module.exports = function (grunt) { ] } }, - newer: { - options: { - cache: './.cache/grunt-newer/' - } - }, npmcopy: { options: { clean: false, @@ -643,7 +638,6 @@ module.exports = function (grunt) { grunt.loadNpmTasks('grunt-exec'); grunt.loadNpmTasks('grunt-eslint'); grunt.loadNpmTasks('grunt-stylelint'); - grunt.loadNpmTasks('grunt-newer'); grunt.loadNpmTasks('grunt-concurrent'); /** @@ -668,7 +662,7 @@ module.exports = function (grunt) { * - sass * - postcss */ - grunt.registerTask('css', ['exec:stylefix', 'sass', 'newer:postcss']); + grunt.registerTask('css', ['exec:stylefix', 'sass', 'postcss']); /** * grunt update task @@ -686,10 +680,11 @@ module.exports = function (grunt) { * call "$ grunt compile-typescript" * * This task does the following things: - * - 1) Check all TypeScript files (*.ts) with ESLint which are located in sysext/<EXTKEY>/Resources/Private/TypeScript/*.ts - * - 2) Compiles all TypeScript files (*.ts) which are located in sysext/<EXTKEY>/Resources/Private/TypeScript/*.ts + * - 1) Remove previously built JS files from local JavaScript directory + * - 2) Check all TypeScript files (*.ts) with ESLint which are located in Sources/TypeScript/<EXTKEY>/*.ts + * - 3) Compiles all TypeScript files (*.ts) which are located in Sources/TypeScript/<EXTKEY>/*.ts */ - grunt.registerTask('compile-typescript', ['tsconfig', 'eslint', 'exec:ts']); + grunt.registerTask('compile-typescript', ['clear-built-js', 'tsconfig', 'eslint', 'exec:ts']); grunt.registerTask('copy-lit', ['es-module-lexer-init', 'copy:lit']); @@ -703,7 +698,7 @@ module.exports = function (grunt) { * - 2) Copy all generated JavaScript files to public folders * - 3) Minify build */ - grunt.registerTask('scripts', ['compile-typescript', 'newer:terser:typescript', 'es-module-lexer-init', 'newer:copy:ts_files']); + grunt.registerTask('scripts', ['compile-typescript', 'terser:typescript', 'es-module-lexer-init', 'copy:ts_files']); /** * grunt clear-build task @@ -712,10 +707,24 @@ module.exports = function (grunt) { * * Removes all build-related assets, e.g. cache and built files */ - grunt.registerTask('clear-build', function () { - grunt.option('force'); - grunt.file.delete('.cache'); - grunt.file.delete('JavaScript'); + grunt.registerTask('clear-build', ['clear-build-cache', 'clear-built-js']); + + /** + * Removes build-related caching information + */ + grunt.registerTask('clear-build-cache', function () { + if (grunt.file.isDir('.cache')) { + grunt.file.delete('.cache'); + } + }); + + /** + * Removes build JavaScript files (incorporated altogether with TypeScript compilations) + */ + grunt.registerTask('clear-built-js', function () { + if (grunt.file.isDir('JavaScript')) { + grunt.file.delete('JavaScript'); + } }); /** diff --git a/Build/package-lock.json b/Build/package-lock.json index 800eb8497a72b4a137a5cdab81139af9e4921fd1..e207717673ff7937afb648cccd009a1654fc50cf 100644 --- a/Build/package-lock.json +++ b/Build/package-lock.json @@ -121,7 +121,6 @@ "grunt-contrib-watch": "~1.1.0", "grunt-eslint": "^24.3.0", "grunt-exec": "^3.0.0", - "grunt-newer": "^1.3.0", "grunt-npmcopy": "^0.2.0", "grunt-sass": "^3.1.0", "grunt-stylelint": "^0.18.0", @@ -5436,13 +5435,6 @@ "node": ">=8" } }, - "node_modules/async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", - "dev": true, - "license": "MIT" - }, "node_modules/async-mutex": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/async-mutex/-/async-mutex-0.4.0.tgz", @@ -8692,36 +8684,6 @@ "node": ">= 8" } }, - "node_modules/grunt-newer": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/grunt-newer/-/grunt-newer-1.3.0.tgz", - "integrity": "sha1-g8y3od2ny9irI7BZAk6+YUrS80I=", - "dev": true, - "license": "MIT", - "dependencies": { - "async": "^1.5.2", - "rimraf": "^2.5.2" - }, - "engines": { - "node": ">= 0.8.0" - }, - "peerDependencies": { - "grunt": ">=0.4.1" - } - }, - "node_modules/grunt-newer/node_modules/rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dev": true, - "license": "ISC", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - } - }, "node_modules/grunt-npmcopy": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/grunt-npmcopy/-/grunt-npmcopy-0.2.0.tgz", diff --git a/Build/package.json b/Build/package.json index 6cd571b59956ec5a6b9e67c967d2c74346c50896..f99ee8d668bb5de12f1d942b2b46232b2befa562 100644 --- a/Build/package.json +++ b/Build/package.json @@ -48,7 +48,6 @@ "grunt-contrib-watch": "~1.1.0", "grunt-eslint": "^24.3.0", "grunt-exec": "^3.0.0", - "grunt-newer": "^1.3.0", "grunt-npmcopy": "^0.2.0", "grunt-sass": "^3.1.0", "grunt-stylelint": "^0.18.0",