Skip to content

Commit

Permalink
Some scripts tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
mjackson committed Jun 3, 2020
1 parent 742a3a4 commit 90144a7
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 22 deletions.
13 changes: 6 additions & 7 deletions scripts/build.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
const execSync = require('child_process').execSync;
const path = require('path');
const execSync = require('child_process').execSync;

function exec(cmd) {
execSync(cmd, { env: process.env, stdio: 'inherit' });
}

let config = path.resolve(__dirname, 'builds/history.js');
let config = path.resolve(__dirname, 'rollup/history.config.js');

exec(`rollup -c ${config}`);
execSync(`rollup -c ${config}`, {
env: process.env,
stdio: 'inherit'
});
2 changes: 1 addition & 1 deletion scripts/publish.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const execSync = require('child_process').execSync;
const path = require('path');
const execSync = require('child_process').execSync;

const jsonfile = require('jsonfile');
const semver = require('semver');
Expand Down
File renamed without changes.
11 changes: 5 additions & 6 deletions scripts/test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
const execSync = require('child_process').execSync;
const path = require('path');

function exec(cmd) {
execSync(cmd, { env: process.env, stdio: 'inherit' });
}
const execSync = require('child_process').execSync;

let karmaConfig = path.resolve(__dirname, 'karma.conf.js');

exec(`karma start ${karmaConfig}`);
execSync(`karma start ${karmaConfig}`, {
env: process.env,
stdio: 'inherit'
});
14 changes: 6 additions & 8 deletions scripts/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,15 @@ function packageJson(packageName) {
return path.join(rootDir, 'packages', packageName, 'package.json');
}

function exec(cmd) {
return execSync(cmd, { env: process.env }).toString();
}

function invariant(cond, message) {
if (!cond) throw new Error(message);
}

function ensureCleanWorkingDirectory() {
let status = exec(`git status --porcelain`);
let lines = status.trim().split('\n');
let status = execSync(`git status --porcelain`)
.toString()
.trim();
let lines = status.split('\n');
invariant(
lines.every(line => line === '' || line.startsWith('?')),
'Working directory is not clean. Please commit or stash your changes.'
Expand Down Expand Up @@ -98,8 +96,8 @@ async function run() {
console.log(chalk.green(` Updated history to version ${version}`));

// 4. Commit and tag
exec(`git commit --all --message="Version ${version}"`);
exec(`git tag -a -m "Version ${version}" v${version}`);
execSync(`git commit --all --message="Version ${version}"`);
execSync(`git tag -a -m "Version ${version}" v${version}`);
console.log(chalk.green(` Committed and tagged version ${version}`));
} catch (error) {
console.log();
Expand Down

0 comments on commit 90144a7

Please sign in to comment.