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/scripts/postpublish.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 packages/0x.js/scripts/postpublish.js (limited to 'packages/0x.js/scripts') 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 v1.2.3 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/scripts/postpublish.js | 76 ++++++++++++++++++++++++++--------- 1 file changed, 58 insertions(+), 18 deletions(-) (limited to 'packages/0x.js/scripts') 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 v1.2.3 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/scripts') 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 v1.2.3 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/scripts/postpublish.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'packages/0x.js/scripts') 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 v1.2.3 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/scripts') 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 v1.2.3 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/scripts') 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 v1.2.3 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/scripts') 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 v1.2.3 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/scripts') 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 v1.2.3 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/scripts/postpublish.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'packages/0x.js/scripts') 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 v1.2.3 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/scripts/postpublish.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'packages/0x.js/scripts') 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 v1.2.3 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/scripts') 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 v1.2.3 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/scripts/postpublish.js | 52 ++++++----------------------------- 1 file changed, 8 insertions(+), 44 deletions(-) (limited to 'packages/0x.js/scripts') 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 v1.2.3 From 5042b85d218bd17dcf0ebf9b3127dd30c5bb5962 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Fri, 17 Nov 2017 12:32:39 -0800 Subject: Remove clean step from test_umd.sh --- packages/0x.js/scripts/test_umd.sh | 1 - 1 file changed, 1 deletion(-) (limited to 'packages/0x.js/scripts') diff --git a/packages/0x.js/scripts/test_umd.sh b/packages/0x.js/scripts/test_umd.sh index d200c76d0..e3eba088a 100755 --- a/packages/0x.js/scripts/test_umd.sh +++ b/packages/0x.js/scripts/test_umd.sh @@ -3,5 +3,4 @@ # UMD tests should only be run after building the commonjs because they reuse some of the commonjs build artifacts run-s substitute_umd_bundle run_mocha return_code=$? -npm run clean exit $return_code -- cgit v1.2.3 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/scripts') 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 v1.2.3 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/scripts') 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 v1.2.3 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/scripts') 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 v1.2.3 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/scripts') 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 v1.2.3