diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2017-11-16 04:14:30 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2017-11-16 04:46:58 +0800 |
commit | 6096fe75d338a82a614d663f7c32ada6c6c7574f (patch) | |
tree | bdb9fb436af1ee8980173a0e1085a3290e502ccd | |
parent | a9fbe921a04d2828bd17a60598a3eee0ec63445b (diff) | |
download | dexon-0x-contracts-6096fe75d338a82a614d663f7c32ada6c6c7574f.tar.gz dexon-0x-contracts-6096fe75d338a82a614d663f7c32ada6c6c7574f.tar.zst dexon-0x-contracts-6096fe75d338a82a614d663f7c32ada6c6c7574f.zip |
WIP
-rw-r--r-- | packages/0x.js/package.json | 2 | ||||
-rw-r--r-- | packages/0x.js/scripts/postpublish.js | 76 | ||||
-rw-r--r-- | yarn.lock | 121 |
3 files changed, 159 insertions, 40 deletions
diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index e2b19a440..d09396a84 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -14,7 +14,6 @@ "scripts": { "prebuild": "npm run clean", "build": "run-p build:umd:prod build:commonjs; exit 0;", - "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", @@ -70,6 +69,7 @@ "npm-run-all": "^4.0.2", "nyc": "^11.0.1", "opn-cli": "^3.1.0", + "prompt": "^1.0.0", "request": "^2.81.0", "request-promise-native": "^1.0.4", "semver-sort": "^0.0.4", diff --git a/packages/0x.js/scripts/postpublish.js b/packages/0x.js/scripts/postpublish.js index c2dffa920..ff425adbb 100644 --- a/packages/0x.js/scripts/postpublish.js +++ b/packages/0x.js/scripts/postpublish.js @@ -1,32 +1,72 @@ const execAsync = require('async-child-process').execAsync; const semverSort = require('semver-sort'); +const publishRelease = require('publish-release'); +const promisify = require('es6-promisify'); +const prompt = require('prompt'); -const packagePrefix = '0x.js@'; -const gitTagsCommand = 'git tags -l "' + packagePrefix + '*"'; -let latestTag; -execAsync(gitTagsCommand) +const publishReleaseAsync = promisify(publishRelease); +const promptGetAsync = promisify(prompt.get); +const subPackageName = '0x.js'; +const subPackagePrefix = subPackageName + '@'; +const githubPersonalAccessToken = process.env.GITHUB_PERSONAL_ACCESS_TOKEN_0X_JS; +let tag; + +getLatestTagAndVersionAsync(subPackageName) .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'); + console.log('POSTPUBLISH: Releasing...'); + tag = result.tag; + const releaseName = subPackageName + ' v' + result.version; + return publishReleaseAsync({ + token: githubPersonalAccessToken, + owner: '0xProject', + repo: '0x.js', + tag: tag, + name: releaseName, + notes: 'TODO', + draft: false, + prerelease: false, + reuseRelease: true, + reuseDraftOnly: false, + assets: ['_bundles/index.js', '_bundles/index.min.js'], + }); }) - .then(function(result) { - if (result.stderr !== '') { - throw new Error(result.stderr); + .then(function(err, release) { + if (err !== null) { + throw err; } + console.log('POSTPUBLISH: Release successful, generating docs...'); 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'; + console.log('POSTPUBLISH: Doc generation successful, uploading docs...'); + const s3Url = 's3://0xjs-docs-jsons/v' + tag +'.json'; return execAsync('S3_URL=' + s3Url + ' yarn upload_docs_json'); }); + + // "release": "publish-release --assets _bundles/index.js,_bundles/index.min.js --tag $LATEST_TAG --owner 0xProject --repo 0x.js --notes TODO --name $RELEASE_NAME", + +function getLatestTagAndVersionAsync(subPackageName) { + const subPackagePrefix = subPackageName + '@'; + const gitTagsCommand = 'git tags -l "' + subPackagePrefix + '*"'; + console.log(gitTagsCommand); + return 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(subPackagePrefix.length); + }); + const sortedVersions = semverSort.desc(versions); + const latestVersion = sortedVersions[0]; + const latestTag = subPackagePrefix + latestVersion; + return { + tag: latestTag, + version: latestVersion + }; + }); +} @@ -2,24 +2,29 @@ # yarn lockfile v1 -"0x.js@^0.25.4": - version "0.25.1" +"@0xproject/assert@0.0.4": + version "0.0.4" + resolved "https://registry.yarnpkg.com/@0xproject/assert/-/assert-0.0.4.tgz#1f9b1de668a5cb2bf7b5ed17af771aee08e87532" dependencies: - "@0xproject/assert" "^0.0.7" - "@0xproject/json-schemas" "^0.6.10" + "@0xproject/json-schemas" "^0.6.7" bignumber.js "~4.1.0" - bn.js "4.11.8" - compare-versions "^3.0.1" - es6-promisify "^5.0.0" - ethereumjs-abi "^0.6.4" - ethereumjs-blockstream "^2.0.6" - ethereumjs-util "^5.1.1" - find-versions "^2.0.0" - js-sha3 "^0.6.1" + ethereum-address "^0.0.4" lodash "^4.17.4" - publish-release "^1.3.3" - uuid "^3.1.0" - web3 "^0.20.0" + valid-url "^1.0.9" + +"@0xproject/json-schemas@0.6.7": + version "0.6.7" + resolved "https://registry.yarnpkg.com/@0xproject/json-schemas/-/json-schemas-0.6.7.tgz#eebd51b92bc40fc7845bee825bded22067bcc6ab" + dependencies: + es6-promisify "^5.0.0" + jsonschema "^1.2.0" + lodash.values "^4.3.0" + +"@0xproject/tslint-config@0.1.0": + version "0.1.0" + resolved "https://registry.yarnpkg.com/@0xproject/tslint-config/-/tslint-config-0.1.0.tgz#238289cb448d942f555ede3b5b1f5eeaaca19e11" + dependencies: + tslint-react "^3.2.0" "@types/fetch-mock@^5.12.1": version "5.12.2" @@ -364,7 +369,7 @@ async-eventemitter@ahultgren/async-eventemitter#fa06e39e56786ba541c180061dbf2c0a dependencies: async "^2.4.0" -async@^0.9.0: +async@^0.9.0, async@~0.9.0: version "0.9.2" resolved "https://registry.yarnpkg.com/async/-/async-0.9.2.tgz#aea74d5e61c1f899613bf64bda66d4c78f2fd17d" @@ -378,6 +383,10 @@ async@^2.0.1, async@^2.1.2, async@^2.4.0, async@^2.5.0: dependencies: lodash "^4.14.0" +async@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/async/-/async-1.0.0.tgz#f8fc04ca3a13784ade9e1641af98578cfbd647a9" + asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" @@ -1319,6 +1328,10 @@ color-name@^1.1.1: version "1.1.3" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" +colors@1.0.x: + version "1.0.3" + resolved "https://registry.yarnpkg.com/colors/-/colors-1.0.3.tgz#0433f44d809680fdeb60ed260f1b0c262e82a40b" + colors@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/colors/-/colors-1.1.2.tgz#168a4701756b6a7f51a12ce0c97bfa28c084ed63" @@ -1657,6 +1670,10 @@ currently-unhandled@^0.4.1: dependencies: array-find-index "^1.0.1" +cycle@1.0.x: + version "1.0.3" + resolved "https://registry.yarnpkg.com/cycle/-/cycle-1.0.3.tgz#21e80b2be8580f98b468f379430662b046c34ad2" + d@1: version "1.0.0" resolved "https://registry.yarnpkg.com/d/-/d-1.0.0.tgz#754bb5bfe55451da69a58b94d45f4c5b0462d58f" @@ -1720,6 +1737,10 @@ deep-eql@^3.0.0: dependencies: type-detect "^4.0.0" +deep-equal@~0.2.1: + version "0.2.2" + resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-0.2.2.tgz#84b745896f34c684e98f2ce0e42abaf43bba017d" + deep-equal@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.0.1.tgz#f5d260292b660e084eff4cdbc9f08ad3247448b5" @@ -2306,6 +2327,10 @@ extsprintf@1.3.0, extsprintf@^1.2.0: version "1.3.0" resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" +eyes@0.1.x: + version "0.1.8" + resolved "https://registry.yarnpkg.com/eyes/-/eyes-0.1.8.tgz#62cf120234c683785d902348a800ef3e0cc20bc0" + fake-merkle-patricia-tree@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/fake-merkle-patricia-tree/-/fake-merkle-patricia-tree-1.0.1.tgz#4b8c3acfb520afadf9860b1f14cd8ce3402cddd3" @@ -2896,6 +2921,10 @@ hyperquest@~1.2.0: duplexer2 "~0.0.2" through2 "~0.6.3" +i@0.3.x: + version "0.3.6" + resolved "https://registry.yarnpkg.com/i/-/i-0.3.6.tgz#d96c92732076f072711b6b10fd7d4f65ad8ee23d" + iconv-lite@^0.4.17, iconv-lite@~0.4.13: version "0.4.19" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" @@ -3232,7 +3261,7 @@ isomorphic-fetch@^2.2.0, isomorphic-fetch@^2.2.1: node-fetch "^1.0.1" whatwg-fetch ">=0.10.0" -isstream@~0.1.2: +isstream@0.1.x, isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" @@ -3891,7 +3920,7 @@ mixin-deep@^1.2.0: for-in "^1.0.2" is-extendable "^0.1.1" -mkdirp@0.5.1, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0: +mkdirp@0.5.1, mkdirp@0.x.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" dependencies: @@ -3952,6 +3981,10 @@ nanomatch@^1.2.5: snapdragon "^0.8.1" to-regex "^3.0.1" +ncp@1.0.x: + version "1.0.1" + resolved "https://registry.yarnpkg.com/ncp/-/ncp-1.0.1.tgz#d15367e5cb87432ba117d2bf80fdf45aecfb4246" + nise@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/nise/-/nise-1.2.0.tgz#079d6cadbbcb12ba30e38f1c999f36ad4d6baa53" @@ -4421,10 +4454,14 @@ pkg-dir@^1.0.0: dependencies: find-up "^1.0.0" -pkginfo@^0.3.0: +pkginfo@0.3.x, pkginfo@^0.3.0: version "0.3.1" resolved "https://registry.yarnpkg.com/pkginfo/-/pkginfo-0.3.1.tgz#5b29f6a81f70717142e09e765bbeab97b4f81e21" +pkginfo@0.x.x: + version "0.4.1" + resolved "https://registry.yarnpkg.com/pkginfo/-/pkginfo-0.4.1.tgz#b5418ef0439de5425fc4995042dced14fb2a84ff" + posix-character-classes@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" @@ -4497,6 +4534,17 @@ promise-to-callback@^1.0.0: is-fn "^1.0.0" set-immediate-shim "^1.0.1" +prompt@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/prompt/-/prompt-1.0.0.tgz#8e57123c396ab988897fb327fd3aedc3e735e4fe" + dependencies: + colors "^1.1.2" + pkginfo "0.x.x" + read "1.0.x" + revalidator "0.1.x" + utile "0.3.x" + winston "2.1.x" + prr@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/prr/-/prr-0.0.0.tgz#1a84b85908325501411853d0081ee3fa86e2926a" @@ -4659,7 +4707,7 @@ read-pkg@^3.0.0: normalize-package-data "^2.3.2" path-type "^3.0.0" -read@~1.0.5: +read@1.0.x, read@~1.0.5: version "1.0.7" resolved "https://registry.yarnpkg.com/read/-/read-1.0.7.tgz#b3da19bd052431a97671d44a42634adf710b40c4" dependencies: @@ -4908,13 +4956,17 @@ resumer@~0.0.0: dependencies: through "~2.3.4" +revalidator@0.1.x: + version "0.1.8" + resolved "https://registry.yarnpkg.com/revalidator/-/revalidator-0.1.8.tgz#fece61bfa0c1b52a206bd6b18198184bdd523a3b" + right-align@^0.1.1: version "0.1.3" resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef" dependencies: align-text "^0.1.1" -rimraf@2, rimraf@^2.2.8, rimraf@^2.3.3, rimraf@^2.5.1, rimraf@^2.5.4, rimraf@^2.6.1: +rimraf@2, rimraf@2.x.x, rimraf@^2.2.8, rimraf@^2.3.3, rimraf@^2.5.1, rimraf@^2.5.4, rimraf@^2.6.1: version "2.6.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" dependencies: @@ -5311,6 +5363,10 @@ sshpk@^1.7.0: jsbn "~0.1.0" tweetnacl "~0.14.0" +stack-trace@0.0.x: + version "0.0.10" + resolved "https://registry.yarnpkg.com/stack-trace/-/stack-trace-0.0.10.tgz#547c70b347e8d32b4e108ea1a2a159e5fdde19c0" + static-extend@^0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" @@ -5891,6 +5947,17 @@ util@0.10.3, util@^0.10.3: dependencies: inherits "2.0.1" +utile@0.3.x: + version "0.3.0" + resolved "https://registry.yarnpkg.com/utile/-/utile-0.3.0.tgz#1352c340eb820e4d8ddba039a4fbfaa32ed4ef3a" + dependencies: + async "~0.9.0" + deep-equal "~0.2.1" + i "0.3.x" + mkdirp "0.x.x" + ncp "1.0.x" + rimraf "2.x.x" + uuid@3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1" @@ -6095,6 +6162,18 @@ window-size@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.2.0.tgz#b4315bb4214a3d7058ebeee892e13fa24d98b075" +winston@2.1.x: + version "2.1.1" + resolved "https://registry.yarnpkg.com/winston/-/winston-2.1.1.tgz#3c9349d196207fd1bdff9d4bc43ef72510e3a12e" + dependencies: + async "~1.0.0" + colors "1.0.x" + cycle "1.0.x" + eyes "0.1.x" + isstream "0.1.x" + pkginfo "0.3.x" + stack-trace "0.0.x" + wordwrap@0.0.2: version "0.0.2" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" |