Merge pull request #290 from openpgpjs/bower

Add compiled v0.10.0 file to git for bower
This commit is contained in:
Tankred Hase 2015-02-13 04:23:40 +01:00
commit 2b682125bb
4 changed files with 80 additions and 28 deletions

2
.gitignore vendored
View File

@ -5,5 +5,7 @@ npm*
src/compression/ src/compression/
test/lib/ test/lib/
dist/ dist/
dist/*.tgz
dist/*_debug.js
openpgp.store/ openpgp.store/
doc/ doc/

View File

@ -1,4 +1,7 @@
module.exports = function(grunt) { module.exports = function(grunt) {
'use strict';
var version = grunt.option('release');
// Project configuration. // Project configuration.
grunt.initConfig({ grunt.initConfig({
@ -150,8 +153,36 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-connect'); grunt.loadNpmTasks('grunt-contrib-connect');
grunt.registerTask('set_version', function() {
if (!version) {
throw new Error('You must specify the version: "--release=1.0.0"');
}
patchFile({
fileName: 'package.json',
version: version
});
patchFile({
fileName: 'bower.json',
version: version
});
});
function patchFile(options) {
var fs = require('fs'),
path = './' + options.fileName,
file = require(path);
if (options.version) {
file.version = options.version;
}
fs.writeFileSync(path, JSON.stringify(file, null, 2));
}
grunt.registerTask('default', 'Build OpenPGP.js', function() { grunt.registerTask('default', 'Build OpenPGP.js', function() {
grunt.task.run(['clean', 'copy:zlib', 'browserify', 'replace', 'uglify', 'npm_pack']); grunt.task.run(['clean', 'copy:zlib', 'browserify', 'replace', 'uglify']);
//TODO jshint is not run because of too many discovered issues, once these are addressed it should autorun //TODO jshint is not run because of too many discovered issues, once these are addressed it should autorun
grunt.log.ok('Before Submitting a Pull Request please also run `grunt jshint`.'); grunt.log.ok('Before Submitting a Pull Request please also run `grunt jshint`.');
}); });
@ -168,25 +199,6 @@ module.exports = function(grunt) {
mocha.stderr.pipe(process.stderr); mocha.stderr.pipe(process.stderr);
}); });
// Alias the `npm_pack` task to run `npm pack` // Test/Dev tasks
grunt.registerTask('npm_pack', 'npm pack', function () {
var done = this.async();
var npm = require('child_process').exec('npm pack ../', { cwd: 'dist'}, function (err, stdout) {
var package = stdout;
if (err === null) {
var install = require('child_process').exec('npm install dist/' + package, function (err) {
done(err);
});
install.stdout.pipe(process.stdout);
install.stderr.pipe(process.stderr);
} else {
done(err);
}
});
npm.stdout.pipe(process.stdout);
npm.stderr.pipe(process.stderr);
});
// Test/Dev tasks
grunt.registerTask('test', ['copy:npm', 'mochaTest', 'mocha_phantomjs']); grunt.registerTask('test', ['copy:npm', 'mochaTest', 'mocha_phantomjs']);
}; };

View File

@ -1,12 +1,17 @@
{ {
"name": "openpgpjs", "name": "openpgp",
"version": "0.7.2", "version": "0.10.0",
"homepage": "http://openpgpjs.org/", "homepage": "http://openpgpjs.org/",
"authors": [ "authors": [
"OpenPGP Development Team <list@openpgpjs.org> (https://github.com/openpgpjs/openpgpjs/graphs/contributors)" "OpenPGP Development Team <list@openpgpjs.org> (https://github.com/openpgpjs/openpgpjs/graphs/contributors)"
], ],
"description": "OpenPGP.js is a Javascript implementation of the OpenPGP protocol. This is defined in RFC 4880.", "description": "OpenPGP.js is a Javascript implementation of the OpenPGP protocol. This is defined in RFC 4880.",
"main": "src/index.js", "main": [
"dist/openpgp.js",
"dist/openpgp.worker.js",
"dist/openpgp.min.js",
"dist/openpgp.worker.min.js"
],
"moduleType": [ "moduleType": [
"amd", "amd",
"es6", "es6",
@ -23,13 +28,12 @@
"license": "LGPL 3.0 or any later version", "license": "LGPL 3.0 or any later version",
"ignore": [ "ignore": [
"**/.*", "**/.*",
"dist/openpgp*.tgz", "dist/*.tgz",
"dist/*_debug.js",
"node_modules", "node_modules",
"bower_components", "bower_components",
"test", "test",
"tests", "tests",
"dist",
"doc" "doc"
] ]
} }

34
release.sh Executable file
View File

@ -0,0 +1,34 @@
#!/bin/sh
# abort if tests fail
set -e
# go to root
cd `dirname $0`
if [ "$#" -ne 1 ] ; then
echo 'Usage: ./release.sh 0.0.0'
exit 0
fi
# install dependencies
rm -rf node_modules/
npm install
# set version
grunt set_version --release=$1
# build and test
npm test
# Add build files to git
sed -i "" '/dist/d' .gitignore
git add dist/ *.json
git commit -m "Release new version"
git checkout .gitignore
git tag v$1
git push
git push --tag
# publish to npm
npm publish