diff --git a/build/publishDev.js b/build/publishDev.js index 6936c82c27..e2aae42d15 100755 --- a/build/publishDev.js +++ b/build/publishDev.js @@ -1,26 +1,25 @@ - /* eslint-env node */ const path = require('path'); const {execSync} = require('child_process'); const jsonData = require('../package.json'); -//default exec options +// default exec options const execOpts = {cwd: path.resolve(__dirname + '/..'), encoding: 'utf8'}; -//get clean version string +// get clean version string let [, version] = /(\d+\.\d+\.\d+)/.exec(jsonData.version); -//if this is a regular version, e.g. no 'beta', 'alpha' or 'rc', do increment the version by 1 +// if this is a regular version, e.g. no 'beta', 'alpha' or 'rc', do increment the version by 1 if (!['-alpha', '-beta', '-rc'].some(qualifier => jsonData.version.includes(qualifier))) { const versionSplit = version.split('.'); const patch = parseInt(versionSplit.pop()); version = [...versionSplit, patch + 1].join('.'); } -//get current git hash +// get current git hash const hash = execSync('git rev-parse --short HEAD', execOpts).trim(); -//check for changes to publish +// check for changes to publish const changes = execSync('git log -1 --pretty=%B', execOpts); const autoPublish = ['feat', 'fix', 'refactor', 'perf']; @@ -31,7 +30,7 @@ const commitRegex = /^(revert: )?(feat|fix|polish|docs|style|refactor|perf|test| let change = commitRegex.exec(changes); if (change) { - //find specific changes to publish + // find specific changes to publish while (change) { if (autoPublish.includes(change[2])) { publish = true; @@ -44,12 +43,12 @@ if (change) { if (publish) { - //set version of package.json + // set version of package.json execSync(`npm version ${version}-dev.${hash} --git-tag-version false`, execOpts); - //create dist files + // create dist files execSync('npm run compile && npm run compile-rtl && npm run build-scss', execOpts); - //publish to dev tag + // publish to dev tag execSync('npm publish --tag dev', execOpts); }