From 968f66e454716a177d121c599cdaacf3900ce0a1 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 5 Aug 2016 15:10:44 +0000 Subject: [PATCH] Add package.json and gulpfile --- Koha/Plugin/Com/ByWaterSolutions/CoverFlow.pm | 2 +- gulpfile.js | 37 +++++++++++++++++++ package.json | 29 +++++++++++++++ 3 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 gulpfile.js create mode 100644 package.json diff --git a/Koha/Plugin/Com/ByWaterSolutions/CoverFlow.pm b/Koha/Plugin/Com/ByWaterSolutions/CoverFlow.pm index 9f0d854..dcc6af5 100644 --- a/Koha/Plugin/Com/ByWaterSolutions/CoverFlow.pm +++ b/Koha/Plugin/Com/ByWaterSolutions/CoverFlow.pm @@ -21,7 +21,7 @@ use JavaScript::Minifier qw(minify); ## Here we set our plugin version -our $VERSION = 2.00; +our $VERSION = "{VERSION}"; ## Here is our metadata, some keys are required, some are optional our $metadata = { diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..483b394 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,37 @@ +const gulp = require('gulp'); +const zip = require('gulp-zip'); +const release = require('gulp-github-release'); +const fs = require('fs'); +const replace = require('gulp-replace'); +const git = require('gulp-git'); + + +var package_json = JSON.parse(fs.readFileSync('./package.json')); +var release_filename = package_json.name + '-v' + package_json.version + '.kpz'; + +var pm_file = 'CoverFlow.pm'; +var pm_file_path = './Koha/Plugin/Com/ByWaterSolutions/'; +var pm_file_path_full = pm_file_path + pm_file; + +console.log(release_filename); + +gulp.task('build', () => { + // Set module version + gulp.src(pm_file_path_full) + .pipe(replace('{VERSION}', package_json.version)) + .pipe(gulp.dest(pm_file_path)); + + //FIXME: This doesn't work! It only zips of the first level of directories, leaving them empty + gulp.src(['./*', '!gulpfile.js', '!node_modules', '!package.json', '!README.md']) + .pipe(zip(release_filename)) + .pipe(gulp.dest('./')); +}); + +gulp.task('release', () => { + gulp.src(release_filename) + .pipe(release({ + manifest: require('./package.json') // package.json from which default values will be extracted if they're missing + })) + .pipe(git.checkoutFiles()); +}); + diff --git a/package.json b/package.json new file mode 100644 index 0000000..83351ca --- /dev/null +++ b/package.json @@ -0,0 +1,29 @@ +{ + "name": "koha-coverflow-plugin", + "version": "2.2.0", + "description": "Koha CoverFlow Plugin", + "main": "index.js", + "dependencies": { + "gulp-git": "^1.11.0", + "gulp-zip": "^3.2.0" + }, + "devDependencies": { + "gulp": "^3.9.1", + "gulp-cli": "^1.2.2", + "gulp-github-release": "^1.1.5", + "gulp-zip": "^3.2.0" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/bywatersolutions/koha-plugin-coverflow.git" + }, + "author": "Kyle M Hall ", + "license": "GPL-3.0", + "bugs": { + "url": "https://github.com/bywatersolutions/koha-plugin-coverflow/issues" + }, + "homepage": "https://github.com/bywatersolutions/koha-plugin-coverflow#readme" +}