From 952f1cf8d03c68b83c614508f3b54801949b368d Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 12 Mar 2018 15:22:04 +0100 Subject: [PATCH 01/22] Use `isMetaMask` flag rather then constructor name for Metamask provider detection --- packages/website/ts/utils/utils.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts index 5fcd3f8e5b..abb2598c3c 100644 --- a/packages/website/ts/utils/utils.ts +++ b/packages/website/ts/utils/utils.ts @@ -281,10 +281,6 @@ export const utils = { const constructorName = provider.constructor.name; let parsedProviderName = constructorName; switch (constructorName) { - case 'MetamaskInpageProvider': - parsedProviderName = Providers.Metamask; - break; - case 'EthereumProvider': parsedProviderName = Providers.Mist; break; @@ -295,6 +291,8 @@ export const utils = { } if ((provider as any).isParity) { parsedProviderName = Providers.Parity; + } else if ((provider as any).isMetaMask) { + parsedProviderName = Providers.Metamask; } return parsedProviderName; }, From 745af5309d32a34e5f8c6a305f12ce31cb2379b1 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 12 Mar 2018 16:04:01 +0100 Subject: [PATCH 02/22] Add missing prettier devDep --- packages/0x.js/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index 4a4d6d2c85..53ddfd258b 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -66,6 +66,7 @@ "npm-run-all": "^4.1.2", "nyc": "^11.0.1", "opn-cli": "^3.1.0", + "prettier": "^1.11.1", "request": "^2.81.0", "request-promise-native": "^1.0.5", "shx": "^0.2.2", From ef6aa9f41b9f21d033034c51e8880ec9d70b6b40 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 12 Mar 2018 22:13:24 +0100 Subject: [PATCH 03/22] Convert 0x.js scripts to TS, move the prepublishUtils script to `dev-utils` and also convert it to TS. --- .gitignore | 3 + package.json | 6 +- packages/0x.js/monorepo_scripts/globals.d.ts | 12 +++ .../0x.js/monorepo_scripts/postpublish.ts | 44 ++++++++++ packages/0x.js/monorepo_scripts/stagedocs.ts | 30 +++++++ packages/0x.js/package.json | 3 +- packages/0x.js/tsconfig_monorepo.json | 9 ++ packages/dev-utils/CHANGELOG.md | 4 + packages/dev-utils/package.json | 2 + packages/dev-utils/src/globals.d.ts | 7 ++ packages/dev-utils/src/index.ts | 1 + packages/dev-utils/src/postpublish_utils.ts | 86 +++++++++++++++++++ packages/dev-utils/src/utils.ts | 5 ++ 13 files changed, 206 insertions(+), 6 deletions(-) create mode 100644 packages/0x.js/monorepo_scripts/globals.d.ts create mode 100644 packages/0x.js/monorepo_scripts/postpublish.ts create mode 100644 packages/0x.js/monorepo_scripts/stagedocs.ts create mode 100644 packages/0x.js/tsconfig_monorepo.json create mode 100644 packages/dev-utils/src/postpublish_utils.ts create mode 100644 packages/dev-utils/src/utils.ts diff --git a/.gitignore b/.gitignore index 7d27493cc3..c5de0f4982 100644 --- a/.gitignore +++ b/.gitignore @@ -75,3 +75,6 @@ bin/ # generated contract artifacts packages/contracts/src/artifacts + +# Monorepo scripts +packages/0x.js/scripts diff --git a/package.json b/package.json index b8ce29c4a2..b1e1bf626e 100644 --- a/package.json +++ b/package.json @@ -16,12 +16,8 @@ "mnemonic": "concert load couple harbor equip island argue ramp clarify fence smart topic" }, "devDependencies": { - "@0xproject/utils": "^0.4.1", - "async-child-process": "^1.1.1", "ethereumjs-testrpc": "^6.0.3", "lerna": "^2.5.1", - "prettier": "^1.11.1", - "publish-release": "0xproject/publish-release", - "semver-sort": "^0.0.4" + "prettier": "^1.11.1" } } diff --git a/packages/0x.js/monorepo_scripts/globals.d.ts b/packages/0x.js/monorepo_scripts/globals.d.ts new file mode 100644 index 0000000000..bbfbdaa6ac --- /dev/null +++ b/packages/0x.js/monorepo_scripts/globals.d.ts @@ -0,0 +1,12 @@ +declare module 'async-child-process'; +declare module 'publish-release'; + +// semver-sort declarations +declare module 'semver-sort' { + const desc: (versions: string[]) => string[]; +} + +declare module '*.json' { + const value: any; + export default value; +} diff --git a/packages/0x.js/monorepo_scripts/postpublish.ts b/packages/0x.js/monorepo_scripts/postpublish.ts new file mode 100644 index 0000000000..13ab013bef --- /dev/null +++ b/packages/0x.js/monorepo_scripts/postpublish.ts @@ -0,0 +1,44 @@ +import { postpublishUtils } from '@0xproject/dev-utils'; +import { execAsync } from 'async-child-process'; +import * as _ from 'lodash'; + +import * as packageJSON from '../package.json'; +import * as tsConfig from '../tsconfig.json'; + +const cwd = `${__dirname}/..`; +const subPackageName = (packageJSON as any).name; +// Include any external packages that are part of the 0x.js public interface +// to this array so that TypeDoc picks it up and adds it to the Docs JSON +// So far, we only have @0xproject/types as part of 0x.js's public interface. +const fileIncludes = [...(tsConfig as any).include, '../types/src/index.ts']; +const fileIncludesAdjusted = postpublishUtils.adjustFileIncludePaths(fileIncludes, __dirname); +const projectFiles = fileIncludesAdjusted.join(' '); +const S3BucketPath = 's3://0xjs-docs-jsons/'; + +(async () => { + const tagAndVersion = await postpublishUtils.getLatestTagAndVersionAsync(subPackageName); + const tag = tagAndVersion.tag; + const version = tagAndVersion.version; + + const releaseName = postpublishUtils.getReleaseName(subPackageName, version); + const assets = [`${__dirname}/../_bundles/index.js`, `${__dirname}/../_bundles/index.min.js`]; + const release = await postpublishUtils.publishReleaseNotesAsync(tag, releaseName, assets); + + // tslint:disable-next-line:no-console + console.log('POSTPUBLISH: Release successful, generating docs...'); + const jsonFilePath = `${__dirname}/../${postpublishUtils.generatedDocsDirectoryName}/index.json`; + + const result = await execAsync(`JSON_FILE_PATH=${jsonFilePath} PROJECT_FILES="${projectFiles}" yarn docs:json`, { + cwd, + }); + if (!_.isEmpty(result.stderr)) { + throw new Error(result.stderr); + } + const fileName = `v${version}.json`; + // tslint:disable-next-line:no-console + console.log(`POSTPUBLISH: Doc generation successful, uploading docs... as ${fileName}`); + const s3Url = S3BucketPath + fileName; + return execAsync(`S3_URL=${s3Url} yarn upload_docs_json`, { + cwd, + }); +})().catch(console.error); diff --git a/packages/0x.js/monorepo_scripts/stagedocs.ts b/packages/0x.js/monorepo_scripts/stagedocs.ts new file mode 100644 index 0000000000..a62d8a0144 --- /dev/null +++ b/packages/0x.js/monorepo_scripts/stagedocs.ts @@ -0,0 +1,30 @@ +import { postpublishUtils } from '@0xproject/dev-utils'; +import { execAsync } from 'async-child-process'; +import * as _ from 'lodash'; + +import * as tsConfig from '../tsconfig.json'; + +const cwd = __dirname + '/..'; +const S3BucketPath = 's3://staging-0xjs-docs-jsons/'; +// Include any external packages that are part of the 0x.js public interface +// to this array so that TypeDoc picks it up and adds it to the Docs JSON +// So far, we only have @0xproject/types as part of 0x.js's public interface. +const fileIncludes = [...(tsConfig as any).include, '../types/src/index.ts']; +const fileIncludesAdjusted = postpublishUtils.adjustFileIncludePaths(fileIncludes, __dirname); +const projectFiles = fileIncludesAdjusted.join(' '); +const jsonFilePath = `${__dirname}/../${postpublishUtils.generatedDocsDirectoryName}/index.json`; +const version = process.env.DOCS_VERSION; + +(async () => { + const result = await execAsync(`JSON_FILE_PATH=${jsonFilePath} PROJECT_FILES="${projectFiles}" yarn docs:json`, { + cwd, + }); + if (!_.isEmpty(result.stderr)) { + throw new Error(result.stderr); + } + const fileName = `v${version}.json`; + const s3Url = S3BucketPath + fileName; + return execAsync(`S3_URL=${s3Url} yarn upload_docs_json`, { + cwd, + }); +})().catch(console.error); diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index 53ddfd258b..54f9ba1adc 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -14,7 +14,7 @@ "scripts": { "build:watch": "tsc -w", "prebuild": "run-s clean generate_contract_wrappers", - "build": "run-p build:umd:prod build:commonjs; exit 0;", + "build": "run-p build:scripts build:umd:prod build:commonjs; exit 0;", "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES", "upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json", "generate_contract_wrappers": "node ../abi-gen/lib/index.js --abis 'src/artifacts/@(Exchange|Token|TokenTransferProxy|EtherToken|TokenRegistry|DummyToken).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers && prettier --write 'src/contract_wrappers/generated/**.ts'", @@ -27,6 +27,7 @@ "clean": "shx rm -rf _bundles lib test_temp", "build:umd:prod": "NODE_ENV=production webpack", "build:commonjs": "tsc && copyfiles -u 2 './src/artifacts/**/*.json' ./lib/src/artifacts;", + "build:scripts": "tsc --p ./tsconfig_monorepo.json", "test:commonjs": "run-s build:commonjs run_mocha", "run_mocha": "mocha lib/test/**/*_test.js --timeout 10000 --bail --exit" }, diff --git a/packages/0x.js/tsconfig_monorepo.json b/packages/0x.js/tsconfig_monorepo.json new file mode 100644 index 0000000000..7e96096598 --- /dev/null +++ b/packages/0x.js/tsconfig_monorepo.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig", + "compilerOptions": { + "outDir": "scripts", + "noImplicitThis": false, + "rootDir": "./monorepo_scripts" + }, + "include": ["./monorepo_scripts/**/*", "../../node_modules/web3-typescript-typings/index.d.ts"] +} diff --git a/packages/dev-utils/CHANGELOG.md b/packages/dev-utils/CHANGELOG.md index ecc5546ae6..6840a6a692 100644 --- a/packages/dev-utils/CHANGELOG.md +++ b/packages/dev-utils/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## v0.2.1 - _TBD_ + + * Add postpublish utils + ## v0.2.0 - _February 16, 2018_ * Remove subproviders (#392) diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index fbbcb182f0..491ebd95fc 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -43,7 +43,9 @@ "@0xproject/utils": "^0.4.1", "ethereumjs-util": "^5.1.2", "lodash": "^4.17.4", + "publish-release": "0xproject/publish-release", "request-promise-native": "^1.0.5", + "semver-sort": "^0.0.4", "web3": "^0.20.0", "web3-provider-engine": "^13.0.1" }, diff --git a/packages/dev-utils/src/globals.d.ts b/packages/dev-utils/src/globals.d.ts index 7b132ee286..9c8a1dc024 100644 --- a/packages/dev-utils/src/globals.d.ts +++ b/packages/dev-utils/src/globals.d.ts @@ -1,2 +1,9 @@ declare module 'web3-provider-engine'; declare module 'web3-provider-engine/subproviders/rpc'; +declare module 'async-child-process'; +declare module 'publish-release'; + +// semver-sort declarations +declare module 'semver-sort' { + const desc: (versions: string[]) => string[]; +} diff --git a/packages/dev-utils/src/index.ts b/packages/dev-utils/src/index.ts index e899ac2069..cc3e668a10 100644 --- a/packages/dev-utils/src/index.ts +++ b/packages/dev-utils/src/index.ts @@ -2,3 +2,4 @@ export { RPC } from './rpc'; export { BlockchainLifecycle } from './blockchain_lifecycle'; export { web3Factory } from './web3_factory'; export { constants as devConstants } from './constants'; +export { postpublishUtils } from './postpublish_utils'; diff --git a/packages/dev-utils/src/postpublish_utils.ts b/packages/dev-utils/src/postpublish_utils.ts new file mode 100644 index 0000000000..35d046e260 --- /dev/null +++ b/packages/dev-utils/src/postpublish_utils.ts @@ -0,0 +1,86 @@ +import { promisify } from '@0xproject/utils'; +import { execAsync } from 'async-child-process'; +import * as _ from 'lodash'; +import * as publishRelease from 'publish-release'; +import semverSort = require('semver-sort'); + +import { utils } from './utils'; + +const publishReleaseAsync = promisify(publishRelease); +const githubPersonalAccessToken = process.env.GITHUB_PERSONAL_ACCESS_TOKEN_0X_JS; +const generatedDocsDirectoryName = 'generated_docs'; + +export interface TagAndVersion { + tag: string; + version: string; +} + +export const postpublishUtils = { + getLatestTagAndVersionAsync(subPackageName: string): Promise { + const subPackagePrefix = `${subPackageName}@`; + const gitTagsCommand = `git tag -l "${subPackagePrefix}*"`; + return execAsync(gitTagsCommand).then((result: any) => { + if (!_.isEmpty(result.stderr)) { + throw new Error(result.stderr); + } + const tags = result.stdout.trim().split('\n'); + const versions = tags.map((tag: string) => { + return tag.slice(subPackagePrefix.length); + }); + const sortedVersions = semverSort.desc(versions); + const latestVersion = sortedVersions[0]; + const latestTag = subPackagePrefix + latestVersion; + return { + tag: latestTag, + version: latestVersion, + }; + }); + }, + publishReleaseNotesAsync(tag: string, releaseName: string, assets: string[]) { + utils.log('POSTPUBLISH: Releasing ', releaseName, '...'); + return publishReleaseAsync({ + token: githubPersonalAccessToken, + owner: '0xProject', + repo: '0x.js', + tag, + name: releaseName, + notes: 'N/A', + draft: false, + prerelease: false, + reuseRelease: true, + reuseDraftOnly: false, + assets, + }); + }, + getReleaseName(subPackageName: string, version: string): string { + const releaseName = `${subPackageName} v${version}`; + return releaseName; + }, + async standardPostPublishAsync(subPackageName: string): Promise { + const result: TagAndVersion = await this.getLatestTagAndVersionAsync(subPackageName); + const releaseName = this.getReleaseName(subPackageName, result.version); + const assets: string[] = []; + await this.publishReleaseNotesAsync(result.tag, releaseName, assets); + }, + adjustFileIncludePaths(fileIncludes: string[], cwd: string): string[] { + 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, +}; diff --git a/packages/dev-utils/src/utils.ts b/packages/dev-utils/src/utils.ts new file mode 100644 index 0000000000..5423cabd98 --- /dev/null +++ b/packages/dev-utils/src/utils.ts @@ -0,0 +1,5 @@ +export const utils = { + log(...args: any[]): void { + console.log(...args); // tslint:disable-line:no-console + }, +}; From 7ac646ff94bfa996abab6fca5000a06acb66a898 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 13 Mar 2018 10:25:10 +0100 Subject: [PATCH 04/22] Move monorepo_scripts into src dir removing the need for a separate globals.d.ts and tsconfig files --- packages/0x.js/monorepo_scripts/globals.d.ts | 12 --- packages/0x.js/package.json | 5 +- packages/0x.js/scripts/postpublish.js | 47 ---------- packages/0x.js/scripts/stagedocs.js | 31 ------- packages/0x.js/src/globals.d.ts | 7 ++ .../{ => src}/monorepo_scripts/postpublish.ts | 0 .../{ => src}/monorepo_scripts/stagedocs.ts | 0 packages/0x.js/tsconfig_monorepo.json | 9 -- scripts/postpublish_utils.js | 86 ------------------- 9 files changed, 9 insertions(+), 188 deletions(-) delete mode 100644 packages/0x.js/monorepo_scripts/globals.d.ts delete mode 100644 packages/0x.js/scripts/postpublish.js delete mode 100644 packages/0x.js/scripts/stagedocs.js rename packages/0x.js/{ => src}/monorepo_scripts/postpublish.ts (100%) rename packages/0x.js/{ => src}/monorepo_scripts/stagedocs.ts (100%) delete mode 100644 packages/0x.js/tsconfig_monorepo.json delete mode 100644 scripts/postpublish_utils.js diff --git a/packages/0x.js/monorepo_scripts/globals.d.ts b/packages/0x.js/monorepo_scripts/globals.d.ts deleted file mode 100644 index bbfbdaa6ac..0000000000 --- a/packages/0x.js/monorepo_scripts/globals.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -declare module 'async-child-process'; -declare module 'publish-release'; - -// semver-sort declarations -declare module 'semver-sort' { - const desc: (versions: string[]) => string[]; -} - -declare module '*.json' { - const value: any; - export default value; -} diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index 54f9ba1adc..16537ba4da 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -14,7 +14,7 @@ "scripts": { "build:watch": "tsc -w", "prebuild": "run-s clean generate_contract_wrappers", - "build": "run-p build:scripts build:umd:prod build:commonjs; exit 0;", + "build": "run-p build:umd:prod build:commonjs; exit 0;", "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES", "upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json", "generate_contract_wrappers": "node ../abi-gen/lib/index.js --abis 'src/artifacts/@(Exchange|Token|TokenTransferProxy|EtherToken|TokenRegistry|DummyToken).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers && prettier --write 'src/contract_wrappers/generated/**.ts'", @@ -26,8 +26,7 @@ "update_contracts": "for i in ${npm_package_config_artifacts}; do copyfiles -u 4 ../contracts/build/contracts/$i.json ../0x.js/src/artifacts; done;", "clean": "shx rm -rf _bundles lib test_temp", "build:umd:prod": "NODE_ENV=production webpack", - "build:commonjs": "tsc && copyfiles -u 2 './src/artifacts/**/*.json' ./lib/src/artifacts;", - "build:scripts": "tsc --p ./tsconfig_monorepo.json", + "build:commonjs": "tsc && copyfiles -u 2 './src/artifacts/**/*.json' ./lib/src/artifacts && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", "test:commonjs": "run-s build:commonjs run_mocha", "run_mocha": "mocha lib/test/**/*_test.js --timeout 10000 --bail --exit" }, diff --git a/packages/0x.js/scripts/postpublish.js b/packages/0x.js/scripts/postpublish.js deleted file mode 100644 index 1a9ab73ea9..0000000000 --- a/packages/0x.js/scripts/postpublish.js +++ /dev/null @@ -1,47 +0,0 @@ -const execAsync = require('async-child-process').execAsync; -const postpublish_utils = require('../../../scripts/postpublish_utils'); -const packageJSON = require('../package.json'); -const tsConfig = require('../tsconfig.json'); - -const cwd = __dirname + '/..'; -const subPackageName = packageJSON.name; -// Include any external packages that are part of the 0x.js public interface -// to this array so that TypeDoc picks it up and adds it to the Docs JSON -// So far, we only have @0xproject/types as part of 0x.js's public interface. -const fileIncludes = [...tsConfig.include, '../types/src/index.ts']; -const fileIncludesAdjusted = postpublish_utils.adjustFileIncludePaths(fileIncludes, __dirname); -const projectFiles = fileIncludesAdjusted.join(' '); -const S3BucketPath = 's3://0xjs-docs-jsons/'; - -let tag; -let version; -postpublish_utils - .getLatestTagAndVersionAsync(subPackageName) - .then(function(result) { - tag = result.tag; - version = result.version; - const releaseName = postpublish_utils.getReleaseName(subPackageName, version); - const assets = [__dirname + '/../_bundles/index.js', __dirname + '/../_bundles/index.min.js']; - return postpublish_utils.publishReleaseNotesAsync(tag, releaseName, assets); - }) - .then(function(release) { - console.log('POSTPUBLISH: Release successful, generating docs...'); - const jsonFilePath = __dirname + '/../' + postpublish_utils.generatedDocsDirectoryName + '/index.json'; - return execAsync('JSON_FILE_PATH=' + jsonFilePath + ' PROJECT_FILES="' + projectFiles + '" yarn docs:json', { - cwd, - }); - }) - .then(function(result) { - if (result.stderr !== '') { - throw new Error(result.stderr); - } - const fileName = 'v' + version + '.json'; - console.log('POSTPUBLISH: Doc generation successful, uploading docs... as ', fileName); - const s3Url = S3BucketPath + fileName; - return execAsync('S3_URL=' + s3Url + ' yarn upload_docs_json', { - cwd, - }); - }) - .catch(function(err) { - throw err; - }); diff --git a/packages/0x.js/scripts/stagedocs.js b/packages/0x.js/scripts/stagedocs.js deleted file mode 100644 index f0ba552058..0000000000 --- a/packages/0x.js/scripts/stagedocs.js +++ /dev/null @@ -1,31 +0,0 @@ -const execAsync = require('async-child-process').execAsync; -const postpublish_utils = require('../../../scripts/postpublish_utils'); -const tsConfig = require('../tsconfig.json'); - -const cwd = __dirname + '/..'; -const S3BucketPath = 's3://staging-0xjs-docs-jsons/'; -// Include any external packages that are part of the 0x.js public interface -// to this array so that TypeDoc picks it up and adds it to the Docs JSON -// So far, we only have @0xproject/types as part of 0x.js's public interface. -const fileIncludes = [...tsConfig.include, '../types/src/index.ts']; -const fileIncludesAdjusted = postpublish_utils.adjustFileIncludePaths(fileIncludes, __dirname); -const projectFiles = fileIncludesAdjusted.join(' '); -const jsonFilePath = __dirname + '/../' + postpublish_utils.generatedDocsDirectoryName + '/index.json'; -const version = process.env.DOCS_VERSION; - -execAsync('JSON_FILE_PATH=' + jsonFilePath + ' PROJECT_FILES="' + projectFiles + '" yarn docs:json', { - cwd, -}) - .then(function(result) { - if (result.stderr !== '') { - throw new Error(result.stderr); - } - const fileName = 'v' + version + '.json'; - const s3Url = S3BucketPath + fileName; - return execAsync('S3_URL=' + s3Url + ' yarn upload_docs_json', { - cwd, - }); - }) - .catch(function(err) { - console.log(err); - }); diff --git a/packages/0x.js/src/globals.d.ts b/packages/0x.js/src/globals.d.ts index 0e103d0575..f37ac7cb02 100644 --- a/packages/0x.js/src/globals.d.ts +++ b/packages/0x.js/src/globals.d.ts @@ -4,6 +4,13 @@ declare module 'dirty-chai'; declare module 'request-promise-native'; declare module 'web3-provider-engine'; declare module 'web3-provider-engine/subproviders/rpc'; +declare module 'async-child-process'; +declare module 'publish-release'; + +// semver-sort declarations +declare module 'semver-sort' { + const desc: (versions: string[]) => string[]; +} // HACK: In order to merge the bignumber declaration added by chai-bignumber to the chai Assertion // interface we must use `namespace` as the Chai definitelyTyped definition does. Since we otherwise diff --git a/packages/0x.js/monorepo_scripts/postpublish.ts b/packages/0x.js/src/monorepo_scripts/postpublish.ts similarity index 100% rename from packages/0x.js/monorepo_scripts/postpublish.ts rename to packages/0x.js/src/monorepo_scripts/postpublish.ts diff --git a/packages/0x.js/monorepo_scripts/stagedocs.ts b/packages/0x.js/src/monorepo_scripts/stagedocs.ts similarity index 100% rename from packages/0x.js/monorepo_scripts/stagedocs.ts rename to packages/0x.js/src/monorepo_scripts/stagedocs.ts diff --git a/packages/0x.js/tsconfig_monorepo.json b/packages/0x.js/tsconfig_monorepo.json deleted file mode 100644 index 7e96096598..0000000000 --- a/packages/0x.js/tsconfig_monorepo.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../tsconfig", - "compilerOptions": { - "outDir": "scripts", - "noImplicitThis": false, - "rootDir": "./monorepo_scripts" - }, - "include": ["./monorepo_scripts/**/*", "../../node_modules/web3-typescript-typings/index.d.ts"] -} diff --git a/scripts/postpublish_utils.js b/scripts/postpublish_utils.js deleted file mode 100644 index 0a8c6f94d8..0000000000 --- a/scripts/postpublish_utils.js +++ /dev/null @@ -1,86 +0,0 @@ -const _ = require('lodash'); -const execAsync = require('async-child-process').execAsync; -const semverSort = require('semver-sort'); -const publishRelease = require('publish-release'); -const promisify = require('@0xproject/utils').promisify; - -const publishReleaseAsync = promisify(publishRelease); -const githubPersonalAccessToken = process.env.GITHUB_PERSONAL_ACCESS_TOKEN_0X_JS; -const generatedDocsDirectoryName = 'generated_docs'; - -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, - }; - }); - }, - publishReleaseNotesAsync: function(tag, releaseName, assets) { - console.log('POSTPUBLISH: Releasing ', releaseName, '...'); - return publishReleaseAsync({ - token: githubPersonalAccessToken, - owner: '0xProject', - repo: '0x.js', - tag: tag, - name: releaseName, - notes: 'N/A', - draft: false, - prerelease: false, - reuseRelease: true, - reuseDraftOnly: false, - assets: assets, - }); - }, - getReleaseName(subPackageName, version) { - const releaseName = subPackageName + ' v' + version; - return releaseName; - }, - 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) - ) - .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, -}; From 92a4e7728844816b79b1892308dadc342fed6853 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 13 Mar 2018 10:42:06 +0100 Subject: [PATCH 05/22] Make git-ignore generic for all package scripts --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index c5de0f4982..7c5c728091 100644 --- a/.gitignore +++ b/.gitignore @@ -77,4 +77,4 @@ bin/ packages/contracts/src/artifacts # Monorepo scripts -packages/0x.js/scripts +packages/**/scripts/ From b93b66edfb050b58f76f6066261fe3074a1df5fc Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 13 Mar 2018 10:42:14 +0100 Subject: [PATCH 06/22] Add missing dep --- packages/0x.js/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index 16537ba4da..f6210e768d 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -52,6 +52,7 @@ "@types/node": "^8.0.53", "@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", From 355aac2a1a119fd78c629031e1d90debdf6ed1ee Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 13 Mar 2018 10:42:33 +0100 Subject: [PATCH 07/22] Move abi-gen scripts to src --- packages/abi-gen/package.json | 4 +++- packages/abi-gen/scripts/postpublish.js | 5 ----- packages/abi-gen/src/globals.d.ts | 7 +++++++ packages/abi-gen/src/monorepo_scripts/postpublish.ts | 6 ++++++ 4 files changed, 16 insertions(+), 6 deletions(-) delete mode 100644 packages/abi-gen/scripts/postpublish.js create mode 100644 packages/abi-gen/src/monorepo_scripts/postpublish.ts diff --git a/packages/abi-gen/package.json b/packages/abi-gen/package.json index 1045b34e08..0390836742 100644 --- a/packages/abi-gen/package.json +++ b/packages/abi-gen/package.json @@ -8,7 +8,7 @@ "build:watch": "tsc -w", "lint": "tslint --project . 'src/**/*.ts'", "clean": "shx rm -rf lib", - "build": "tsc" + "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts" }, "bin": { "abi-gen": "lib/index.js" @@ -35,11 +35,13 @@ }, "devDependencies": { "@0xproject/tslint-config": "^0.4.10", + "@0xproject/dev-utils": "^0.2.1", "@types/glob": "^5.0.33", "@types/handlebars": "^4.0.36", "@types/mkdirp": "^0.5.1", "@types/node": "^8.0.53", "@types/yargs": "^10.0.0", + "copyfiles": "^1.2.0", "npm-run-all": "^4.1.2", "shx": "^0.2.2", "tslint": "5.8.0", diff --git a/packages/abi-gen/scripts/postpublish.js b/packages/abi-gen/scripts/postpublish.js deleted file mode 100644 index b3e5407c81..0000000000 --- a/packages/abi-gen/scripts/postpublish.js +++ /dev/null @@ -1,5 +0,0 @@ -const postpublish_utils = require('../../../scripts/postpublish_utils'); -const packageJSON = require('../package.json'); - -const subPackageName = packageJSON.name; -postpublish_utils.standardPostPublishAsync(subPackageName); \ No newline at end of file diff --git a/packages/abi-gen/src/globals.d.ts b/packages/abi-gen/src/globals.d.ts index 39df3f8526..d267a41061 100644 --- a/packages/abi-gen/src/globals.d.ts +++ b/packages/abi-gen/src/globals.d.ts @@ -2,3 +2,10 @@ declare function toSnakeCase(str: string): string; declare module 'to-snake-case' { export = toSnakeCase; } + +declare module '*.json' { + const json: any; + /* tslint:disable */ + export default json; + /* tslint:enable */ +} diff --git a/packages/abi-gen/src/monorepo_scripts/postpublish.ts b/packages/abi-gen/src/monorepo_scripts/postpublish.ts new file mode 100644 index 0000000000..63790a0116 --- /dev/null +++ b/packages/abi-gen/src/monorepo_scripts/postpublish.ts @@ -0,0 +1,6 @@ +import { postpublishUtils } from '@0xproject/dev-utils'; + +import * as packageJSON from '../package.json'; + +const subPackageName = (packageJSON as any).name; +postpublishUtils.standardPostPublishAsync(subPackageName); From df1968157c13a7bbe2e512cbc924190a414e6738 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 13 Mar 2018 10:59:53 +0100 Subject: [PATCH 08/22] Fix gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7c5c728091..1b5d403486 100644 --- a/.gitignore +++ b/.gitignore @@ -77,4 +77,4 @@ bin/ packages/contracts/src/artifacts # Monorepo scripts -packages/**/scripts/ +packages/*/scripts/ From ca25b816fabe15ce1ebc539c0316beba813683b8 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 13 Mar 2018 15:29:12 +0100 Subject: [PATCH 09/22] move scripts to monorepro-scripts --- README.md | 2 +- packages/0x.js/package.json | 3 +- .../0x.js/src/monorepo_scripts/postpublish.ts | 2 +- .../0x.js/src/monorepo_scripts/stagedocs.ts | 2 +- packages/abi-gen/package.json | 3 +- .../src/monorepo_scripts/postpublish.ts | 2 +- packages/assert/package.json | 6 +- packages/assert/scripts/postpublish.js | 5 - packages/assert/src/globals.d.ts | 7 ++ .../src/monorepo_scripts/postpublish.ts | 6 + packages/base-contract/package.json | 6 +- .../ts => base-contract/src}/globals.d.ts | 0 .../src/monorepo_scripts/postpublish.ts | 6 + .../monorepo_scripts/globals.d.ts | 6 + .../monorepo_scripts/postpublish.ts | 6 + .../package.json | 9 ++ .../scripts/postpublish.js | 5 - .../tsconfig.json | 7 ++ .../monorepo_scripts/globals.d.ts | 6 + .../monorepo_scripts/postpublish.ts | 6 + packages/chai-typescript-typings/package.json | 9 ++ .../scripts/postpublish.js | 5 - .../chai-typescript-typings/tsconfig.json | 7 ++ packages/connect/package.json | 6 +- packages/connect/scripts/postpublish.js | 45 -------- packages/connect/scripts/stagedocs.js | 30 ----- packages/connect/src/globals.d.ts | 1 + .../src/monorepo_scripts/postpublish.ts | 43 ++++++++ .../connect/src/monorepo_scripts/stagedocs.ts | 29 +++++ packages/deployer/package.json | 5 +- packages/deployer/scripts/postpublish.js | 5 - packages/deployer/src/globals.d.ts | 7 ++ .../src/monorepo_scripts/postpublish.ts | 6 + packages/dev-utils/package.json | 8 +- packages/dev-utils/scripts/postpublish.js | 5 - packages/dev-utils/src/globals.d.ts | 10 +- .../src/monorepo_scripts/postpublish.ts | 6 + packages/dev-utils/{ => test}/.npmignore | 0 .../monorepo_scripts/globals.d.ts | 6 + .../monorepo_scripts/postpublish.ts | 6 + .../ethers-typescript-typings/package.json | 7 +- .../scripts/postpublish.js | 5 - .../ethers-typescript-typings/tsconfig.json | 7 ++ packages/json-schemas/package.json | 6 +- packages/json-schemas/scripts/postpublish.js | 5 - packages/json-schemas/src/globals.d.ts | 7 ++ .../src/monorepo_scripts/postpublish.ts | 6 + packages/monorepo-scripts/package.json | 7 +- packages/monorepo-scripts/src/globals.d.ts | 8 ++ packages/monorepo-scripts/src/index.ts | 1 + .../src/postpublish_utils.ts | 2 +- .../src/utils.ts | 0 packages/react-docs-example/package.json | 1 + packages/react-docs/package.json | 103 +++++++++--------- packages/react-docs/scripts/postpublish.js | 5 - .../src/{ts => }/components/badge.tsx | 0 .../src/{ts => }/components/comment.tsx | 0 .../src/{ts => }/components/custom_enum.tsx | 0 .../src/{ts => }/components/documentation.tsx | 0 .../src/{ts => }/components/enum.tsx | 0 .../{ts => }/components/event_definition.tsx | 0 .../src/{ts => }/components/interface.tsx | 0 .../src/{ts => }/components/method_block.tsx | 0 .../{ts => }/components/method_signature.tsx | 0 .../src/{ts => }/components/source_link.tsx | 0 .../src/{ts => }/components/type.tsx | 0 .../{ts => }/components/type_definition.tsx | 0 packages/react-docs/src/{ts => }/docs_info.ts | 0 packages/react-docs/src/{ts => }/globals.d.ts | 0 packages/react-docs/src/{ts => }/index.ts | 0 .../src/monorepo_scripts/postpublish.ts | 6 + packages/react-docs/src/{ts => }/types.ts | 0 .../src/{ts => }/utils/constants.ts | 0 .../src/{ts => }/utils/doxity_utils.ts | 0 .../src/{ts => }/utils/typedoc_utils.ts | 0 .../react-docs/src/{ts => }/utils/utils.ts | 0 packages/react-docs/tsconfig.json | 2 +- packages/react-shared/package.json | 99 +++++++++-------- packages/react-shared/scripts/postpublish.js | 5 - .../src/{ts => }/components/anchor_title.tsx | 0 .../components/markdown_code_block.tsx | 0 .../components/markdown_link_block.tsx | 0 .../{ts => }/components/markdown_section.tsx | 0 .../components/nested_sidebar_menu.tsx | 0 .../{ts => }/components/section_header.tsx | 0 .../{ts => }/components/version_drop_down.tsx | 0 .../react-shared/src/{ts => }/globals.d.ts | 7 ++ packages/react-shared/src/{ts => }/index.ts | 0 .../src/monorepo_scripts/postpublish.ts | 6 + packages/react-shared/src/{ts => }/types.ts | 0 .../react-shared/src/{ts => }/utils/colors.ts | 0 .../src/{ts => }/utils/constants.ts | 0 .../react-shared/src/{ts => }/utils/utils.ts | 0 packages/sra-report/package.json | 6 +- packages/sra-report/scripts/postpublish.js | 5 - .../src/monorepo_scripts/postpublish.ts | 6 + packages/subproviders/package.json | 6 +- packages/subproviders/scripts/postpublish.js | 5 - packages/subproviders/src/globals.d.ts | 7 ++ .../src/monorepo_scripts/postpublish.ts | 6 + .../monorepo_scripts/globals.d.ts | 6 + .../monorepo_scripts/postpublish.ts | 6 + packages/tslint-config/package.json | 6 +- packages/tslint-config/scripts/postpublish.js | 5 - packages/tslint-config/tsconfig.json | 2 +- packages/types/package.json | 6 +- packages/types/scripts/postpublish.js | 5 - packages/types/src/globals.d.ts | 6 + .../types/src/monorepo_scripts/postpublish.ts | 6 + packages/utils/package.json | 6 +- packages/utils/scripts/postpublish.js | 5 - packages/utils/src/globals.d.ts | 6 + .../utils/src/monorepo_scripts/postpublish.ts | 6 + .../monorepo_scripts/globals.d.ts | 6 + .../monorepo_scripts/postpublish.ts | 6 + packages/web3-typescript-typings/package.json | 7 +- .../scripts/postpublish.js | 5 - .../web3-typescript-typings/tsconfig.json | 7 ++ packages/web3-wrapper/package.json | 6 +- packages/web3-wrapper/scripts/postpublish.js | 5 - packages/web3-wrapper/src/globals.d.ts | 6 + .../src/monorepo_scripts/postpublish.ts | 6 + 122 files changed, 498 insertions(+), 297 deletions(-) delete mode 100644 packages/assert/scripts/postpublish.js create mode 100644 packages/assert/src/monorepo_scripts/postpublish.ts rename packages/{react-docs-example/ts => base-contract/src}/globals.d.ts (100%) create mode 100644 packages/base-contract/src/monorepo_scripts/postpublish.ts create mode 100644 packages/chai-as-promised-typescript-typings/monorepo_scripts/globals.d.ts create mode 100644 packages/chai-as-promised-typescript-typings/monorepo_scripts/postpublish.ts delete mode 100644 packages/chai-as-promised-typescript-typings/scripts/postpublish.js create mode 100644 packages/chai-as-promised-typescript-typings/tsconfig.json create mode 100644 packages/chai-typescript-typings/monorepo_scripts/globals.d.ts create mode 100644 packages/chai-typescript-typings/monorepo_scripts/postpublish.ts delete mode 100644 packages/chai-typescript-typings/scripts/postpublish.js create mode 100644 packages/chai-typescript-typings/tsconfig.json delete mode 100644 packages/connect/scripts/postpublish.js delete mode 100644 packages/connect/scripts/stagedocs.js create mode 100644 packages/connect/src/monorepo_scripts/postpublish.ts create mode 100644 packages/connect/src/monorepo_scripts/stagedocs.ts delete mode 100644 packages/deployer/scripts/postpublish.js create mode 100644 packages/deployer/src/monorepo_scripts/postpublish.ts delete mode 100644 packages/dev-utils/scripts/postpublish.js create mode 100644 packages/dev-utils/src/monorepo_scripts/postpublish.ts rename packages/dev-utils/{ => test}/.npmignore (100%) create mode 100644 packages/ethers-typescript-typings/monorepo_scripts/globals.d.ts create mode 100644 packages/ethers-typescript-typings/monorepo_scripts/postpublish.ts delete mode 100644 packages/ethers-typescript-typings/scripts/postpublish.js create mode 100644 packages/ethers-typescript-typings/tsconfig.json delete mode 100644 packages/json-schemas/scripts/postpublish.js create mode 100644 packages/json-schemas/src/monorepo_scripts/postpublish.ts create mode 100644 packages/monorepo-scripts/src/globals.d.ts create mode 100644 packages/monorepo-scripts/src/index.ts rename packages/{dev-utils => monorepo-scripts}/src/postpublish_utils.ts (98%) rename packages/{dev-utils => monorepo-scripts}/src/utils.ts (100%) delete mode 100644 packages/react-docs/scripts/postpublish.js rename packages/react-docs/src/{ts => }/components/badge.tsx (100%) rename packages/react-docs/src/{ts => }/components/comment.tsx (100%) rename packages/react-docs/src/{ts => }/components/custom_enum.tsx (100%) rename packages/react-docs/src/{ts => }/components/documentation.tsx (100%) rename packages/react-docs/src/{ts => }/components/enum.tsx (100%) rename packages/react-docs/src/{ts => }/components/event_definition.tsx (100%) rename packages/react-docs/src/{ts => }/components/interface.tsx (100%) rename packages/react-docs/src/{ts => }/components/method_block.tsx (100%) rename packages/react-docs/src/{ts => }/components/method_signature.tsx (100%) rename packages/react-docs/src/{ts => }/components/source_link.tsx (100%) rename packages/react-docs/src/{ts => }/components/type.tsx (100%) rename packages/react-docs/src/{ts => }/components/type_definition.tsx (100%) rename packages/react-docs/src/{ts => }/docs_info.ts (100%) rename packages/react-docs/src/{ts => }/globals.d.ts (100%) rename packages/react-docs/src/{ts => }/index.ts (100%) create mode 100644 packages/react-docs/src/monorepo_scripts/postpublish.ts rename packages/react-docs/src/{ts => }/types.ts (100%) rename packages/react-docs/src/{ts => }/utils/constants.ts (100%) rename packages/react-docs/src/{ts => }/utils/doxity_utils.ts (100%) rename packages/react-docs/src/{ts => }/utils/typedoc_utils.ts (100%) rename packages/react-docs/src/{ts => }/utils/utils.ts (100%) delete mode 100644 packages/react-shared/scripts/postpublish.js rename packages/react-shared/src/{ts => }/components/anchor_title.tsx (100%) rename packages/react-shared/src/{ts => }/components/markdown_code_block.tsx (100%) rename packages/react-shared/src/{ts => }/components/markdown_link_block.tsx (100%) rename packages/react-shared/src/{ts => }/components/markdown_section.tsx (100%) rename packages/react-shared/src/{ts => }/components/nested_sidebar_menu.tsx (100%) rename packages/react-shared/src/{ts => }/components/section_header.tsx (100%) rename packages/react-shared/src/{ts => }/components/version_drop_down.tsx (100%) rename packages/react-shared/src/{ts => }/globals.d.ts (55%) rename packages/react-shared/src/{ts => }/index.ts (100%) create mode 100644 packages/react-shared/src/monorepo_scripts/postpublish.ts rename packages/react-shared/src/{ts => }/types.ts (100%) rename packages/react-shared/src/{ts => }/utils/colors.ts (100%) rename packages/react-shared/src/{ts => }/utils/constants.ts (100%) rename packages/react-shared/src/{ts => }/utils/utils.ts (100%) delete mode 100644 packages/sra-report/scripts/postpublish.js create mode 100644 packages/sra-report/src/monorepo_scripts/postpublish.ts delete mode 100644 packages/subproviders/scripts/postpublish.js create mode 100644 packages/subproviders/src/monorepo_scripts/postpublish.ts create mode 100644 packages/tslint-config/monorepo_scripts/globals.d.ts create mode 100644 packages/tslint-config/monorepo_scripts/postpublish.ts delete mode 100644 packages/tslint-config/scripts/postpublish.js delete mode 100644 packages/types/scripts/postpublish.js create mode 100644 packages/types/src/globals.d.ts create mode 100644 packages/types/src/monorepo_scripts/postpublish.ts delete mode 100644 packages/utils/scripts/postpublish.js create mode 100644 packages/utils/src/globals.d.ts create mode 100644 packages/utils/src/monorepo_scripts/postpublish.ts create mode 100644 packages/web3-typescript-typings/monorepo_scripts/globals.d.ts create mode 100644 packages/web3-typescript-typings/monorepo_scripts/postpublish.ts delete mode 100644 packages/web3-typescript-typings/scripts/postpublish.js create mode 100644 packages/web3-typescript-typings/tsconfig.json delete mode 100644 packages/web3-wrapper/scripts/postpublish.js create mode 100644 packages/web3-wrapper/src/globals.d.ts create mode 100644 packages/web3-wrapper/src/monorepo_scripts/postpublish.ts diff --git a/README.md b/README.md index ee3932531d..ba1caa7a66 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ This repository is a monorepo including the 0x protocol smart contracts and nume | [`@0xproject/dev-utils`](/packages/dev-utils) | [![npm](https://img.shields.io/npm/v/@0xproject/dev-utils.svg)](https://www.npmjs.com/package/@0xproject/dev-utils) | Dev utils to be shared across 0x projects and packages | | [`ethers-typescript-typings`](/packages/ethers-typescript-typings) | [![npm](https://img.shields.io/npm/v/@0xproject/deployer.svg)](https://www.npmjs.com/package/ethers-typescript-typings) | [Ethers.js](https://github.com/ethers-io/ethers.js/) typescript typings | | [`@0xproject/json-schemas`](/packages/json-schemas) | [![npm](https://img.shields.io/npm/v/@0xproject/json-schemas.svg)](https://www.npmjs.com/package/@0xproject/json-schemas) | 0x-related json schemas | +| [`@0xproject/monorepo-scripts`](/packages/monorepo-scripts) | [![npm](https://img.shields.io/npm/v/@0xproject/monorepo-scripts.svg)](https://www.npmjs.com/package/@0xproject/monorepo-scripts) | Scripts for managing a monorepo | | [`@0xproject/react-docs`](/packages/react-docs) | [![npm](https://img.shields.io/npm/v/@0xproject/react-docs.svg)](https://www.npmjs.com/package/@0xproject/react-docs) | React documentation component for rendering TypeDoc & Doxity generated JSON | | [`@0xproject/react-shared`](/packages/react-shared) | [![npm](https://img.shields.io/npm/v/@0xproject/react-shared.svg)](https://www.npmjs.com/package/@0xproject/react-shared) | 0x shared react components | | [`@0xproject/sra-report`](/packages/sra-report) | [![npm](https://img.shields.io/npm/v/@0xproject/sra-report.svg)](https://www.npmjs.com/package/@0xproject/sra-report) | Generate reports for standard relayer API compliance | @@ -47,7 +48,6 @@ This repository is a monorepo including the 0x protocol smart contracts and nume | --------------------------------------------------------------- | ---------------------------------------------------------------- | | [`@0xproject/contracts`](/packages/contracts) | 0x solidity smart contracts & tests | | [`@0xproject/react-docs-example`](/packages/react-docs-example) | Example documentation site created with `@0xproject/react-docs` | -| [`@0xproject/monorepo-scripts`](/packages/monorepo-scripts) | Shared monorepo scripts | | [`@0xproject/testnet-faucets`](/packages/testnet-faucets) | A faucet micro-service that dispenses test ERC20 tokens or Ether | | [`@0xproject/website`](/packages/website) | 0x website & Portal DApp | diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index f6210e768d..ec55bf1af2 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -24,7 +24,7 @@ "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;", - "clean": "shx rm -rf _bundles lib test_temp", + "clean": "shx rm -rf _bundles lib test_temp scripts", "build:umd:prod": "NODE_ENV=production webpack", "build:commonjs": "tsc && copyfiles -u 2 './src/artifacts/**/*.json' ./lib/src/artifacts && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", "test:commonjs": "run-s build:commonjs run_mocha", @@ -44,6 +44,7 @@ "devDependencies": { "@0xproject/abi-gen": "^0.2.5", "@0xproject/dev-utils": "^0.2.1", + "@0xproject/monorepo-scripts": "^0.1.12", "@0xproject/tslint-config": "^0.4.10", "@types/bintrees": "^1.0.2", "@types/jsonschema": "^1.1.1", diff --git a/packages/0x.js/src/monorepo_scripts/postpublish.ts b/packages/0x.js/src/monorepo_scripts/postpublish.ts index 13ab013bef..8e2692c93c 100644 --- a/packages/0x.js/src/monorepo_scripts/postpublish.ts +++ b/packages/0x.js/src/monorepo_scripts/postpublish.ts @@ -1,4 +1,4 @@ -import { postpublishUtils } from '@0xproject/dev-utils'; +import { postpublishUtils } from '@0xproject/monorepo-scripts'; import { execAsync } from 'async-child-process'; import * as _ from 'lodash'; diff --git a/packages/0x.js/src/monorepo_scripts/stagedocs.ts b/packages/0x.js/src/monorepo_scripts/stagedocs.ts index a62d8a0144..20355c52c6 100644 --- a/packages/0x.js/src/monorepo_scripts/stagedocs.ts +++ b/packages/0x.js/src/monorepo_scripts/stagedocs.ts @@ -1,4 +1,4 @@ -import { postpublishUtils } from '@0xproject/dev-utils'; +import { postpublishUtils } from '@0xproject/monorepo-scripts'; import { execAsync } from 'async-child-process'; import * as _ from 'lodash'; diff --git a/packages/abi-gen/package.json b/packages/abi-gen/package.json index 0390836742..ffae67e22b 100644 --- a/packages/abi-gen/package.json +++ b/packages/abi-gen/package.json @@ -7,7 +7,7 @@ "scripts": { "build:watch": "tsc -w", "lint": "tslint --project . 'src/**/*.ts'", - "clean": "shx rm -rf lib", + "clean": "shx rm -rf lib scripts", "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts" }, "bin": { @@ -34,6 +34,7 @@ "yargs": "^10.0.3" }, "devDependencies": { + "@0xproject/monorepo-scripts": "^0.1.12", "@0xproject/tslint-config": "^0.4.10", "@0xproject/dev-utils": "^0.2.1", "@types/glob": "^5.0.33", diff --git a/packages/abi-gen/src/monorepo_scripts/postpublish.ts b/packages/abi-gen/src/monorepo_scripts/postpublish.ts index 63790a0116..d5fcff9d00 100644 --- a/packages/abi-gen/src/monorepo_scripts/postpublish.ts +++ b/packages/abi-gen/src/monorepo_scripts/postpublish.ts @@ -1,4 +1,4 @@ -import { postpublishUtils } from '@0xproject/dev-utils'; +import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; diff --git a/packages/assert/package.json b/packages/assert/package.json index 49b0f33905..be5f4902df 100644 --- a/packages/assert/package.json +++ b/packages/assert/package.json @@ -6,8 +6,8 @@ "types": "lib/src/index.d.ts", "scripts": { "build:watch": "tsc -w", - "build": "tsc", - "clean": "shx rm -rf _bundles lib test_temp", + "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", + "clean": "shx rm -rf _bundles lib test_temp scripts", "lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'", "run_mocha": "mocha lib/test/**/*_test.js", "prepublishOnly": "run-p build", @@ -24,12 +24,14 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/assert/README.md", "devDependencies": { + "@0xproject/monorepo-scripts": "^0.1.12", "@0xproject/tslint-config": "^0.4.10", "@types/lodash": "^4.14.86", "@types/mocha": "^2.2.42", "@types/valid-url": "^1.0.2", "chai": "^4.0.1", "chai-typescript-typings": "^0.0.4", + "copyfiles": "^1.2.0", "dirty-chai": "^2.0.1", "mocha": "^4.0.1", "npm-run-all": "^4.1.2", diff --git a/packages/assert/scripts/postpublish.js b/packages/assert/scripts/postpublish.js deleted file mode 100644 index b3e5407c81..0000000000 --- a/packages/assert/scripts/postpublish.js +++ /dev/null @@ -1,5 +0,0 @@ -const postpublish_utils = require('../../../scripts/postpublish_utils'); -const packageJSON = require('../package.json'); - -const subPackageName = packageJSON.name; -postpublish_utils.standardPostPublishAsync(subPackageName); \ No newline at end of file diff --git a/packages/assert/src/globals.d.ts b/packages/assert/src/globals.d.ts index 91ed2021ef..5476b6bd8c 100644 --- a/packages/assert/src/globals.d.ts +++ b/packages/assert/src/globals.d.ts @@ -1 +1,8 @@ declare module 'dirty-chai'; + +declare module '*.json' { + const json: any; + /* tslint:disable */ + export default json; + /* tslint:enable */ +} diff --git a/packages/assert/src/monorepo_scripts/postpublish.ts b/packages/assert/src/monorepo_scripts/postpublish.ts new file mode 100644 index 0000000000..d5fcff9d00 --- /dev/null +++ b/packages/assert/src/monorepo_scripts/postpublish.ts @@ -0,0 +1,6 @@ +import { postpublishUtils } from '@0xproject/monorepo-scripts'; + +import * as packageJSON from '../package.json'; + +const subPackageName = (packageJSON as any).name; +postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/base-contract/package.json b/packages/base-contract/package.json index 6b4fc9a8ee..cfb336106f 100644 --- a/packages/base-contract/package.json +++ b/packages/base-contract/package.json @@ -6,8 +6,8 @@ "types": "lib/index.d.ts", "scripts": { "build:watch": "tsc -w", - "build": "tsc", - "clean": "shx rm -rf lib", + "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts", + "clean": "shx rm -rf lib scripts", "lint": "tslint --project . 'src/**/*.ts'" }, "license": "Apache-2.0", @@ -20,8 +20,10 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/base-contract/README.md", "devDependencies": { + "@0xproject/monorepo-scripts": "^0.1.12", "@0xproject/tslint-config": "^0.4.10", "@types/lodash": "^4.14.86", + "copyfiles": "^1.2.0", "npm-run-all": "^4.1.2", "shx": "^0.2.2", "tslint": "5.8.0", diff --git a/packages/react-docs-example/ts/globals.d.ts b/packages/base-contract/src/globals.d.ts similarity index 100% rename from packages/react-docs-example/ts/globals.d.ts rename to packages/base-contract/src/globals.d.ts diff --git a/packages/base-contract/src/monorepo_scripts/postpublish.ts b/packages/base-contract/src/monorepo_scripts/postpublish.ts new file mode 100644 index 0000000000..d5fcff9d00 --- /dev/null +++ b/packages/base-contract/src/monorepo_scripts/postpublish.ts @@ -0,0 +1,6 @@ +import { postpublishUtils } from '@0xproject/monorepo-scripts'; + +import * as packageJSON from '../package.json'; + +const subPackageName = (packageJSON as any).name; +postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/chai-as-promised-typescript-typings/monorepo_scripts/globals.d.ts b/packages/chai-as-promised-typescript-typings/monorepo_scripts/globals.d.ts new file mode 100644 index 0000000000..94e63a32de --- /dev/null +++ b/packages/chai-as-promised-typescript-typings/monorepo_scripts/globals.d.ts @@ -0,0 +1,6 @@ +declare module '*.json' { + const json: any; + /* tslint:disable */ + export default json; + /* tslint:enable */ +} diff --git a/packages/chai-as-promised-typescript-typings/monorepo_scripts/postpublish.ts b/packages/chai-as-promised-typescript-typings/monorepo_scripts/postpublish.ts new file mode 100644 index 0000000000..d5fcff9d00 --- /dev/null +++ b/packages/chai-as-promised-typescript-typings/monorepo_scripts/postpublish.ts @@ -0,0 +1,6 @@ +import { postpublishUtils } from '@0xproject/monorepo-scripts'; + +import * as packageJSON from '../package.json'; + +const subPackageName = (packageJSON as any).name; +postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/chai-as-promised-typescript-typings/package.json b/packages/chai-as-promised-typescript-typings/package.json index 98fc63b38f..d22f45d28d 100644 --- a/packages/chai-as-promised-typescript-typings/package.json +++ b/packages/chai-as-promised-typescript-typings/package.json @@ -4,6 +4,10 @@ "description": "Typescript type definitions for chai-as-promised", "main": "index.d.ts", "types": "index.d.ts", + "scripts": { + "build": "tsc && copyfiles -u 1 './lib/**/*' ./scripts", + "clean": "shx rm -rf scripts" + }, "repository": { "type": "git", "url": "git+https://github.com/0xProject/0x-monorepo.git" @@ -20,6 +24,11 @@ "dependencies": { "chai-typescript-typings": "^0.0.4" }, + "devDependencies": { + "@0xproject/monorepo-scripts": "^0.1.12", + "copyfiles": "^1.2.0", + "shx": "^0.2.2" + }, "publishConfig": { "access": "public" } diff --git a/packages/chai-as-promised-typescript-typings/scripts/postpublish.js b/packages/chai-as-promised-typescript-typings/scripts/postpublish.js deleted file mode 100644 index b3e5407c81..0000000000 --- a/packages/chai-as-promised-typescript-typings/scripts/postpublish.js +++ /dev/null @@ -1,5 +0,0 @@ -const postpublish_utils = require('../../../scripts/postpublish_utils'); -const packageJSON = require('../package.json'); - -const subPackageName = packageJSON.name; -postpublish_utils.standardPostPublishAsync(subPackageName); \ No newline at end of file diff --git a/packages/chai-as-promised-typescript-typings/tsconfig.json b/packages/chai-as-promised-typescript-typings/tsconfig.json new file mode 100644 index 0000000000..2599d1b7c6 --- /dev/null +++ b/packages/chai-as-promised-typescript-typings/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig", + "compilerOptions": { + "outDir": "lib" + }, + "include": ["./monorepo_scripts/**/*", "../../node_modules/web3-typescript-typings/index.d.ts"] +} diff --git a/packages/chai-typescript-typings/monorepo_scripts/globals.d.ts b/packages/chai-typescript-typings/monorepo_scripts/globals.d.ts new file mode 100644 index 0000000000..94e63a32de --- /dev/null +++ b/packages/chai-typescript-typings/monorepo_scripts/globals.d.ts @@ -0,0 +1,6 @@ +declare module '*.json' { + const json: any; + /* tslint:disable */ + export default json; + /* tslint:enable */ +} diff --git a/packages/chai-typescript-typings/monorepo_scripts/postpublish.ts b/packages/chai-typescript-typings/monorepo_scripts/postpublish.ts new file mode 100644 index 0000000000..d5fcff9d00 --- /dev/null +++ b/packages/chai-typescript-typings/monorepo_scripts/postpublish.ts @@ -0,0 +1,6 @@ +import { postpublishUtils } from '@0xproject/monorepo-scripts'; + +import * as packageJSON from '../package.json'; + +const subPackageName = (packageJSON as any).name; +postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/chai-typescript-typings/package.json b/packages/chai-typescript-typings/package.json index a07694ed08..e8981b8cd4 100644 --- a/packages/chai-typescript-typings/package.json +++ b/packages/chai-typescript-typings/package.json @@ -4,6 +4,10 @@ "description": "Typescript type definitions for chai", "main": "index.d.ts", "types": "index.d.ts", + "scripts": { + "build": "tsc && copyfiles -u 1 './lib/**/*' ./scripts", + "clean": "shx rm -rf scripts" + }, "repository": { "type": "git", "url": "git+https://github.com/0xProject/0x-monorepo.git" @@ -13,6 +17,11 @@ "url": "https://github.com/0xProject/0x-monorepo/issues" }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/chai-typescript-typings#readme", + "devDependencies": { + "@0xproject/monorepo-scripts": "^0.1.12", + "copyfiles": "^1.2.0", + "shx": "^0.2.2" + }, "publishConfig": { "access": "public" } diff --git a/packages/chai-typescript-typings/scripts/postpublish.js b/packages/chai-typescript-typings/scripts/postpublish.js deleted file mode 100644 index b3e5407c81..0000000000 --- a/packages/chai-typescript-typings/scripts/postpublish.js +++ /dev/null @@ -1,5 +0,0 @@ -const postpublish_utils = require('../../../scripts/postpublish_utils'); -const packageJSON = require('../package.json'); - -const subPackageName = packageJSON.name; -postpublish_utils.standardPostPublishAsync(subPackageName); \ No newline at end of file diff --git a/packages/chai-typescript-typings/tsconfig.json b/packages/chai-typescript-typings/tsconfig.json new file mode 100644 index 0000000000..2599d1b7c6 --- /dev/null +++ b/packages/chai-typescript-typings/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig", + "compilerOptions": { + "outDir": "lib" + }, + "include": ["./monorepo_scripts/**/*", "../../node_modules/web3-typescript-typings/index.d.ts"] +} diff --git a/packages/connect/package.json b/packages/connect/package.json index c8714a93a2..0c4db7f609 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -13,8 +13,8 @@ "types": "lib/src/index.d.ts", "scripts": { "build:watch": "tsc -w", - "build": "tsc", - "clean": "shx rm -rf _bundles lib test_temp", + "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", + "clean": "shx rm -rf _bundles lib test_temp scripts", "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES", "upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json", "copy_test_fixtures": "copyfiles -u 2 './test/fixtures/**/*.json' ./lib/test/fixtures", @@ -46,12 +46,14 @@ "websocket": "^1.0.25" }, "devDependencies": { + "@0xproject/monorepo-scripts": "^0.1.12", "@0xproject/tslint-config": "^0.4.10", "@types/fetch-mock": "^5.12.1", "@types/lodash": "^4.14.86", "@types/mocha": "^2.2.42", "@types/query-string": "^5.0.1", "@types/websocket": "^0.0.34", + "async-child-process": "^1.1.1", "chai": "^4.0.1", "chai-as-promised": "^7.1.0", "chai-as-promised-typescript-typings": "^0.0.10", diff --git a/packages/connect/scripts/postpublish.js b/packages/connect/scripts/postpublish.js deleted file mode 100644 index e447615f94..0000000000 --- a/packages/connect/scripts/postpublish.js +++ /dev/null @@ -1,45 +0,0 @@ -const execAsync = require('async-child-process').execAsync; -const postpublish_utils = require('../../../scripts/postpublish_utils'); -const packageJSON = require('../package.json'); -const tsConfig = require('../tsconfig.json'); - -const cwd = __dirname + '/..'; -const subPackageName = packageJSON.name; -const S3BucketPath = 's3://connect-docs-jsons/'; -// Include any external packages that are part of the @0xproject/connect public interface -// to this array so that TypeDoc picks it up and adds it to the Docs JSON -const fileIncludes = [...tsConfig.include]; -const fileIncludesAdjusted = postpublish_utils.adjustFileIncludePaths(fileIncludes, __dirname); -const projectFiles = fileIncludesAdjusted.join(' '); - -let tag; -let version; -postpublish_utils - .getLatestTagAndVersionAsync(subPackageName) - .then(function(result) { - tag = result.tag; - version = result.version; - const releaseName = postpublish_utils.getReleaseName(subPackageName, version); - return postpublish_utils.publishReleaseNotesAsync(tag, releaseName); - }) - .then(function(release) { - console.log('POSTPUBLISH: Release successful, generating docs...'); - const jsonFilePath = __dirname + '/../' + postpublish_utils.generatedDocsDirectoryName + '/index.json'; - return execAsync('JSON_FILE_PATH=' + jsonFilePath + ' PROJECT_FILES="' + projectFiles + '" yarn docs:json', { - cwd, - }); - }) - .then(function(result) { - if (result.stderr !== '') { - throw new Error(result.stderr); - } - const fileName = 'v' + version + '.json'; - console.log('POSTPUBLISH: Doc generation successful, uploading docs... as ', fileName); - const s3Url = S3BucketPath + fileName; - return execAsync('S3_URL=' + s3Url + ' yarn upload_docs_json', { - cwd, - }); - }) - .catch(function(err) { - throw err; - }); diff --git a/packages/connect/scripts/stagedocs.js b/packages/connect/scripts/stagedocs.js deleted file mode 100644 index 58272ab866..0000000000 --- a/packages/connect/scripts/stagedocs.js +++ /dev/null @@ -1,30 +0,0 @@ -const execAsync = require('async-child-process').execAsync; -const postpublish_utils = require('../../../scripts/postpublish_utils'); -const tsConfig = require('../tsconfig.json'); - -const cwd = __dirname + '/..'; -const S3BucketPath = 's3://staging-connect-docs-jsons/'; -const jsonFilePath = __dirname + '/../' + postpublish_utils.generatedDocsDirectoryName + '/index.json'; -const version = process.env.DOCS_VERSION; -// Include any external packages that are part of the @0xproject/connect public interface -// to this array so that TypeDoc picks it up and adds it to the Docs JSON -const fileIncludes = [...tsConfig.include]; -const fileIncludesAdjusted = postpublish_utils.adjustFileIncludePaths(fileIncludes, __dirname); -const projectFiles = fileIncludesAdjusted.join(' '); - -execAsync('JSON_FILE_PATH=' + jsonFilePath + ' PROJECT_FILES="' + projectFiles + '" yarn docs:json', { - cwd, -}) - .then(function(result) { - if (result.stderr !== '') { - throw new Error(result.stderr); - } - const fileName = 'v' + version + '.json'; - const s3Url = S3BucketPath + fileName; - return execAsync('S3_URL=' + s3Url + ' yarn upload_docs_json', { - cwd, - }); - }) - .catch(function(err) { - console.log(err); - }); diff --git a/packages/connect/src/globals.d.ts b/packages/connect/src/globals.d.ts index 078e189cd9..cb71dcdd1f 100644 --- a/packages/connect/src/globals.d.ts +++ b/packages/connect/src/globals.d.ts @@ -1,3 +1,4 @@ +declare module 'async-child-process'; declare module 'dirty-chai'; declare module '*.json' { diff --git a/packages/connect/src/monorepo_scripts/postpublish.ts b/packages/connect/src/monorepo_scripts/postpublish.ts new file mode 100644 index 0000000000..4cb8bf071d --- /dev/null +++ b/packages/connect/src/monorepo_scripts/postpublish.ts @@ -0,0 +1,43 @@ +import { postpublishUtils } from '@0xproject/monorepo-scripts'; +import { execAsync } from 'async-child-process'; +import * as _ from 'lodash'; + +import * as packageJSON from '../package.json'; +import * as tsConfig from '../tsconfig.json'; + +const cwd = `${__dirname}/..`; +const subPackageName = (packageJSON as any).name; +// Include any external packages that are part of the @0xproject/connect public interface +// to this array so that TypeDoc picks it up and adds it to the Docs JSON +const fileIncludes = [...(tsConfig as any).include]; +const fileIncludesAdjusted = postpublishUtils.adjustFileIncludePaths(fileIncludes, __dirname); +const projectFiles = fileIncludesAdjusted.join(' '); +const S3BucketPath = 's3://connect-docs-jsons/'; + +(async () => { + const tagAndVersion = await postpublishUtils.getLatestTagAndVersionAsync(subPackageName); + const tag = tagAndVersion.tag; + const version = tagAndVersion.version; + + const releaseName = postpublishUtils.getReleaseName(subPackageName, version); + const assets = [`${__dirname}/../_bundles/index.js`, `${__dirname}/../_bundles/index.min.js`]; + const release = await postpublishUtils.publishReleaseNotesAsync(tag, releaseName, assets); + + // tslint:disable-next-line:no-console + console.log('POSTPUBLISH: Release successful, generating docs...'); + const jsonFilePath = `${__dirname}/../${postpublishUtils.generatedDocsDirectoryName}/index.json`; + + const result = await execAsync(`JSON_FILE_PATH=${jsonFilePath} PROJECT_FILES="${projectFiles}" yarn docs:json`, { + cwd, + }); + if (!_.isEmpty(result.stderr)) { + throw new Error(result.stderr); + } + const fileName = `v${version}.json`; + // tslint:disable-next-line:no-console + console.log(`POSTPUBLISH: Doc generation successful, uploading docs... as ${fileName}`); + const s3Url = S3BucketPath + fileName; + return execAsync(`S3_URL=${s3Url} yarn upload_docs_json`, { + cwd, + }); +})().catch(console.error); diff --git a/packages/connect/src/monorepo_scripts/stagedocs.ts b/packages/connect/src/monorepo_scripts/stagedocs.ts new file mode 100644 index 0000000000..ae0383ed7b --- /dev/null +++ b/packages/connect/src/monorepo_scripts/stagedocs.ts @@ -0,0 +1,29 @@ +import { postpublishUtils } from '@0xproject/monorepo-scripts'; +import { execAsync } from 'async-child-process'; +import * as _ from 'lodash'; + +import * as tsConfig from '../tsconfig.json'; + +const cwd = __dirname + '/..'; +const S3BucketPath = 's3://staging-connect-docs-jsons/'; +// Include any external packages that are part of the @0xproject/connect public interface +// to this array so that TypeDoc picks it up and adds it to the Docs JSON +const fileIncludes = [...(tsConfig as any).include]; +const fileIncludesAdjusted = postpublishUtils.adjustFileIncludePaths(fileIncludes, __dirname); +const projectFiles = fileIncludesAdjusted.join(' '); +const jsonFilePath = `${__dirname}/../${postpublishUtils.generatedDocsDirectoryName}/index.json`; +const version = process.env.DOCS_VERSION; + +(async () => { + const result = await execAsync(`JSON_FILE_PATH=${jsonFilePath} PROJECT_FILES="${projectFiles}" yarn docs:json`, { + cwd, + }); + if (!_.isEmpty(result.stderr)) { + throw new Error(result.stderr); + } + const fileName = `v${version}.json`; + const s3Url = S3BucketPath + fileName; + return execAsync(`S3_URL=${s3Url} yarn upload_docs_json`, { + cwd, + }); +})().catch(console.error); diff --git a/packages/deployer/package.json b/packages/deployer/package.json index a705f1ac0c..650997e78b 100644 --- a/packages/deployer/package.json +++ b/packages/deployer/package.json @@ -6,10 +6,10 @@ "types": "lib/src/index.d.ts", "scripts": { "build:watch": "tsc -w", - "build": "yarn clean && copyfiles 'test/fixtures/contracts/**/*' src/solc/solc_bin/* ./lib && tsc", + "build": "yarn clean && copyfiles 'test/fixtures/contracts/**/*' src/solc/solc_bin/* ./lib && tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", "test": "npm run build; mocha lib/test/*_test.js", "compile": "npm run build; node lib/src/cli.js compile", - "clean": "shx rm -rf ./lib", + "clean": "shx rm -rf lib scripts", "migrate": "npm run build; node lib/src/cli.js migrate", "lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'", "test:circleci": "yarn test" @@ -28,6 +28,7 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/deployer/README.md", "devDependencies": { + "@0xproject/monorepo-scripts": "^0.1.12", "@0xproject/tslint-config": "^0.4.10", "chai": "^4.0.1", "copyfiles": "^1.2.0", diff --git a/packages/deployer/scripts/postpublish.js b/packages/deployer/scripts/postpublish.js deleted file mode 100644 index b3e5407c81..0000000000 --- a/packages/deployer/scripts/postpublish.js +++ /dev/null @@ -1,5 +0,0 @@ -const postpublish_utils = require('../../../scripts/postpublish_utils'); -const packageJSON = require('../package.json'); - -const subPackageName = packageJSON.name; -postpublish_utils.standardPostPublishAsync(subPackageName); \ No newline at end of file diff --git a/packages/deployer/src/globals.d.ts b/packages/deployer/src/globals.d.ts index 2e04d83eaf..ec671ab632 100644 --- a/packages/deployer/src/globals.d.ts +++ b/packages/deployer/src/globals.d.ts @@ -9,3 +9,10 @@ declare module 'web3-eth-abi' { // tslint:disable-next-line:completed-docs export function encodeParameters(typesArray: string[], parameters: any[]): string; } + +declare module '*.json' { + const json: any; + /* tslint:disable */ + export default json; + /* tslint:enable */ +} diff --git a/packages/deployer/src/monorepo_scripts/postpublish.ts b/packages/deployer/src/monorepo_scripts/postpublish.ts new file mode 100644 index 0000000000..d5fcff9d00 --- /dev/null +++ b/packages/deployer/src/monorepo_scripts/postpublish.ts @@ -0,0 +1,6 @@ +import { postpublishUtils } from '@0xproject/monorepo-scripts'; + +import * as packageJSON from '../package.json'; + +const subPackageName = (packageJSON as any).name; +postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index 491ebd95fc..8912a73307 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -6,11 +6,11 @@ "types": "lib/src/index.d.ts", "scripts": { "build:watch": "tsc -w", - "build": "tsc", + "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", "test": "run-s clean build run_mocha", "test:circleci": "yarn test", "run_mocha": "mocha lib/test/**/*_test.js --bail --exit", - "clean": "shx rm -rf lib", + "clean": "shx rm -rf lib scripts", "lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'" }, "license": "Apache-2.0", @@ -23,12 +23,14 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/dev-utils/README.md", "devDependencies": { + "@0xproject/monorepo-scripts": "^0.1.12", "@0xproject/tslint-config": "^0.4.10", "@0xproject/web3-wrapper": "^0.2.1", "@types/lodash": "^4.14.86", "@types/mocha": "^2.2.42", "chai": "^4.0.1", "chai-typescript-typings": "^0.0.4", + "copyfiles": "^1.2.0", "mocha": "^4.0.1", "npm-run-all": "^4.1.2", "shx": "^0.2.2", @@ -43,9 +45,7 @@ "@0xproject/utils": "^0.4.1", "ethereumjs-util": "^5.1.2", "lodash": "^4.17.4", - "publish-release": "0xproject/publish-release", "request-promise-native": "^1.0.5", - "semver-sort": "^0.0.4", "web3": "^0.20.0", "web3-provider-engine": "^13.0.1" }, diff --git a/packages/dev-utils/scripts/postpublish.js b/packages/dev-utils/scripts/postpublish.js deleted file mode 100644 index b3e5407c81..0000000000 --- a/packages/dev-utils/scripts/postpublish.js +++ /dev/null @@ -1,5 +0,0 @@ -const postpublish_utils = require('../../../scripts/postpublish_utils'); -const packageJSON = require('../package.json'); - -const subPackageName = packageJSON.name; -postpublish_utils.standardPostPublishAsync(subPackageName); \ No newline at end of file diff --git a/packages/dev-utils/src/globals.d.ts b/packages/dev-utils/src/globals.d.ts index 9c8a1dc024..894e56c583 100644 --- a/packages/dev-utils/src/globals.d.ts +++ b/packages/dev-utils/src/globals.d.ts @@ -1,9 +1,9 @@ declare module 'web3-provider-engine'; declare module 'web3-provider-engine/subproviders/rpc'; -declare module 'async-child-process'; -declare module 'publish-release'; -// semver-sort declarations -declare module 'semver-sort' { - const desc: (versions: string[]) => string[]; +declare module '*.json' { + const json: any; + /* tslint:disable */ + export default json; + /* tslint:enable */ } diff --git a/packages/dev-utils/src/monorepo_scripts/postpublish.ts b/packages/dev-utils/src/monorepo_scripts/postpublish.ts new file mode 100644 index 0000000000..6bd94e71d7 --- /dev/null +++ b/packages/dev-utils/src/monorepo_scripts/postpublish.ts @@ -0,0 +1,6 @@ +import { postpublishUtils } from '../postpublish_utils'; + +import * as packageJSON from '../package.json'; + +const subPackageName = (packageJSON as any).name; +postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/dev-utils/.npmignore b/packages/dev-utils/test/.npmignore similarity index 100% rename from packages/dev-utils/.npmignore rename to packages/dev-utils/test/.npmignore diff --git a/packages/ethers-typescript-typings/monorepo_scripts/globals.d.ts b/packages/ethers-typescript-typings/monorepo_scripts/globals.d.ts new file mode 100644 index 0000000000..94e63a32de --- /dev/null +++ b/packages/ethers-typescript-typings/monorepo_scripts/globals.d.ts @@ -0,0 +1,6 @@ +declare module '*.json' { + const json: any; + /* tslint:disable */ + export default json; + /* tslint:enable */ +} diff --git a/packages/ethers-typescript-typings/monorepo_scripts/postpublish.ts b/packages/ethers-typescript-typings/monorepo_scripts/postpublish.ts new file mode 100644 index 0000000000..d5fcff9d00 --- /dev/null +++ b/packages/ethers-typescript-typings/monorepo_scripts/postpublish.ts @@ -0,0 +1,6 @@ +import { postpublishUtils } from '@0xproject/monorepo-scripts'; + +import * as packageJSON from '../package.json'; + +const subPackageName = (packageJSON as any).name; +postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/ethers-typescript-typings/package.json b/packages/ethers-typescript-typings/package.json index 6d76017947..1e349fa932 100644 --- a/packages/ethers-typescript-typings/package.json +++ b/packages/ethers-typescript-typings/package.json @@ -5,7 +5,9 @@ "main": "index.d.ts", "types": "index.d.ts", "scripts": { - "lint": "tslint index.d.ts" + "lint": "tslint index.d.ts", + "build": "tsc && copyfiles -u 1 './lib/**/*' ./scripts", + "clean": "shx rm -rf scripts" }, "repository": { "type": "git", @@ -21,6 +23,9 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/ethers-typescript-typings#readme", "devDependencies": { + "@0xproject/monorepo-scripts": "^0.1.12", + "copyfiles": "^1.2.0", + "shx": "^0.2.2", "tslint": "5.8.0", "tslint-config-0xproject": "^0.0.2", "typescript": "2.7.1" diff --git a/packages/ethers-typescript-typings/scripts/postpublish.js b/packages/ethers-typescript-typings/scripts/postpublish.js deleted file mode 100644 index b3e5407c81..0000000000 --- a/packages/ethers-typescript-typings/scripts/postpublish.js +++ /dev/null @@ -1,5 +0,0 @@ -const postpublish_utils = require('../../../scripts/postpublish_utils'); -const packageJSON = require('../package.json'); - -const subPackageName = packageJSON.name; -postpublish_utils.standardPostPublishAsync(subPackageName); \ No newline at end of file diff --git a/packages/ethers-typescript-typings/tsconfig.json b/packages/ethers-typescript-typings/tsconfig.json new file mode 100644 index 0000000000..2599d1b7c6 --- /dev/null +++ b/packages/ethers-typescript-typings/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig", + "compilerOptions": { + "outDir": "lib" + }, + "include": ["./monorepo_scripts/**/*", "../../node_modules/web3-typescript-typings/index.d.ts"] +} diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json index 8d82511b4c..e775130cb0 100644 --- a/packages/json-schemas/package.json +++ b/packages/json-schemas/package.json @@ -10,8 +10,8 @@ "test": "run-s clean build run_mocha", "test:circleci": "yarn test", "run_mocha": "mocha lib/test/**/*_test.js", - "clean": "shx rm -rf _bundles lib test_temp", - "build": "tsc" + "clean": "shx rm -rf _bundles lib test_temp scripts", + "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts" }, "repository": { "type": "git", @@ -28,6 +28,7 @@ "lodash.values": "^4.3.0" }, "devDependencies": { + "@0xproject/monorepo-scripts": "^0.1.12", "@0xproject/tslint-config": "^0.4.10", "@0xproject/utils": "^0.4.1", "@types/lodash.foreach": "^4.5.3", @@ -35,6 +36,7 @@ "@types/mocha": "^2.2.42", "chai": "^4.0.1", "chai-typescript-typings": "^0.0.4", + "copyfiles": "^1.2.0", "dirty-chai": "^2.0.1", "lodash.foreach": "^4.5.0", "mocha": "^4.0.1", diff --git a/packages/json-schemas/scripts/postpublish.js b/packages/json-schemas/scripts/postpublish.js deleted file mode 100644 index b3e5407c81..0000000000 --- a/packages/json-schemas/scripts/postpublish.js +++ /dev/null @@ -1,5 +0,0 @@ -const postpublish_utils = require('../../../scripts/postpublish_utils'); -const packageJSON = require('../package.json'); - -const subPackageName = packageJSON.name; -postpublish_utils.standardPostPublishAsync(subPackageName); \ No newline at end of file diff --git a/packages/json-schemas/src/globals.d.ts b/packages/json-schemas/src/globals.d.ts index 91ed2021ef..5476b6bd8c 100644 --- a/packages/json-schemas/src/globals.d.ts +++ b/packages/json-schemas/src/globals.d.ts @@ -1 +1,8 @@ declare module 'dirty-chai'; + +declare module '*.json' { + const json: any; + /* tslint:disable */ + export default json; + /* tslint:enable */ +} diff --git a/packages/json-schemas/src/monorepo_scripts/postpublish.ts b/packages/json-schemas/src/monorepo_scripts/postpublish.ts new file mode 100644 index 0000000000..d5fcff9d00 --- /dev/null +++ b/packages/json-schemas/src/monorepo_scripts/postpublish.ts @@ -0,0 +1,6 @@ +import { postpublishUtils } from '@0xproject/monorepo-scripts'; + +import * as packageJSON from '../package.json'; + +const subPackageName = (packageJSON as any).name; +postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/monorepo-scripts/package.json b/packages/monorepo-scripts/package.json index c9bbe0c6ab..09a632c077 100644 --- a/packages/monorepo-scripts/package.json +++ b/packages/monorepo-scripts/package.json @@ -1,7 +1,6 @@ { "name": "@0xproject/monorepo-scripts", "version": "0.1.12", - "private": true, "description": "Helper scripts for the monorepo", "scripts": { "build:watch": "tsc -w", @@ -28,8 +27,12 @@ "typescript": "2.7.1" }, "dependencies": { + "es6-promisify": "^5.0.0", + "async-child-process": "^1.1.1", + "publish-release": "0xproject/publish-release", "chalk": "^2.3.0", "glob": "^7.1.2", - "lodash": "^4.17.4" + "lodash": "^4.17.4", + "semver-sort": "^0.0.4" } } diff --git a/packages/monorepo-scripts/src/globals.d.ts b/packages/monorepo-scripts/src/globals.d.ts new file mode 100644 index 0000000000..757ae40974 --- /dev/null +++ b/packages/monorepo-scripts/src/globals.d.ts @@ -0,0 +1,8 @@ +declare module 'async-child-process'; +declare module 'publish-release'; +declare module 'es6-promisify'; + +// semver-sort declarations +declare module 'semver-sort' { + const desc: (versions: string[]) => string[]; +} diff --git a/packages/monorepo-scripts/src/index.ts b/packages/monorepo-scripts/src/index.ts new file mode 100644 index 0000000000..95c96ebe85 --- /dev/null +++ b/packages/monorepo-scripts/src/index.ts @@ -0,0 +1 @@ +export { postpublishUtils } from './postpublish_utils'; diff --git a/packages/dev-utils/src/postpublish_utils.ts b/packages/monorepo-scripts/src/postpublish_utils.ts similarity index 98% rename from packages/dev-utils/src/postpublish_utils.ts rename to packages/monorepo-scripts/src/postpublish_utils.ts index 35d046e260..2f27e15cb8 100644 --- a/packages/dev-utils/src/postpublish_utils.ts +++ b/packages/monorepo-scripts/src/postpublish_utils.ts @@ -1,4 +1,4 @@ -import { promisify } from '@0xproject/utils'; +import * as promisify from 'es6-promisify'; import { execAsync } from 'async-child-process'; import * as _ from 'lodash'; import * as publishRelease from 'publish-release'; diff --git a/packages/dev-utils/src/utils.ts b/packages/monorepo-scripts/src/utils.ts similarity index 100% rename from packages/dev-utils/src/utils.ts rename to packages/monorepo-scripts/src/utils.ts diff --git a/packages/react-docs-example/package.json b/packages/react-docs-example/package.json index 5469677d47..95a617de74 100644 --- a/packages/react-docs-example/package.json +++ b/packages/react-docs-example/package.json @@ -34,6 +34,7 @@ "@types/lodash": "^4.14.86", "@types/node": "^8.0.53", "awesome-typescript-loader": "^3.1.3", + "copyfiles": "^1.2.0", "css-loader": "^0.28.9", "json-loader": "^0.5.4", "less": "^2.7.2", diff --git a/packages/react-docs/package.json b/packages/react-docs/package.json index eb76fe47e7..a3e6b55d8d 100644 --- a/packages/react-docs/package.json +++ b/packages/react-docs/package.json @@ -1,52 +1,55 @@ { - "name": "@0xproject/react-docs", - "version": "0.0.1", - "description": "React documentation component for rendering TypeDoc & Doxity generated JSON", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "scripts": { - "lint": "tslint --project . 'src/ts/**/*.ts' 'src/ts/**/*.tsx'", - "build": "tsc", - "build:watch": "tsc -w", - "clean": "shx rm -rf lib" - }, - "author": "Fabio Berger", - "license": "Apache-2.0", - "bugs": { - "url": "https://github.com/0xProject/0x-monorepo/issues" - }, - "homepage": "https://github.com/0xProject/0x-monorepo/packages/react-docs/README.md", - "repository": { - "type": "git", - "url": "https://github.com/0xProject/0x-monorepo.git" - }, - "devDependencies": { - "@0xproject/tslint-config": "^0.4.9", - "@types/lodash": "^4.14.86", - "@types/material-ui": "0.18.0", - "@types/node": "^8.0.53", - "@types/react": "^15.0.15", - "@types/react-dom": "^0.14.23", - "@types/react-scroll": "0.0.31", - "@types/react-tap-event-plugin": "0.0.30", - "shx": "^0.2.2", - "tslint": "^5.9.1", - "typescript": "2.7.1" - }, - "dependencies": { - "@0xproject/react-shared": "^0.0.1", - "basscss": "^8.0.3", - "compare-versions": "^3.0.1", - "lodash": "^4.17.4", - "material-ui": "^0.17.1", - "react": "15.6.1", - "react-dom": "15.6.1", - "react-markdown": "^3.2.2", - "react-scroll": "^1.5.2", - "react-tap-event-plugin": "^2.0.1", - "react-tooltip": "^3.2.7" - }, - "publishConfig": { - "access": "public" - } + "name": "@0xproject/react-docs", + "version": "0.0.1", + "description": "React documentation component for rendering TypeDoc & Doxity generated JSON", + "main": "lib/index.js", + "types": "lib/index.d.ts", + "scripts": { + "lint": "tslint --project . 'src/**/*.ts' 'src/**/*.tsx'", + "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts", + "build:watch": "tsc -w", + "clean": "shx rm -rf lib scripts" + }, + "author": "Fabio Berger", + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/0xProject/0x-monorepo/issues" + }, + "homepage": "https://github.com/0xProject/0x-monorepo/packages/react-docs/README.md", + "repository": { + "type": "git", + "url": "https://github.com/0xProject/0x-monorepo.git" + }, + "devDependencies": { + "@0xproject/dev-utils": "^0.2.1", + "@0xproject/monorepo-scripts": "^0.1.12", + "@0xproject/tslint-config": "^0.4.9", + "@types/lodash": "^4.14.86", + "@types/material-ui": "0.18.0", + "@types/node": "^8.0.53", + "@types/react": "^15.0.15", + "@types/react-dom": "^0.14.23", + "@types/react-scroll": "0.0.31", + "@types/react-tap-event-plugin": "0.0.30", + "copyfiles": "^1.2.0", + "shx": "^0.2.2", + "tslint": "^5.9.1", + "typescript": "2.7.1" + }, + "dependencies": { + "@0xproject/react-shared": "^0.0.1", + "basscss": "^8.0.3", + "compare-versions": "^3.0.1", + "lodash": "^4.17.4", + "material-ui": "^0.17.1", + "react": "15.6.1", + "react-dom": "15.6.1", + "react-markdown": "^3.2.2", + "react-scroll": "^1.5.2", + "react-tap-event-plugin": "^2.0.1", + "react-tooltip": "^3.2.7" + }, + "publishConfig": { + "access": "public" + } } diff --git a/packages/react-docs/scripts/postpublish.js b/packages/react-docs/scripts/postpublish.js deleted file mode 100644 index 639656c7ee..0000000000 --- a/packages/react-docs/scripts/postpublish.js +++ /dev/null @@ -1,5 +0,0 @@ -const postpublish_utils = require('../../../scripts/postpublish_utils'); -const packageJSON = require('../package.json'); - -const subPackageName = packageJSON.name; -postpublish_utils.standardPostPublishAsync(subPackageName); diff --git a/packages/react-docs/src/ts/components/badge.tsx b/packages/react-docs/src/components/badge.tsx similarity index 100% rename from packages/react-docs/src/ts/components/badge.tsx rename to packages/react-docs/src/components/badge.tsx diff --git a/packages/react-docs/src/ts/components/comment.tsx b/packages/react-docs/src/components/comment.tsx similarity index 100% rename from packages/react-docs/src/ts/components/comment.tsx rename to packages/react-docs/src/components/comment.tsx diff --git a/packages/react-docs/src/ts/components/custom_enum.tsx b/packages/react-docs/src/components/custom_enum.tsx similarity index 100% rename from packages/react-docs/src/ts/components/custom_enum.tsx rename to packages/react-docs/src/components/custom_enum.tsx diff --git a/packages/react-docs/src/ts/components/documentation.tsx b/packages/react-docs/src/components/documentation.tsx similarity index 100% rename from packages/react-docs/src/ts/components/documentation.tsx rename to packages/react-docs/src/components/documentation.tsx diff --git a/packages/react-docs/src/ts/components/enum.tsx b/packages/react-docs/src/components/enum.tsx similarity index 100% rename from packages/react-docs/src/ts/components/enum.tsx rename to packages/react-docs/src/components/enum.tsx diff --git a/packages/react-docs/src/ts/components/event_definition.tsx b/packages/react-docs/src/components/event_definition.tsx similarity index 100% rename from packages/react-docs/src/ts/components/event_definition.tsx rename to packages/react-docs/src/components/event_definition.tsx diff --git a/packages/react-docs/src/ts/components/interface.tsx b/packages/react-docs/src/components/interface.tsx similarity index 100% rename from packages/react-docs/src/ts/components/interface.tsx rename to packages/react-docs/src/components/interface.tsx diff --git a/packages/react-docs/src/ts/components/method_block.tsx b/packages/react-docs/src/components/method_block.tsx similarity index 100% rename from packages/react-docs/src/ts/components/method_block.tsx rename to packages/react-docs/src/components/method_block.tsx diff --git a/packages/react-docs/src/ts/components/method_signature.tsx b/packages/react-docs/src/components/method_signature.tsx similarity index 100% rename from packages/react-docs/src/ts/components/method_signature.tsx rename to packages/react-docs/src/components/method_signature.tsx diff --git a/packages/react-docs/src/ts/components/source_link.tsx b/packages/react-docs/src/components/source_link.tsx similarity index 100% rename from packages/react-docs/src/ts/components/source_link.tsx rename to packages/react-docs/src/components/source_link.tsx diff --git a/packages/react-docs/src/ts/components/type.tsx b/packages/react-docs/src/components/type.tsx similarity index 100% rename from packages/react-docs/src/ts/components/type.tsx rename to packages/react-docs/src/components/type.tsx diff --git a/packages/react-docs/src/ts/components/type_definition.tsx b/packages/react-docs/src/components/type_definition.tsx similarity index 100% rename from packages/react-docs/src/ts/components/type_definition.tsx rename to packages/react-docs/src/components/type_definition.tsx diff --git a/packages/react-docs/src/ts/docs_info.ts b/packages/react-docs/src/docs_info.ts similarity index 100% rename from packages/react-docs/src/ts/docs_info.ts rename to packages/react-docs/src/docs_info.ts diff --git a/packages/react-docs/src/ts/globals.d.ts b/packages/react-docs/src/globals.d.ts similarity index 100% rename from packages/react-docs/src/ts/globals.d.ts rename to packages/react-docs/src/globals.d.ts diff --git a/packages/react-docs/src/ts/index.ts b/packages/react-docs/src/index.ts similarity index 100% rename from packages/react-docs/src/ts/index.ts rename to packages/react-docs/src/index.ts diff --git a/packages/react-docs/src/monorepo_scripts/postpublish.ts b/packages/react-docs/src/monorepo_scripts/postpublish.ts new file mode 100644 index 0000000000..d5fcff9d00 --- /dev/null +++ b/packages/react-docs/src/monorepo_scripts/postpublish.ts @@ -0,0 +1,6 @@ +import { postpublishUtils } from '@0xproject/monorepo-scripts'; + +import * as packageJSON from '../package.json'; + +const subPackageName = (packageJSON as any).name; +postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/react-docs/src/ts/types.ts b/packages/react-docs/src/types.ts similarity index 100% rename from packages/react-docs/src/ts/types.ts rename to packages/react-docs/src/types.ts diff --git a/packages/react-docs/src/ts/utils/constants.ts b/packages/react-docs/src/utils/constants.ts similarity index 100% rename from packages/react-docs/src/ts/utils/constants.ts rename to packages/react-docs/src/utils/constants.ts diff --git a/packages/react-docs/src/ts/utils/doxity_utils.ts b/packages/react-docs/src/utils/doxity_utils.ts similarity index 100% rename from packages/react-docs/src/ts/utils/doxity_utils.ts rename to packages/react-docs/src/utils/doxity_utils.ts diff --git a/packages/react-docs/src/ts/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts similarity index 100% rename from packages/react-docs/src/ts/utils/typedoc_utils.ts rename to packages/react-docs/src/utils/typedoc_utils.ts diff --git a/packages/react-docs/src/ts/utils/utils.ts b/packages/react-docs/src/utils/utils.ts similarity index 100% rename from packages/react-docs/src/ts/utils/utils.ts rename to packages/react-docs/src/utils/utils.ts diff --git a/packages/react-docs/tsconfig.json b/packages/react-docs/tsconfig.json index 44055a0373..9af6638a26 100644 --- a/packages/react-docs/tsconfig.json +++ b/packages/react-docs/tsconfig.json @@ -9,5 +9,5 @@ "*": ["node_modules/@types/*", "*"] } }, - "include": ["./src/ts/**/*"] + "include": ["./src/**/*", "../../node_modules/web3-typescript-typings/index.d.ts"] } diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index adfbce52c2..ac1d05f38c 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -1,50 +1,53 @@ { - "name": "@0xproject/react-shared", - "version": "0.0.1", - "description": "0x shared react components", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "scripts": { - "lint": "tslint --project . 'src/ts/**/*.ts' 'src/ts/**/*.tsx'", - "build": "tsc", - "build:watch": "tsc -w", - "clean": "shx rm -rf lib" - }, - "author": "Fabio Berger", - "license": "Apache-2.0", - "bugs": { - "url": "https://github.com/0xProject/0x-monorepo/issues" - }, - "homepage": "https://github.com/0xProject/0x-monorepo/packages/react-shared/README.md", - "repository": { - "type": "git", - "url": "https://github.com/0xProject/0x-monorepo.git" - }, - "devDependencies": { - "@0xproject/tslint-config": "^0.4.9", - "@types/lodash": "^4.14.86", - "@types/material-ui": "0.18.0", - "@types/node": "^8.0.53", - "@types/react": "^15.0.15", - "@types/react-dom": "^0.14.23", - "@types/react-scroll": "0.0.31", - "shx": "^0.2.2", - "tslint": "^5.9.1", - "typescript": "2.7.1" - }, - "dependencies": { - "basscss": "^8.0.3", - "is-mobile": "^0.2.2", - "lodash": "^4.17.4", - "material-ui": "^0.17.1", - "react": "15.6.1", - "react-dom": "15.6.1", - "react-highlight": "0xproject/react-highlight", - "react-markdown": "^3.2.2", - "react-scroll": "^1.5.2", - "react-tap-event-plugin": "^2.0.1" - }, - "publishConfig": { - "access": "public" - } + "name": "@0xproject/react-shared", + "version": "0.0.1", + "description": "0x shared react components", + "main": "lib/index.js", + "types": "lib/index.d.ts", + "scripts": { + "lint": "tslint --project . 'src/**/*.ts' 'src/**/*.tsx'", + "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts", + "build:watch": "tsc -w", + "clean": "shx rm -rf lib scripts" + }, + "author": "Fabio Berger", + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/0xProject/0x-monorepo/issues" + }, + "homepage": "https://github.com/0xProject/0x-monorepo/packages/react-shared/README.md", + "repository": { + "type": "git", + "url": "https://github.com/0xProject/0x-monorepo.git" + }, + "devDependencies": { + "@0xproject/dev-utils": "^0.2.1", + "@0xproject/monorepo-scripts": "^0.1.12", + "@0xproject/tslint-config": "^0.4.9", + "@types/lodash": "^4.14.86", + "@types/material-ui": "0.18.0", + "@types/node": "^8.0.53", + "@types/react": "^15.0.15", + "@types/react-dom": "^0.14.23", + "@types/react-scroll": "0.0.31", + "copyfiles": "^1.2.0", + "shx": "^0.2.2", + "tslint": "^5.9.1", + "typescript": "2.7.1" + }, + "dependencies": { + "basscss": "^8.0.3", + "is-mobile": "^0.2.2", + "lodash": "^4.17.4", + "material-ui": "^0.17.1", + "react": "15.6.1", + "react-dom": "15.6.1", + "react-highlight": "0xproject/react-highlight", + "react-markdown": "^3.2.2", + "react-scroll": "^1.5.2", + "react-tap-event-plugin": "^2.0.1" + }, + "publishConfig": { + "access": "public" + } } diff --git a/packages/react-shared/scripts/postpublish.js b/packages/react-shared/scripts/postpublish.js deleted file mode 100644 index 639656c7ee..0000000000 --- a/packages/react-shared/scripts/postpublish.js +++ /dev/null @@ -1,5 +0,0 @@ -const postpublish_utils = require('../../../scripts/postpublish_utils'); -const packageJSON = require('../package.json'); - -const subPackageName = packageJSON.name; -postpublish_utils.standardPostPublishAsync(subPackageName); diff --git a/packages/react-shared/src/ts/components/anchor_title.tsx b/packages/react-shared/src/components/anchor_title.tsx similarity index 100% rename from packages/react-shared/src/ts/components/anchor_title.tsx rename to packages/react-shared/src/components/anchor_title.tsx diff --git a/packages/react-shared/src/ts/components/markdown_code_block.tsx b/packages/react-shared/src/components/markdown_code_block.tsx similarity index 100% rename from packages/react-shared/src/ts/components/markdown_code_block.tsx rename to packages/react-shared/src/components/markdown_code_block.tsx diff --git a/packages/react-shared/src/ts/components/markdown_link_block.tsx b/packages/react-shared/src/components/markdown_link_block.tsx similarity index 100% rename from packages/react-shared/src/ts/components/markdown_link_block.tsx rename to packages/react-shared/src/components/markdown_link_block.tsx diff --git a/packages/react-shared/src/ts/components/markdown_section.tsx b/packages/react-shared/src/components/markdown_section.tsx similarity index 100% rename from packages/react-shared/src/ts/components/markdown_section.tsx rename to packages/react-shared/src/components/markdown_section.tsx diff --git a/packages/react-shared/src/ts/components/nested_sidebar_menu.tsx b/packages/react-shared/src/components/nested_sidebar_menu.tsx similarity index 100% rename from packages/react-shared/src/ts/components/nested_sidebar_menu.tsx rename to packages/react-shared/src/components/nested_sidebar_menu.tsx diff --git a/packages/react-shared/src/ts/components/section_header.tsx b/packages/react-shared/src/components/section_header.tsx similarity index 100% rename from packages/react-shared/src/ts/components/section_header.tsx rename to packages/react-shared/src/components/section_header.tsx diff --git a/packages/react-shared/src/ts/components/version_drop_down.tsx b/packages/react-shared/src/components/version_drop_down.tsx similarity index 100% rename from packages/react-shared/src/ts/components/version_drop_down.tsx rename to packages/react-shared/src/components/version_drop_down.tsx diff --git a/packages/react-shared/src/ts/globals.d.ts b/packages/react-shared/src/globals.d.ts similarity index 55% rename from packages/react-shared/src/ts/globals.d.ts rename to packages/react-shared/src/globals.d.ts index 9b0bcf8457..525563e23d 100644 --- a/packages/react-shared/src/ts/globals.d.ts +++ b/packages/react-shared/src/globals.d.ts @@ -5,3 +5,10 @@ declare function isMobile(): boolean; declare module 'is-mobile' { export = isMobile; } + +declare module '*.json' { + const json: any; + /* tslint:disable */ + export default json; + /* tslint:enable */ +} diff --git a/packages/react-shared/src/ts/index.ts b/packages/react-shared/src/index.ts similarity index 100% rename from packages/react-shared/src/ts/index.ts rename to packages/react-shared/src/index.ts diff --git a/packages/react-shared/src/monorepo_scripts/postpublish.ts b/packages/react-shared/src/monorepo_scripts/postpublish.ts new file mode 100644 index 0000000000..d5fcff9d00 --- /dev/null +++ b/packages/react-shared/src/monorepo_scripts/postpublish.ts @@ -0,0 +1,6 @@ +import { postpublishUtils } from '@0xproject/monorepo-scripts'; + +import * as packageJSON from '../package.json'; + +const subPackageName = (packageJSON as any).name; +postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/react-shared/src/ts/types.ts b/packages/react-shared/src/types.ts similarity index 100% rename from packages/react-shared/src/ts/types.ts rename to packages/react-shared/src/types.ts diff --git a/packages/react-shared/src/ts/utils/colors.ts b/packages/react-shared/src/utils/colors.ts similarity index 100% rename from packages/react-shared/src/ts/utils/colors.ts rename to packages/react-shared/src/utils/colors.ts diff --git a/packages/react-shared/src/ts/utils/constants.ts b/packages/react-shared/src/utils/constants.ts similarity index 100% rename from packages/react-shared/src/ts/utils/constants.ts rename to packages/react-shared/src/utils/constants.ts diff --git a/packages/react-shared/src/ts/utils/utils.ts b/packages/react-shared/src/utils/utils.ts similarity index 100% rename from packages/react-shared/src/ts/utils/utils.ts rename to packages/react-shared/src/utils/utils.ts diff --git a/packages/sra-report/package.json b/packages/sra-report/package.json index abe305f527..86083d0006 100644 --- a/packages/sra-report/package.json +++ b/packages/sra-report/package.json @@ -7,8 +7,8 @@ "scripts": { "build:watch": "tsc -w", "lint": "tslint --project . 'src/**/*.ts'", - "clean": "shx rm -rf lib", - "build": "tsc" + "clean": "shx rm -rf lib scripts", + "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts" }, "bin": { "sra-report": "lib/index.js" @@ -34,10 +34,12 @@ "yargs": "^10.0.3" }, "devDependencies": { + "@0xproject/monorepo-scripts": "^0.1.12", "@0xproject/tslint-config": "^0.4.10", "@types/lodash": "^4.14.86", "@types/node": "^8.0.53", "@types/yargs": "^10.0.0", + "copyfiles": "^1.2.0", "shx": "^0.2.2", "tslint": "5.8.0", "typescript": "2.7.1" diff --git a/packages/sra-report/scripts/postpublish.js b/packages/sra-report/scripts/postpublish.js deleted file mode 100644 index 639656c7ee..0000000000 --- a/packages/sra-report/scripts/postpublish.js +++ /dev/null @@ -1,5 +0,0 @@ -const postpublish_utils = require('../../../scripts/postpublish_utils'); -const packageJSON = require('../package.json'); - -const subPackageName = packageJSON.name; -postpublish_utils.standardPostPublishAsync(subPackageName); diff --git a/packages/sra-report/src/monorepo_scripts/postpublish.ts b/packages/sra-report/src/monorepo_scripts/postpublish.ts new file mode 100644 index 0000000000..d5fcff9d00 --- /dev/null +++ b/packages/sra-report/src/monorepo_scripts/postpublish.ts @@ -0,0 +1,6 @@ +import { postpublishUtils } from '@0xproject/monorepo-scripts'; + +import * as packageJSON from '../package.json'; + +const subPackageName = (packageJSON as any).name; +postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json index c52484f821..1b30e18c05 100644 --- a/packages/subproviders/package.json +++ b/packages/subproviders/package.json @@ -6,8 +6,8 @@ "license": "Apache-2.0", "scripts": { "build:watch": "tsc -w", - "clean": "shx rm -rf lib", - "build": "tsc", + "clean": "shx rm -rf lib scripts", + "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", "lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'", "run_mocha_unit": "mocha lib/test/unit/**/*_test.js --timeout 10000 --bail --exit", "run_mocha_integration": "mocha lib/test/integration/**/*_test.js --timeout 10000 --bail --exit", @@ -35,6 +35,7 @@ "web3-typescript-typings": "^0.10.0" }, "devDependencies": { + "@0xproject/monorepo-scripts": "^0.1.12", "@0xproject/tslint-config": "^0.4.10", "@0xproject/utils": "^0.4.1", "@types/lodash": "^4.14.86", @@ -44,6 +45,7 @@ "chai-as-promised": "^7.1.0", "chai-as-promised-typescript-typings": "^0.0.10", "chai-typescript-typings": "^0.0.4", + "copyfiles": "^1.2.0", "dirty-chai": "^2.0.1", "mocha": "^4.0.1", "npm-run-all": "^4.1.2", diff --git a/packages/subproviders/scripts/postpublish.js b/packages/subproviders/scripts/postpublish.js deleted file mode 100644 index b3e5407c81..0000000000 --- a/packages/subproviders/scripts/postpublish.js +++ /dev/null @@ -1,5 +0,0 @@ -const postpublish_utils = require('../../../scripts/postpublish_utils'); -const packageJSON = require('../package.json'); - -const subPackageName = packageJSON.name; -postpublish_utils.standardPostPublishAsync(subPackageName); \ No newline at end of file diff --git a/packages/subproviders/src/globals.d.ts b/packages/subproviders/src/globals.d.ts index d59ee9e67f..e51801b5c6 100644 --- a/packages/subproviders/src/globals.d.ts +++ b/packages/subproviders/src/globals.d.ts @@ -134,3 +134,10 @@ declare module 'hdkey' { } export = HDNode; } + +declare module '*.json' { + const json: any; + /* tslint:disable */ + export default json; + /* tslint:enable */ +} diff --git a/packages/subproviders/src/monorepo_scripts/postpublish.ts b/packages/subproviders/src/monorepo_scripts/postpublish.ts new file mode 100644 index 0000000000..d5fcff9d00 --- /dev/null +++ b/packages/subproviders/src/monorepo_scripts/postpublish.ts @@ -0,0 +1,6 @@ +import { postpublishUtils } from '@0xproject/monorepo-scripts'; + +import * as packageJSON from '../package.json'; + +const subPackageName = (packageJSON as any).name; +postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/tslint-config/monorepo_scripts/globals.d.ts b/packages/tslint-config/monorepo_scripts/globals.d.ts new file mode 100644 index 0000000000..94e63a32de --- /dev/null +++ b/packages/tslint-config/monorepo_scripts/globals.d.ts @@ -0,0 +1,6 @@ +declare module '*.json' { + const json: any; + /* tslint:disable */ + export default json; + /* tslint:enable */ +} diff --git a/packages/tslint-config/monorepo_scripts/postpublish.ts b/packages/tslint-config/monorepo_scripts/postpublish.ts new file mode 100644 index 0000000000..d5fcff9d00 --- /dev/null +++ b/packages/tslint-config/monorepo_scripts/postpublish.ts @@ -0,0 +1,6 @@ +import { postpublishUtils } from '@0xproject/monorepo-scripts'; + +import * as packageJSON from '../package.json'; + +const subPackageName = (packageJSON as any).name; +postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/tslint-config/package.json b/packages/tslint-config/package.json index b8398445f8..13dcce87e0 100644 --- a/packages/tslint-config/package.json +++ b/packages/tslint-config/package.json @@ -5,8 +5,8 @@ "main": "tslint.json", "scripts": { "build:watch": "tsc -w", - "build": "tsc", - "clean": "shx rm -rf lib", + "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts", + "clean": "shx rm -rf lib scripts", "lint": "tslint --project . 'rules/**/*.ts'" }, "repository": { @@ -30,7 +30,9 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/tslint-config/README.md", "devDependencies": { + "@0xproject/monorepo-scripts": "^0.1.12", "@types/lodash": "^4.14.86", + "copyfiles": "^1.2.0", "shx": "^0.2.2", "typescript": "2.7.1" }, diff --git a/packages/tslint-config/scripts/postpublish.js b/packages/tslint-config/scripts/postpublish.js deleted file mode 100644 index b3e5407c81..0000000000 --- a/packages/tslint-config/scripts/postpublish.js +++ /dev/null @@ -1,5 +0,0 @@ -const postpublish_utils = require('../../../scripts/postpublish_utils'); -const packageJSON = require('../package.json'); - -const subPackageName = packageJSON.name; -postpublish_utils.standardPostPublishAsync(subPackageName); \ No newline at end of file diff --git a/packages/tslint-config/tsconfig.json b/packages/tslint-config/tsconfig.json index 15da53092e..6e5f060a47 100644 --- a/packages/tslint-config/tsconfig.json +++ b/packages/tslint-config/tsconfig.json @@ -3,5 +3,5 @@ "compilerOptions": { "outDir": "lib" }, - "include": ["./rules/**/*"] + "include": ["./rules/**/*", "./monorepo_scripts/**/*", "../../node_modules/web3-typescript-typings/index.d.ts"] } diff --git a/packages/types/package.json b/packages/types/package.json index f4a587fc6b..8dc03892e6 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -6,8 +6,8 @@ "types": "lib/index.d.ts", "scripts": { "build:watch": "tsc -w", - "build": "tsc", - "clean": "shx rm -rf lib", + "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts", + "clean": "shx rm -rf lib scripts", "lint": "tslint --project . 'src/**/*.ts'" }, "license": "Apache-2.0", @@ -20,7 +20,9 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/types/README.md", "devDependencies": { + "@0xproject/monorepo-scripts": "^0.1.12", "@0xproject/tslint-config": "^0.4.10", + "copyfiles": "^1.2.0", "shx": "^0.2.2", "tslint": "5.8.0", "typescript": "2.7.1" diff --git a/packages/types/scripts/postpublish.js b/packages/types/scripts/postpublish.js deleted file mode 100644 index b3e5407c81..0000000000 --- a/packages/types/scripts/postpublish.js +++ /dev/null @@ -1,5 +0,0 @@ -const postpublish_utils = require('../../../scripts/postpublish_utils'); -const packageJSON = require('../package.json'); - -const subPackageName = packageJSON.name; -postpublish_utils.standardPostPublishAsync(subPackageName); \ No newline at end of file diff --git a/packages/types/src/globals.d.ts b/packages/types/src/globals.d.ts new file mode 100644 index 0000000000..94e63a32de --- /dev/null +++ b/packages/types/src/globals.d.ts @@ -0,0 +1,6 @@ +declare module '*.json' { + const json: any; + /* tslint:disable */ + export default json; + /* tslint:enable */ +} diff --git a/packages/types/src/monorepo_scripts/postpublish.ts b/packages/types/src/monorepo_scripts/postpublish.ts new file mode 100644 index 0000000000..d5fcff9d00 --- /dev/null +++ b/packages/types/src/monorepo_scripts/postpublish.ts @@ -0,0 +1,6 @@ +import { postpublishUtils } from '@0xproject/monorepo-scripts'; + +import * as packageJSON from '../package.json'; + +const subPackageName = (packageJSON as any).name; +postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/utils/package.json b/packages/utils/package.json index 0cfd501781..b7c98b78ea 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -6,8 +6,8 @@ "types": "lib/index.d.ts", "scripts": { "build:watch": "tsc -w", - "build": "tsc", - "clean": "shx rm -rf lib", + "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts", + "clean": "shx rm -rf lib scripts", "lint": "tslint --project . 'src/**/*.ts'" }, "license": "Apache-2.0", @@ -20,8 +20,10 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/utils/README.md", "devDependencies": { + "@0xproject/monorepo-scripts": "^0.1.12", "@0xproject/tslint-config": "^0.4.10", "@types/lodash": "^4.14.86", + "copyfiles": "^1.2.0", "npm-run-all": "^4.1.2", "shx": "^0.2.2", "tslint": "5.8.0", diff --git a/packages/utils/scripts/postpublish.js b/packages/utils/scripts/postpublish.js deleted file mode 100644 index b3e5407c81..0000000000 --- a/packages/utils/scripts/postpublish.js +++ /dev/null @@ -1,5 +0,0 @@ -const postpublish_utils = require('../../../scripts/postpublish_utils'); -const packageJSON = require('../package.json'); - -const subPackageName = packageJSON.name; -postpublish_utils.standardPostPublishAsync(subPackageName); \ No newline at end of file diff --git a/packages/utils/src/globals.d.ts b/packages/utils/src/globals.d.ts new file mode 100644 index 0000000000..94e63a32de --- /dev/null +++ b/packages/utils/src/globals.d.ts @@ -0,0 +1,6 @@ +declare module '*.json' { + const json: any; + /* tslint:disable */ + export default json; + /* tslint:enable */ +} diff --git a/packages/utils/src/monorepo_scripts/postpublish.ts b/packages/utils/src/monorepo_scripts/postpublish.ts new file mode 100644 index 0000000000..d5fcff9d00 --- /dev/null +++ b/packages/utils/src/monorepo_scripts/postpublish.ts @@ -0,0 +1,6 @@ +import { postpublishUtils } from '@0xproject/monorepo-scripts'; + +import * as packageJSON from '../package.json'; + +const subPackageName = (packageJSON as any).name; +postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/web3-typescript-typings/monorepo_scripts/globals.d.ts b/packages/web3-typescript-typings/monorepo_scripts/globals.d.ts new file mode 100644 index 0000000000..94e63a32de --- /dev/null +++ b/packages/web3-typescript-typings/monorepo_scripts/globals.d.ts @@ -0,0 +1,6 @@ +declare module '*.json' { + const json: any; + /* tslint:disable */ + export default json; + /* tslint:enable */ +} diff --git a/packages/web3-typescript-typings/monorepo_scripts/postpublish.ts b/packages/web3-typescript-typings/monorepo_scripts/postpublish.ts new file mode 100644 index 0000000000..d5fcff9d00 --- /dev/null +++ b/packages/web3-typescript-typings/monorepo_scripts/postpublish.ts @@ -0,0 +1,6 @@ +import { postpublishUtils } from '@0xproject/monorepo-scripts'; + +import * as packageJSON from '../package.json'; + +const subPackageName = (packageJSON as any).name; +postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/web3-typescript-typings/package.json b/packages/web3-typescript-typings/package.json index 0b04fe0505..0825f646dd 100644 --- a/packages/web3-typescript-typings/package.json +++ b/packages/web3-typescript-typings/package.json @@ -5,7 +5,9 @@ "main": "index.d.ts", "types": "index.d.ts", "scripts": { - "lint": "tslint index.d.ts" + "lint": "tslint index.d.ts", + "build": "tsc && copyfiles -u 1 './lib/**/*' ./scripts", + "clean": "shx rm -rf scripts" }, "repository": { "type": "git", @@ -21,7 +23,10 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/web3-typescript-typings#readme", "devDependencies": { + "@0xproject/monorepo-scripts": "^0.1.12", "@types/bignumber.js": "^4.0.2", + "copyfiles": "^1.2.0", + "shx": "^0.2.2", "tslint": "5.8.0", "tslint-config-0xproject": "^0.0.2", "typescript": "2.7.1" diff --git a/packages/web3-typescript-typings/scripts/postpublish.js b/packages/web3-typescript-typings/scripts/postpublish.js deleted file mode 100644 index b3e5407c81..0000000000 --- a/packages/web3-typescript-typings/scripts/postpublish.js +++ /dev/null @@ -1,5 +0,0 @@ -const postpublish_utils = require('../../../scripts/postpublish_utils'); -const packageJSON = require('../package.json'); - -const subPackageName = packageJSON.name; -postpublish_utils.standardPostPublishAsync(subPackageName); \ No newline at end of file diff --git a/packages/web3-typescript-typings/tsconfig.json b/packages/web3-typescript-typings/tsconfig.json new file mode 100644 index 0000000000..2599d1b7c6 --- /dev/null +++ b/packages/web3-typescript-typings/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig", + "compilerOptions": { + "outDir": "lib" + }, + "include": ["./monorepo_scripts/**/*", "../../node_modules/web3-typescript-typings/index.d.ts"] +} diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json index 2b545732eb..6e569b993d 100644 --- a/packages/web3-wrapper/package.json +++ b/packages/web3-wrapper/package.json @@ -6,8 +6,8 @@ "types": "lib/index.d.ts", "scripts": { "build:watch": "tsc -w", - "build": "tsc", - "clean": "shx rm -rf lib", + "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts", + "clean": "shx rm -rf lib scripts", "lint": "tslint --project . 'src/**/*.ts'" }, "license": "Apache-2.0", @@ -20,8 +20,10 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/web3-wrapper/README.md", "devDependencies": { + "@0xproject/monorepo-scripts": "^0.1.12", "@0xproject/tslint-config": "^0.4.10", "@types/lodash": "^4.14.86", + "copyfiles": "^1.2.0", "npm-run-all": "^4.1.2", "shx": "^0.2.2", "tslint": "5.8.0", diff --git a/packages/web3-wrapper/scripts/postpublish.js b/packages/web3-wrapper/scripts/postpublish.js deleted file mode 100644 index b3e5407c81..0000000000 --- a/packages/web3-wrapper/scripts/postpublish.js +++ /dev/null @@ -1,5 +0,0 @@ -const postpublish_utils = require('../../../scripts/postpublish_utils'); -const packageJSON = require('../package.json'); - -const subPackageName = packageJSON.name; -postpublish_utils.standardPostPublishAsync(subPackageName); \ No newline at end of file diff --git a/packages/web3-wrapper/src/globals.d.ts b/packages/web3-wrapper/src/globals.d.ts new file mode 100644 index 0000000000..94e63a32de --- /dev/null +++ b/packages/web3-wrapper/src/globals.d.ts @@ -0,0 +1,6 @@ +declare module '*.json' { + const json: any; + /* tslint:disable */ + export default json; + /* tslint:enable */ +} diff --git a/packages/web3-wrapper/src/monorepo_scripts/postpublish.ts b/packages/web3-wrapper/src/monorepo_scripts/postpublish.ts new file mode 100644 index 0000000000..d5fcff9d00 --- /dev/null +++ b/packages/web3-wrapper/src/monorepo_scripts/postpublish.ts @@ -0,0 +1,6 @@ +import { postpublishUtils } from '@0xproject/monorepo-scripts'; + +import * as packageJSON from '../package.json'; + +const subPackageName = (packageJSON as any).name; +postpublishUtils.standardPostPublishAsync(subPackageName); From c3b4359e8751a9c98a6081659a364fc29e69653d Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 13 Mar 2018 16:36:05 +0100 Subject: [PATCH 10/22] small fixes --- packages/dev-utils/src/index.ts | 1 - packages/dev-utils/src/monorepo_scripts/postpublish.ts | 2 +- packages/monorepo-scripts/package.json | 3 ++- packages/monorepo-scripts/tslint.json | 3 --- packages/react-docs-example/ts/globals.d.ts | 6 ++++++ packages/react-shared/tsconfig.json | 2 +- 6 files changed, 10 insertions(+), 7 deletions(-) delete mode 100644 packages/monorepo-scripts/tslint.json create mode 100644 packages/react-docs-example/ts/globals.d.ts diff --git a/packages/dev-utils/src/index.ts b/packages/dev-utils/src/index.ts index cc3e668a10..e899ac2069 100644 --- a/packages/dev-utils/src/index.ts +++ b/packages/dev-utils/src/index.ts @@ -2,4 +2,3 @@ export { RPC } from './rpc'; export { BlockchainLifecycle } from './blockchain_lifecycle'; export { web3Factory } from './web3_factory'; export { constants as devConstants } from './constants'; -export { postpublishUtils } from './postpublish_utils'; diff --git a/packages/dev-utils/src/monorepo_scripts/postpublish.ts b/packages/dev-utils/src/monorepo_scripts/postpublish.ts index 6bd94e71d7..d5fcff9d00 100644 --- a/packages/dev-utils/src/monorepo_scripts/postpublish.ts +++ b/packages/dev-utils/src/monorepo_scripts/postpublish.ts @@ -1,4 +1,4 @@ -import { postpublishUtils } from '../postpublish_utils'; +import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; diff --git a/packages/monorepo-scripts/package.json b/packages/monorepo-scripts/package.json index 09a632c077..42b9d6c55d 100644 --- a/packages/monorepo-scripts/package.json +++ b/packages/monorepo-scripts/package.json @@ -2,6 +2,8 @@ "name": "@0xproject/monorepo-scripts", "version": "0.1.12", "description": "Helper scripts for the monorepo", + "main": "lib/index.js", + "types": "lib/index.d.ts", "scripts": { "build:watch": "tsc -w", "deps_versions": "node ./lib/deps_versions.js", @@ -19,7 +21,6 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/monorepo-scripts/README.md", "devDependencies": { - "@0xproject/tslint-config": "^0.4.10", "@types/glob": "^5.0.33", "@types/node": "^8.0.53", "shx": "^0.2.2", diff --git a/packages/monorepo-scripts/tslint.json b/packages/monorepo-scripts/tslint.json deleted file mode 100644 index ffaefe83a6..0000000000 --- a/packages/monorepo-scripts/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": ["@0xproject/tslint-config"] -} diff --git a/packages/react-docs-example/ts/globals.d.ts b/packages/react-docs-example/ts/globals.d.ts new file mode 100644 index 0000000000..94e63a32de --- /dev/null +++ b/packages/react-docs-example/ts/globals.d.ts @@ -0,0 +1,6 @@ +declare module '*.json' { + const json: any; + /* tslint:disable */ + export default json; + /* tslint:enable */ +} diff --git a/packages/react-shared/tsconfig.json b/packages/react-shared/tsconfig.json index de87aa45bf..687bd1f4e6 100644 --- a/packages/react-shared/tsconfig.json +++ b/packages/react-shared/tsconfig.json @@ -8,5 +8,5 @@ "*": ["node_modules/@types/*", "*"] } }, - "include": ["./src/ts/**/*"] + "include": ["./src/**/*"] } From 67fbffc964a12c56c06e3262c9afdb1d2d01559c Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 13 Mar 2018 16:55:35 +0100 Subject: [PATCH 11/22] Re-add linter to monorepo-scripts but with tslint-config dep at earlier version to avoid cyclical dependency --- packages/monorepo-scripts/package.json | 2 ++ packages/monorepo-scripts/tslint.json | 3 +++ yarn.lock | 7 +++++++ 3 files changed, 12 insertions(+) create mode 100644 packages/monorepo-scripts/tslint.json diff --git a/packages/monorepo-scripts/package.json b/packages/monorepo-scripts/package.json index 42b9d6c55d..e0ca3cd1f0 100644 --- a/packages/monorepo-scripts/package.json +++ b/packages/monorepo-scripts/package.json @@ -20,7 +20,9 @@ "url": "https://github.com/0xProject/0x-monorepo/issues" }, "homepage": "https://github.com/0xProject/0x-monorepo/packages/monorepo-scripts/README.md", + "comment": "// We purposefully use an older version of tslint-config here to avoid creating an import cycle", "devDependencies": { + "@0xproject/tslint-config": "0.4.8", "@types/glob": "^5.0.33", "@types/node": "^8.0.53", "shx": "^0.2.2", diff --git a/packages/monorepo-scripts/tslint.json b/packages/monorepo-scripts/tslint.json new file mode 100644 index 0000000000..ffaefe83a6 --- /dev/null +++ b/packages/monorepo-scripts/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": ["@0xproject/tslint-config"] +} diff --git a/yarn.lock b/yarn.lock index 88532729be..821a22f10f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6,6 +6,13 @@ version "0.3.9" resolved "https://registry.yarnpkg.com/8fold-marked/-/8fold-marked-0.3.9.tgz#bb89c645612f8ccfaffac1ca6e3c11f168c9cf59" +"@0xproject/tslint-config@0.4.8": + version "0.4.8" + resolved "https://registry.yarnpkg.com/@0xproject/tslint-config/-/tslint-config-0.4.8.tgz#5a3dfb1fc94e17752184137b452c5b0b3287d822" + dependencies: + lodash "^4.17.4" + tslint-react "^3.2.0" + "@ledgerhq/hw-app-eth@^4.3.0": version "4.3.0" resolved "https://registry.yarnpkg.com/@ledgerhq/hw-app-eth/-/hw-app-eth-4.3.0.tgz#5f365a3560cd78e8cd711737ec56249390cbf5e5" From a2e848a7fafbae4df51de6f05fd53a6abf78a593 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 13 Mar 2018 16:55:50 +0100 Subject: [PATCH 12/22] Fix lint issues --- packages/abi-gen/src/monorepo_scripts/postpublish.ts | 1 + packages/assert/src/monorepo_scripts/postpublish.ts | 1 + packages/base-contract/src/monorepo_scripts/postpublish.ts | 1 + .../monorepo_scripts/postpublish.ts | 1 + .../chai-typescript-typings/monorepo_scripts/postpublish.ts | 1 + packages/deployer/src/monorepo_scripts/postpublish.ts | 1 + packages/dev-utils/src/monorepo_scripts/postpublish.ts | 1 + .../monorepo_scripts/postpublish.ts | 1 + packages/json-schemas/src/monorepo_scripts/postpublish.ts | 1 + packages/monorepo-scripts/src/postpublish_utils.ts | 6 +++--- packages/react-docs/src/monorepo_scripts/postpublish.ts | 1 + packages/react-shared/src/monorepo_scripts/postpublish.ts | 1 + packages/sra-report/src/monorepo_scripts/postpublish.ts | 1 + packages/subproviders/src/monorepo_scripts/postpublish.ts | 1 + packages/tslint-config/monorepo_scripts/postpublish.ts | 1 + packages/types/src/monorepo_scripts/postpublish.ts | 1 + packages/utils/src/monorepo_scripts/postpublish.ts | 1 + .../web3-typescript-typings/monorepo_scripts/postpublish.ts | 1 + packages/web3-wrapper/src/monorepo_scripts/postpublish.ts | 1 + 19 files changed, 21 insertions(+), 3 deletions(-) diff --git a/packages/abi-gen/src/monorepo_scripts/postpublish.ts b/packages/abi-gen/src/monorepo_scripts/postpublish.ts index d5fcff9d00..6e5aa050a3 100644 --- a/packages/abi-gen/src/monorepo_scripts/postpublish.ts +++ b/packages/abi-gen/src/monorepo_scripts/postpublish.ts @@ -3,4 +3,5 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; const subPackageName = (packageJSON as any).name; +// tslint:disable-next-line:no-floating-promises postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/assert/src/monorepo_scripts/postpublish.ts b/packages/assert/src/monorepo_scripts/postpublish.ts index d5fcff9d00..6e5aa050a3 100644 --- a/packages/assert/src/monorepo_scripts/postpublish.ts +++ b/packages/assert/src/monorepo_scripts/postpublish.ts @@ -3,4 +3,5 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; const subPackageName = (packageJSON as any).name; +// tslint:disable-next-line:no-floating-promises postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/base-contract/src/monorepo_scripts/postpublish.ts b/packages/base-contract/src/monorepo_scripts/postpublish.ts index d5fcff9d00..6e5aa050a3 100644 --- a/packages/base-contract/src/monorepo_scripts/postpublish.ts +++ b/packages/base-contract/src/monorepo_scripts/postpublish.ts @@ -3,4 +3,5 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; const subPackageName = (packageJSON as any).name; +// tslint:disable-next-line:no-floating-promises postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/chai-as-promised-typescript-typings/monorepo_scripts/postpublish.ts b/packages/chai-as-promised-typescript-typings/monorepo_scripts/postpublish.ts index d5fcff9d00..6e5aa050a3 100644 --- a/packages/chai-as-promised-typescript-typings/monorepo_scripts/postpublish.ts +++ b/packages/chai-as-promised-typescript-typings/monorepo_scripts/postpublish.ts @@ -3,4 +3,5 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; const subPackageName = (packageJSON as any).name; +// tslint:disable-next-line:no-floating-promises postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/chai-typescript-typings/monorepo_scripts/postpublish.ts b/packages/chai-typescript-typings/monorepo_scripts/postpublish.ts index d5fcff9d00..6e5aa050a3 100644 --- a/packages/chai-typescript-typings/monorepo_scripts/postpublish.ts +++ b/packages/chai-typescript-typings/monorepo_scripts/postpublish.ts @@ -3,4 +3,5 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; const subPackageName = (packageJSON as any).name; +// tslint:disable-next-line:no-floating-promises postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/deployer/src/monorepo_scripts/postpublish.ts b/packages/deployer/src/monorepo_scripts/postpublish.ts index d5fcff9d00..6e5aa050a3 100644 --- a/packages/deployer/src/monorepo_scripts/postpublish.ts +++ b/packages/deployer/src/monorepo_scripts/postpublish.ts @@ -3,4 +3,5 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; const subPackageName = (packageJSON as any).name; +// tslint:disable-next-line:no-floating-promises postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/dev-utils/src/monorepo_scripts/postpublish.ts b/packages/dev-utils/src/monorepo_scripts/postpublish.ts index d5fcff9d00..6e5aa050a3 100644 --- a/packages/dev-utils/src/monorepo_scripts/postpublish.ts +++ b/packages/dev-utils/src/monorepo_scripts/postpublish.ts @@ -3,4 +3,5 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; const subPackageName = (packageJSON as any).name; +// tslint:disable-next-line:no-floating-promises postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/ethers-typescript-typings/monorepo_scripts/postpublish.ts b/packages/ethers-typescript-typings/monorepo_scripts/postpublish.ts index d5fcff9d00..6e5aa050a3 100644 --- a/packages/ethers-typescript-typings/monorepo_scripts/postpublish.ts +++ b/packages/ethers-typescript-typings/monorepo_scripts/postpublish.ts @@ -3,4 +3,5 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; const subPackageName = (packageJSON as any).name; +// tslint:disable-next-line:no-floating-promises postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/json-schemas/src/monorepo_scripts/postpublish.ts b/packages/json-schemas/src/monorepo_scripts/postpublish.ts index d5fcff9d00..6e5aa050a3 100644 --- a/packages/json-schemas/src/monorepo_scripts/postpublish.ts +++ b/packages/json-schemas/src/monorepo_scripts/postpublish.ts @@ -3,4 +3,5 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; const subPackageName = (packageJSON as any).name; +// tslint:disable-next-line:no-floating-promises postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/monorepo-scripts/src/postpublish_utils.ts b/packages/monorepo-scripts/src/postpublish_utils.ts index 2f27e15cb8..e04c316490 100644 --- a/packages/monorepo-scripts/src/postpublish_utils.ts +++ b/packages/monorepo-scripts/src/postpublish_utils.ts @@ -1,5 +1,5 @@ -import * as promisify from 'es6-promisify'; import { execAsync } from 'async-child-process'; +import * as promisify from 'es6-promisify'; import * as _ from 'lodash'; import * as publishRelease from 'publish-release'; import semverSort = require('semver-sort'); @@ -16,7 +16,7 @@ export interface TagAndVersion { } export const postpublishUtils = { - getLatestTagAndVersionAsync(subPackageName: string): Promise { + async getLatestTagAndVersionAsync(subPackageName: string): Promise { const subPackagePrefix = `${subPackageName}@`; const gitTagsCommand = `git tag -l "${subPackagePrefix}*"`; return execAsync(gitTagsCommand).then((result: any) => { @@ -36,7 +36,7 @@ export const postpublishUtils = { }; }); }, - publishReleaseNotesAsync(tag: string, releaseName: string, assets: string[]) { + async publishReleaseNotesAsync(tag: string, releaseName: string, assets: string[]) { utils.log('POSTPUBLISH: Releasing ', releaseName, '...'); return publishReleaseAsync({ token: githubPersonalAccessToken, diff --git a/packages/react-docs/src/monorepo_scripts/postpublish.ts b/packages/react-docs/src/monorepo_scripts/postpublish.ts index d5fcff9d00..6e5aa050a3 100644 --- a/packages/react-docs/src/monorepo_scripts/postpublish.ts +++ b/packages/react-docs/src/monorepo_scripts/postpublish.ts @@ -3,4 +3,5 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; const subPackageName = (packageJSON as any).name; +// tslint:disable-next-line:no-floating-promises postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/react-shared/src/monorepo_scripts/postpublish.ts b/packages/react-shared/src/monorepo_scripts/postpublish.ts index d5fcff9d00..6e5aa050a3 100644 --- a/packages/react-shared/src/monorepo_scripts/postpublish.ts +++ b/packages/react-shared/src/monorepo_scripts/postpublish.ts @@ -3,4 +3,5 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; const subPackageName = (packageJSON as any).name; +// tslint:disable-next-line:no-floating-promises postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/sra-report/src/monorepo_scripts/postpublish.ts b/packages/sra-report/src/monorepo_scripts/postpublish.ts index d5fcff9d00..6e5aa050a3 100644 --- a/packages/sra-report/src/monorepo_scripts/postpublish.ts +++ b/packages/sra-report/src/monorepo_scripts/postpublish.ts @@ -3,4 +3,5 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; const subPackageName = (packageJSON as any).name; +// tslint:disable-next-line:no-floating-promises postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/subproviders/src/monorepo_scripts/postpublish.ts b/packages/subproviders/src/monorepo_scripts/postpublish.ts index d5fcff9d00..6e5aa050a3 100644 --- a/packages/subproviders/src/monorepo_scripts/postpublish.ts +++ b/packages/subproviders/src/monorepo_scripts/postpublish.ts @@ -3,4 +3,5 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; const subPackageName = (packageJSON as any).name; +// tslint:disable-next-line:no-floating-promises postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/tslint-config/monorepo_scripts/postpublish.ts b/packages/tslint-config/monorepo_scripts/postpublish.ts index d5fcff9d00..6e5aa050a3 100644 --- a/packages/tslint-config/monorepo_scripts/postpublish.ts +++ b/packages/tslint-config/monorepo_scripts/postpublish.ts @@ -3,4 +3,5 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; const subPackageName = (packageJSON as any).name; +// tslint:disable-next-line:no-floating-promises postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/types/src/monorepo_scripts/postpublish.ts b/packages/types/src/monorepo_scripts/postpublish.ts index d5fcff9d00..6e5aa050a3 100644 --- a/packages/types/src/monorepo_scripts/postpublish.ts +++ b/packages/types/src/monorepo_scripts/postpublish.ts @@ -3,4 +3,5 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; const subPackageName = (packageJSON as any).name; +// tslint:disable-next-line:no-floating-promises postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/utils/src/monorepo_scripts/postpublish.ts b/packages/utils/src/monorepo_scripts/postpublish.ts index d5fcff9d00..6e5aa050a3 100644 --- a/packages/utils/src/monorepo_scripts/postpublish.ts +++ b/packages/utils/src/monorepo_scripts/postpublish.ts @@ -3,4 +3,5 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; const subPackageName = (packageJSON as any).name; +// tslint:disable-next-line:no-floating-promises postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/web3-typescript-typings/monorepo_scripts/postpublish.ts b/packages/web3-typescript-typings/monorepo_scripts/postpublish.ts index d5fcff9d00..6e5aa050a3 100644 --- a/packages/web3-typescript-typings/monorepo_scripts/postpublish.ts +++ b/packages/web3-typescript-typings/monorepo_scripts/postpublish.ts @@ -3,4 +3,5 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; const subPackageName = (packageJSON as any).name; +// tslint:disable-next-line:no-floating-promises postpublishUtils.standardPostPublishAsync(subPackageName); diff --git a/packages/web3-wrapper/src/monorepo_scripts/postpublish.ts b/packages/web3-wrapper/src/monorepo_scripts/postpublish.ts index d5fcff9d00..6e5aa050a3 100644 --- a/packages/web3-wrapper/src/monorepo_scripts/postpublish.ts +++ b/packages/web3-wrapper/src/monorepo_scripts/postpublish.ts @@ -3,4 +3,5 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; const subPackageName = (packageJSON as any).name; +// tslint:disable-next-line:no-floating-promises postpublishUtils.standardPostPublishAsync(subPackageName); From e1fa65f5ef8f34482381911f51e7d713345005c7 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 13 Mar 2018 17:04:14 +0100 Subject: [PATCH 13/22] remove unused dep --- packages/abi-gen/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/abi-gen/package.json b/packages/abi-gen/package.json index ffae67e22b..9e0e536309 100644 --- a/packages/abi-gen/package.json +++ b/packages/abi-gen/package.json @@ -36,7 +36,6 @@ "devDependencies": { "@0xproject/monorepo-scripts": "^0.1.12", "@0xproject/tslint-config": "^0.4.10", - "@0xproject/dev-utils": "^0.2.1", "@types/glob": "^5.0.33", "@types/handlebars": "^4.0.36", "@types/mkdirp": "^0.5.1", From b3c1c0ccadff32bbe962588733222fccc121d10e Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 13 Mar 2018 17:04:31 +0100 Subject: [PATCH 14/22] remove unneeded include --- packages/chai-as-promised-typescript-typings/tsconfig.json | 2 +- packages/chai-typescript-typings/tsconfig.json | 2 +- packages/ethers-typescript-typings/tsconfig.json | 2 +- packages/web3-typescript-typings/tsconfig.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/chai-as-promised-typescript-typings/tsconfig.json b/packages/chai-as-promised-typescript-typings/tsconfig.json index 2599d1b7c6..bc453af4ba 100644 --- a/packages/chai-as-promised-typescript-typings/tsconfig.json +++ b/packages/chai-as-promised-typescript-typings/tsconfig.json @@ -3,5 +3,5 @@ "compilerOptions": { "outDir": "lib" }, - "include": ["./monorepo_scripts/**/*", "../../node_modules/web3-typescript-typings/index.d.ts"] + "include": ["./monorepo_scripts/**/*"] } diff --git a/packages/chai-typescript-typings/tsconfig.json b/packages/chai-typescript-typings/tsconfig.json index 2599d1b7c6..bc453af4ba 100644 --- a/packages/chai-typescript-typings/tsconfig.json +++ b/packages/chai-typescript-typings/tsconfig.json @@ -3,5 +3,5 @@ "compilerOptions": { "outDir": "lib" }, - "include": ["./monorepo_scripts/**/*", "../../node_modules/web3-typescript-typings/index.d.ts"] + "include": ["./monorepo_scripts/**/*"] } diff --git a/packages/ethers-typescript-typings/tsconfig.json b/packages/ethers-typescript-typings/tsconfig.json index 2599d1b7c6..bc453af4ba 100644 --- a/packages/ethers-typescript-typings/tsconfig.json +++ b/packages/ethers-typescript-typings/tsconfig.json @@ -3,5 +3,5 @@ "compilerOptions": { "outDir": "lib" }, - "include": ["./monorepo_scripts/**/*", "../../node_modules/web3-typescript-typings/index.d.ts"] + "include": ["./monorepo_scripts/**/*"] } diff --git a/packages/web3-typescript-typings/tsconfig.json b/packages/web3-typescript-typings/tsconfig.json index 2599d1b7c6..bc453af4ba 100644 --- a/packages/web3-typescript-typings/tsconfig.json +++ b/packages/web3-typescript-typings/tsconfig.json @@ -3,5 +3,5 @@ "compilerOptions": { "outDir": "lib" }, - "include": ["./monorepo_scripts/**/*", "../../node_modules/web3-typescript-typings/index.d.ts"] + "include": ["./monorepo_scripts/**/*"] } From a08ae722c112e3bbd257bcf1606e3cf962266eae Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 13 Mar 2018 17:04:38 +0100 Subject: [PATCH 15/22] Move changelog entry --- packages/dev-utils/CHANGELOG.md | 4 ---- packages/monorepo-scripts/CHANGELOG.md | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 packages/monorepo-scripts/CHANGELOG.md diff --git a/packages/dev-utils/CHANGELOG.md b/packages/dev-utils/CHANGELOG.md index 6840a6a692..ecc5546ae6 100644 --- a/packages/dev-utils/CHANGELOG.md +++ b/packages/dev-utils/CHANGELOG.md @@ -1,9 +1,5 @@ # CHANGELOG -## v0.2.1 - _TBD_ - - * Add postpublish utils - ## v0.2.0 - _February 16, 2018_ * Remove subproviders (#392) diff --git a/packages/monorepo-scripts/CHANGELOG.md b/packages/monorepo-scripts/CHANGELOG.md new file mode 100644 index 0000000000..bb685a436a --- /dev/null +++ b/packages/monorepo-scripts/CHANGELOG.md @@ -0,0 +1,5 @@ +CHANGELOG + +## v0.1.13 - _TBD_ + + * Add postpublish utils From ee29ed26ff1d754fa13576840c08267b8b5707ba Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 13 Mar 2018 17:36:12 +0100 Subject: [PATCH 16/22] Use async/await instead of promise syntax --- .../monorepo-scripts/src/postpublish_utils.ts | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/packages/monorepo-scripts/src/postpublish_utils.ts b/packages/monorepo-scripts/src/postpublish_utils.ts index e04c316490..6c8771c6f6 100644 --- a/packages/monorepo-scripts/src/postpublish_utils.ts +++ b/packages/monorepo-scripts/src/postpublish_utils.ts @@ -19,22 +19,21 @@ export const postpublishUtils = { async getLatestTagAndVersionAsync(subPackageName: string): Promise { const subPackagePrefix = `${subPackageName}@`; const gitTagsCommand = `git tag -l "${subPackagePrefix}*"`; - return execAsync(gitTagsCommand).then((result: any) => { - if (!_.isEmpty(result.stderr)) { - throw new Error(result.stderr); - } - const tags = result.stdout.trim().split('\n'); - const versions = tags.map((tag: string) => { - return tag.slice(subPackagePrefix.length); - }); - const sortedVersions = semverSort.desc(versions); - const latestVersion = sortedVersions[0]; - const latestTag = subPackagePrefix + latestVersion; - return { - tag: latestTag, - version: latestVersion, - }; + const result = await execAsync(gitTagsCommand); + if (!_.isEmpty(result.stderr)) { + throw new Error(result.stderr); + } + const tags = result.stdout.trim().split('\n'); + const versions = tags.map((tag: string) => { + return tag.slice(subPackagePrefix.length); }); + const sortedVersions = semverSort.desc(versions); + const latestVersion = sortedVersions[0]; + const latestTag = subPackagePrefix + latestVersion; + return { + tag: latestTag, + version: latestVersion, + }; }, async publishReleaseNotesAsync(tag: string, releaseName: string, assets: string[]) { utils.log('POSTPUBLISH: Releasing ', releaseName, '...'); From dba1b8a7e92ebd18132e0e714d5109f87b9ab7a9 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 13 Mar 2018 17:55:16 +0100 Subject: [PATCH 17/22] Consolidate docs generation and uploading logic --- .../0x.js/src/monorepo_scripts/postpublish.ts | 17 +----------- .../0x.js/src/monorepo_scripts/stagedocs.ts | 15 ++--------- .../src/monorepo_scripts/postpublish.ts | 17 +----------- .../connect/src/monorepo_scripts/stagedocs.ts | 14 ++-------- .../monorepo-scripts/src/postpublish_utils.ts | 26 +++++++++++++++++++ 5 files changed, 32 insertions(+), 57 deletions(-) diff --git a/packages/0x.js/src/monorepo_scripts/postpublish.ts b/packages/0x.js/src/monorepo_scripts/postpublish.ts index 8e2692c93c..88be6444f8 100644 --- a/packages/0x.js/src/monorepo_scripts/postpublish.ts +++ b/packages/0x.js/src/monorepo_scripts/postpublish.ts @@ -12,7 +12,6 @@ const subPackageName = (packageJSON as any).name; // So far, we only have @0xproject/types as part of 0x.js's public interface. const fileIncludes = [...(tsConfig as any).include, '../types/src/index.ts']; const fileIncludesAdjusted = postpublishUtils.adjustFileIncludePaths(fileIncludes, __dirname); -const projectFiles = fileIncludesAdjusted.join(' '); const S3BucketPath = 's3://0xjs-docs-jsons/'; (async () => { @@ -26,19 +25,5 @@ const S3BucketPath = 's3://0xjs-docs-jsons/'; // tslint:disable-next-line:no-console console.log('POSTPUBLISH: Release successful, generating docs...'); - const jsonFilePath = `${__dirname}/../${postpublishUtils.generatedDocsDirectoryName}/index.json`; - - const result = await execAsync(`JSON_FILE_PATH=${jsonFilePath} PROJECT_FILES="${projectFiles}" yarn docs:json`, { - cwd, - }); - if (!_.isEmpty(result.stderr)) { - throw new Error(result.stderr); - } - const fileName = `v${version}.json`; - // tslint:disable-next-line:no-console - console.log(`POSTPUBLISH: Doc generation successful, uploading docs... as ${fileName}`); - const s3Url = S3BucketPath + fileName; - return execAsync(`S3_URL=${s3Url} yarn upload_docs_json`, { - cwd, - }); + await postpublishUtils.generateAndUploadDocsAsync(__dirname, cwd, fileIncludesAdjusted, version, S3BucketPath); })().catch(console.error); diff --git a/packages/0x.js/src/monorepo_scripts/stagedocs.ts b/packages/0x.js/src/monorepo_scripts/stagedocs.ts index 20355c52c6..525d6a96fb 100644 --- a/packages/0x.js/src/monorepo_scripts/stagedocs.ts +++ b/packages/0x.js/src/monorepo_scripts/stagedocs.ts @@ -11,20 +11,9 @@ const S3BucketPath = 's3://staging-0xjs-docs-jsons/'; // So far, we only have @0xproject/types as part of 0x.js's public interface. const fileIncludes = [...(tsConfig as any).include, '../types/src/index.ts']; const fileIncludesAdjusted = postpublishUtils.adjustFileIncludePaths(fileIncludes, __dirname); -const projectFiles = fileIncludesAdjusted.join(' '); const jsonFilePath = `${__dirname}/../${postpublishUtils.generatedDocsDirectoryName}/index.json`; -const version = process.env.DOCS_VERSION; +const version = process.env.DOCS_VERSION || '0.0.0'; (async () => { - const result = await execAsync(`JSON_FILE_PATH=${jsonFilePath} PROJECT_FILES="${projectFiles}" yarn docs:json`, { - cwd, - }); - if (!_.isEmpty(result.stderr)) { - throw new Error(result.stderr); - } - const fileName = `v${version}.json`; - const s3Url = S3BucketPath + fileName; - return execAsync(`S3_URL=${s3Url} yarn upload_docs_json`, { - cwd, - }); + await postpublishUtils.generateAndUploadDocsAsync(__dirname, cwd, fileIncludesAdjusted, version, S3BucketPath); })().catch(console.error); diff --git a/packages/connect/src/monorepo_scripts/postpublish.ts b/packages/connect/src/monorepo_scripts/postpublish.ts index 4cb8bf071d..ecbd268722 100644 --- a/packages/connect/src/monorepo_scripts/postpublish.ts +++ b/packages/connect/src/monorepo_scripts/postpublish.ts @@ -11,7 +11,6 @@ const subPackageName = (packageJSON as any).name; // to this array so that TypeDoc picks it up and adds it to the Docs JSON const fileIncludes = [...(tsConfig as any).include]; const fileIncludesAdjusted = postpublishUtils.adjustFileIncludePaths(fileIncludes, __dirname); -const projectFiles = fileIncludesAdjusted.join(' '); const S3BucketPath = 's3://connect-docs-jsons/'; (async () => { @@ -25,19 +24,5 @@ const S3BucketPath = 's3://connect-docs-jsons/'; // tslint:disable-next-line:no-console console.log('POSTPUBLISH: Release successful, generating docs...'); - const jsonFilePath = `${__dirname}/../${postpublishUtils.generatedDocsDirectoryName}/index.json`; - - const result = await execAsync(`JSON_FILE_PATH=${jsonFilePath} PROJECT_FILES="${projectFiles}" yarn docs:json`, { - cwd, - }); - if (!_.isEmpty(result.stderr)) { - throw new Error(result.stderr); - } - const fileName = `v${version}.json`; - // tslint:disable-next-line:no-console - console.log(`POSTPUBLISH: Doc generation successful, uploading docs... as ${fileName}`); - const s3Url = S3BucketPath + fileName; - return execAsync(`S3_URL=${s3Url} yarn upload_docs_json`, { - cwd, - }); + await postpublishUtils.generateAndUploadDocsAsync(__dirname, cwd, fileIncludesAdjusted, version, S3BucketPath); })().catch(console.error); diff --git a/packages/connect/src/monorepo_scripts/stagedocs.ts b/packages/connect/src/monorepo_scripts/stagedocs.ts index ae0383ed7b..efd3ad62d3 100644 --- a/packages/connect/src/monorepo_scripts/stagedocs.ts +++ b/packages/connect/src/monorepo_scripts/stagedocs.ts @@ -12,18 +12,8 @@ const fileIncludes = [...(tsConfig as any).include]; const fileIncludesAdjusted = postpublishUtils.adjustFileIncludePaths(fileIncludes, __dirname); const projectFiles = fileIncludesAdjusted.join(' '); const jsonFilePath = `${__dirname}/../${postpublishUtils.generatedDocsDirectoryName}/index.json`; -const version = process.env.DOCS_VERSION; +const version = process.env.DOCS_VERSION || '0.0.0'; (async () => { - const result = await execAsync(`JSON_FILE_PATH=${jsonFilePath} PROJECT_FILES="${projectFiles}" yarn docs:json`, { - cwd, - }); - if (!_.isEmpty(result.stderr)) { - throw new Error(result.stderr); - } - const fileName = `v${version}.json`; - const s3Url = S3BucketPath + fileName; - return execAsync(`S3_URL=${s3Url} yarn upload_docs_json`, { - cwd, - }); + await postpublishUtils.generateAndUploadDocsAsync(__dirname, cwd, fileIncludesAdjusted, version, S3BucketPath); })().catch(console.error); diff --git a/packages/monorepo-scripts/src/postpublish_utils.ts b/packages/monorepo-scripts/src/postpublish_utils.ts index 6c8771c6f6..a36408ccd5 100644 --- a/packages/monorepo-scripts/src/postpublish_utils.ts +++ b/packages/monorepo-scripts/src/postpublish_utils.ts @@ -81,5 +81,31 @@ export const postpublishUtils = { }); return fileIncludesAdjusted; }, + async generateAndUploadDocsAsync( + dirname: string, + cwd: string, + includedFiles: string[], + version: string, + S3BucketPath: string, + ) { + const jsonFilePath = `${dirname}/../${postpublishUtils.generatedDocsDirectoryName}/index.json`; + const projectFiles = includedFiles.join(' '); + const result = await execAsync( + `JSON_FILE_PATH=${jsonFilePath} PROJECT_FILES="${projectFiles}" yarn docs:json`, + { + cwd, + }, + ); + if (!_.isEmpty(result.stderr)) { + throw new Error(result.stderr); + } + const fileName = `v${version}.json`; + utils.log(`POSTPUBLISH: Doc generation successful, uploading docs... as ${fileName}`); + const s3Url = S3BucketPath + fileName; + await execAsync(`S3_URL=${s3Url} yarn upload_docs_json`, { + cwd, + }); + utils.log(`POSTPUBLISH: Docs uploaded to S3 bucket: ${S3BucketPath}`); + }, generatedDocsDirectoryName, }; From f7c1e10b5ac112866ee55e7fededdb37c890d30f Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 14 Mar 2018 14:07:24 +0100 Subject: [PATCH 18/22] Move configuration into package.json configs section --- packages/0x.js/package.json | 11 +- packages/0x.js/src/globals.d.ts | 1 - .../0x.js/src/monorepo_scripts/postpublish.ts | 27 +--- .../0x.js/src/monorepo_scripts/stagedocs.ts | 21 +-- .../src/monorepo_scripts/postpublish.ts | 5 +- .../src/monorepo_scripts/postpublish.ts | 5 +- .../src/monorepo_scripts/postpublish.ts | 5 +- .../monorepo_scripts/postpublish.ts | 5 +- .../monorepo_scripts/postpublish.ts | 5 +- packages/connect/package.json | 9 ++ .../src/monorepo_scripts/postpublish.ts | 26 +--- .../connect/src/monorepo_scripts/stagedocs.ts | 21 +-- .../src/monorepo_scripts/postpublish.ts | 5 +- .../src/monorepo_scripts/postpublish.ts | 5 +- .../monorepo_scripts/postpublish.ts | 5 +- .../src/monorepo_scripts/postpublish.ts | 5 +- .../monorepo-scripts/src/postpublish_utils.ts | 141 ++++++++++++------ .../src/monorepo_scripts/postpublish.ts | 5 +- .../src/monorepo_scripts/postpublish.ts | 5 +- .../src/monorepo_scripts/postpublish.ts | 5 +- .../src/monorepo_scripts/postpublish.ts | 5 +- .../monorepo_scripts/postpublish.ts | 5 +- .../types/src/monorepo_scripts/postpublish.ts | 5 +- .../utils/src/monorepo_scripts/postpublish.ts | 5 +- .../monorepo_scripts/postpublish.ts | 5 +- .../src/monorepo_scripts/postpublish.ts | 5 +- 26 files changed, 185 insertions(+), 162 deletions(-) diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index ec55bf1af2..f99029b532 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -31,7 +31,15 @@ "run_mocha": "mocha lib/test/**/*_test.js --timeout 10000 --bail --exit" }, "config": { - "artifacts": "TokenTransferProxy Exchange TokenRegistry Token EtherToken" + "artifacts": "TokenTransferProxy Exchange TokenRegistry Token EtherToken", + "postpublish": { + "assets": ["_bundles/index.js", "_bundles/index.min.js"], + "docPublishConfigs": { + "extraFileIncludes": ["../types/src/index.ts"], + "s3BucketPath": "s3://0xjs-docs-jsons/", + "s3StagingBucketPath": "s3://staging-0xjs-docs-jsons/" + } + } }, "repository": { "type": "git", @@ -53,7 +61,6 @@ "@types/node": "^8.0.53", "@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", diff --git a/packages/0x.js/src/globals.d.ts b/packages/0x.js/src/globals.d.ts index f37ac7cb02..e2c321f38b 100644 --- a/packages/0x.js/src/globals.d.ts +++ b/packages/0x.js/src/globals.d.ts @@ -4,7 +4,6 @@ declare module 'dirty-chai'; declare module 'request-promise-native'; declare module 'web3-provider-engine'; declare module 'web3-provider-engine/subproviders/rpc'; -declare module 'async-child-process'; declare module 'publish-release'; // semver-sort declarations diff --git a/packages/0x.js/src/monorepo_scripts/postpublish.ts b/packages/0x.js/src/monorepo_scripts/postpublish.ts index 88be6444f8..dcb99d0f76 100644 --- a/packages/0x.js/src/monorepo_scripts/postpublish.ts +++ b/packages/0x.js/src/monorepo_scripts/postpublish.ts @@ -1,29 +1,8 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; -import { execAsync } from 'async-child-process'; -import * as _ from 'lodash'; import * as packageJSON from '../package.json'; -import * as tsConfig from '../tsconfig.json'; +import * as tsConfigJSON from '../tsconfig.json'; const cwd = `${__dirname}/..`; -const subPackageName = (packageJSON as any).name; -// Include any external packages that are part of the 0x.js public interface -// to this array so that TypeDoc picks it up and adds it to the Docs JSON -// So far, we only have @0xproject/types as part of 0x.js's public interface. -const fileIncludes = [...(tsConfig as any).include, '../types/src/index.ts']; -const fileIncludesAdjusted = postpublishUtils.adjustFileIncludePaths(fileIncludes, __dirname); -const S3BucketPath = 's3://0xjs-docs-jsons/'; - -(async () => { - const tagAndVersion = await postpublishUtils.getLatestTagAndVersionAsync(subPackageName); - const tag = tagAndVersion.tag; - const version = tagAndVersion.version; - - const releaseName = postpublishUtils.getReleaseName(subPackageName, version); - const assets = [`${__dirname}/../_bundles/index.js`, `${__dirname}/../_bundles/index.min.js`]; - const release = await postpublishUtils.publishReleaseNotesAsync(tag, releaseName, assets); - - // tslint:disable-next-line:no-console - console.log('POSTPUBLISH: Release successful, generating docs...'); - await postpublishUtils.generateAndUploadDocsAsync(__dirname, cwd, fileIncludesAdjusted, version, S3BucketPath); -})().catch(console.error); +// tslint:disable-next-line:no-floating-promises +postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/0x.js/src/monorepo_scripts/stagedocs.ts b/packages/0x.js/src/monorepo_scripts/stagedocs.ts index 525d6a96fb..e732ac8eb2 100644 --- a/packages/0x.js/src/monorepo_scripts/stagedocs.ts +++ b/packages/0x.js/src/monorepo_scripts/stagedocs.ts @@ -1,19 +1,8 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; -import { execAsync } from 'async-child-process'; -import * as _ from 'lodash'; -import * as tsConfig from '../tsconfig.json'; +import * as packageJSON from '../package.json'; +import * as tsConfigJSON from '../tsconfig.json'; -const cwd = __dirname + '/..'; -const S3BucketPath = 's3://staging-0xjs-docs-jsons/'; -// Include any external packages that are part of the 0x.js public interface -// to this array so that TypeDoc picks it up and adds it to the Docs JSON -// So far, we only have @0xproject/types as part of 0x.js's public interface. -const fileIncludes = [...(tsConfig as any).include, '../types/src/index.ts']; -const fileIncludesAdjusted = postpublishUtils.adjustFileIncludePaths(fileIncludes, __dirname); -const jsonFilePath = `${__dirname}/../${postpublishUtils.generatedDocsDirectoryName}/index.json`; -const version = process.env.DOCS_VERSION || '0.0.0'; - -(async () => { - await postpublishUtils.generateAndUploadDocsAsync(__dirname, cwd, fileIncludesAdjusted, version, S3BucketPath); -})().catch(console.error); +const cwd = `${__dirname}/..`; +// tslint:disable-next-line:no-floating-promises +postpublishUtils.publishDocsToStagingAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/abi-gen/src/monorepo_scripts/postpublish.ts b/packages/abi-gen/src/monorepo_scripts/postpublish.ts index 6e5aa050a3..dcb99d0f76 100644 --- a/packages/abi-gen/src/monorepo_scripts/postpublish.ts +++ b/packages/abi-gen/src/monorepo_scripts/postpublish.ts @@ -1,7 +1,8 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; +import * as tsConfigJSON from '../tsconfig.json'; -const subPackageName = (packageJSON as any).name; +const cwd = `${__dirname}/..`; // tslint:disable-next-line:no-floating-promises -postpublishUtils.standardPostPublishAsync(subPackageName); +postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/assert/src/monorepo_scripts/postpublish.ts b/packages/assert/src/monorepo_scripts/postpublish.ts index 6e5aa050a3..dcb99d0f76 100644 --- a/packages/assert/src/monorepo_scripts/postpublish.ts +++ b/packages/assert/src/monorepo_scripts/postpublish.ts @@ -1,7 +1,8 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; +import * as tsConfigJSON from '../tsconfig.json'; -const subPackageName = (packageJSON as any).name; +const cwd = `${__dirname}/..`; // tslint:disable-next-line:no-floating-promises -postpublishUtils.standardPostPublishAsync(subPackageName); +postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/base-contract/src/monorepo_scripts/postpublish.ts b/packages/base-contract/src/monorepo_scripts/postpublish.ts index 6e5aa050a3..dcb99d0f76 100644 --- a/packages/base-contract/src/monorepo_scripts/postpublish.ts +++ b/packages/base-contract/src/monorepo_scripts/postpublish.ts @@ -1,7 +1,8 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; +import * as tsConfigJSON from '../tsconfig.json'; -const subPackageName = (packageJSON as any).name; +const cwd = `${__dirname}/..`; // tslint:disable-next-line:no-floating-promises -postpublishUtils.standardPostPublishAsync(subPackageName); +postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/chai-as-promised-typescript-typings/monorepo_scripts/postpublish.ts b/packages/chai-as-promised-typescript-typings/monorepo_scripts/postpublish.ts index 6e5aa050a3..dcb99d0f76 100644 --- a/packages/chai-as-promised-typescript-typings/monorepo_scripts/postpublish.ts +++ b/packages/chai-as-promised-typescript-typings/monorepo_scripts/postpublish.ts @@ -1,7 +1,8 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; +import * as tsConfigJSON from '../tsconfig.json'; -const subPackageName = (packageJSON as any).name; +const cwd = `${__dirname}/..`; // tslint:disable-next-line:no-floating-promises -postpublishUtils.standardPostPublishAsync(subPackageName); +postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/chai-typescript-typings/monorepo_scripts/postpublish.ts b/packages/chai-typescript-typings/monorepo_scripts/postpublish.ts index 6e5aa050a3..dcb99d0f76 100644 --- a/packages/chai-typescript-typings/monorepo_scripts/postpublish.ts +++ b/packages/chai-typescript-typings/monorepo_scripts/postpublish.ts @@ -1,7 +1,8 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; +import * as tsConfigJSON from '../tsconfig.json'; -const subPackageName = (packageJSON as any).name; +const cwd = `${__dirname}/..`; // tslint:disable-next-line:no-floating-promises -postpublishUtils.standardPostPublishAsync(subPackageName); +postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/connect/package.json b/packages/connect/package.json index 0c4db7f609..8b3b24fcd2 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -23,6 +23,15 @@ "test": "run-s clean build copy_test_fixtures run_mocha", "test:circleci": "yarn test" }, + "config": { + "postpublish": { + "assets": ["_bundles/index.js", "_bundles/index.min.js"], + "docPublishConfigs": { + "s3BucketPath": "s3://connect-docs-jsons/", + "s3StagingBucketPath": "s3://staging-connect-docs-jsons/" + } + } + }, "repository": { "type": "git", "url": "https://github.com/0xProject/0x-monorepo.git" diff --git a/packages/connect/src/monorepo_scripts/postpublish.ts b/packages/connect/src/monorepo_scripts/postpublish.ts index ecbd268722..dcb99d0f76 100644 --- a/packages/connect/src/monorepo_scripts/postpublish.ts +++ b/packages/connect/src/monorepo_scripts/postpublish.ts @@ -1,28 +1,8 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; -import { execAsync } from 'async-child-process'; -import * as _ from 'lodash'; import * as packageJSON from '../package.json'; -import * as tsConfig from '../tsconfig.json'; +import * as tsConfigJSON from '../tsconfig.json'; const cwd = `${__dirname}/..`; -const subPackageName = (packageJSON as any).name; -// Include any external packages that are part of the @0xproject/connect public interface -// to this array so that TypeDoc picks it up and adds it to the Docs JSON -const fileIncludes = [...(tsConfig as any).include]; -const fileIncludesAdjusted = postpublishUtils.adjustFileIncludePaths(fileIncludes, __dirname); -const S3BucketPath = 's3://connect-docs-jsons/'; - -(async () => { - const tagAndVersion = await postpublishUtils.getLatestTagAndVersionAsync(subPackageName); - const tag = tagAndVersion.tag; - const version = tagAndVersion.version; - - const releaseName = postpublishUtils.getReleaseName(subPackageName, version); - const assets = [`${__dirname}/../_bundles/index.js`, `${__dirname}/../_bundles/index.min.js`]; - const release = await postpublishUtils.publishReleaseNotesAsync(tag, releaseName, assets); - - // tslint:disable-next-line:no-console - console.log('POSTPUBLISH: Release successful, generating docs...'); - await postpublishUtils.generateAndUploadDocsAsync(__dirname, cwd, fileIncludesAdjusted, version, S3BucketPath); -})().catch(console.error); +// tslint:disable-next-line:no-floating-promises +postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/connect/src/monorepo_scripts/stagedocs.ts b/packages/connect/src/monorepo_scripts/stagedocs.ts index efd3ad62d3..e732ac8eb2 100644 --- a/packages/connect/src/monorepo_scripts/stagedocs.ts +++ b/packages/connect/src/monorepo_scripts/stagedocs.ts @@ -1,19 +1,8 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; -import { execAsync } from 'async-child-process'; -import * as _ from 'lodash'; -import * as tsConfig from '../tsconfig.json'; +import * as packageJSON from '../package.json'; +import * as tsConfigJSON from '../tsconfig.json'; -const cwd = __dirname + '/..'; -const S3BucketPath = 's3://staging-connect-docs-jsons/'; -// Include any external packages that are part of the @0xproject/connect public interface -// to this array so that TypeDoc picks it up and adds it to the Docs JSON -const fileIncludes = [...(tsConfig as any).include]; -const fileIncludesAdjusted = postpublishUtils.adjustFileIncludePaths(fileIncludes, __dirname); -const projectFiles = fileIncludesAdjusted.join(' '); -const jsonFilePath = `${__dirname}/../${postpublishUtils.generatedDocsDirectoryName}/index.json`; -const version = process.env.DOCS_VERSION || '0.0.0'; - -(async () => { - await postpublishUtils.generateAndUploadDocsAsync(__dirname, cwd, fileIncludesAdjusted, version, S3BucketPath); -})().catch(console.error); +const cwd = `${__dirname}/..`; +// tslint:disable-next-line:no-floating-promises +postpublishUtils.publishDocsToStagingAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/deployer/src/monorepo_scripts/postpublish.ts b/packages/deployer/src/monorepo_scripts/postpublish.ts index 6e5aa050a3..dcb99d0f76 100644 --- a/packages/deployer/src/monorepo_scripts/postpublish.ts +++ b/packages/deployer/src/monorepo_scripts/postpublish.ts @@ -1,7 +1,8 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; +import * as tsConfigJSON from '../tsconfig.json'; -const subPackageName = (packageJSON as any).name; +const cwd = `${__dirname}/..`; // tslint:disable-next-line:no-floating-promises -postpublishUtils.standardPostPublishAsync(subPackageName); +postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/dev-utils/src/monorepo_scripts/postpublish.ts b/packages/dev-utils/src/monorepo_scripts/postpublish.ts index 6e5aa050a3..dcb99d0f76 100644 --- a/packages/dev-utils/src/monorepo_scripts/postpublish.ts +++ b/packages/dev-utils/src/monorepo_scripts/postpublish.ts @@ -1,7 +1,8 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; +import * as tsConfigJSON from '../tsconfig.json'; -const subPackageName = (packageJSON as any).name; +const cwd = `${__dirname}/..`; // tslint:disable-next-line:no-floating-promises -postpublishUtils.standardPostPublishAsync(subPackageName); +postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/ethers-typescript-typings/monorepo_scripts/postpublish.ts b/packages/ethers-typescript-typings/monorepo_scripts/postpublish.ts index 6e5aa050a3..dcb99d0f76 100644 --- a/packages/ethers-typescript-typings/monorepo_scripts/postpublish.ts +++ b/packages/ethers-typescript-typings/monorepo_scripts/postpublish.ts @@ -1,7 +1,8 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; +import * as tsConfigJSON from '../tsconfig.json'; -const subPackageName = (packageJSON as any).name; +const cwd = `${__dirname}/..`; // tslint:disable-next-line:no-floating-promises -postpublishUtils.standardPostPublishAsync(subPackageName); +postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/json-schemas/src/monorepo_scripts/postpublish.ts b/packages/json-schemas/src/monorepo_scripts/postpublish.ts index 6e5aa050a3..dcb99d0f76 100644 --- a/packages/json-schemas/src/monorepo_scripts/postpublish.ts +++ b/packages/json-schemas/src/monorepo_scripts/postpublish.ts @@ -1,7 +1,8 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; +import * as tsConfigJSON from '../tsconfig.json'; -const subPackageName = (packageJSON as any).name; +const cwd = `${__dirname}/..`; // tslint:disable-next-line:no-floating-promises -postpublishUtils.standardPostPublishAsync(subPackageName); +postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/monorepo-scripts/src/postpublish_utils.ts b/packages/monorepo-scripts/src/postpublish_utils.ts index a36408ccd5..55c44ca637 100644 --- a/packages/monorepo-scripts/src/postpublish_utils.ts +++ b/packages/monorepo-scripts/src/postpublish_utils.ts @@ -10,37 +10,95 @@ const publishReleaseAsync = promisify(publishRelease); const githubPersonalAccessToken = process.env.GITHUB_PERSONAL_ACCESS_TOKEN_0X_JS; const generatedDocsDirectoryName = 'generated_docs'; -export interface TagAndVersion { - tag: string; +export interface PostpublishConfigs { + cwd: string; + packageName: string; version: string; + assets: string[]; + docPublishConfigs: DocPublishConfigs; +} + +export interface DocPublishConfigs { + fileIncludes: string[]; + s3BucketPath: string; + s3StagingBucketPath: string; } export const postpublishUtils = { - async getLatestTagAndVersionAsync(subPackageName: string): Promise { - const subPackagePrefix = `${subPackageName}@`; - const gitTagsCommand = `git tag -l "${subPackagePrefix}*"`; - const result = await execAsync(gitTagsCommand); - if (!_.isEmpty(result.stderr)) { - throw new Error(result.stderr); + generateConfig(packageJSON: any, tsConfigJSON: any, cwd: string): PostpublishConfigs { + if (_.isUndefined(packageJSON.name)) { + throw new Error('name field required in package.json. Cannot publish release notes to Github.'); } - const tags = result.stdout.trim().split('\n'); - const versions = tags.map((tag: string) => { - return tag.slice(subPackagePrefix.length); - }); - const sortedVersions = semverSort.desc(versions); - const latestVersion = sortedVersions[0]; - const latestTag = subPackagePrefix + latestVersion; - return { - tag: latestTag, - version: latestVersion, + if (_.isUndefined(packageJSON.version)) { + throw new Error('version field required in package.json. Cannot publish release notes to Github.'); + } + const postpublishConfig = _.get(packageJSON, 'config.postpublish', {}); + const configs: PostpublishConfigs = { + cwd, + packageName: packageJSON.name, + version: packageJSON.version, + assets: _.get(postpublishConfig, 'assets', []), + docPublishConfigs: { + // Include any external packages that are part of the 0x.js public interface + // to this array so that TypeDoc picks it up and adds it to the Docs JSON + // So far, we only have @0xproject/types as part of 0x.js's public interface. + fileIncludes: [ + ...(tsConfigJSON as any).include, + ..._.get(postpublishConfig, 'docPublishConfigs.extraFileIncludes', []), + ], + s3BucketPath: _.get(postpublishConfig, 'docPublishConfigs.s3BucketPath'), + s3StagingBucketPath: _.get(postpublishConfig, 'docPublishConfigs.s3StagingBucketPath'), + }, }; + return configs; }, - async publishReleaseNotesAsync(tag: string, releaseName: string, assets: string[]) { + async runAsync(packageJSON: any, tsConfigJSON: any, cwd: string): Promise { + const configs = this.generateConfig(packageJSON, tsConfigJSON, cwd); + const release = await this.publishReleaseNotesAsync( + configs.cwd, + configs.packageName, + configs.version, + configs.assets, + ); + if ( + !_.isUndefined(configs.docPublishConfigs.s3BucketPath) || + !_.isUndefined(configs.docPublishConfigs.s3StagingBucketPath) + ) { + utils.log('POSTPUBLISH: Release successful, generating docs...'); + await postpublishUtils.generateAndUploadDocsAsync( + configs.cwd, + configs.docPublishConfigs.fileIncludes, + configs.version, + configs.docPublishConfigs.s3BucketPath, + ); + } else { + utils.log(`POSTPUBLISH: No S3Bucket config found for ${packageJSON.name}. Skipping doc JSON generation.`); + } + }, + async publishDocsToStagingAsync(packageJSON: any, tsConfigJSON: any, cwd: string) { + const configs = this.generateConfig(packageJSON, tsConfigJSON, cwd); + if (_.isUndefined(configs.docPublishConfigs.s3StagingBucketPath)) { + utils.log('config.postpublish.docPublishConfigs.s3StagingBucketPath entry in package.json not found!'); + return; + } + + utils.log('POSTPUBLISH: Generating docs...'); + await postpublishUtils.generateAndUploadDocsAsync( + configs.cwd, + configs.docPublishConfigs.fileIncludes, + configs.version, + configs.docPublishConfigs.s3StagingBucketPath, + ); + }, + async publishReleaseNotesAsync(cwd: string, packageName: string, version: string, assets: string[]): Promise { + const releaseName = this.getReleaseName(packageName, version); + const tag = this.getTag(packageName, version); utils.log('POSTPUBLISH: Releasing ', releaseName, '...'); - return publishReleaseAsync({ + const finalAssets = this.adjustAssetPaths(cwd, assets); + const result = await publishReleaseAsync({ token: githubPersonalAccessToken, owner: '0xProject', - repo: '0x.js', + repo: '0x-monorepo', tag, name: releaseName, notes: 'N/A', @@ -51,26 +109,23 @@ export const postpublishUtils = { assets, }); }, + getTag(packageName: string, version: string) { + return `${packageName}@${version}`; + }, getReleaseName(subPackageName: string, version: string): string { const releaseName = `${subPackageName} v${version}`; return releaseName; }, - async standardPostPublishAsync(subPackageName: string): Promise { - const result: TagAndVersion = await this.getLatestTagAndVersionAsync(subPackageName); - const releaseName = this.getReleaseName(subPackageName, result.version); - const assets: string[] = []; - await this.publishReleaseNotesAsync(result.tag, releaseName, assets); + adjustAssetPaths(cwd: string, assets: string[]) { + const finalAssets: string[] = []; + _.each(assets, (asset: string) => { + finalAssets.push(`${cwd}/${asset}`); + }); + return finalAssets; }, adjustFileIncludePaths(fileIncludes: string[], cwd: string): string[] { 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}`; - } + let path = _.startsWith(fileInclude, './') ? `${cwd}/${fileInclude.substr(2)}` : `${cwd}/${fileInclude}`; // HACK: tsconfig.json needs wildcard directory endings as `/**/*` // but TypeDoc needs it as `/**` in order to pick up files at the root @@ -81,15 +136,10 @@ export const postpublishUtils = { }); return fileIncludesAdjusted; }, - async generateAndUploadDocsAsync( - dirname: string, - cwd: string, - includedFiles: string[], - version: string, - S3BucketPath: string, - ) { - const jsonFilePath = `${dirname}/../${postpublishUtils.generatedDocsDirectoryName}/index.json`; - const projectFiles = includedFiles.join(' '); + async generateAndUploadDocsAsync(cwd: string, fileIncludes: string[], version: string, S3BucketPath: string) { + const fileIncludesAdjusted = this.adjustFileIncludePaths(fileIncludes, cwd); + const projectFiles = fileIncludesAdjusted.join(' '); + const jsonFilePath = `${cwd}/${generatedDocsDirectoryName}/index.json`; const result = await execAsync( `JSON_FILE_PATH=${jsonFilePath} PROJECT_FILES="${projectFiles}" yarn docs:json`, { @@ -105,7 +155,10 @@ export const postpublishUtils = { await execAsync(`S3_URL=${s3Url} yarn upload_docs_json`, { cwd, }); + // Remove the generated docs directory + await execAsync(`rm -rf ${generatedDocsDirectoryName}`, { + cwd, + }); utils.log(`POSTPUBLISH: Docs uploaded to S3 bucket: ${S3BucketPath}`); }, - generatedDocsDirectoryName, }; diff --git a/packages/react-docs/src/monorepo_scripts/postpublish.ts b/packages/react-docs/src/monorepo_scripts/postpublish.ts index 6e5aa050a3..dcb99d0f76 100644 --- a/packages/react-docs/src/monorepo_scripts/postpublish.ts +++ b/packages/react-docs/src/monorepo_scripts/postpublish.ts @@ -1,7 +1,8 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; +import * as tsConfigJSON from '../tsconfig.json'; -const subPackageName = (packageJSON as any).name; +const cwd = `${__dirname}/..`; // tslint:disable-next-line:no-floating-promises -postpublishUtils.standardPostPublishAsync(subPackageName); +postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/react-shared/src/monorepo_scripts/postpublish.ts b/packages/react-shared/src/monorepo_scripts/postpublish.ts index 6e5aa050a3..dcb99d0f76 100644 --- a/packages/react-shared/src/monorepo_scripts/postpublish.ts +++ b/packages/react-shared/src/monorepo_scripts/postpublish.ts @@ -1,7 +1,8 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; +import * as tsConfigJSON from '../tsconfig.json'; -const subPackageName = (packageJSON as any).name; +const cwd = `${__dirname}/..`; // tslint:disable-next-line:no-floating-promises -postpublishUtils.standardPostPublishAsync(subPackageName); +postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/sra-report/src/monorepo_scripts/postpublish.ts b/packages/sra-report/src/monorepo_scripts/postpublish.ts index 6e5aa050a3..dcb99d0f76 100644 --- a/packages/sra-report/src/monorepo_scripts/postpublish.ts +++ b/packages/sra-report/src/monorepo_scripts/postpublish.ts @@ -1,7 +1,8 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; +import * as tsConfigJSON from '../tsconfig.json'; -const subPackageName = (packageJSON as any).name; +const cwd = `${__dirname}/..`; // tslint:disable-next-line:no-floating-promises -postpublishUtils.standardPostPublishAsync(subPackageName); +postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/subproviders/src/monorepo_scripts/postpublish.ts b/packages/subproviders/src/monorepo_scripts/postpublish.ts index 6e5aa050a3..dcb99d0f76 100644 --- a/packages/subproviders/src/monorepo_scripts/postpublish.ts +++ b/packages/subproviders/src/monorepo_scripts/postpublish.ts @@ -1,7 +1,8 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; +import * as tsConfigJSON from '../tsconfig.json'; -const subPackageName = (packageJSON as any).name; +const cwd = `${__dirname}/..`; // tslint:disable-next-line:no-floating-promises -postpublishUtils.standardPostPublishAsync(subPackageName); +postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/tslint-config/monorepo_scripts/postpublish.ts b/packages/tslint-config/monorepo_scripts/postpublish.ts index 6e5aa050a3..dcb99d0f76 100644 --- a/packages/tslint-config/monorepo_scripts/postpublish.ts +++ b/packages/tslint-config/monorepo_scripts/postpublish.ts @@ -1,7 +1,8 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; +import * as tsConfigJSON from '../tsconfig.json'; -const subPackageName = (packageJSON as any).name; +const cwd = `${__dirname}/..`; // tslint:disable-next-line:no-floating-promises -postpublishUtils.standardPostPublishAsync(subPackageName); +postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/types/src/monorepo_scripts/postpublish.ts b/packages/types/src/monorepo_scripts/postpublish.ts index 6e5aa050a3..dcb99d0f76 100644 --- a/packages/types/src/monorepo_scripts/postpublish.ts +++ b/packages/types/src/monorepo_scripts/postpublish.ts @@ -1,7 +1,8 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; +import * as tsConfigJSON from '../tsconfig.json'; -const subPackageName = (packageJSON as any).name; +const cwd = `${__dirname}/..`; // tslint:disable-next-line:no-floating-promises -postpublishUtils.standardPostPublishAsync(subPackageName); +postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/utils/src/monorepo_scripts/postpublish.ts b/packages/utils/src/monorepo_scripts/postpublish.ts index 6e5aa050a3..dcb99d0f76 100644 --- a/packages/utils/src/monorepo_scripts/postpublish.ts +++ b/packages/utils/src/monorepo_scripts/postpublish.ts @@ -1,7 +1,8 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; +import * as tsConfigJSON from '../tsconfig.json'; -const subPackageName = (packageJSON as any).name; +const cwd = `${__dirname}/..`; // tslint:disable-next-line:no-floating-promises -postpublishUtils.standardPostPublishAsync(subPackageName); +postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/web3-typescript-typings/monorepo_scripts/postpublish.ts b/packages/web3-typescript-typings/monorepo_scripts/postpublish.ts index 6e5aa050a3..dcb99d0f76 100644 --- a/packages/web3-typescript-typings/monorepo_scripts/postpublish.ts +++ b/packages/web3-typescript-typings/monorepo_scripts/postpublish.ts @@ -1,7 +1,8 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; +import * as tsConfigJSON from '../tsconfig.json'; -const subPackageName = (packageJSON as any).name; +const cwd = `${__dirname}/..`; // tslint:disable-next-line:no-floating-promises -postpublishUtils.standardPostPublishAsync(subPackageName); +postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/web3-wrapper/src/monorepo_scripts/postpublish.ts b/packages/web3-wrapper/src/monorepo_scripts/postpublish.ts index 6e5aa050a3..dcb99d0f76 100644 --- a/packages/web3-wrapper/src/monorepo_scripts/postpublish.ts +++ b/packages/web3-wrapper/src/monorepo_scripts/postpublish.ts @@ -1,7 +1,8 @@ import { postpublishUtils } from '@0xproject/monorepo-scripts'; import * as packageJSON from '../package.json'; +import * as tsConfigJSON from '../tsconfig.json'; -const subPackageName = (packageJSON as any).name; +const cwd = `${__dirname}/..`; // tslint:disable-next-line:no-floating-promises -postpublishUtils.standardPostPublishAsync(subPackageName); +postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd); From 538ac604a88c2f7ae2dbb1970d464425624a3cd9 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 14 Mar 2018 14:27:36 +0100 Subject: [PATCH 19/22] Add postpublish script to sol-cov --- packages/sol-cov/package.json | 3 ++- packages/sol-cov/scripts/postpublish.js | 5 ----- packages/sol-cov/src/globals.d.ts | 8 ++++++++ packages/sol-cov/src/monorepo_scripts/postpublish.ts | 8 ++++++++ 4 files changed, 18 insertions(+), 6 deletions(-) delete mode 100644 packages/sol-cov/scripts/postpublish.js create mode 100644 packages/sol-cov/src/monorepo_scripts/postpublish.ts diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json index af6be13f2c..48d798fa37 100644 --- a/packages/sol-cov/package.json +++ b/packages/sol-cov/package.json @@ -7,7 +7,7 @@ "scripts": { "build:watch": "tsc -w", "lint": "tslint --project . 'src/**/*.ts'", - "clean": "shx rm -rf lib", + "clean": "shx rm -rf lib scripts", "build": "tsc" }, "repository": { @@ -33,6 +33,7 @@ "web3": "^0.20.0" }, "devDependencies": { + "@0xproject/monorepo-scripts": "^0.1.12", "@0xproject/tslint-config": "^0.4.9", "@types/istanbul": "^0.4.29", "@types/node": "^8.0.53", diff --git a/packages/sol-cov/scripts/postpublish.js b/packages/sol-cov/scripts/postpublish.js deleted file mode 100644 index b3e5407c81..0000000000 --- a/packages/sol-cov/scripts/postpublish.js +++ /dev/null @@ -1,5 +0,0 @@ -const postpublish_utils = require('../../../scripts/postpublish_utils'); -const packageJSON = require('../package.json'); - -const subPackageName = packageJSON.name; -postpublish_utils.standardPostPublishAsync(subPackageName); \ No newline at end of file diff --git a/packages/sol-cov/src/globals.d.ts b/packages/sol-cov/src/globals.d.ts index 54ee64684e..3e457f0b55 100644 --- a/packages/sol-cov/src/globals.d.ts +++ b/packages/sol-cov/src/globals.d.ts @@ -1,4 +1,12 @@ // tslint:disable:completed-docs + +declare module '*.json' { + const json: any; + /* tslint:disable */ + export default json; + /* tslint:enable */ +} + declare module 'solidity-parser-antlr' { export interface BaseASTNode { range: [number, number]; diff --git a/packages/sol-cov/src/monorepo_scripts/postpublish.ts b/packages/sol-cov/src/monorepo_scripts/postpublish.ts new file mode 100644 index 0000000000..dcb99d0f76 --- /dev/null +++ b/packages/sol-cov/src/monorepo_scripts/postpublish.ts @@ -0,0 +1,8 @@ +import { postpublishUtils } from '@0xproject/monorepo-scripts'; + +import * as packageJSON from '../package.json'; +import * as tsConfigJSON from '../tsconfig.json'; + +const cwd = `${__dirname}/..`; +// tslint:disable-next-line:no-floating-promises +postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd); From 32d15d79f10470d764b2645574884573cd3beeaa Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 14 Mar 2018 14:30:15 +0100 Subject: [PATCH 20/22] Add script copying to build command --- packages/sol-cov/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json index 48d798fa37..84e58f8d89 100644 --- a/packages/sol-cov/package.json +++ b/packages/sol-cov/package.json @@ -8,7 +8,7 @@ "build:watch": "tsc -w", "lint": "tslint --project . 'src/**/*.ts'", "clean": "shx rm -rf lib scripts", - "build": "tsc" + "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts" }, "repository": { "type": "git", @@ -37,6 +37,7 @@ "@0xproject/tslint-config": "^0.4.9", "@types/istanbul": "^0.4.29", "@types/node": "^8.0.53", + "copyfiles": "^1.2.0", "npm-run-all": "^4.1.2", "shx": "^0.2.2", "tslint": "5.8.0", From 28abcef1cac095e61d4eb94d42870d3f608d9a97 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 14 Mar 2018 14:32:45 +0100 Subject: [PATCH 21/22] Remove outdated comment --- packages/monorepo-scripts/src/postpublish_utils.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/monorepo-scripts/src/postpublish_utils.ts b/packages/monorepo-scripts/src/postpublish_utils.ts index 55c44ca637..d90d50fbab 100644 --- a/packages/monorepo-scripts/src/postpublish_utils.ts +++ b/packages/monorepo-scripts/src/postpublish_utils.ts @@ -39,9 +39,6 @@ export const postpublishUtils = { version: packageJSON.version, assets: _.get(postpublishConfig, 'assets', []), docPublishConfigs: { - // Include any external packages that are part of the 0x.js public interface - // to this array so that TypeDoc picks it up and adds it to the Docs JSON - // So far, we only have @0xproject/types as part of 0x.js's public interface. fileIncludes: [ ...(tsConfigJSON as any).include, ..._.get(postpublishConfig, 'docPublishConfigs.extraFileIncludes', []), From 83ae7ba08d55fa964bf7b7a985aea0fe1520c5c7 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 14 Mar 2018 14:49:09 +0100 Subject: [PATCH 22/22] Fix linter issuesx --- packages/monorepo-scripts/src/postpublish_utils.ts | 2 +- packages/subproviders/src/globals.d.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/monorepo-scripts/src/postpublish_utils.ts b/packages/monorepo-scripts/src/postpublish_utils.ts index d90d50fbab..898b00c479 100644 --- a/packages/monorepo-scripts/src/postpublish_utils.ts +++ b/packages/monorepo-scripts/src/postpublish_utils.ts @@ -40,7 +40,7 @@ export const postpublishUtils = { assets: _.get(postpublishConfig, 'assets', []), docPublishConfigs: { fileIncludes: [ - ...(tsConfigJSON as any).include, + ...tsConfigJSON.include, ..._.get(postpublishConfig, 'docPublishConfigs.extraFileIncludes', []), ], s3BucketPath: _.get(postpublishConfig, 'docPublishConfigs.s3BucketPath'), diff --git a/packages/subproviders/src/globals.d.ts b/packages/subproviders/src/globals.d.ts index b3dcd4ed32..2c86346f51 100644 --- a/packages/subproviders/src/globals.d.ts +++ b/packages/subproviders/src/globals.d.ts @@ -144,5 +144,6 @@ declare module 'ganache-core' { networkId: number; mnemonic: string; } + // tslint:disable-next-line:completed-docs export function provider(opts: GanacheOpts): Web3.Provider; }