Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hg-auto-semver

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hg-auto-semver - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

56

bin/cli.js
#!/usr/bin/env node
'use strict';
const exec = require('child_process').exec;
const npm = require('npm');
const execSync = require('child_process').execSync;

@@ -13,26 +12,27 @@ const Version = {

function getParentBranch(callback) {
exec('hg log --rev "p2(.)" --template "{branch}"', (error, stdout, stderr) => {
if (error) {
console.error(`exec error: ${error}`);
return;
}
callback(stdout);
});
function getParentBranch() {
return execSync('hg log --rev "p2(.)" --template "{branch}"');
}
function bump(type) {
npm.load((error, npm) => {
console.log(error);
npm.commands.version([type], function(error) {
if (error) {
console.error(`npm version error: ${error}`);
return;
}
});
});
execSync(`npm version ${type}`);
}
getParentBranch((branch) => {
function publish() {
const version = require('./package.json').version;
execSync(`hg commit --config ui.username=jenkins@coveo.com -m 'Release v${version}'`);
execSync(`hg tag --config ui.username=jenkins@coveo.com ${PACKAGE_VERSION} -f`);
execSync(`echo 'strict-ssl=false' > .npmrc`);
execSync(`echo '//npm.corp.coveo.com/:_authToken=${env.NPM_TOKEN}' >> .npmrc`);
execSync(`echo '@coveo:registry=https://npm.corp.coveo.com/' >> .npmrc`);
execSync(`npm publish`);
execSync(`hg --config auth.jenkins.prefix=* --config auth.jenkins.username=${process.env.HG_USR} --config auth.jenkins.password=${process.env.HG_PWD} --config 'auth.jenkins.schemes=http https' push`);
}
try {
const branch = getParentBranch();
if (branch) {

@@ -44,8 +44,16 @@ const fixRegex = new RegExp('^fix\\-|[^a-z]fix\\-', 'gim');

console.log('Branch name contains "fix-", bumping a PATCH version');
bump(Version.PATCH)
bump(Version.PATCH);
publish();
} else if (featureRegex.test(branch)) {
console.log('Branch name contains "feature-", bumping a MINOR version');
bump(Version.MINOR)
bump(Version.MINOR);
publish();
}
} else {
console.log('No parent branch, exiting');
}
});
} catch (err) {
// We don't want our CI to have an error, just log it.
console.log(err);
}
{
"name": "hg-auto-semver",
"version": "1.0.2",
"version": "1.1.0",
"description": "Automatically bump versions according to hg parent branch name.",

@@ -14,6 +14,3 @@ "main": "index.js",

"author": "wfortin",
"license": "MIT",
"dependencies": {
"npm": "^3.10.7"
}
"license": "MIT"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc