diff --git a/.gitignore b/.gitignore index c9c4a71ba..c432f3ef2 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ demo/TEMP/ config.json users.db dist/ +release/ diff --git a/.travis.yml b/.travis.yml index e2abf577d..94e0f4ea9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/gulpfile.js b/gulpfile.js index 8f0039edb..82ad67245 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -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(); - }); -}); \ No newline at end of file + runSequence('build-frontend', 'build-backend', 'copy-static', 'copy-package', 'zip-release', function () { + done(); + }); +}); diff --git a/package.json b/package.json index 8a02b6e42..fe1c80e17 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", @@ -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", @@ -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",