Skip to content

Commit

Permalink
👟 dist and version tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
desandro committed Feb 2, 2022
1 parent 08cc9c0 commit 08f0603
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
"qunit": "^2.17.2",
"terser": "^5.10.0"
},
"scripts": {
"test": "npm run lint",
"lint": "npx eslint .",
"dist": "node tasks/dist.js",
"version": "node tasks/version.js && npm run dist && git add -A ."
},
"repository": {
"type": "git",
"url": "git://github.com/desandro/imagesloaded.git"
Expand All @@ -32,10 +38,5 @@
"directories": {
"test": "test"
},
"scripts": {
"test": "npm run lint",
"lint": "npx eslint .",
"version": "node bin/version.js && npm run dist && git add -A css js dist"
},
"author": "David DeSandro"
}
4 changes: 2 additions & 2 deletions tasks/dist.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ const fs = require('fs');
const { execSync } = require('child_process');
const { minify } = require('terser');

const indexPath = 'js/index.js';
const indexPath = 'imagesloaded.js';
const distPath = 'imagesloaded.pkgd.js';
const distMinPath = 'imagesloaded.min.js';
const distMinPath = 'imagesloaded.pkgd.min.js';

let indexContent = fs.readFileSync( `./${indexPath}`, 'utf8' );

Expand Down
8 changes: 8 additions & 0 deletions tasks/version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const fs = require('fs');
const version = require('../package.json').version;

const file = 'imagesloaded.js';

let src = fs.readFileSync( file, 'utf8' );
src = src.replace( /imagesLoaded v\d+\.\d+\.\d+/, `imagesLoaded v${version}` );
fs.writeFileSync( file, src, 'utf8' );

0 comments on commit 08f0603

Please sign in to comment.