This commit is contained in:
Brandon Millman
2017-11-15 15:14:20 -05:00
parent 4e39a957c7
commit a9fbe921a0
7 changed files with 81 additions and 16 deletions

View File

@@ -14,10 +14,8 @@
"scripts": {
"prebuild": "npm run clean",
"build": "run-p build:umd:prod build:commonjs; exit 0;",
"prepublishOnly": "run-p build",
"postpublish": "run-s release docs:json upload_docs_json",
"release": "publish-release --assets _bundles/index.js,_bundles/index.min.js --tag $(git describe --tags) --owner 0xProject --repo 0x.js",
"upload_docs_json": "aws s3 cp docs/index.json s3://0xjs-docs-jsons/$(git describe --tags).json --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type aplication/json",
"release": "publish-release --assets _bundles/index.js,_bundles/index.min.js --tag $LATEST_TAG --owner 0xProject --repo 0x.js",
"upload_docs_json": "aws s3 cp docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type aplication/json",
"lint": "tslint src/**/*.ts test/**/*.ts",
"test:circleci": "run-s test:coverage report_test_coverage; if [ $CIRCLE_BRANCH = \"development\" ]; then yarn test:umd; fi",
"test": "run-s clean test:commonjs",
@@ -49,13 +47,14 @@
"node": ">=6.0.0"
},
"devDependencies": {
"@0xproject/tslint-config": "^0.1.0",
"@0xproject/tslint-config": "^0.1.3",
"@types/jsonschema": "^1.1.1",
"@types/lodash": "^4.14.64",
"@types/mocha": "^2.2.41",
"@types/node": "^8.0.1",
"@types/sinon": "^2.2.2",
"@types/uuid": "^3.4.2",
"async-child-process": "^1.1.1",
"awesome-typescript-loader": "^3.1.3",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
@@ -73,6 +72,7 @@
"opn-cli": "^3.1.0",
"request": "^2.81.0",
"request-promise-native": "^1.0.4",
"semver-sort": "^0.0.4",
"shx": "^0.2.2",
"sinon": "^4.0.0",
"source-map-support": "^0.5.0",
@@ -87,8 +87,8 @@
"webpack": "^3.1.0"
},
"dependencies": {
"@0xproject/assert": "^0.0.4",
"@0xproject/json-schemas": "^0.6.7",
"@0xproject/assert": "^0.0.7",
"@0xproject/json-schemas": "^0.6.10",
"bignumber.js": "~4.1.0",
"bn.js": "4.11.8",
"compare-versions": "^3.0.1",

View File

@@ -0,0 +1,32 @@
const execAsync = require('async-child-process').execAsync;
const semverSort = require('semver-sort');
const packagePrefix = '0x.js@';
const gitTagsCommand = 'git tags -l "' + packagePrefix + '*"';
let latestTag;
execAsync(gitTagsCommand)
.then(function(result) {
if (result.stderr !== '') {
throw new Error(result.stderr);
}
const tags = result.stdout.trim().split('\n');
const versions = tags.map(function(tag) {
return tag.slice(packagePrefix.length);
});
const sortedVersions = semverSort.desc(versions);
latestTag = packagePrefix + sortedVersions[0];
return execAsync('LATEST_TAG=' + latestTag + ' yarn release');
})
.then(function(result) {
if (result.stderr !== '') {
throw new Error(result.stderr);
}
return execAsync('yarn docs:json');
})
.then(function(result) {
if (result.stderr !== '') {
throw new Error(result.stderr);
}
const s3Url = 's3://0xjs-docs-jsons/v' + latestTag +'.json';
return execAsync('S3_URL=' + s3Url + ' yarn upload_docs_json');
});