Skip to content

Commit

Permalink
📦 add tasks/version
Browse files Browse the repository at this point in the history
📦 add file to package.json
  • Loading branch information
desandro committed May 28, 2019
1 parent e5da999 commit 7e9850f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ uglify:
npx uglifyjs dist/zdog.dist.js -o dist/zdog.dist.min.js --mangle --comments /^!/

lint:
npx jshint js/*.js demos/**/*.js
npx jshint js/*.js demos/**/*.js tasks/*.js

dist: lint bundle uglify
dist: bundle uglify
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@
"version": "1.0.0",
"description": "Round, flat, designer-friendly pseudo-3D engine",
"main": "js/index.js",
"files": [
"dist/",
"js/"
],
"dependencies": {},
"devDependencies": {
"jshint": "^2.10.2",
"uglify-js": "^3.5.3"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"preversion": "npm test",
"version": "node ./tasks/version && make dist && git add -A dist js",
"test": "make lint"
},
"repository": {
"type": "git",
Expand Down
15 changes: 15 additions & 0 deletions tasks/version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* jshint node: true, esversion: 6, unused: true, undef: true */

const fs = require('fs');
const version = require('../package.json').version;

const boilerplatePath = 'js/boilerplate.js';

let boilerplateSrc = fs.readFileSync( boilerplatePath, 'utf8' );

boilerplateSrc = boilerplateSrc.replace( /\n \* Zdog v\d+\.\d+\.\d+/,
`\n * Zdog v${version}` );

fs.writeFileSync( boilerplatePath, boilerplateSrc, 'utf8' );

console.log(`updated ${boilerplatePath} to ${version}`);

0 comments on commit 7e9850f

Please sign in to comment.