aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-03-06 07:08:56 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-03-06 07:08:56 +0800
commitd171ce4fba97847a617fc4c8fd7e3b759586c933 (patch)
treec800ae90713a098cd00a418bffe516776b579baf /scripts
parent92b9dbd706768fd0edfc8f72a90f197abd8b3d66 (diff)
parent994935b5da0b15796958a32c5bab0a25b9430b5a (diff)
downloaddexon-0x-contracts-d171ce4fba97847a617fc4c8fd7e3b759586c933.tar.gz
dexon-0x-contracts-d171ce4fba97847a617fc4c8fd7e3b759586c933.tar.zst
dexon-0x-contracts-d171ce4fba97847a617fc4c8fd7e3b759586c933.zip
Merge branch 'development' into feature/sra-reporter
* development: (79 commits) remove from devDeps Remove date for now Add ethers typescript typings to 0x.js deps. The library works without this atm since another dep of 0x.js has it as a dep. But it's more robust to have it here. Add missing instructions to add external types to tsconfig.json after installing the package Fix bugs in postpublish_utils.js Update @0xproject/utils in top-level package.json Changelog tweaks Publish Updated CHANGELOGS Fix typo Add PR number to changelog entry Add changelog update to subproviders package Add `numberOfAccounts` param to `LedgerSubprovider` method `getAccountsAsync` and add tests Remove unnecessary type assertion 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 ...
Diffstat (limited to 'scripts')
-rw-r--r--scripts/postpublish_utils.js66
1 files changed, 44 insertions, 22 deletions
diff --git a/scripts/postpublish_utils.js b/scripts/postpublish_utils.js
index 7ce01189c..0a8c6f94d 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,36 @@ 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 => {
+ let path;
+ if (_.startsWith(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;
+ },
generatedDocsDirectoryName,
};