Skip to content

Commit

Permalink
updated gulpfile from v3 to v5 and fixed workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasfroeller committed Apr 29, 2024
1 parent 44ce591 commit 419a3ee
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 49 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ jobs:
file: Dockerfile
push: true
tags: |
propromo/rest-microservice:latest
ghcr.io/${{ github.repository_owner }}/propromo-rest-microservice:latest
registry.cloud.htl-leonding.ac.at/j.froeller/rest-microservice:latest
propromo/development-server:latest
ghcr.io/${{ github.repository_owner }}/propromo-development-server:latest
registry.cloud.htl-leonding.ac.at/j.froeller/development-server:latest
103 changes: 57 additions & 46 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,70 +1,81 @@
var gulp = require('gulp');
var tsc = require('gulp-tsc');
var shell = require('gulp-shell');
var runseq = require('run-sequence');
var gulp = require('gulp');
var tsc = require('gulp-tsc');
var shell = require('gulp-shell');
var tslint = require('gulp-tslint');
var babel = require('gulp-babel');
var babel = require('gulp-babel');

var paths = {
tscripts : { src : ['src/**/*.ts'],
dest: 'build'
},
jsscripts: {
src: ['src/**/*.js'],
dest: 'build'
}
tscripts: { src: ['src/**/*.ts'], dest: 'build' },
jsscripts: { src: ['src/**/*.js'], dest: 'build' },
};

gulp.task('default', ['lint', 'buildrun']);
function defaultTask(cb) {
gulp.series('lint', buildrunTask)(cb);
}

// ** Running ** //

gulp.task('run', shell.task([
'node build/index.js'
]));
function runTask() {
return shell.task([
'node build/index.js'
]);
}

gulp.task('buildrun', function (cb) {
runseq('build', 'run', cb);
});
function buildrunTask(cb) {
gulp.series('build', runTask)(cb);
}

// ** Watching ** //

gulp.task('watch', function () {
gulp.watch(paths.tscripts.src, ['compile']);
});
function watchTask() {
gulp.watch(paths.tscripts.src, compileTask);
}

gulp.task('watchrun', function () {
gulp.watch(paths.tscripts.src, runseq('compile', 'run'));
});
function watchrunTask() {
gulp.watch(paths.tscripts.src, gulp.series(compileTask, runTask));
}

// ** Compilation ** //

gulp.task('build', ['compile']);
gulp.task('compile', ['compile:typescript', 'compile:javascript']);
gulp.task('compile:typescript', function () {
function buildTask(cb) {
gulp.series(compileTypescriptTask, compileJavascriptTask)(cb);
}

function compileTask(cb) {
gulp.series(compileTypescriptTask, compileJavascriptTask)(cb);
}

function compileTypescriptTask() {
return gulp
.src(paths.tscripts.src)
.pipe(tsc({
module: "commonjs",
emitError: false
}))
.pipe(gulp.dest(paths.tscripts.dest));
});

gulp.task('compile:javascript', function () {
.src(paths.tscripts.src)
.pipe(tsc({
module: "commonjs",
emitError: false
}))
.pipe(gulp.dest(paths.tscripts.dest));
}

function compileJavascriptTask() {
return gulp
.src(paths.jsscripts.src)
.pipe(babel())
.pipe(gulp.dest(paths.jsscripts.dest));
});
}

// ** Linting ** //

gulp.task('lint', ['lint:default']);
gulp.task('lint:default', function(){
return gulp.src(paths.tscripts.src)
.pipe(tslint())
.pipe(tslint.report('prose', {
emitError: false
}));
});
function lintTask() {
return gulp.src(paths.tscripts.src)
.pipe(tslint())
.pipe(tslint.report('prose', {
emitError: false
}));
}

exports.default = defaultTask;
exports.lint = lintTask;
exports.compile = compileTask;
exports.build = buildTask;
exports.buildrun = buildrunTask;
exports.watch = watchTask;
exports.watchrun = watchrunTask;

0 comments on commit 419a3ee

Please sign in to comment.