diff --git a/Gruntfile.js b/Gruntfile.js index 062c7f1..16ee631 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -370,7 +370,6 @@ module.exports = function (grunt) { dest: '<%= yeoman.dist %>/', src: [ 'config.json.example', - 'package.json', 'LICENSE', 'README.md' ] @@ -397,6 +396,23 @@ module.exports = function (grunt) { } }, + // Toggle private flag in package.json when copying to dist/. + replace: { + dist: { + options: { + patterns: [{ + match: /"private": true/g, + replacement: '"private": false' + }] + }, + files: [{ + src: ['package.json'], + dest: 'dist/', + cwd: '.' + }] + } + }, + // Run some tasks in parallel to speed up the build process concurrent: { server: [ @@ -442,6 +458,7 @@ module.exports = function (grunt) { 'concat', 'ngAnnotate', 'copy:dist', + 'replace:dist', 'cssmin', 'uglify', 'rev', diff --git a/package.json b/package.json index f22d9d5..7929bcd 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,11 @@ { "name": "ffffng", "version": "0.2.0-SNAPSHOT", - "description": "Node managent form for Freifunk", + "description": "Node management form for Freifunk", "license": "MIT", + "private": true, + "repository": { "type": "git", "url": "https://github.com/freifunkhamburg/ffffng" @@ -41,6 +43,9 @@ "sqlite3": "3.1.4" }, "devDependencies": { + "bower": "1.7.9", + "grunt-cli": "1.2.0", + "escape-string-regexp": "1.0.5", "grunt": "~0.4.1", "grunt-autoprefixer": "~3.0.4", @@ -61,6 +66,7 @@ "grunt-html2js": "~0.3.6", "grunt-newer": "~1.2.0", "grunt-ng-annotate": "~2.0.2", + "grunt-replace": "~1.0.1", "grunt-rev": "~0.1.0", "grunt-svgmin": "~3.2.0", "grunt-usemin": "~3.1.1", diff --git a/publish.sh b/publish.sh new file mode 100755 index 0000000..7d16d49 --- /dev/null +++ b/publish.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +set -e + +cd $(dirname $0) + +version=$(grep '^ *"version": *"[^"]*" *, *$' package.json | cut -d '"' -f4) + +if [ -z "$version" ]; then + echo "Could not determine current version." + exit 1 +fi + +echo "Current version: $version" + +if [[ $version =~ 'SNAPSHOT' ]]; then + echo "Will not publish SNAPSHOT version." + exit 1 +fi + +./node_modules/.bin/grunt clean build + +cd dist +npm publish +