From a9fbe921a04d2828bd17a60598a3eee0ec63445b Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Wed, 15 Nov 2017 15:14:20 -0500 Subject: WIP --- packages/0x.js/package.json | 14 +++++++------- packages/0x.js/scripts/postpublish.js | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 packages/0x.js/scripts/postpublish.js (limited to 'packages/0x.js') 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'); + }); -- cgit From 6096fe75d338a82a614d663f7c32ada6c6c7574f Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Wed, 15 Nov 2017 15:14:30 -0500 Subject: WIP --- packages/0x.js/package.json | 2 +- packages/0x.js/scripts/postpublish.js | 76 ++++++++++++++++++++++++++--------- 2 files changed, 59 insertions(+), 19 deletions(-) (limited to 'packages/0x.js') 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 + }; + }); +} -- cgit From 827c2457772bd2203307d87f864214c370383807 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 15 Nov 2017 16:19:33 -0500 Subject: postpublish script fixes --- packages/0x.js/scripts/postpublish.js | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'packages/0x.js') diff --git a/packages/0x.js/scripts/postpublish.js b/packages/0x.js/scripts/postpublish.js index ff425adbb..deedee74c 100644 --- a/packages/0x.js/scripts/postpublish.js +++ b/packages/0x.js/scripts/postpublish.js @@ -10,12 +10,13 @@ const subPackageName = '0x.js'; const subPackagePrefix = subPackageName + '@'; const githubPersonalAccessToken = process.env.GITHUB_PERSONAL_ACCESS_TOKEN_0X_JS; let tag; - +let version; getLatestTagAndVersionAsync(subPackageName) .then(function(result) { console.log('POSTPUBLISH: Releasing...'); tag = result.tag; - const releaseName = subPackageName + ' v' + result.version; + version = result.version; + const releaseName = subPackageName + ' v' + result.version; return publishReleaseAsync({ token: githubPersonalAccessToken, owner: '0xProject', @@ -30,24 +31,19 @@ getLatestTagAndVersionAsync(subPackageName) assets: ['_bundles/index.js', '_bundles/index.min.js'], }); }) - .then(function(err, release) { - if (err !== null) { - throw err; - } - console.log('POSTPUBLISH: Release successful, generating docs...'); - return execAsync('yarn docs:json'); + .then(function(release) { + console.log('POSTPUBLISH: Release successful, generating docs...'); + return execAsync('yarn docs:json'); }) .then(function(result) { if (result.stderr !== '') { throw new Error(result.stderr); } - 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'); + console.log('POSTPUBLISH: Doc generation successful, uploading docs...'); + const s3Url = 's3://0xjs-docs-jsons/v' + version +'.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 + '*"'; -- cgit From 9a57f71ee6fd7aef73811c18e71179e5dc94a417 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 15 Nov 2017 16:47:35 -0500 Subject: improve script --- packages/0x.js/package.json | 6 +----- packages/0x.js/scripts/postpublish.js | 7 +++---- 2 files changed, 4 insertions(+), 9 deletions(-) (limited to 'packages/0x.js') diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index d09396a84..61039a8c0 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;", - "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", @@ -22,9 +21,6 @@ "test:coverage": "nyc npm run test --all", "report_test_coverage": "nyc report --reporter=text-lcov | coveralls", "update_contracts": "for i in ${npm_package_config_artifacts}; do copyfiles -u 4 ../contracts/build/contracts/$i.json ../0x.js/src/artifacts; done;", - "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json docs/index.json .", - "docs:generate": "typedoc --out docs .", - "docs:open": "opn docs/index.html", "clean": "shx rm -rf _bundles lib test_temp", "build:umd:dev": "webpack", "build:umd:prod": "NODE_ENV=production webpack", @@ -99,7 +95,7 @@ "find-versions": "^2.0.0", "js-sha3": "^0.6.1", "lodash": "^4.17.4", - "publish-release": "^1.3.3", + "publish-release": "0xproject/publish-release", "uuid": "^3.1.0", "web3": "^0.20.0" } diff --git a/packages/0x.js/scripts/postpublish.js b/packages/0x.js/scripts/postpublish.js index deedee74c..b30c7eb3e 100644 --- a/packages/0x.js/scripts/postpublish.js +++ b/packages/0x.js/scripts/postpublish.js @@ -28,12 +28,12 @@ getLatestTagAndVersionAsync(subPackageName) prerelease: false, reuseRelease: true, reuseDraftOnly: false, - assets: ['_bundles/index.js', '_bundles/index.min.js'], + assets: [__dirname + '/../_bundles/index.js', __dirname + '/../_bundles/index.min.js'], }); }) .then(function(release) { console.log('POSTPUBLISH: Release successful, generating docs...'); - return execAsync('yarn docs:json'); + return execAsync('typedoc --excludePrivate --excludeExternals --target ES5 --json ' + __dirname + '/../docs/index.json ' + __dirname + '/..'); }) .then(function(result) { if (result.stderr !== '') { @@ -41,13 +41,12 @@ getLatestTagAndVersionAsync(subPackageName) } console.log('POSTPUBLISH: Doc generation successful, uploading docs...'); const s3Url = 's3://0xjs-docs-jsons/v' + version +'.json'; - return execAsync('S3_URL=' + s3Url + ' yarn upload_docs_json'); + return execAsync('aws s3 cp ' + __dirname + '/../docs/index.json ' + s3Url + ' --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type aplication/json'); }); function getLatestTagAndVersionAsync(subPackageName) { const subPackagePrefix = subPackageName + '@'; const gitTagsCommand = 'git tags -l "' + subPackagePrefix + '*"'; - console.log(gitTagsCommand); return execAsync(gitTagsCommand) .then(function(result) { if (result.stderr !== '') { -- cgit From 1e5cc3b0e53aeb606140d0f735652aa464c2a4e7 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Wed, 15 Nov 2017 18:17:41 -0500 Subject: experiment with calling typedoc programatically --- packages/0x.js/scripts/postpublish.js | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'packages/0x.js') diff --git a/packages/0x.js/scripts/postpublish.js b/packages/0x.js/scripts/postpublish.js index b30c7eb3e..d68fd8fa0 100644 --- a/packages/0x.js/scripts/postpublish.js +++ b/packages/0x.js/scripts/postpublish.js @@ -2,12 +2,10 @@ 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 typedoc = require('typedoc'); 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; let version; @@ -33,7 +31,23 @@ getLatestTagAndVersionAsync(subPackageName) }) .then(function(release) { console.log('POSTPUBLISH: Release successful, generating docs...'); - return execAsync('typedoc --excludePrivate --excludeExternals --target ES5 --json ' + __dirname + '/../docs/index.json ' + __dirname + '/..'); + + // const rootDir = __dirname + '/../src/index.ts'; + // const typedocApp = new typedoc.Application({ + // excludePrivate: true, + // excludeExternals: true, + // target: 'ES5', + // }); + + // console.log(typedocApp.options); + // typedocApp.options.setValue('excludePrivate', true); + // typedocApp.options.setValue('excludeExternals', true); + // typedocApp.options.setValue('json', true); + // typedocApp.options.setValue('target', 'ES5'); + + + // return typedocApp.generateDocs([rootDir], __dirname + '/../docs/index.json'); + return execAsync('yarn typedoc --excludePrivate --excludeExternals --target ES5 --json ' + __dirname + '/../docs/index.json ' + __dirname + '/..'); }) .then(function(result) { if (result.stderr !== '') { @@ -42,6 +56,8 @@ getLatestTagAndVersionAsync(subPackageName) console.log('POSTPUBLISH: Doc generation successful, uploading docs...'); const s3Url = 's3://0xjs-docs-jsons/v' + version +'.json'; return execAsync('aws s3 cp ' + __dirname + '/../docs/index.json ' + s3Url + ' --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type aplication/json'); + }).catch (function(error) { + throw error; }); function getLatestTagAndVersionAsync(subPackageName) { -- cgit From 7b61ad639b7410c9157e340a422b431b25dc620d Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 17 Nov 2017 12:23:27 -0500 Subject: small fixes --- packages/0x.js/scripts/postpublish.js | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'packages/0x.js') diff --git a/packages/0x.js/scripts/postpublish.js b/packages/0x.js/scripts/postpublish.js index d68fd8fa0..e8ca99db9 100644 --- a/packages/0x.js/scripts/postpublish.js +++ b/packages/0x.js/scripts/postpublish.js @@ -7,6 +7,7 @@ const typedoc = require('typedoc'); const publishReleaseAsync = promisify(publishRelease); const subPackageName = '0x.js'; const githubPersonalAccessToken = process.env.GITHUB_PERSONAL_ACCESS_TOKEN_0X_JS; + let tag; let version; getLatestTagAndVersionAsync(subPackageName) @@ -32,20 +33,6 @@ getLatestTagAndVersionAsync(subPackageName) .then(function(release) { console.log('POSTPUBLISH: Release successful, generating docs...'); - // const rootDir = __dirname + '/../src/index.ts'; - // const typedocApp = new typedoc.Application({ - // excludePrivate: true, - // excludeExternals: true, - // target: 'ES5', - // }); - - // console.log(typedocApp.options); - // typedocApp.options.setValue('excludePrivate', true); - // typedocApp.options.setValue('excludeExternals', true); - // typedocApp.options.setValue('json', true); - // typedocApp.options.setValue('target', 'ES5'); - - // return typedocApp.generateDocs([rootDir], __dirname + '/../docs/index.json'); return execAsync('yarn typedoc --excludePrivate --excludeExternals --target ES5 --json ' + __dirname + '/../docs/index.json ' + __dirname + '/..'); }) @@ -56,8 +43,8 @@ getLatestTagAndVersionAsync(subPackageName) console.log('POSTPUBLISH: Doc generation successful, uploading docs...'); const s3Url = 's3://0xjs-docs-jsons/v' + version +'.json'; return execAsync('aws s3 cp ' + __dirname + '/../docs/index.json ' + s3Url + ' --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type aplication/json'); - }).catch (function(error) { - throw error; + }).catch (function(err) { + throw err; }); function getLatestTagAndVersionAsync(subPackageName) { -- cgit From 2e368b50ebb8080bad46412fcf8defbc34eabcef Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 17 Nov 2017 13:24:15 -0500 Subject: print out file name in console --- packages/0x.js/scripts/postpublish.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'packages/0x.js') diff --git a/packages/0x.js/scripts/postpublish.js b/packages/0x.js/scripts/postpublish.js index e8ca99db9..519973f61 100644 --- a/packages/0x.js/scripts/postpublish.js +++ b/packages/0x.js/scripts/postpublish.js @@ -40,8 +40,9 @@ getLatestTagAndVersionAsync(subPackageName) if (result.stderr !== '') { throw new Error(result.stderr); } - console.log('POSTPUBLISH: Doc generation successful, uploading docs...'); - const s3Url = 's3://0xjs-docs-jsons/v' + version +'.json'; + const fileName = 'v' + version + '.json'; + console.log('POSTPUBLISH: Doc generation successful, uploading docs... as ', fileName); + const s3Url = 's3://0xjs-docs-jsons/' + fileName; return execAsync('aws s3 cp ' + __dirname + '/../docs/index.json ' + s3Url + ' --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type aplication/json'); }).catch (function(err) { throw err; -- cgit From 50dc1d3db34c061fe6836273c1b80bc450b04d69 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 17 Nov 2017 13:24:36 -0500 Subject: specify the current working directory in which to run the `yarn` command --- packages/0x.js/scripts/postpublish.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'packages/0x.js') diff --git a/packages/0x.js/scripts/postpublish.js b/packages/0x.js/scripts/postpublish.js index 519973f61..3f0502c64 100644 --- a/packages/0x.js/scripts/postpublish.js +++ b/packages/0x.js/scripts/postpublish.js @@ -34,7 +34,12 @@ getLatestTagAndVersionAsync(subPackageName) console.log('POSTPUBLISH: Release successful, generating docs...'); // return typedocApp.generateDocs([rootDir], __dirname + '/../docs/index.json'); - return execAsync('yarn typedoc --excludePrivate --excludeExternals --target ES5 --json ' + __dirname + '/../docs/index.json ' + __dirname + '/..'); + return execAsync( + 'yarn typedoc --excludePrivate --excludeExternals --target ES5 --json ' + __dirname + '/../docs/index.json ' + __dirname + '/..', + { + cwd: __dirname + '/..', + } + ); }) .then(function(result) { if (result.stderr !== '') { -- cgit From e70c3976db61bfe2038b0d56ea196412215aae4f Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 17 Nov 2017 13:30:26 -0500 Subject: Use `yarn docs:json` command --- packages/0x.js/package.json | 1 + packages/0x.js/scripts/postpublish.js | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'packages/0x.js') diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index 61039a8c0..10ace5529 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -14,6 +14,7 @@ "scripts": { "prebuild": "npm run clean", "build": "run-p build:umd:prod build:commonjs; exit 0;", + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $1 $2", "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", diff --git a/packages/0x.js/scripts/postpublish.js b/packages/0x.js/scripts/postpublish.js index 3f0502c64..1ec0ac258 100644 --- a/packages/0x.js/scripts/postpublish.js +++ b/packages/0x.js/scripts/postpublish.js @@ -28,14 +28,13 @@ getLatestTagAndVersionAsync(subPackageName) reuseRelease: true, reuseDraftOnly: false, assets: [__dirname + '/../_bundles/index.js', __dirname + '/../_bundles/index.min.js'], - }); + }); }) .then(function(release) { console.log('POSTPUBLISH: Release successful, generating docs...'); - // return typedocApp.generateDocs([rootDir], __dirname + '/../docs/index.json'); return execAsync( - 'yarn typedoc --excludePrivate --excludeExternals --target ES5 --json ' + __dirname + '/../docs/index.json ' + __dirname + '/..', + 'yarn docs:json ' + __dirname + '/../docs/index.json ' + __dirname + '/..', { cwd: __dirname + '/..', } -- cgit From 0402d3de802ba262bb820d582baa157ca9c8ba54 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 17 Nov 2017 13:19:12 -0600 Subject: Move upload_docs_json back to npm script and pass in vars properly. --- packages/0x.js/package.json | 3 ++- packages/0x.js/scripts/postpublish.js | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'packages/0x.js') diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index 10ace5529..e1f0bb93e 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -14,7 +14,8 @@ "scripts": { "prebuild": "npm run clean", "build": "run-p build:umd:prod build:commonjs; exit 0;", - "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $1 $2", + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_DIR", + "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", diff --git a/packages/0x.js/scripts/postpublish.js b/packages/0x.js/scripts/postpublish.js index 1ec0ac258..b9fe0bc9a 100644 --- a/packages/0x.js/scripts/postpublish.js +++ b/packages/0x.js/scripts/postpublish.js @@ -4,6 +4,7 @@ const publishRelease = require('publish-release'); const promisify = require('es6-promisify'); const typedoc = require('typedoc'); +const cwd = __dirname + '/..'; const publishReleaseAsync = promisify(publishRelease); const subPackageName = '0x.js'; const githubPersonalAccessToken = process.env.GITHUB_PERSONAL_ACCESS_TOKEN_0X_JS; @@ -34,9 +35,9 @@ getLatestTagAndVersionAsync(subPackageName) console.log('POSTPUBLISH: Release successful, generating docs...'); return execAsync( - 'yarn docs:json ' + __dirname + '/../docs/index.json ' + __dirname + '/..', + 'JSON_FILE_PATH=' + __dirname + '/../docs/index.json PROJECT_DIR=' + __dirname + '/.. yarn docs:json', { - cwd: __dirname + '/..', + cwd, } ); }) @@ -47,7 +48,9 @@ getLatestTagAndVersionAsync(subPackageName) const fileName = 'v' + version + '.json'; console.log('POSTPUBLISH: Doc generation successful, uploading docs... as ', fileName); const s3Url = 's3://0xjs-docs-jsons/' + fileName; - return execAsync('aws s3 cp ' + __dirname + '/../docs/index.json ' + s3Url + ' --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type aplication/json'); + return execAsync('S3_URL=' + s3Url + ' yarn upload_docs_json', { + cwd, + }); }).catch (function(err) { throw err; }); -- cgit From f25b2d9ab9bfc9410e17d1ee7a4bf0074aaa622c Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 17 Nov 2017 13:19:33 -0600 Subject: Set prerelease to true so that non of the releases are marked as "latest" --- packages/0x.js/scripts/postpublish.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/0x.js') diff --git a/packages/0x.js/scripts/postpublish.js b/packages/0x.js/scripts/postpublish.js index b9fe0bc9a..4512fb24c 100644 --- a/packages/0x.js/scripts/postpublish.js +++ b/packages/0x.js/scripts/postpublish.js @@ -25,7 +25,7 @@ getLatestTagAndVersionAsync(subPackageName) name: releaseName, notes: 'TODO', draft: false, - prerelease: false, + prerelease: true, reuseRelease: true, reuseDraftOnly: false, assets: [__dirname + '/../_bundles/index.js', __dirname + '/../_bundles/index.min.js'], -- cgit From 5277d4a2666a795d01b7d3d4d018ca6d0e42399f Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 17 Nov 2017 14:09:48 -0600 Subject: Move most of code for getting latest tag/version and calling publish_release to postpublish_utils script in top-level dir --- packages/0x.js/package.json | 3 -- packages/0x.js/scripts/postpublish.js | 52 ++++++----------------------------- 2 files changed, 8 insertions(+), 47 deletions(-) (limited to 'packages/0x.js') diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index e1f0bb93e..c381d3898 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -70,7 +70,6 @@ "prompt": "^1.0.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", @@ -90,14 +89,12 @@ "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": "0xproject/publish-release", "uuid": "^3.1.0", "web3": "^0.20.0" } diff --git a/packages/0x.js/scripts/postpublish.js b/packages/0x.js/scripts/postpublish.js index 4512fb24c..e68302b33 100644 --- a/packages/0x.js/scripts/postpublish.js +++ b/packages/0x.js/scripts/postpublish.js @@ -1,39 +1,25 @@ const execAsync = require('async-child-process').execAsync; -const semverSort = require('semver-sort'); -const publishRelease = require('publish-release'); -const promisify = require('es6-promisify'); -const typedoc = require('typedoc'); +const postpublish_utils = require('../../../scripts/postpublish_utils'); const cwd = __dirname + '/..'; -const publishReleaseAsync = promisify(publishRelease); const subPackageName = '0x.js'; -const githubPersonalAccessToken = process.env.GITHUB_PERSONAL_ACCESS_TOKEN_0X_JS; let tag; let version; -getLatestTagAndVersionAsync(subPackageName) +postpublish_utils.getLatestTagAndVersionAsync(subPackageName) .then(function(result) { console.log('POSTPUBLISH: Releasing...'); tag = result.tag; version = result.version; - const releaseName = subPackageName + ' v' + result.version; - return publishReleaseAsync({ - token: githubPersonalAccessToken, - owner: '0xProject', - repo: '0x.js', - tag: tag, - name: releaseName, - notes: 'TODO', - draft: false, - prerelease: true, - reuseRelease: true, - reuseDraftOnly: false, - assets: [__dirname + '/../_bundles/index.js', __dirname + '/../_bundles/index.min.js'], - }); + const releaseName = subPackageName + ' v' + version; + const assets = [ + __dirname + '/../_bundles/index.js', + __dirname + '/../_bundles/index.min.js', + ]; + return postpublish_utils.publishReleaseNotes(tag, releaseName, assets); }) .then(function(release) { console.log('POSTPUBLISH: Release successful, generating docs...'); - return execAsync( 'JSON_FILE_PATH=' + __dirname + '/../docs/index.json PROJECT_DIR=' + __dirname + '/.. yarn docs:json', { @@ -54,25 +40,3 @@ getLatestTagAndVersionAsync(subPackageName) }).catch (function(err) { throw err; }); - -function getLatestTagAndVersionAsync(subPackageName) { - const subPackagePrefix = subPackageName + '@'; - const gitTagsCommand = 'git tags -l "' + subPackagePrefix + '*"'; - 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 - }; - }); -} -- cgit From cd0f6716e817a8b123d2b5203ea838ecf3a5e8d4 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 17 Nov 2017 14:33:28 -0600 Subject: remove unused imports --- packages/0x.js/package.json | 2 -- 1 file changed, 2 deletions(-) (limited to 'packages/0x.js') diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index c381d3898..341df882b 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -51,7 +51,6 @@ "@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", @@ -67,7 +66,6 @@ "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", "shx": "^0.2.2", -- cgit From 70f4453e3eb2818c883862f609885e077b6bc631 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 17 Nov 2017 14:33:43 -0600 Subject: Get package name from package.json --- packages/0x.js/scripts/postpublish.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'packages/0x.js') diff --git a/packages/0x.js/scripts/postpublish.js b/packages/0x.js/scripts/postpublish.js index e68302b33..bf4c63032 100644 --- a/packages/0x.js/scripts/postpublish.js +++ b/packages/0x.js/scripts/postpublish.js @@ -1,8 +1,9 @@ const execAsync = require('async-child-process').execAsync; const postpublish_utils = require('../../../scripts/postpublish_utils'); +const packageJSON = require('../package.json'); const cwd = __dirname + '/..'; -const subPackageName = '0x.js'; +const subPackageName = packageJSON.name; let tag; let version; -- cgit From 6a83687f45db37cbb8bdb24a7bb090094a6cae08 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 17 Nov 2017 14:44:44 -0600 Subject: reset all sub-package versions to latest actually published --- packages/0x.js/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'packages/0x.js') diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index 341df882b..8278a96f6 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -44,7 +44,7 @@ "node": ">=6.0.0" }, "devDependencies": { - "@0xproject/tslint-config": "^0.1.3", + "@0xproject/tslint-config": "^0.1.0", "@types/jsonschema": "^1.1.1", "@types/lodash": "^4.14.64", "@types/mocha": "^2.2.41", @@ -82,8 +82,8 @@ "webpack": "^3.1.0" }, "dependencies": { - "@0xproject/assert": "^0.0.7", - "@0xproject/json-schemas": "^0.6.10", + "@0xproject/assert": "^0.0.4", + "@0xproject/json-schemas": "^0.6.7", "bignumber.js": "~4.1.0", "bn.js": "4.11.8", "compare-versions": "^3.0.1", -- cgit From 49ba456189bf43149a9f58aa01ecd820baa52082 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 17 Nov 2017 14:49:46 -0600 Subject: Set S3 bucket path to variable --- packages/0x.js/scripts/postpublish.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'packages/0x.js') diff --git a/packages/0x.js/scripts/postpublish.js b/packages/0x.js/scripts/postpublish.js index bf4c63032..3756b8984 100644 --- a/packages/0x.js/scripts/postpublish.js +++ b/packages/0x.js/scripts/postpublish.js @@ -4,6 +4,7 @@ const packageJSON = require('../package.json'); const cwd = __dirname + '/..'; const subPackageName = packageJSON.name; +const S3BucketPath = 's3://0xjs-docs-jsons/', let tag; let version; @@ -34,7 +35,7 @@ postpublish_utils.getLatestTagAndVersionAsync(subPackageName) } const fileName = 'v' + version + '.json'; console.log('POSTPUBLISH: Doc generation successful, uploading docs... as ', fileName); - const s3Url = 's3://0xjs-docs-jsons/' + fileName; + const s3Url = S3BucketPath + fileName; return execAsync('S3_URL=' + s3Url + ' yarn upload_docs_json', { cwd, }); -- cgit From abee7d25a4e9bee81fa76d6bc0da31488aed16bc Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 17 Nov 2017 16:43:15 -0600 Subject: Add back promisify --- packages/0x.js/package.json | 1 + 1 file changed, 1 insertion(+) (limited to 'packages/0x.js') diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index 8278a96f6..7aa360954 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -87,6 +87,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", -- cgit From 7f595169c1bc02873d47a5b7411dfb7414c19041 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 17 Nov 2017 16:44:56 -0600 Subject: Put release name generation into postpublish_utils --- packages/0x.js/scripts/postpublish.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'packages/0x.js') diff --git a/packages/0x.js/scripts/postpublish.js b/packages/0x.js/scripts/postpublish.js index 3756b8984..d2ae86bbd 100644 --- a/packages/0x.js/scripts/postpublish.js +++ b/packages/0x.js/scripts/postpublish.js @@ -10,10 +10,9 @@ let tag; let version; postpublish_utils.getLatestTagAndVersionAsync(subPackageName) .then(function(result) { - console.log('POSTPUBLISH: Releasing...'); tag = result.tag; version = result.version; - const releaseName = subPackageName + ' v' + version; + const releaseName = postpublish_utils.getReleaseName(subPackageName, version); const assets = [ __dirname + '/../_bundles/index.js', __dirname + '/../_bundles/index.min.js', -- cgit From 37a9b64503edc8fe750dad02a7a45d8303f9ba04 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 17 Nov 2017 17:00:15 -0600 Subject: Small fixes --- packages/0x.js/scripts/postpublish.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/0x.js') diff --git a/packages/0x.js/scripts/postpublish.js b/packages/0x.js/scripts/postpublish.js index d2ae86bbd..ffc68afb4 100644 --- a/packages/0x.js/scripts/postpublish.js +++ b/packages/0x.js/scripts/postpublish.js @@ -4,7 +4,7 @@ const packageJSON = require('../package.json'); const cwd = __dirname + '/..'; const subPackageName = packageJSON.name; -const S3BucketPath = 's3://0xjs-docs-jsons/', +const S3BucketPath = 's3://0xjs-docs-jsons/'; let tag; let version; -- cgit