Skip to content

Commit

Permalink
updating gulp file of building release
Browse files Browse the repository at this point in the history
  • Loading branch information
bpatrik committed Jul 11, 2017
1 parent 314bbba commit 0489c8e
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 41 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ demo/TEMP/
config.json
users.db
dist/
release/
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ deploy:
secure: NrgDMoHY4j9r4Ht9oPT6cYiGkcpbNsvR6DxEk51kD5qVRPtUq+V5gpIo0tSwIFfPzgY+5hsqK6Onl2AdSsaotHB8PT2CoZ9oZPJO8BlZFvD7iT83Qi49QcsMo6jjmgqByg6EwzhHLeAiMfYrNSqw1gT0tEONc9Ygq5deFolYSqf6yfplBkcT0HEFSncnDhn5i+s4SS/wOy/UppXJxKk9DE0GaRwaIuBC/aSAtDfoFUuxVwjahTiTb8YuqwguzoZA5lYC/EcoCxbSyb5y58XrsMB13AZmH271NlbSTYmo3c4+HGO4BkcIB/WATw9VcI1NU/huTgSNZnVzAalbtF9oWKG+IKyfa9gMbe6fj07CvB7KwCkaeJmToi5Hw3Eiw0+ioadEzD3KXRr0dchUjlYuYnmZEUxSAVW9jD+tJSdCxQKyna3PxtIcD7QvRlu8/ZXurcerZXVib5FbwmoXUzLZvbMeyaFHEMbawepp5xups/YYqp+I6H0SUqbMcNIAntENb/0doteXKwdOgsSUkdtMVoEM0p6PhFngFJLFPYAdq0yZiC8WQNwHNTBHcSME3CrIWk1sjrDjN8WylFTPljy7fNm2Rl2UFHvdtGHo5e5YEltHGdlcnSD4ZhXKCn3blR7O87taNUEAjljgjxdridbUrAJ3ooJRVPicVfeslVCM+OQ=
file: pigallery2.zip
skip_cleanup: true
on:
repo: bpatrik/pigallery2
on:
tags: true

provider: heroku
Expand Down
69 changes: 46 additions & 23 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,57 @@ var ts = require('gulp-typescript');
var gulp = require('gulp');
var zip = require('gulp-zip');
var runSequence = require('run-sequence');
var jsonModify = require('gulp-json-modify');
var exec = require('child_process').exec;

var tsProject = ts.createProject('tsconfig.json');
gulp.task('compile-release', function () {
return gulp.src([
"frontend/**/*.ts",
"common/**/*.ts",
"backend/**/*.ts"], {base: "."})
.pipe(tsProject())
.js
.pipe(gulp.dest("."))
gulp.task('build-backend', function () {
return gulp.src([
"common/**/*.ts",
"backend/**/*.ts"], {base: "."})
.pipe(tsProject())
.js
.pipe(gulp.dest("./release"))

});
gulp.task('build-frontend', function (cb) {
exec("ng build -prod --output-path=./release/dist --no-progress", function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
});

gulp.task('copy-static', function () {
return gulp.src([
"README.md",
"LICENSE"], {base: "."})
.pipe(gulp.dest('./release'));
});

gulp.task('copy-package', function () {
return gulp.src([
"package.json"], {base: "."})
.pipe(jsonModify({
key: 'devDependencies',
value: {}
}))
.pipe(jsonModify({
key: 'scripts',
value: {"start": "node ./backend/index.js"}
}))
.pipe(gulp.dest('./release'));
});


gulp.task('zip-release', function () {
return gulp.src(['package.json',
"README.md",
"LICENSE",
"frontend/**/*.js",
"common/**/*.js",
"backend/**/*.js",
"frontend/**/*.+(png|ejs|html|css)",
"frontend/systemjs*"], {base: "."})
.pipe(zip('pigallery2.zip'))
.pipe(gulp.dest('.'));
return gulp.src(['release/*'], {base: "."})
.pipe(zip('pigallery2.zip'))
.pipe(gulp.dest('.'));
});

gulp.task('build-release', function (done) {
runSequence('compile-release', 'zip-release', function () {
console.log('Run something else');
done();
});
});
runSequence('build-frontend', 'build-backend', 'copy-static', 'copy-package', 'zip-release', function () {
done();
});
});
34 changes: 18 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pigallery2",
"version": "1.0.0-beta.2",
"version": "1.0.0-beta.3",
"description": "This is a photo gallery optimised for running low resource servers (especially on raspberry pi)",
"author": "Patrik J. Braun",
"homepage": "https://github.com/bpatrik/PiGallery2",
Expand All @@ -9,6 +9,7 @@
"bin": "./backend/index.js",
"scripts": {
"build": "tsc && ng build",
"build-release": "gulp",
"pretest": "tsc",
"test": "ng test --single-run && mocha --recursive test/backend/unit",
"start": "node ./backend/index",
Expand All @@ -24,22 +25,22 @@
"url": "https://github.com/bpatrik/PiGallery2/issues"
},
"dependencies": {
"@types/bcryptjs": "^2.4.0",
"bcryptjs": "^2.4.3",
"body-parser": "^1.17.2",
"ejs": "^2.5.6",
"exif-parser": "^0.1.11",
"express": "^4.15.3",
"express-session": "^1.15.3",
"flat-file-db": "^1.0.0",
"jimp": "^0.2.28",
"mime": "^1.3.6",
"mysql": "^2.13.0",
"node-iptc": "^1.0.4",
"reflect-metadata": "^0.1.10",
"typeconfig": "^1.0.3",
"@types/bcryptjs": "2.4.0",
"bcryptjs": "2.4.3",
"body-parser": "1.17.2",
"ejs": "2.5.6",
"exif-parser": "0.1.11",
"express": "4.15.3",
"express-session": "1.15.3",
"flat-file-db": "1.0.0",
"jimp": "0.2.28",
"mime": "1.3.6",
"mysql": "2.13.0",
"node-iptc": "1.0.4",
"reflect-metadata": "0.1.10",
"typeconfig": "1.0.3",
"typeorm": "0.0.11",
"winston": "^2.3.1"
"winston": "2.3.1"
},
"devDependencies": {
"@agm/core": "^1.0.0-beta.0",
Expand Down Expand Up @@ -69,6 +70,7 @@
"core-js": "^2.4.1",
"ejs-loader": "^0.3.0",
"gulp": "^3.9.1",
"gulp-json-modify": "^1.0.2",
"gulp-typescript": "^3.2.0",
"gulp-zip": "^4.0.0",
"intl": "^1.2.5",
Expand Down

0 comments on commit 0489c8e

Please sign in to comment.