From a9fbe921a04d2828bd17a60598a3eee0ec63445b Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Wed, 15 Nov 2017 15:14:20 -0500 Subject: WIP --- package.json | 3 ++- packages/0x.js/package.json | 14 +++++++------- packages/0x.js/scripts/postpublish.js | 32 +++++++++++++++++++++++++++++++ packages/assert/package.json | 6 +++--- packages/json-schemas/package.json | 4 ++-- packages/tslint-config/package.json | 2 +- yarn.lock | 36 +++++++++++++++++++++++++++++++++-- 7 files changed, 81 insertions(+), 16 deletions(-) create mode 100644 packages/0x.js/scripts/postpublish.js diff --git a/package.json b/package.json index 49c97eff6..baccee6b4 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ ], "scripts": { "testrpc": "testrpc -p 8545 --networkId 50 -m \"${npm_package_config_mnemonic}\"", - "lerna:run": "lerna run" + "lerna:run": "lerna run", + "lerna:publish": "lerna run clean; lerna run build; lerna publish" }, "config": { "mnemonic": "concert load couple harbor equip island argue ramp clarify fence smart topic" diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index 0204d723f..e2b19a440 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -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", diff --git a/packages/0x.js/scripts/postpublish.js b/packages/0x.js/scripts/postpublish.js new file mode 100644 index 000000000..c2dffa920 --- /dev/null +++ b/packages/0x.js/scripts/postpublish.js @@ -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'); + }); diff --git a/packages/assert/package.json b/packages/assert/package.json index ed1d2a98b..96f41e552 100644 --- a/packages/assert/package.json +++ b/packages/assert/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/assert", - "version": "0.0.4", + "version": "0.0.7", "description": "Provides a standard way of performing type and schema validation across 0x projects", "main": "lib/src/index.js", "types": "lib/src/index.d.ts", @@ -23,7 +23,7 @@ }, "homepage": "https://github.com/0xProject/0x.js/packages/assert/README.md", "devDependencies": { - "@0xproject/tslint-config": "^0.1.0", + "@0xproject/tslint-config": "^0.1.3", "@types/lodash": "^4.14.78", "@types/mocha": "^2.2.42", "@types/valid-url": "^1.0.2", @@ -37,7 +37,7 @@ "typescript": "^2.4.2" }, "dependencies": { - "@0xproject/json-schemas": "^0.6.7", + "@0xproject/json-schemas": "^0.6.10", "bignumber.js": "~4.1.0", "ethereum-address": "^0.0.4", "lodash": "^4.17.4", diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json index 07ed20551..aa7c5d5d1 100644 --- a/packages/json-schemas/package.json +++ b/packages/json-schemas/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/json-schemas", - "version": "0.6.7", + "version": "0.6.10", "description": "0x-related json schemas", "main": "lib/src/index.js", "types": "lib/src/index.d.ts", @@ -28,7 +28,7 @@ "lodash.values": "^4.3.0" }, "devDependencies": { - "@0xproject/tslint-config": "^0.1.0", + "@0xproject/tslint-config": "^0.1.3", "@types/lodash.foreach": "^4.5.3", "@types/lodash.values": "^4.3.3", "@types/mocha": "^2.2.42", diff --git a/packages/tslint-config/package.json b/packages/tslint-config/package.json index ca46d63fc..50adae56f 100644 --- a/packages/tslint-config/package.json +++ b/packages/tslint-config/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/tslint-config", - "version": "0.1.0", + "version": "0.1.3", "description": "Lint rules related to 0xProject for TSLint", "main": "tslint.json", "files": [ diff --git a/yarn.lock b/yarn.lock index d10468fed..ade8366a0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,25 @@ # yarn lockfile v1 +"0x.js@^0.25.4": + version "0.25.1" + dependencies: + "@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" + 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" + lodash "^4.17.4" + publish-release "^1.3.3" + uuid "^3.1.0" + web3 "^0.20.0" + "@types/fetch-mock@^5.12.1": version "5.12.2" resolved "https://registry.yarnpkg.com/@types/fetch-mock/-/fetch-mock-5.12.2.tgz#8c96517ff74303031c65c5da2d99858e34c844d2" @@ -323,6 +342,12 @@ assertion-error@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.0.2.tgz#13ca515d86206da0bac66e834dd397d87581094c" +async-child-process@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/async-child-process/-/async-child-process-1.1.1.tgz#27d0a598b5738707f9898c048bd231340583747b" + dependencies: + babel-runtime "^6.11.6" + async-each@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d" @@ -740,7 +765,7 @@ babel-register@^6.26.0: mkdirp "^0.5.1" source-map-support "^0.4.15" -babel-runtime@^6.18.0, babel-runtime@^6.22.0, babel-runtime@^6.26.0: +babel-runtime@^6.11.6, babel-runtime@^6.18.0, babel-runtime@^6.22.0, babel-runtime@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" dependencies: @@ -4979,7 +5004,14 @@ semver-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/semver-regex/-/semver-regex-1.0.0.tgz#92a4969065f9c70c694753d55248fc68f8f652c9" -"semver@2 || 3 || 4 || 5", semver@^5.0.1, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@~5.4.1: +semver-sort@^0.0.4: + version "0.0.4" + resolved "https://registry.yarnpkg.com/semver-sort/-/semver-sort-0.0.4.tgz#34fdbddc6a6b2b4161398c3c4dba56243bfeaa8b" + dependencies: + semver "^5.0.3" + semver-regex "^1.0.0" + +"semver@2 || 3 || 4 || 5", semver@^5.0.1, semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@~5.4.1: version "5.4.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" -- cgit v1.2.3