mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-09-28 00:18:45 +03:00
Updated verup to v1.2.0 and moved its config to package.json
This commit is contained in:
parent
1fa7137f1f
commit
dc6bae6aae
@ -15,27 +15,20 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @author Dumitru Uzun (DUzun.Me)
|
* @author Dumitru Uzun (DUzun.Me)
|
||||||
* @version 1.1.0
|
* @version 1.2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
|
||||||
var _root = path.join(__dirname, '..');
|
var packFile = findPackage(__dirname);
|
||||||
var files = [
|
|
||||||
'ua-parser-js.jquery.json',
|
|
||||||
'component.json',
|
|
||||||
'bower.json',
|
|
||||||
'package.js',
|
|
||||||
'src/ua-parser.js'
|
|
||||||
];
|
|
||||||
|
|
||||||
var ver_reg = [
|
if ( !packFile ) {
|
||||||
/^((?:\$|@|(\s*(?:var|,)?\s+))(?:LIBVERSION|version)[\s\:='"]+)([0-9]+(?:\.[0-9]+){2,2})/
|
console.log('package.json file not found');
|
||||||
, /^(\s?\*.*v)([0-9]+(?:\.[0-9]+){2,2})/
|
process.exist(1);
|
||||||
];
|
}
|
||||||
|
|
||||||
var packFile = path.join(_root, 'package.json');
|
var _root = path.dirname(packFile);
|
||||||
var packo = require(packFile);
|
var packo = require(packFile);
|
||||||
|
|
||||||
if ( !packo ) {
|
if ( !packo ) {
|
||||||
@ -43,6 +36,24 @@ if ( !packo ) {
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _verup = packo.verup;
|
||||||
|
|
||||||
|
if ( !_verup ) {
|
||||||
|
console.log('package.json doesn\'t have a `verup` property defined');
|
||||||
|
process.exist(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
var files = _verup.files;
|
||||||
|
|
||||||
|
var ver_reg = [
|
||||||
|
/^((?:\$|@|(\s*(?:var|,)?\s+))version[\s\:='"]+)([0-9]+(?:\.[0-9]+){2,2})/
|
||||||
|
, /^(\s?\*.*v)([0-9]+(?:\.[0-9]+){2,2})/
|
||||||
|
];
|
||||||
|
|
||||||
|
if ( _verup.regs ) {
|
||||||
|
ver_reg = _verup.regs.map(function (r) { return new RegExp(r); });
|
||||||
|
}
|
||||||
|
|
||||||
var over = packo.version;
|
var over = packo.version;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -56,7 +67,7 @@ if ( over ) {
|
|||||||
while(bump.length && !(b = parseInt(bump.pop())));
|
while(bump.length && !(b = parseInt(bump.pop())));
|
||||||
l = bump.length;
|
l = bump.length;
|
||||||
|
|
||||||
// console.log({b:b,nver:nver,over:over,l:l,bump:bump})
|
// console.log({b:b,nver:nver,over:over,l:l,bump:bump})
|
||||||
nver[l] = +nver[l] + b;
|
nver[l] = +nver[l] + b;
|
||||||
bump.forEach(function (v,i) { nver[i] = v; });
|
bump.forEach(function (v,i) { nver[i] = v; });
|
||||||
|
|
||||||
@ -110,3 +121,16 @@ if ( over ) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Find package.json file in closest folder from `dir` and up.
|
||||||
|
function findPackage(dir) {
|
||||||
|
var d = dir || '.', f;
|
||||||
|
do {
|
||||||
|
f = path.join(d, 'package.json');
|
||||||
|
if ( fs.existsSync(f) ) return f;
|
||||||
|
dir = d;
|
||||||
|
d = path.join(d, '..');
|
||||||
|
} while (d != dir && dir.slice(0,2) != '..');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
13
package.json
13
package.json
@ -45,6 +45,19 @@
|
|||||||
"test": "./build/build.sh",
|
"test": "./build/build.sh",
|
||||||
"verup": "node ./build/verup.js"
|
"verup": "node ./build/verup.js"
|
||||||
},
|
},
|
||||||
|
"verup": {
|
||||||
|
"files": [
|
||||||
|
"ua-parser-js.jquery.json",
|
||||||
|
"component.json",
|
||||||
|
"bower.json",
|
||||||
|
"package.js",
|
||||||
|
"src/ua-parser.js"
|
||||||
|
],
|
||||||
|
"regs": [
|
||||||
|
"^((?:\\$|@|(\\s*(?:var|,)?\\s+))(?:LIBVERSION|version)[\\s\\:='\"]+)([0-9]+(?:\\.[0-9]+){2,2})",
|
||||||
|
"^(\\s?\\*.*v)([0-9]+(?:\\.[0-9]+){2,2})"
|
||||||
|
]
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"jshint": "~1.1.0",
|
"jshint": "~1.1.0",
|
||||||
"mocha": "~1.8.0",
|
"mocha": "~1.8.0",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user