Skip to content
This repository was archived by the owner on Jun 4, 2024. It is now read-only.

Commit 53777ba

Browse files
committed
Add publish script.
1 parent db9a541 commit 53777ba

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

scripts/publish.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#! /usr/bin/env node
2+
const execSh = require('exec-sh');
3+
let version = require('../package.json').version;
4+
let name = require('../package.json').name.replace(/-/g, '_');
5+
if(version.includes("rc")) {
6+
version = version.replace('-', '');
7+
console.log("Adjusted version to", version, "for PyPi");
8+
}
9+
console.log(`Publishing version ${version} of ${name} to NPM & PyPi\n`);
10+
console.log('>', 'python setup.py sdist');
11+
execSh('git diff-index --quiet HEAD --', err => {
12+
if(err) {
13+
throw new Error('\nIt looks like there are uncommitted changes! Aborting until these changes have been resolved.\n');
14+
} else {
15+
execSh([
16+
'npm publish',
17+
`python setup.py sdist`,
18+
`twine upload dist/${name}-${version}.tar.gz`,
19+
`git tag -a 'v${version}' -m 'v${version}'`,
20+
`git push origin v${version}`
21+
]
22+
, err => {
23+
if(err) {
24+
throw new Error(err);
25+
}
26+
});
27+
}
28+
})

0 commit comments

Comments
 (0)