diff options
author | Fabio Berger <me@fabioberger.com> | 2018-03-04 04:44:44 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-03-04 04:44:44 +0800 |
commit | df4db8fa4c19d2ef0a311d201061ba732ce0eb97 (patch) | |
tree | e5fcbc5612296eaa8b368c264259001e0172e4f1 /scripts/postpublish_utils.js | |
parent | e11e26a35274a96fd2d4b7f37e60b89220115994 (diff) | |
parent | bd85fe0af3ce201710f92b995cf25dfc96fba953 (diff) | |
download | dexon-sol-tools-df4db8fa4c19d2ef0a311d201061ba732ce0eb97.tar dexon-sol-tools-df4db8fa4c19d2ef0a311d201061ba732ce0eb97.tar.gz dexon-sol-tools-df4db8fa4c19d2ef0a311d201061ba732ce0eb97.tar.bz2 dexon-sol-tools-df4db8fa4c19d2ef0a311d201061ba732ce0eb97.tar.lz dexon-sol-tools-df4db8fa4c19d2ef0a311d201061ba732ce0eb97.tar.xz dexon-sol-tools-df4db8fa4c19d2ef0a311d201061ba732ce0eb97.tar.zst dexon-sol-tools-df4db8fa4c19d2ef0a311d201061ba732ce0eb97.zip |
Merge branch '0x.js/updateTypeDoc' into extractDocs
* 0x.js/updateTypeDoc:
Fix comments
Add comments
Don't need any external packages for 0x connect docs yet
Instead of adding `@0xproject/types` to tsconfig.json, let's only add it when calling TypeDoc
Fix styling
Make prettier ignore postpublish_utils
Update yarn.lock
Diffstat (limited to 'scripts/postpublish_utils.js')
-rw-r--r-- | scripts/postpublish_utils.js | 56 |
1 files changed, 34 insertions, 22 deletions
diff --git a/scripts/postpublish_utils.js b/scripts/postpublish_utils.js index 7ce01189c..6f990eb5e 100644 --- a/scripts/postpublish_utils.js +++ b/scripts/postpublish_utils.js @@ -1,3 +1,4 @@ +const _ = require('lodash'); const execAsync = require('async-child-process').execAsync; const semverSort = require('semver-sort'); const publishRelease = require('publish-release'); @@ -11,23 +12,22 @@ module.exports = { getLatestTagAndVersionAsync: function(subPackageName) { const subPackagePrefix = subPackageName + '@'; const gitTagsCommand = 'git tag -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 - }; + 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, + }; + }); }, publishReleaseNotesAsync: function(tag, releaseName, assets) { console.log('POSTPUBLISH: Releasing ', releaseName, '...'); @@ -43,7 +43,7 @@ module.exports = { reuseRelease: true, reuseDraftOnly: false, assets: assets, - }); + }); }, getReleaseName(subPackageName, version) { const releaseName = subPackageName + ' v' + version; @@ -51,14 +51,26 @@ module.exports = { }, standardPostPublishAsync: function(subPackageName) { return this.getLatestTagAndVersionAsync(subPackageName) - .then(function(result) { - const releaseName = this.getReleaseName(subPackageName, result.version); - const assets = []; - return this.publishReleaseNotesAsync(result.tag, releaseName, assets); - }.bind(this)) + .then( + function(result) { + const releaseName = this.getReleaseName(subPackageName, result.version); + const assets = []; + return this.publishReleaseNotesAsync(result.tag, releaseName, assets); + }.bind(this) + ) .catch(function(err) { throw err; }); }, + adjustFileIncludePaths: function(fileIncludes, cwd) { + const fileIncludesAdjusted = _.map(fileIncludes, fileInclude => { + if (_.startsWith(fileInclude, '../')) { + return cwd + '/../' + fileInclude; + } else if (_.startsWith('./')) { + return cwd + '/../' + fileInclude; + } + }); + return fileIncludesAdjusted; + }, generatedDocsDirectoryName, }; |