From 49a4f0c74c5578abf4b64ea2ed36f4821af10f9f Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sat, 3 Mar 2018 21:33:44 +0100 Subject: Fix styling --- scripts/postpublish_utils.js | 45 ++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) (limited to 'scripts') diff --git a/scripts/postpublish_utils.js b/scripts/postpublish_utils.js index 7ce01189c..e67d4d896 100644 --- a/scripts/postpublish_utils.js +++ b/scripts/postpublish_utils.js @@ -11,23 +11,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 +42,7 @@ module.exports = { reuseRelease: true, reuseDraftOnly: false, assets: assets, - }); + }); }, getReleaseName(subPackageName, version) { const releaseName = subPackageName + ' v' + version; @@ -51,11 +50,13 @@ 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; }); -- cgit v1.2.3 From 839e5895e41c849d69b493ad2a1e85c8504c38b2 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sat, 3 Mar 2018 21:34:13 +0100 Subject: Instead of adding `@0xproject/types` to tsconfig.json, let's only add it when calling TypeDoc --- scripts/postpublish_utils.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'scripts') diff --git a/scripts/postpublish_utils.js b/scripts/postpublish_utils.js index e67d4d896..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'); @@ -61,5 +62,15 @@ module.exports = { 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, }; -- cgit v1.2.3 From 699c0c3e05d3a882c8a59fec4f035ec25cb43c9e Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sun, 4 Mar 2018 21:24:47 +0100 Subject: Fix bugs in postpublish_utils.js --- scripts/postpublish_utils.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/postpublish_utils.js b/scripts/postpublish_utils.js index 6f990eb5e..0a8c6f94d 100644 --- a/scripts/postpublish_utils.js +++ b/scripts/postpublish_utils.js @@ -64,11 +64,21 @@ module.exports = { }, adjustFileIncludePaths: function(fileIncludes, cwd) { const fileIncludesAdjusted = _.map(fileIncludes, fileInclude => { + let path; if (_.startsWith(fileInclude, '../')) { - return cwd + '/../' + fileInclude; - } else if (_.startsWith('./')) { - return cwd + '/../' + fileInclude; + path = cwd + '/../' + fileInclude; + } else if (_.startsWith(fileInclude, './')) { + path = cwd + '/../' + fileInclude.substr(2); + } else { + path = cwd + '/' + fileInclude; } + + // HACK: tsconfig.json needs wildcard directory endings as `/**/*` + // but TypeDoc needs it as `/**` in order to pick up files at the root + if (_.endsWith(path, '/**/*')) { + path = path.slice(0, -2); + } + return path; }); return fileIncludesAdjusted; }, -- cgit v1.2.3