Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,40 @@ module.exports = function(grunt) {
grunt.loadNpmTasks("grunt-browserify");
grunt.loadNpmTasks("grunt-contrib-uglify");

grunt.registerTask("build", ["browserify", "uglify"]);
var packagePath = "package.json";
var browserIndexKey = "./lib/index";

grunt.registerTask("unmap-browser-entry", function() {
var original = grunt.file.read(packagePath);
var pkg = JSON.parse(original);

if (!pkg.browser || !pkg.browser[browserIndexKey]) {
return;
}

grunt.config.set("packageJsonBackup", original);
var browser = Object.assign({}, pkg.browser);
delete browser[browserIndexKey];
pkg.browser = browser;
grunt.file.write(packagePath, JSON.stringify(pkg, null, 2));
});

grunt.registerTask("restore-browser-entry", function() {
var original = grunt.config.get("packageJsonBackup");

if (!original) {
return;
}

grunt.file.write(packagePath, original);
grunt.config.set("packageJsonBackup", null);
});

grunt.registerTask("build", [
"unmap-browser-entry",
"browserify",
"uglify",
"restore-browser-entry"
]);
grunt.registerTask("default", ["build"]);
};
19 changes: 8 additions & 11 deletions documentation/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,13 @@ If you have tested bug fixes or new features, you can open a

## Releasing a new version

1. In `package.json` temporarily remove `browser["./lib/index"]`.
2. Run `npm test`
1. Run `npm test`
* Locally open http://localhost:8080/test/
* Or use the SauceLabs configuration above
3. Update `JSZip.version` in `index.js`, `index.html` and in `package.json`
4. Run `grunt` to generate the new dist files
* undo the package.json change, it was just needed to replace the `__VERSION__` in the header
5. Undo step 1.
6. Change version back in `package.json` (it will get update by the npm command below)
7. Update CHANGES.md
8. Commit the appropriate changes
9. Run `npm version ...` where `...` is `major`, `minor`, or `patch`
10. Run npm publish
2. Update `JSZip.version` in `index.js`, `index.html` and in `package.json`
3. Run `grunt` to generate the new dist files
4. Change version back in `package.json` (it will get update by the npm command below)
5. Update CHANGES.md
6. Commit the appropriate changes
7. Run `npm version ...` where `...` is `major`, `minor`, or `patch`
8. Run npm publish
Loading