From 7dd3b2d38b4e4ee2f1daa24c90f503b2e7ad0422 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 19 Apr 2018 11:40:22 +0900 Subject: Add removeGitTags script that can be run after a failed Lerna publish --- packages/monorepo-scripts/package.json | 4 +- packages/monorepo-scripts/src/constants.ts | 1 + packages/monorepo-scripts/src/remove_tags.ts | 56 ++++++++++++++++++++++++++++ packages/monorepo-scripts/src/utils.ts | 45 ++++++++++++++++++++++ 4 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 packages/monorepo-scripts/src/remove_tags.ts (limited to 'packages') diff --git a/packages/monorepo-scripts/package.json b/packages/monorepo-scripts/package.json index 8bf1d83e5..733a099d1 100644 --- a/packages/monorepo-scripts/package.json +++ b/packages/monorepo-scripts/package.json @@ -11,9 +11,11 @@ "build": "tsc", "test:publish": "run-s build script:publish", "find_unused_deps": "run-s build script:find_unused_deps", + "remove_tags": "run-s build script:remove_tags", "script:deps_versions": "node ./lib/deps_versions.js", "script:publish": "IS_DRY_RUN=true node ./lib/publish.js", - "script:find_unused_deps": "node ./lib/find_unused_dependencies.js" + "script:find_unused_deps": "node ./lib/find_unused_dependencies.js", + "script:remove_tags": "node ./lib/remove_tags.js" }, "repository": { "type": "git", diff --git a/packages/monorepo-scripts/src/constants.ts b/packages/monorepo-scripts/src/constants.ts index 081a49332..e93b27820 100644 --- a/packages/monorepo-scripts/src/constants.ts +++ b/packages/monorepo-scripts/src/constants.ts @@ -3,4 +3,5 @@ import * as path from 'path'; export const constants = { monorepoRootPath: path.join(__dirname, '../../..'), stagingWebsite: 'http://staging-0xproject.s3-website-us-east-1.amazonaws.com', + lernaExecutable: './node_modules/lerna/bin/lerna.js', }; diff --git a/packages/monorepo-scripts/src/remove_tags.ts b/packages/monorepo-scripts/src/remove_tags.ts new file mode 100644 index 000000000..a91c6ec39 --- /dev/null +++ b/packages/monorepo-scripts/src/remove_tags.ts @@ -0,0 +1,56 @@ +#!/usr/bin/env node + +import lernaGetPackages = require('lerna-get-packages'); +import * as _ from 'lodash'; +import * as path from 'path'; +import { exec as execAsync } from 'promisify-child-process'; +import semverSort = require('semver-sort'); + +import { constants } from './constants'; +import { Changelog } from './types'; +import { utils } from './utils'; + +(async () => { + const shouldIncludePrivate = true; + const updatedPublicLernaPackages = await utils.getUpdatedLernaPackagesAsync(shouldIncludePrivate); + + for (const lernaPackage of updatedPublicLernaPackages) { + const packageName = lernaPackage.package.name; + const currentVersion = lernaPackage.package.version; + const changelogJSONPath = path.join(lernaPackage.location, 'CHANGELOG.json'); + const changelogJSONIfExists = utils.getChangelogJSONIfExists(changelogJSONPath); + + let latestChangelogVersion: string; + if (!_.isUndefined(changelogJSONIfExists)) { + let changelogs: Changelog[]; + try { + changelogs = JSON.parse(changelogJSONIfExists); + } catch (err) { + throw new Error( + `${lernaPackage.package.name}'s CHANGELOG.json contains invalid JSON. Please fix and try again.`, + ); + } + latestChangelogVersion = changelogs[0].version; + } else { + latestChangelogVersion = utils.getNextPatchVersion(currentVersion); + } + + const sortedVersions = semverSort.desc([latestChangelogVersion, currentVersion]); + if (sortedVersions[0] === latestChangelogVersion && latestChangelogVersion !== currentVersion) { + const tagName = `${packageName}@${latestChangelogVersion}`; + try { + await execAsync(`git tag -d ${tagName}`, { cwd: constants.monorepoRootPath }); + utils.log(`removed tag: ${tagName}`); + } catch (err) { + if (_.includes(err.message, 'not found')) { + utils.log(`Could not find tag: ${tagName}`); + } else { + throw err; + } + } + } + } +})().catch(err => { + utils.log(err); + process.exit(1); +}); diff --git a/packages/monorepo-scripts/src/utils.ts b/packages/monorepo-scripts/src/utils.ts index 9aa37e272..3a16bf91d 100644 --- a/packages/monorepo-scripts/src/utils.ts +++ b/packages/monorepo-scripts/src/utils.ts @@ -1,6 +1,11 @@ +import * as fs from 'fs'; +import lernaGetPackages = require('lerna-get-packages'); import * as _ from 'lodash'; import { exec as execAsync, spawn } from 'promisify-child-process'; +import { constants } from './constants'; +import { UpdatedPackage } from './types'; + export const utils = { log(...args: any[]): void { console.log(...args); // tslint:disable-line:no-console @@ -17,4 +22,44 @@ export const utils = { cwd, }); }, + async getUpdatedLernaPackagesAsync(shouldIncludePrivate: boolean): Promise { + const updatedPublicPackages = await this.getLernaUpdatedPackagesAsync(shouldIncludePrivate); + const updatedPackageNames = _.map(updatedPublicPackages, pkg => pkg.name); + + const allLernaPackages = lernaGetPackages(constants.monorepoRootPath); + const updatedPublicLernaPackages = _.filter(allLernaPackages, pkg => { + return _.includes(updatedPackageNames, pkg.package.name); + }); + return updatedPublicLernaPackages; + }, + async getLernaUpdatedPackagesAsync(shouldIncludePrivate: boolean): Promise { + const result = await execAsync(`${constants.lernaExecutable} updated --json`, { + cwd: constants.monorepoRootPath, + }); + const updatedPackages = JSON.parse(result.stdout); + if (!shouldIncludePrivate) { + const updatedPublicPackages = _.filter(updatedPackages, updatedPackage => !updatedPackage.private); + return updatedPublicPackages; + } + return updatedPackages; + }, + getChangelogJSONIfExists(changelogPath: string) { + let changelogJSON: string; + try { + changelogJSON = fs.readFileSync(changelogPath, 'utf-8'); + return changelogJSON; + } catch (err) { + return undefined; + } + }, + getChangelogJSONOrCreateIfMissing(changelogPath: string): string { + const changelogIfExists = this.getChangelogJSONIfExists(changelogPath); + if (_.isUndefined(changelogIfExists)) { + // If none exists, create new, empty one. + const emptyChangelogJSON = JSON.stringify([], null, 4); + fs.writeFileSync(changelogPath, emptyChangelogJSON); + return emptyChangelogJSON; + } + return changelogIfExists; + }, }; -- cgit v1.2.3 From 1a0d68d49a066d4624677eab518bdca0e6603fe3 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 19 Apr 2018 11:56:41 +0900 Subject: Add descriptions for all commands in monorepo-scripts --- packages/monorepo-scripts/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'packages') diff --git a/packages/monorepo-scripts/README.md b/packages/monorepo-scripts/README.md index a740ba28a..1bfa1b0d8 100644 --- a/packages/monorepo-scripts/README.md +++ b/packages/monorepo-scripts/README.md @@ -2,6 +2,16 @@ This repository contains a few helpful scripts for working with this mono repo. +#### Scripts + +**`yarn deps_versions`**: Since we use Lerna + yarn workspaces, shared dependencies between packages in the monorepo get hoisted to a top-level `node_modules` directory. If two packages use different versions of the same dependency however, both get installed. To avoid having many versions of a dependency installed, we try to keep dependency versions the same across packages in the monorepo. This script will list any dependencies for which we have multiple versions installed. We can then go through them and try to consolidate to a single version where possible. + +**`yarn find_unused_deps`**: Sometimes we accidentally leave dependencies listed in `package.json` that are no longer being used. This script finds potential dependencies that might no longer be in use. Please verify that it is no longer in use before removing, the `depcheck` package we use under-the-hood doesn't handle some TS quirks perfectly. + +**`yarn remove_tags`**: Our publishing script calls `lerna publish` under-the-hood. If this command fails, it might have created new versioned git tags for each package. Removing these manually is tedious, so you can also run this command instead. Before doing so, check to see if `lerna` already created the publish commit. If so, first revert that with `git reset --hard HEAD~1`, then run this command. + +**`yarn test:publish`**: Execute a test-run of the publish script. This dry run won't actually publish, nor will it commit/push anything to Github. + ## Usage #### Dependency versions -- cgit v1.2.3 From fc2b7f747bf15b8c9329f2940ed2f6cf71353c33 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 19 Apr 2018 14:10:48 +0900 Subject: Add checks for the required local setup before running the publish script --- packages/monorepo-scripts/src/publish.ts | 50 ++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'packages') diff --git a/packages/monorepo-scripts/src/publish.ts b/packages/monorepo-scripts/src/publish.ts index a2d641ff9..9bd9ff6be 100644 --- a/packages/monorepo-scripts/src/publish.ts +++ b/packages/monorepo-scripts/src/publish.ts @@ -38,6 +38,11 @@ const packageNameToWebsitePath: { [name: string]: string } = { }; (async () => { + const hasRequiredSetup = await checkPublishRequiredSetupAsync(); + if (!hasRequiredSetup) { + return; // abort + } + // Fetch public, updated Lerna packages const updatedPublicLernaPackages = await getUpdatedPublicLernaPackagesAsync(); @@ -107,6 +112,51 @@ package.ts. Please add an entry for it and try again.`, } } +async function checkPublishRequiredSetupAsync(): Promise { + // check to see if logged into npm before publishing (npm whoami) + try { + await execAsync(`sudo npm whoami`); + } catch (err) { + utils.log('You must be logged into npm in the commandline to publish. Run `npm login` and try again.'); + return false; + } + + // Check to see if Git creds setup (check for ENV 'GITHUB_PERSONAL_ACCESS_TOKEN_0X_JS') + if (_.isUndefined(process.env.GITHUB_PERSONAL_ACCESS_TOKEN_0X_JS)) { + utils.log( + 'You must have a Github personal access token set to an envVar named `GITHUB_PERSONAL_ACCESS_TOKEN_0X_JS`. Add it then try again.', + ); + return false; + } + // Check NPM version is 5.X + const result = await execAsync(`npm --version`); + const version = result.stdout; + const versionSegments = version.split('.'); + const majorVersion = _.parseInt(versionSegments[0]); + if (majorVersion < 5) { + utils.log('You npm version must be v5.x or higher. Upgrade your npm and try again.'); + return false; + } + + // Check that `aws` commandline is installed + try { + await execAsync(`aws help`); + } catch (err) { + utils.log('You must have `awscli` commandline tool installed. Install it and try again.'); + return false; + } + + // Check that `aws` creds are setup + try { + await execAsync(`aws sts get-caller-identity`); + } catch (err) { + utils.log('You must setup your AWS credentials by running `aws configure`. Do this and try again.'); + return false; + } + + return true; +} + async function pushChangelogsToGithubAsync() { await execAsync(`git add . --all`, { cwd: constants.monorepoRootPath }); await execAsync(`git commit -m "Updated CHANGELOGS"`, { cwd: constants.monorepoRootPath }); -- cgit v1.2.3 From 858d1768cecf165adefcdf860f247dad258d8cae Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 19 Apr 2018 14:14:10 +0900 Subject: Improve comments --- packages/monorepo-scripts/src/publish.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'packages') diff --git a/packages/monorepo-scripts/src/publish.ts b/packages/monorepo-scripts/src/publish.ts index 9bd9ff6be..827d6165e 100644 --- a/packages/monorepo-scripts/src/publish.ts +++ b/packages/monorepo-scripts/src/publish.ts @@ -113,7 +113,7 @@ package.ts. Please add an entry for it and try again.`, } async function checkPublishRequiredSetupAsync(): Promise { - // check to see if logged into npm before publishing (npm whoami) + // check to see if logged into npm before publishing try { await execAsync(`sudo npm whoami`); } catch (err) { @@ -121,13 +121,14 @@ async function checkPublishRequiredSetupAsync(): Promise { return false; } - // Check to see if Git creds setup (check for ENV 'GITHUB_PERSONAL_ACCESS_TOKEN_0X_JS') + // Check to see if Git personal token setup if (_.isUndefined(process.env.GITHUB_PERSONAL_ACCESS_TOKEN_0X_JS)) { utils.log( 'You must have a Github personal access token set to an envVar named `GITHUB_PERSONAL_ACCESS_TOKEN_0X_JS`. Add it then try again.', ); return false; } + // Check NPM version is 5.X const result = await execAsync(`npm --version`); const version = result.stdout; @@ -138,7 +139,7 @@ async function checkPublishRequiredSetupAsync(): Promise { return false; } - // Check that `aws` commandline is installed + // Check that `aws` commandline tool is installed try { await execAsync(`aws help`); } catch (err) { @@ -146,7 +147,7 @@ async function checkPublishRequiredSetupAsync(): Promise { return false; } - // Check that `aws` creds are setup + // Check that `aws` credentials are setup try { await execAsync(`aws sts get-caller-identity`); } catch (err) { -- cgit v1.2.3 From 60d879e04537f2af4d7476d384fd0e2002a0fbd3 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 19 Apr 2018 14:16:11 +0900 Subject: Add comment --- packages/monorepo-scripts/src/remove_tags.ts | 2 ++ 1 file changed, 2 insertions(+) (limited to 'packages') diff --git a/packages/monorepo-scripts/src/remove_tags.ts b/packages/monorepo-scripts/src/remove_tags.ts index a91c6ec39..6d09729c7 100644 --- a/packages/monorepo-scripts/src/remove_tags.ts +++ b/packages/monorepo-scripts/src/remove_tags.ts @@ -18,6 +18,8 @@ import { utils } from './utils'; const packageName = lernaPackage.package.name; const currentVersion = lernaPackage.package.version; const changelogJSONPath = path.join(lernaPackage.location, 'CHANGELOG.json'); + // Private packages don't have changelogs, and their versions are always incremented + // by a patch version. const changelogJSONIfExists = utils.getChangelogJSONIfExists(changelogJSONPath); let latestChangelogVersion: string; -- cgit v1.2.3 From 2b15c03b9ac516f7e38eef174503096026162b90 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 19 Apr 2018 14:19:34 +0900 Subject: Use methods moved to utils since now shared by multiple scripts --- packages/monorepo-scripts/src/publish.ts | 36 +++----------------------------- 1 file changed, 3 insertions(+), 33 deletions(-) (limited to 'packages') diff --git a/packages/monorepo-scripts/src/publish.ts b/packages/monorepo-scripts/src/publish.ts index 827d6165e..2ae9bbb60 100644 --- a/packages/monorepo-scripts/src/publish.ts +++ b/packages/monorepo-scripts/src/publish.ts @@ -44,7 +44,8 @@ const packageNameToWebsitePath: { [name: string]: string } = { } // Fetch public, updated Lerna packages - const updatedPublicLernaPackages = await getUpdatedPublicLernaPackagesAsync(); + const shouldIncludePrivate = false; + const updatedPublicLernaPackages = await utils.getUpdatedLernaPackagesAsync(shouldIncludePrivate); await confirmDocPagesRenderAsync(updatedPublicLernaPackages); @@ -165,23 +166,12 @@ async function pushChangelogsToGithubAsync() { utils.log(`Pushed CHANGELOG updates to Github`); } -async function getUpdatedPublicLernaPackagesAsync(): Promise { - const updatedPublicPackages = await getPublicLernaUpdatedPackagesAsync(); - const updatedPackageNames = _.map(updatedPublicPackages, pkg => pkg.name); - - const allLernaPackages = lernaGetPackages(constants.monorepoRootPath); - const updatedPublicLernaPackages = _.filter(allLernaPackages, pkg => { - return _.includes(updatedPackageNames, pkg.package.name); - }); - return updatedPublicLernaPackages; -} - async function updateChangeLogsAsync(updatedPublicLernaPackages: LernaPackage[]): Promise { const packageToVersionChange: PackageToVersionChange = {}; for (const lernaPackage of updatedPublicLernaPackages) { const packageName = lernaPackage.package.name; const changelogJSONPath = path.join(lernaPackage.location, 'CHANGELOG.json'); - const changelogJSON = getChangelogJSONOrCreateIfMissing(lernaPackage.package.name, changelogJSONPath); + const changelogJSON = utils.getChangelogJSONOrCreateIfMissing(changelogJSONPath); let changelogs: Changelog[]; try { changelogs = JSON.parse(changelogJSON); @@ -276,13 +266,6 @@ async function lernaPublishAsync(packageToVersionChange: { [name: string]: strin }); } -async function getPublicLernaUpdatedPackagesAsync(): Promise { - const result = await execAsync(`${LERNA_EXECUTABLE} updated --json`, { cwd: constants.monorepoRootPath }); - const updatedPackages = JSON.parse(result.stdout); - const updatedPublicPackages = _.filter(updatedPackages, updatedPackage => !updatedPackage.private); - return updatedPublicPackages; -} - function updateVersionNumberIfNeeded(currentVersion: string, proposedNextVersion: string) { if (proposedNextVersion === currentVersion) { return utils.getNextPatchVersion(currentVersion); @@ -294,19 +277,6 @@ function updateVersionNumberIfNeeded(currentVersion: string, proposedNextVersion return proposedNextVersion; } -function getChangelogJSONOrCreateIfMissing(packageName: string, changelogPath: string): string { - let changelogJSON: string; - try { - changelogJSON = fs.readFileSync(changelogPath, 'utf-8'); - return changelogJSON; - } catch (err) { - // If none exists, create new, empty one. - const emptyChangelogJSON = JSON.stringify([], null, 4); - fs.writeFileSync(changelogPath, emptyChangelogJSON); - return emptyChangelogJSON; - } -} - function shouldAddNewChangelogEntry(currentVersion: string, changelogs: Changelog[]): boolean { if (_.isEmpty(changelogs)) { return true; -- cgit v1.2.3 From 417cec9e04af84935c38ed77cdb53a8026b0004e Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 20 Apr 2018 09:36:03 +0900 Subject: Consolidate github personal access token env to one place: constants.ts --- packages/monorepo-scripts/src/constants.ts | 1 + packages/monorepo-scripts/src/postpublish_utils.ts | 3 +-- packages/monorepo-scripts/src/publish.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'packages') diff --git a/packages/monorepo-scripts/src/constants.ts b/packages/monorepo-scripts/src/constants.ts index e93b27820..154a86069 100644 --- a/packages/monorepo-scripts/src/constants.ts +++ b/packages/monorepo-scripts/src/constants.ts @@ -4,4 +4,5 @@ export const constants = { monorepoRootPath: path.join(__dirname, '../../..'), stagingWebsite: 'http://staging-0xproject.s3-website-us-east-1.amazonaws.com', lernaExecutable: './node_modules/lerna/bin/lerna.js', + githubPersonalAccessToken: process.env.GITHUB_PERSONAL_ACCESS_TOKEN_0X_JS, }; diff --git a/packages/monorepo-scripts/src/postpublish_utils.ts b/packages/monorepo-scripts/src/postpublish_utils.ts index ca4c92f5d..df2bcb128 100644 --- a/packages/monorepo-scripts/src/postpublish_utils.ts +++ b/packages/monorepo-scripts/src/postpublish_utils.ts @@ -10,7 +10,6 @@ import { constants } from './constants'; import { utils } from './utils'; const publishReleaseAsync = promisify(publishRelease); -const githubPersonalAccessToken = process.env.GITHUB_PERSONAL_ACCESS_TOKEN_0X_JS; const generatedDocsDirectoryName = 'generated_docs'; export interface PostpublishConfigs { @@ -97,7 +96,7 @@ export const postpublishUtils = { const finalAssets = this.adjustAssetPaths(cwd, assets); utils.log('POSTPUBLISH: Releasing ', releaseName, '...'); const result = await publishReleaseAsync({ - token: githubPersonalAccessToken, + token: constants.githubPersonalAccessToken, owner: '0xProject', repo: '0x-monorepo', tag, diff --git a/packages/monorepo-scripts/src/publish.ts b/packages/monorepo-scripts/src/publish.ts index 2ae9bbb60..6c728467a 100644 --- a/packages/monorepo-scripts/src/publish.ts +++ b/packages/monorepo-scripts/src/publish.ts @@ -123,7 +123,7 @@ async function checkPublishRequiredSetupAsync(): Promise { } // Check to see if Git personal token setup - if (_.isUndefined(process.env.GITHUB_PERSONAL_ACCESS_TOKEN_0X_JS)) { + if (_.isUndefined(constants.githubPersonalAccessToken)) { utils.log( 'You must have a Github personal access token set to an envVar named `GITHUB_PERSONAL_ACCESS_TOKEN_0X_JS`. Add it then try again.', ); -- cgit v1.2.3 From 7f46e9af2cef99667da798205bd0dd6fa590f897 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 20 Apr 2018 10:00:37 +0900 Subject: Use path for platform independence --- packages/monorepo-scripts/src/constants.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/monorepo-scripts/src/constants.ts b/packages/monorepo-scripts/src/constants.ts index 154a86069..3aaf881cb 100644 --- a/packages/monorepo-scripts/src/constants.ts +++ b/packages/monorepo-scripts/src/constants.ts @@ -3,6 +3,6 @@ import * as path from 'path'; export const constants = { monorepoRootPath: path.join(__dirname, '../../..'), stagingWebsite: 'http://staging-0xproject.s3-website-us-east-1.amazonaws.com', - lernaExecutable: './node_modules/lerna/bin/lerna.js', + lernaExecutable: path.join('node_modules', 'lerna', 'bin', 'lerna.js'), githubPersonalAccessToken: process.env.GITHUB_PERSONAL_ACCESS_TOKEN_0X_JS, }; -- cgit v1.2.3 From 30256cbe517c217e7aa1e80e8c9428239751d5cb Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 20 Apr 2018 10:01:21 +0900 Subject: Capitalize yarn --- packages/monorepo-scripts/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/monorepo-scripts/README.md b/packages/monorepo-scripts/README.md index 1bfa1b0d8..cec77a10d 100644 --- a/packages/monorepo-scripts/README.md +++ b/packages/monorepo-scripts/README.md @@ -4,7 +4,7 @@ This repository contains a few helpful scripts for working with this mono repo. #### Scripts -**`yarn deps_versions`**: Since we use Lerna + yarn workspaces, shared dependencies between packages in the monorepo get hoisted to a top-level `node_modules` directory. If two packages use different versions of the same dependency however, both get installed. To avoid having many versions of a dependency installed, we try to keep dependency versions the same across packages in the monorepo. This script will list any dependencies for which we have multiple versions installed. We can then go through them and try to consolidate to a single version where possible. +**`yarn deps_versions`**: Since we use Lerna + Yarn workspaces, shared dependencies between packages in the monorepo get hoisted to a top-level `node_modules` directory. If two packages use different versions of the same dependency however, both get installed. To avoid having many versions of a dependency installed, we try to keep dependency versions the same across packages in the monorepo. This script will list any dependencies for which we have multiple versions installed. We can then go through them and try to consolidate to a single version where possible. **`yarn find_unused_deps`**: Sometimes we accidentally leave dependencies listed in `package.json` that are no longer being used. This script finds potential dependencies that might no longer be in use. Please verify that it is no longer in use before removing, the `depcheck` package we use under-the-hood doesn't handle some TS quirks perfectly. -- cgit v1.2.3 From b6fb8dbb528a28cfc3d9395262fa39e3eecca2d5 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 20 Apr 2018 10:03:53 +0900 Subject: Remove outside declaration --- packages/monorepo-scripts/src/utils.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/monorepo-scripts/src/utils.ts b/packages/monorepo-scripts/src/utils.ts index 3a16bf91d..b1bb78ab2 100644 --- a/packages/monorepo-scripts/src/utils.ts +++ b/packages/monorepo-scripts/src/utils.ts @@ -44,9 +44,8 @@ export const utils = { return updatedPackages; }, getChangelogJSONIfExists(changelogPath: string) { - let changelogJSON: string; try { - changelogJSON = fs.readFileSync(changelogPath, 'utf-8'); + const changelogJSON = fs.readFileSync(changelogPath, 'utf-8'); return changelogJSON; } catch (err) { return undefined; -- cgit v1.2.3 From 1f82c7eadfe9e9cddb56b40562a2f0f69cc7dfd9 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 20 Apr 2018 10:04:22 +0900 Subject: Remove unnecessary additional params --- packages/monorepo-scripts/src/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/monorepo-scripts/src/utils.ts b/packages/monorepo-scripts/src/utils.ts index b1bb78ab2..4412f753a 100644 --- a/packages/monorepo-scripts/src/utils.ts +++ b/packages/monorepo-scripts/src/utils.ts @@ -55,7 +55,7 @@ export const utils = { const changelogIfExists = this.getChangelogJSONIfExists(changelogPath); if (_.isUndefined(changelogIfExists)) { // If none exists, create new, empty one. - const emptyChangelogJSON = JSON.stringify([], null, 4); + const emptyChangelogJSON = JSON.stringify([]); fs.writeFileSync(changelogPath, emptyChangelogJSON); return emptyChangelogJSON; } -- cgit v1.2.3 From cc471dd127b3b2b30ebe32452f9dd03778845e7c Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Mon, 23 Apr 2018 11:57:55 -0700 Subject: Rename Portal and PortalMenu components to LegacyPortal and LegacyPortalMenu --- .../ts/components/legacy_portal/legacy_portal.tsx | 442 ++++++++++++++++++++ .../legacy_portal/legacy_portal_menu.tsx | 94 +++++ packages/website/ts/components/portal.tsx | 444 --------------------- packages/website/ts/components/portal_menu.tsx | 94 ----- packages/website/ts/components/top_bar/top_bar.tsx | 4 +- packages/website/ts/containers/legacy_portal.ts | 92 +++++ packages/website/ts/containers/portal.ts | 88 ---- packages/website/ts/index.tsx | 2 +- 8 files changed, 631 insertions(+), 629 deletions(-) create mode 100644 packages/website/ts/components/legacy_portal/legacy_portal.tsx create mode 100644 packages/website/ts/components/legacy_portal/legacy_portal_menu.tsx delete mode 100644 packages/website/ts/components/portal.tsx delete mode 100644 packages/website/ts/components/portal_menu.tsx create mode 100644 packages/website/ts/containers/legacy_portal.ts delete mode 100644 packages/website/ts/containers/portal.ts (limited to 'packages') diff --git a/packages/website/ts/components/legacy_portal/legacy_portal.tsx b/packages/website/ts/components/legacy_portal/legacy_portal.tsx new file mode 100644 index 000000000..8942e4356 --- /dev/null +++ b/packages/website/ts/components/legacy_portal/legacy_portal.tsx @@ -0,0 +1,442 @@ +import { colors } from '@0xproject/react-shared'; +import { BigNumber, logUtils } from '@0xproject/utils'; +import * as _ from 'lodash'; +import CircularProgress from 'material-ui/CircularProgress'; +import Paper from 'material-ui/Paper'; +import * as React from 'react'; +import * as DocumentTitle from 'react-document-title'; +import { Route, Switch } from 'react-router-dom'; +import { Blockchain } from 'ts/blockchain'; +import { BlockchainErrDialog } from 'ts/components/dialogs/blockchain_err_dialog'; +import { LedgerConfigDialog } from 'ts/components/dialogs/ledger_config_dialog'; +import { PortalDisclaimerDialog } from 'ts/components/dialogs/portal_disclaimer_dialog'; +import { WrappedEthSectionNoticeDialog } from 'ts/components/dialogs/wrapped_eth_section_notice_dialog'; +import { EthWrappers } from 'ts/components/eth_wrappers'; +import { FillOrder } from 'ts/components/fill_order'; +import { Footer } from 'ts/components/footer'; +import { LegacyPortalMenu } from 'ts/components/legacy_portal/legacy_portal_menu'; +import { RelayerIndex } from 'ts/components/relayer_index/relayer_index'; +import { TokenBalances } from 'ts/components/token_balances'; +import { TopBar } from 'ts/components/top_bar/top_bar'; +import { TradeHistory } from 'ts/components/trade_history/trade_history'; +import { FlashMessage } from 'ts/components/ui/flash_message'; +import { Wallet } from 'ts/components/wallet/wallet'; +import { GenerateOrderForm } from 'ts/containers/generate_order_form'; +import { localStorage } from 'ts/local_storage/local_storage'; +import { Dispatcher } from 'ts/redux/dispatcher'; +import { portalOrderSchema } from 'ts/schemas/portal_order_schema'; +import { validator } from 'ts/schemas/validator'; +import { + BlockchainErrs, + Environments, + HashData, + Order, + ProviderType, + ScreenWidths, + TokenByAddress, + WebsitePaths, +} from 'ts/types'; +import { configs } from 'ts/utils/configs'; +import { constants } from 'ts/utils/constants'; +import { Translate } from 'ts/utils/translate'; +import { utils } from 'ts/utils/utils'; + +const THROTTLE_TIMEOUT = 100; + +export interface LegacyPortalProps { + blockchainErr: BlockchainErrs; + blockchainIsLoaded: boolean; + dispatcher: Dispatcher; + hashData: HashData; + injectedProviderName: string; + networkId: number; + nodeVersion: string; + orderFillAmount: BigNumber; + providerType: ProviderType; + screenWidth: ScreenWidths; + tokenByAddress: TokenByAddress; + userEtherBalanceInWei: BigNumber; + userAddress: string; + shouldBlockchainErrDialogBeOpen: boolean; + userSuppliedOrderCache: Order; + location: Location; + flashMessage?: string | React.ReactNode; + lastForceTokenStateRefetch: number; + translate: Translate; +} + +interface LegacyPortalState { + prevNetworkId: number; + prevNodeVersion: string; + prevUserAddress: string; + prevPathname: string; + isDisclaimerDialogOpen: boolean; + isWethNoticeDialogOpen: boolean; + isLedgerDialogOpen: boolean; +} + +export class LegacyPortal extends React.Component { + private _blockchain: Blockchain; + private _sharedOrderIfExists: Order; + private _throttledScreenWidthUpdate: () => void; + public static hasAlreadyDismissedWethNotice() { + const didDismissWethNotice = localStorage.getItemIfExists(constants.LOCAL_STORAGE_KEY_DISMISS_WETH_NOTICE); + const hasAlreadyDismissedWethNotice = !_.isUndefined(didDismissWethNotice) && !_.isEmpty(didDismissWethNotice); + return hasAlreadyDismissedWethNotice; + } + constructor(props: LegacyPortalProps) { + super(props); + this._sharedOrderIfExists = this._getSharedOrderIfExists(); + this._throttledScreenWidthUpdate = _.throttle(this._updateScreenWidth.bind(this), THROTTLE_TIMEOUT); + + const isViewingBalances = _.includes(props.location.pathname, `${WebsitePaths.Portal}/balances`); + const hasAlreadyDismissedWethNotice = LegacyPortal.hasAlreadyDismissedWethNotice(); + + const didAcceptPortalDisclaimer = localStorage.getItemIfExists(constants.LOCAL_STORAGE_KEY_ACCEPT_DISCLAIMER); + const hasAcceptedDisclaimer = + !_.isUndefined(didAcceptPortalDisclaimer) && !_.isEmpty(didAcceptPortalDisclaimer); + this.state = { + prevNetworkId: this.props.networkId, + prevNodeVersion: this.props.nodeVersion, + prevUserAddress: this.props.userAddress, + prevPathname: this.props.location.pathname, + isDisclaimerDialogOpen: !hasAcceptedDisclaimer, + isWethNoticeDialogOpen: !hasAlreadyDismissedWethNotice && isViewingBalances, + isLedgerDialogOpen: false, + }; + } + public componentDidMount() { + window.addEventListener('resize', this._throttledScreenWidthUpdate); + window.scrollTo(0, 0); + } + public componentWillMount() { + this._blockchain = new Blockchain(this.props.dispatcher); + } + public componentWillUnmount() { + this._blockchain.destroy(); + window.removeEventListener('resize', this._throttledScreenWidthUpdate); + // We re-set the entire redux state when the portal is unmounted so that when it is re-rendered + // the initialization process always occurs from the same base state. This helps avoid + // initialization inconsistencies (i.e While the portal was unrendered, the user might have + // become disconnected from their backing Ethereum node, changes user accounts, etc...) + this.props.dispatcher.resetState(); + } + public componentWillReceiveProps(nextProps: LegacyPortalProps) { + if (nextProps.networkId !== this.state.prevNetworkId) { + // tslint:disable-next-line:no-floating-promises + this._blockchain.networkIdUpdatedFireAndForgetAsync(nextProps.networkId); + this.setState({ + prevNetworkId: nextProps.networkId, + }); + } + if (nextProps.userAddress !== this.state.prevUserAddress) { + const newUserAddress = _.isEmpty(nextProps.userAddress) ? undefined : nextProps.userAddress; + // tslint:disable-next-line:no-floating-promises + this._blockchain.userAddressUpdatedFireAndForgetAsync(newUserAddress); + this.setState({ + prevUserAddress: nextProps.userAddress, + }); + } + if (nextProps.nodeVersion !== this.state.prevNodeVersion) { + // tslint:disable-next-line:no-floating-promises + this._blockchain.nodeVersionUpdatedFireAndForgetAsync(nextProps.nodeVersion); + } + if (nextProps.location.pathname !== this.state.prevPathname) { + const isViewingBalances = _.includes(nextProps.location.pathname, `${WebsitePaths.Portal}/balances`); + const hasAlreadyDismissedWethNotice = LegacyPortal.hasAlreadyDismissedWethNotice(); + this.setState({ + prevPathname: nextProps.location.pathname, + isWethNoticeDialogOpen: !hasAlreadyDismissedWethNotice && isViewingBalances, + }); + } + } + public render() { + const updateShouldBlockchainErrDialogBeOpen = this.props.dispatcher.updateShouldBlockchainErrDialogBeOpen.bind( + this.props.dispatcher, + ); + const isDevelopment = configs.ENVIRONMENT === Environments.DEVELOPMENT; + const portalStyle: React.CSSProperties = { + minHeight: '100vh', + display: 'flex', + flexDirection: 'column', + justifyContent: 'space-between', + }; + const portalMenuContainerStyle: React.CSSProperties = { + overflow: 'hidden', + backgroundColor: colors.darkestGrey, + color: colors.white, + }; + return ( +
+ + +
+ + {!configs.IS_MAINNET_ENABLED && this.props.networkId === constants.NETWORK_ID_MAINNET ? ( +
+
Mainnet unavailable
+
+ +
+
+ 0x portal is currently unavailable on the Ethereum mainnet. +
To try it out, switch to the Kovan test network (networkId: 42).
+
Check back soon!
+
+
+ ) : ( +
+
+ +
+
+
+ {this.props.blockchainIsLoaded ? ( + + {isDevelopment && ( + + )} + {isDevelopment && ( + + )} + + + + + + + ) : ( +
+
+
+ +
+
+ Loading Portal... +
+
+
+ )} +
+
+
+ )} +
+ + + + + {this.props.blockchainIsLoaded && ( + + )} +
+
+
+ ); + } + public onToggleLedgerDialog() { + this.setState({ + isLedgerDialogOpen: !this.state.isLedgerDialogOpen, + }); + } + private _renderWallet() { + const allTokens = _.values(this.props.tokenByAddress); + const trackedTokens = _.filter(allTokens, t => t.isTracked); + return ( +
+
+ +
+
+ ); + } + private _renderRelayers() { + return ( +
+
+ +
+
+ ); + } + private _renderEthWrapper() { + return ( + + ); + } + private _renderTradeHistory() { + return ( + + ); + } + private _renderTokenBalances() { + const allTokens = _.values(this.props.tokenByAddress); + const trackedTokens = _.filter(allTokens, t => t.isTracked); + return ( + + ); + } + private _renderFillOrder(match: any, location: Location, history: History) { + const initialFillOrder = !_.isUndefined(this.props.userSuppliedOrderCache) + ? this.props.userSuppliedOrderCache + : this._sharedOrderIfExists; + return ( + + ); + } + private _renderGenerateOrderForm(match: any, location: Location, history: History) { + return ( + + ); + } + private _onPortalDisclaimerAccepted() { + localStorage.setItem(constants.LOCAL_STORAGE_KEY_ACCEPT_DISCLAIMER, 'set'); + this.setState({ + isDisclaimerDialogOpen: false, + }); + } + private _onWethNoticeAccepted() { + localStorage.setItem(constants.LOCAL_STORAGE_KEY_DISMISS_WETH_NOTICE, 'set'); + this.setState({ + isWethNoticeDialogOpen: false, + }); + } + private _getSharedOrderIfExists(): Order | undefined { + const queryString = window.location.search; + if (queryString.length === 0) { + return undefined; + } + const queryParams = queryString.substring(1).split('&'); + const orderQueryParam = _.find(queryParams, queryParam => { + const queryPair = queryParam.split('='); + return queryPair[0] === 'order'; + }); + if (_.isUndefined(orderQueryParam)) { + return undefined; + } + const orderPair = orderQueryParam.split('='); + if (orderPair.length !== 2) { + return undefined; + } + + const order = JSON.parse(decodeURIComponent(orderPair[1])); + const validationResult = validator.validate(order, portalOrderSchema); + if (validationResult.errors.length > 0) { + logUtils.log(`Invalid shared order: ${validationResult.errors}`); + return undefined; + } + return order; + } + private _updateScreenWidth() { + const newScreenWidth = utils.getScreenWidth(); + this.props.dispatcher.updateScreenWidth(newScreenWidth); + } +} diff --git a/packages/website/ts/components/legacy_portal/legacy_portal_menu.tsx b/packages/website/ts/components/legacy_portal/legacy_portal_menu.tsx new file mode 100644 index 000000000..634d966ed --- /dev/null +++ b/packages/website/ts/components/legacy_portal/legacy_portal_menu.tsx @@ -0,0 +1,94 @@ +import * as _ from 'lodash'; +import * as React from 'react'; +import { MenuItem } from 'ts/components/ui/menu_item'; +import { Environments, WebsitePaths } from 'ts/types'; +import { configs } from 'ts/utils/configs'; + +export interface LegacyPortalMenuProps { + menuItemStyle: React.CSSProperties; + onClick?: () => void; +} + +interface LegacyPortalMenuState {} + +export class LegacyPortalMenu extends React.Component { + public static defaultProps: Partial = { + onClick: _.noop, + }; + public render() { + return ( +
+ + {this._renderMenuItemWithIcon('Generate order', 'zmdi-arrow-right-top')} + + + {this._renderMenuItemWithIcon('Fill order', 'zmdi-arrow-left-bottom')} + + + {this._renderMenuItemWithIcon('Balances', 'zmdi-balance-wallet')} + + + {this._renderMenuItemWithIcon('Trade history', 'zmdi-format-list-bulleted')} + + + {this._renderMenuItemWithIcon('Wrap ETH', 'zmdi-circle-o')} + + {configs.ENVIRONMENT === Environments.DEVELOPMENT && ( +
+ + {this._renderMenuItemWithIcon('Wallet', 'zmdi-balance-wallet')} + + + {this._renderMenuItemWithIcon('Relayers', 'zmdi-input-antenna')} + +
+ )} +
+ ); + } + private _renderMenuItemWithIcon(title: string, iconName: string) { + return ( +
+
+ +
+
{title}
+
+ ); + } +} diff --git a/packages/website/ts/components/portal.tsx b/packages/website/ts/components/portal.tsx deleted file mode 100644 index b79f5e288..000000000 --- a/packages/website/ts/components/portal.tsx +++ /dev/null @@ -1,444 +0,0 @@ -import { colors } from '@0xproject/react-shared'; -import { BigNumber, logUtils } from '@0xproject/utils'; -import * as _ from 'lodash'; -import CircularProgress from 'material-ui/CircularProgress'; -import Paper from 'material-ui/Paper'; -import * as React from 'react'; -import * as DocumentTitle from 'react-document-title'; -import { Route, Switch } from 'react-router-dom'; -import { Blockchain } from 'ts/blockchain'; -import { BlockchainErrDialog } from 'ts/components/dialogs/blockchain_err_dialog'; -import { LedgerConfigDialog } from 'ts/components/dialogs/ledger_config_dialog'; -import { PortalDisclaimerDialog } from 'ts/components/dialogs/portal_disclaimer_dialog'; -import { WrappedEthSectionNoticeDialog } from 'ts/components/dialogs/wrapped_eth_section_notice_dialog'; -import { EthWrappers } from 'ts/components/eth_wrappers'; -import { FillOrder } from 'ts/components/fill_order'; -import { Footer } from 'ts/components/footer'; -import { PortalMenu } from 'ts/components/portal_menu'; -import { RelayerIndex } from 'ts/components/relayer_index/relayer_index'; -import { TokenBalances } from 'ts/components/token_balances'; -import { TopBar } from 'ts/components/top_bar/top_bar'; -import { TradeHistory } from 'ts/components/trade_history/trade_history'; -import { FlashMessage } from 'ts/components/ui/flash_message'; -import { Wallet } from 'ts/components/wallet/wallet'; -import { GenerateOrderForm } from 'ts/containers/generate_order_form'; -import { localStorage } from 'ts/local_storage/local_storage'; -import { Dispatcher } from 'ts/redux/dispatcher'; -import { portalOrderSchema } from 'ts/schemas/portal_order_schema'; -import { validator } from 'ts/schemas/validator'; -import { - BlockchainErrs, - Environments, - HashData, - Order, - ProviderType, - ScreenWidths, - TokenByAddress, - WebsitePaths, -} from 'ts/types'; -import { configs } from 'ts/utils/configs'; -import { constants } from 'ts/utils/constants'; -import { Translate } from 'ts/utils/translate'; -import { utils } from 'ts/utils/utils'; - -const THROTTLE_TIMEOUT = 100; - -export interface PortalPassedProps {} - -export interface PortalAllProps { - blockchainErr: BlockchainErrs; - blockchainIsLoaded: boolean; - dispatcher: Dispatcher; - hashData: HashData; - injectedProviderName: string; - networkId: number; - nodeVersion: string; - orderFillAmount: BigNumber; - providerType: ProviderType; - screenWidth: ScreenWidths; - tokenByAddress: TokenByAddress; - userEtherBalanceInWei: BigNumber; - userAddress: string; - shouldBlockchainErrDialogBeOpen: boolean; - userSuppliedOrderCache: Order; - location: Location; - flashMessage?: string | React.ReactNode; - lastForceTokenStateRefetch: number; - translate: Translate; -} - -interface PortalAllState { - prevNetworkId: number; - prevNodeVersion: string; - prevUserAddress: string; - prevPathname: string; - isDisclaimerDialogOpen: boolean; - isWethNoticeDialogOpen: boolean; - isLedgerDialogOpen: boolean; -} - -export class Portal extends React.Component { - private _blockchain: Blockchain; - private _sharedOrderIfExists: Order; - private _throttledScreenWidthUpdate: () => void; - public static hasAlreadyDismissedWethNotice() { - const didDismissWethNotice = localStorage.getItemIfExists(constants.LOCAL_STORAGE_KEY_DISMISS_WETH_NOTICE); - const hasAlreadyDismissedWethNotice = !_.isUndefined(didDismissWethNotice) && !_.isEmpty(didDismissWethNotice); - return hasAlreadyDismissedWethNotice; - } - constructor(props: PortalAllProps) { - super(props); - this._sharedOrderIfExists = this._getSharedOrderIfExists(); - this._throttledScreenWidthUpdate = _.throttle(this._updateScreenWidth.bind(this), THROTTLE_TIMEOUT); - - const isViewingBalances = _.includes(props.location.pathname, `${WebsitePaths.Portal}/balances`); - const hasAlreadyDismissedWethNotice = Portal.hasAlreadyDismissedWethNotice(); - - const didAcceptPortalDisclaimer = localStorage.getItemIfExists(constants.LOCAL_STORAGE_KEY_ACCEPT_DISCLAIMER); - const hasAcceptedDisclaimer = - !_.isUndefined(didAcceptPortalDisclaimer) && !_.isEmpty(didAcceptPortalDisclaimer); - this.state = { - prevNetworkId: this.props.networkId, - prevNodeVersion: this.props.nodeVersion, - prevUserAddress: this.props.userAddress, - prevPathname: this.props.location.pathname, - isDisclaimerDialogOpen: !hasAcceptedDisclaimer, - isWethNoticeDialogOpen: !hasAlreadyDismissedWethNotice && isViewingBalances, - isLedgerDialogOpen: false, - }; - } - public componentDidMount() { - window.addEventListener('resize', this._throttledScreenWidthUpdate); - window.scrollTo(0, 0); - } - public componentWillMount() { - this._blockchain = new Blockchain(this.props.dispatcher); - } - public componentWillUnmount() { - this._blockchain.destroy(); - window.removeEventListener('resize', this._throttledScreenWidthUpdate); - // We re-set the entire redux state when the portal is unmounted so that when it is re-rendered - // the initialization process always occurs from the same base state. This helps avoid - // initialization inconsistencies (i.e While the portal was unrendered, the user might have - // become disconnected from their backing Ethereum node, changes user accounts, etc...) - this.props.dispatcher.resetState(); - } - public componentWillReceiveProps(nextProps: PortalAllProps) { - if (nextProps.networkId !== this.state.prevNetworkId) { - // tslint:disable-next-line:no-floating-promises - this._blockchain.networkIdUpdatedFireAndForgetAsync(nextProps.networkId); - this.setState({ - prevNetworkId: nextProps.networkId, - }); - } - if (nextProps.userAddress !== this.state.prevUserAddress) { - const newUserAddress = _.isEmpty(nextProps.userAddress) ? undefined : nextProps.userAddress; - // tslint:disable-next-line:no-floating-promises - this._blockchain.userAddressUpdatedFireAndForgetAsync(newUserAddress); - this.setState({ - prevUserAddress: nextProps.userAddress, - }); - } - if (nextProps.nodeVersion !== this.state.prevNodeVersion) { - // tslint:disable-next-line:no-floating-promises - this._blockchain.nodeVersionUpdatedFireAndForgetAsync(nextProps.nodeVersion); - } - if (nextProps.location.pathname !== this.state.prevPathname) { - const isViewingBalances = _.includes(nextProps.location.pathname, `${WebsitePaths.Portal}/balances`); - const hasAlreadyDismissedWethNotice = Portal.hasAlreadyDismissedWethNotice(); - this.setState({ - prevPathname: nextProps.location.pathname, - isWethNoticeDialogOpen: !hasAlreadyDismissedWethNotice && isViewingBalances, - }); - } - } - public render() { - const updateShouldBlockchainErrDialogBeOpen = this.props.dispatcher.updateShouldBlockchainErrDialogBeOpen.bind( - this.props.dispatcher, - ); - const isDevelopment = configs.ENVIRONMENT === Environments.DEVELOPMENT; - const portalStyle: React.CSSProperties = { - minHeight: '100vh', - display: 'flex', - flexDirection: 'column', - justifyContent: 'space-between', - }; - const portalMenuContainerStyle: React.CSSProperties = { - overflow: 'hidden', - backgroundColor: colors.darkestGrey, - color: colors.white, - }; - return ( -
- - -
- - {!configs.IS_MAINNET_ENABLED && this.props.networkId === constants.NETWORK_ID_MAINNET ? ( -
-
Mainnet unavailable
-
- -
-
- 0x portal is currently unavailable on the Ethereum mainnet. -
To try it out, switch to the Kovan test network (networkId: 42).
-
Check back soon!
-
-
- ) : ( -
-
- -
-
-
- {this.props.blockchainIsLoaded ? ( - - {isDevelopment && ( - - )} - {isDevelopment && ( - - )} - - - - - - - ) : ( -
-
-
- -
-
- Loading Portal... -
-
-
- )} -
-
-
- )} -
- - - - - {this.props.blockchainIsLoaded && ( - - )} -
-
-
- ); - } - public onToggleLedgerDialog() { - this.setState({ - isLedgerDialogOpen: !this.state.isLedgerDialogOpen, - }); - } - private _renderWallet() { - const allTokens = _.values(this.props.tokenByAddress); - const trackedTokens = _.filter(allTokens, t => t.isTracked); - return ( -
-
- -
-
- ); - } - private _renderRelayers() { - return ( -
-
- -
-
- ); - } - private _renderEthWrapper() { - return ( - - ); - } - private _renderTradeHistory() { - return ( - - ); - } - private _renderTokenBalances() { - const allTokens = _.values(this.props.tokenByAddress); - const trackedTokens = _.filter(allTokens, t => t.isTracked); - return ( - - ); - } - private _renderFillOrder(match: any, location: Location, history: History) { - const initialFillOrder = !_.isUndefined(this.props.userSuppliedOrderCache) - ? this.props.userSuppliedOrderCache - : this._sharedOrderIfExists; - return ( - - ); - } - private _renderGenerateOrderForm(match: any, location: Location, history: History) { - return ( - - ); - } - private _onPortalDisclaimerAccepted() { - localStorage.setItem(constants.LOCAL_STORAGE_KEY_ACCEPT_DISCLAIMER, 'set'); - this.setState({ - isDisclaimerDialogOpen: false, - }); - } - private _onWethNoticeAccepted() { - localStorage.setItem(constants.LOCAL_STORAGE_KEY_DISMISS_WETH_NOTICE, 'set'); - this.setState({ - isWethNoticeDialogOpen: false, - }); - } - private _getSharedOrderIfExists(): Order | undefined { - const queryString = window.location.search; - if (queryString.length === 0) { - return undefined; - } - const queryParams = queryString.substring(1).split('&'); - const orderQueryParam = _.find(queryParams, queryParam => { - const queryPair = queryParam.split('='); - return queryPair[0] === 'order'; - }); - if (_.isUndefined(orderQueryParam)) { - return undefined; - } - const orderPair = orderQueryParam.split('='); - if (orderPair.length !== 2) { - return undefined; - } - - const order = JSON.parse(decodeURIComponent(orderPair[1])); - const validationResult = validator.validate(order, portalOrderSchema); - if (validationResult.errors.length > 0) { - logUtils.log(`Invalid shared order: ${validationResult.errors}`); - return undefined; - } - return order; - } - private _updateScreenWidth() { - const newScreenWidth = utils.getScreenWidth(); - this.props.dispatcher.updateScreenWidth(newScreenWidth); - } -} diff --git a/packages/website/ts/components/portal_menu.tsx b/packages/website/ts/components/portal_menu.tsx deleted file mode 100644 index 2b4d7eea2..000000000 --- a/packages/website/ts/components/portal_menu.tsx +++ /dev/null @@ -1,94 +0,0 @@ -import * as _ from 'lodash'; -import * as React from 'react'; -import { MenuItem } from 'ts/components/ui/menu_item'; -import { Environments, WebsitePaths } from 'ts/types'; -import { configs } from 'ts/utils/configs'; - -export interface PortalMenuProps { - menuItemStyle: React.CSSProperties; - onClick?: () => void; -} - -interface PortalMenuState {} - -export class PortalMenu extends React.Component { - public static defaultProps: Partial = { - onClick: _.noop, - }; - public render() { - return ( -
- - {this._renderMenuItemWithIcon('Generate order', 'zmdi-arrow-right-top')} - - - {this._renderMenuItemWithIcon('Fill order', 'zmdi-arrow-left-bottom')} - - - {this._renderMenuItemWithIcon('Balances', 'zmdi-balance-wallet')} - - - {this._renderMenuItemWithIcon('Trade history', 'zmdi-format-list-bulleted')} - - - {this._renderMenuItemWithIcon('Wrap ETH', 'zmdi-circle-o')} - - {configs.ENVIRONMENT === Environments.DEVELOPMENT && ( -
- - {this._renderMenuItemWithIcon('Wallet', 'zmdi-balance-wallet')} - - - {this._renderMenuItemWithIcon('Relayers', 'zmdi-input-antenna')} - -
- )} -
- ); - } - private _renderMenuItemWithIcon(title: string, iconName: string) { - return ( -
-
- -
-
{title}
-
- ); - } -} diff --git a/packages/website/ts/components/top_bar/top_bar.tsx b/packages/website/ts/components/top_bar/top_bar.tsx index 13351dcdc..0c32f4c62 100644 --- a/packages/website/ts/components/top_bar/top_bar.tsx +++ b/packages/website/ts/components/top_bar/top_bar.tsx @@ -8,7 +8,7 @@ import * as React from 'react'; import { Link } from 'react-router-dom'; import ReactTooltip = require('react-tooltip'); import { Blockchain } from 'ts/blockchain'; -import { PortalMenu } from 'ts/components/portal_menu'; +import { LegacyPortalMenu } from 'ts/components/legacy_portal/legacy_portal_menu'; import { SidebarHeader } from 'ts/components/sidebar_header'; import { ProviderDisplay } from 'ts/components/top_bar/provider_display'; import { TopBarMenuItem } from 'ts/components/top_bar/top_bar_menu_item'; @@ -431,7 +431,7 @@ export class TopBar extends React.Component {
{this.props.translate.get(Key.PortalDApp, Deco.CapWords)}
- + ); } diff --git a/packages/website/ts/containers/legacy_portal.ts b/packages/website/ts/containers/legacy_portal.ts new file mode 100644 index 000000000..3b1172a44 --- /dev/null +++ b/packages/website/ts/containers/legacy_portal.ts @@ -0,0 +1,92 @@ +import { BigNumber } from '@0xproject/utils'; +import * as _ from 'lodash'; +import * as React from 'react'; +import { connect } from 'react-redux'; +import { Dispatch } from 'redux'; +import { + LegacyPortal as LegacyPortalComponent, + LegacyPortalProps as LegacyPortalComponentProps, +} from 'ts/components/legacy_portal/legacy_portal'; +import { Dispatcher } from 'ts/redux/dispatcher'; +import { State } from 'ts/redux/reducer'; +import { BlockchainErrs, HashData, Order, ProviderType, ScreenWidths, Side, TokenByAddress } from 'ts/types'; +import { constants } from 'ts/utils/constants'; +import { Translate } from 'ts/utils/translate'; + +interface ConnectedState { + blockchainErr: BlockchainErrs; + blockchainIsLoaded: boolean; + hashData: HashData; + injectedProviderName: string; + networkId: number; + nodeVersion: string; + orderFillAmount: BigNumber; + providerType: ProviderType; + tokenByAddress: TokenByAddress; + lastForceTokenStateRefetch: number; + userEtherBalanceInWei: BigNumber; + screenWidth: ScreenWidths; + shouldBlockchainErrDialogBeOpen: boolean; + userAddress: string; + userSuppliedOrderCache: Order; + flashMessage?: string | React.ReactNode; + translate: Translate; +} + +interface ConnectedDispatch { + dispatcher: Dispatcher; +} + +const mapStateToProps = (state: State, ownProps: LegacyPortalComponentProps): ConnectedState => { + const receiveAssetToken = state.sideToAssetToken[Side.Receive]; + const depositAssetToken = state.sideToAssetToken[Side.Deposit]; + const receiveAddress = !_.isUndefined(receiveAssetToken.address) + ? receiveAssetToken.address + : constants.NULL_ADDRESS; + const depositAddress = !_.isUndefined(depositAssetToken.address) + ? depositAssetToken.address + : constants.NULL_ADDRESS; + const receiveAmount = !_.isUndefined(receiveAssetToken.amount) ? receiveAssetToken.amount : new BigNumber(0); + const depositAmount = !_.isUndefined(depositAssetToken.amount) ? depositAssetToken.amount : new BigNumber(0); + const hashData = { + depositAmount, + depositTokenContractAddr: depositAddress, + feeRecipientAddress: constants.NULL_ADDRESS, + makerFee: constants.MAKER_FEE, + orderExpiryTimestamp: state.orderExpiryTimestamp, + orderMakerAddress: state.userAddress, + orderTakerAddress: state.orderTakerAddress !== '' ? state.orderTakerAddress : constants.NULL_ADDRESS, + receiveAmount, + receiveTokenContractAddr: receiveAddress, + takerFee: constants.TAKER_FEE, + orderSalt: state.orderSalt, + }; + return { + blockchainErr: state.blockchainErr, + blockchainIsLoaded: state.blockchainIsLoaded, + hashData, + injectedProviderName: state.injectedProviderName, + networkId: state.networkId, + nodeVersion: state.nodeVersion, + orderFillAmount: state.orderFillAmount, + providerType: state.providerType, + screenWidth: state.screenWidth, + shouldBlockchainErrDialogBeOpen: state.shouldBlockchainErrDialogBeOpen, + tokenByAddress: state.tokenByAddress, + lastForceTokenStateRefetch: state.lastForceTokenStateRefetch, + userAddress: state.userAddress, + userEtherBalanceInWei: state.userEtherBalanceInWei, + userSuppliedOrderCache: state.userSuppliedOrderCache, + flashMessage: state.flashMessage, + translate: state.translate, + }; +}; + +const mapDispatchToProps = (dispatch: Dispatch): ConnectedDispatch => ({ + dispatcher: new Dispatcher(dispatch), +}); + +export const LegacyPortal: React.ComponentClass = connect( + mapStateToProps, + mapDispatchToProps, +)(LegacyPortalComponent); diff --git a/packages/website/ts/containers/portal.ts b/packages/website/ts/containers/portal.ts deleted file mode 100644 index 725564ead..000000000 --- a/packages/website/ts/containers/portal.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { BigNumber } from '@0xproject/utils'; -import * as _ from 'lodash'; -import * as React from 'react'; -import { connect } from 'react-redux'; -import { Dispatch } from 'redux'; -import { Portal as PortalComponent, PortalAllProps as PortalComponentAllProps } from 'ts/components/portal'; -import { Dispatcher } from 'ts/redux/dispatcher'; -import { State } from 'ts/redux/reducer'; -import { BlockchainErrs, HashData, Order, ProviderType, ScreenWidths, Side, TokenByAddress } from 'ts/types'; -import { constants } from 'ts/utils/constants'; -import { Translate } from 'ts/utils/translate'; - -interface ConnectedState { - blockchainErr: BlockchainErrs; - blockchainIsLoaded: boolean; - hashData: HashData; - injectedProviderName: string; - networkId: number; - nodeVersion: string; - orderFillAmount: BigNumber; - providerType: ProviderType; - tokenByAddress: TokenByAddress; - lastForceTokenStateRefetch: number; - userEtherBalanceInWei: BigNumber; - screenWidth: ScreenWidths; - shouldBlockchainErrDialogBeOpen: boolean; - userAddress: string; - userSuppliedOrderCache: Order; - flashMessage?: string | React.ReactNode; - translate: Translate; -} - -interface ConnectedDispatch { - dispatcher: Dispatcher; -} - -const mapStateToProps = (state: State, ownProps: PortalComponentAllProps): ConnectedState => { - const receiveAssetToken = state.sideToAssetToken[Side.Receive]; - const depositAssetToken = state.sideToAssetToken[Side.Deposit]; - const receiveAddress = !_.isUndefined(receiveAssetToken.address) - ? receiveAssetToken.address - : constants.NULL_ADDRESS; - const depositAddress = !_.isUndefined(depositAssetToken.address) - ? depositAssetToken.address - : constants.NULL_ADDRESS; - const receiveAmount = !_.isUndefined(receiveAssetToken.amount) ? receiveAssetToken.amount : new BigNumber(0); - const depositAmount = !_.isUndefined(depositAssetToken.amount) ? depositAssetToken.amount : new BigNumber(0); - const hashData = { - depositAmount, - depositTokenContractAddr: depositAddress, - feeRecipientAddress: constants.NULL_ADDRESS, - makerFee: constants.MAKER_FEE, - orderExpiryTimestamp: state.orderExpiryTimestamp, - orderMakerAddress: state.userAddress, - orderTakerAddress: state.orderTakerAddress !== '' ? state.orderTakerAddress : constants.NULL_ADDRESS, - receiveAmount, - receiveTokenContractAddr: receiveAddress, - takerFee: constants.TAKER_FEE, - orderSalt: state.orderSalt, - }; - return { - blockchainErr: state.blockchainErr, - blockchainIsLoaded: state.blockchainIsLoaded, - hashData, - injectedProviderName: state.injectedProviderName, - networkId: state.networkId, - nodeVersion: state.nodeVersion, - orderFillAmount: state.orderFillAmount, - providerType: state.providerType, - screenWidth: state.screenWidth, - shouldBlockchainErrDialogBeOpen: state.shouldBlockchainErrDialogBeOpen, - tokenByAddress: state.tokenByAddress, - lastForceTokenStateRefetch: state.lastForceTokenStateRefetch, - userAddress: state.userAddress, - userEtherBalanceInWei: state.userEtherBalanceInWei, - userSuppliedOrderCache: state.userSuppliedOrderCache, - flashMessage: state.flashMessage, - translate: state.translate, - }; -}; - -const mapDispatchToProps = (dispatch: Dispatch): ConnectedDispatch => ({ - dispatcher: new Dispatcher(dispatch), -}); - -export const Portal: React.ComponentClass = connect(mapStateToProps, mapDispatchToProps)( - PortalComponent, -); diff --git a/packages/website/ts/index.tsx b/packages/website/ts/index.tsx index 6b347145f..66154e9b8 100644 --- a/packages/website/ts/index.tsx +++ b/packages/website/ts/index.tsx @@ -35,7 +35,7 @@ import 'less/all.less'; // At the same time webpack statically parses for System.import() to determine bundle chunk split points // so each lazy import needs it's own `System.import()` declaration. const LazyPortal = createLazyComponent('Portal', async () => - System.import(/* webpackChunkName: "portal" */ 'ts/containers/portal'), + System.import(/* webpackChunkName: "portal" */ 'ts/containers/legacy_portal'), ); const LazyZeroExJSDocumentation = createLazyComponent('Documentation', async () => System.import(/* webpackChunkName: "zeroExDocs" */ 'ts/containers/zero_ex_js_documentation'), -- cgit v1.2.3 From 941342cc2412d5dccfad8fc56fc5e36d3a0e6b1a Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Mon, 23 Apr 2018 16:41:02 -0700 Subject: Fix lazy load component name --- packages/website/ts/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/website/ts/index.tsx b/packages/website/ts/index.tsx index 66154e9b8..d99187151 100644 --- a/packages/website/ts/index.tsx +++ b/packages/website/ts/index.tsx @@ -34,8 +34,8 @@ import 'less/all.less'; // cause we only want to import the module when the user navigates to the page. // At the same time webpack statically parses for System.import() to determine bundle chunk split points // so each lazy import needs it's own `System.import()` declaration. -const LazyPortal = createLazyComponent('Portal', async () => - System.import(/* webpackChunkName: "portal" */ 'ts/containers/legacy_portal'), +const LazyPortal = createLazyComponent('LegacyPortal', async () => + System.import(/* webpackChunkName: "legacyPortal" */ 'ts/containers/legacy_portal'), ); const LazyZeroExJSDocumentation = createLazyComponent('Documentation', async () => System.import(/* webpackChunkName: "zeroExDocs" */ 'ts/containers/zero_ex_js_documentation'), -- cgit v1.2.3 From a3cc5c1dd7e88aea50859560f7d751435cb577bd Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 24 Apr 2018 10:32:44 +0900 Subject: Add hack comment about the use of sudo --- packages/monorepo-scripts/src/publish.ts | 2 ++ 1 file changed, 2 insertions(+) (limited to 'packages') diff --git a/packages/monorepo-scripts/src/publish.ts b/packages/monorepo-scripts/src/publish.ts index 6c728467a..0ca3ea7a1 100644 --- a/packages/monorepo-scripts/src/publish.ts +++ b/packages/monorepo-scripts/src/publish.ts @@ -116,6 +116,8 @@ package.ts. Please add an entry for it and try again.`, async function checkPublishRequiredSetupAsync(): Promise { // check to see if logged into npm before publishing try { + // HACK: for some reason on some setups, the `npm whoami` will not recognize a logged-in user + // unless run with `sudo` (i.e Fabio's NVM setup) but is fine for others (Jacob's N setup). await execAsync(`sudo npm whoami`); } catch (err) { utils.log('You must be logged into npm in the commandline to publish. Run `npm login` and try again.'); -- cgit v1.2.3 From ffd9b791003f4718a0dcc469e9806450c73200aa Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 24 Apr 2018 10:43:44 +0900 Subject: Check for Yarn instead of npm --- packages/monorepo-scripts/src/publish.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'packages') diff --git a/packages/monorepo-scripts/src/publish.ts b/packages/monorepo-scripts/src/publish.ts index 0ca3ea7a1..bc580c87f 100644 --- a/packages/monorepo-scripts/src/publish.ts +++ b/packages/monorepo-scripts/src/publish.ts @@ -132,13 +132,13 @@ async function checkPublishRequiredSetupAsync(): Promise { return false; } - // Check NPM version is 5.X - const result = await execAsync(`npm --version`); + // Check Yarn version is 1.X + const result = await execAsync(`yarn --version`); const version = result.stdout; const versionSegments = version.split('.'); const majorVersion = _.parseInt(versionSegments[0]); - if (majorVersion < 5) { - utils.log('You npm version must be v5.x or higher. Upgrade your npm and try again.'); + if (majorVersion < 1) { + utils.log('Your yarn version must be v1.x or higher. Upgrade yarn and try again.'); return false; } -- cgit v1.2.3 From 5682cd0048072fd5c420a35170045134bc5185b9 Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Tue, 24 Apr 2018 14:06:56 +1000 Subject: Update Web3 Provider Engine to 14.0.4 --- packages/0x.js/CHANGELOG.json | 6 +++++- packages/0x.js/package.json | 2 +- packages/dev-utils/CHANGELOG.json | 9 +++++++++ packages/dev-utils/package.json | 2 +- packages/metacoin/package.json | 2 +- packages/subproviders/CHANGELOG.json | 13 +++++++++++++ packages/subproviders/package.json | 2 +- .../src/subproviders/base_wallet_subprovider.ts | 5 +++-- packages/testnet-faucets/package.json | 2 +- packages/website/package.json | 2 +- 10 files changed, 36 insertions(+), 9 deletions(-) (limited to 'packages') diff --git a/packages/0x.js/CHANGELOG.json b/packages/0x.js/CHANGELOG.json index ef4bb1e07..b2aebf803 100644 --- a/packages/0x.js/CHANGELOG.json +++ b/packages/0x.js/CHANGELOG.json @@ -1,10 +1,14 @@ [ { - "version": "0.36.4", + "version": "0.37.0", "changes": [ { "note": "Fixed expiration watcher comparator to handle orders with equal expiration times", "pr": 526 + }, + { + "note": "Update Web3 Provider Engine to 14.0.4", + "pr": 555 } ] }, diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index e7cdff09e..24fd44413 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -93,7 +93,7 @@ "tslint": "5.8.0", "typedoc": "0xProject/typedoc", "typescript": "2.7.1", - "web3-provider-engine": "^13.0.1", + "web3-provider-engine": "^14.0.4", "webpack": "^3.1.0" }, "dependencies": { diff --git a/packages/dev-utils/CHANGELOG.json b/packages/dev-utils/CHANGELOG.json index f245e6183..a453e2ac0 100644 --- a/packages/dev-utils/CHANGELOG.json +++ b/packages/dev-utils/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "0.4.0", + "changes": [ + { + "note": "Update web3 provider engine to 14.0.4", + "pr": 555 + } + ] + }, { "version": "0.3.6", "changes": [ diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index 5b855fb33..a6cd08450 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -47,7 +47,7 @@ "@0xproject/web3-wrapper": "^0.6.1", "lodash": "^4.17.4", "web3": "^0.20.0", - "web3-provider-engine": "^13.0.1" + "web3-provider-engine": "^14.0.4" }, "publishConfig": { "access": "public" diff --git a/packages/metacoin/package.json b/packages/metacoin/package.json index e944d725b..d04d90995 100644 --- a/packages/metacoin/package.json +++ b/packages/metacoin/package.json @@ -34,7 +34,7 @@ "@0xproject/web3-wrapper": "^0.6.1", "ethers": "^3.0.15", "lodash": "^4.17.4", - "web3-provider-engine": "^13.0.1" + "web3-provider-engine": "^14.0.4" }, "devDependencies": { "@0xproject/dev-utils": "^0.3.6", diff --git a/packages/subproviders/CHANGELOG.json b/packages/subproviders/CHANGELOG.json index d3ba7a928..5055f1f65 100644 --- a/packages/subproviders/CHANGELOG.json +++ b/packages/subproviders/CHANGELOG.json @@ -1,4 +1,17 @@ [ + { + "version": "0.10.0", + "changes": [ + { + "note": "Upgrade web3-provider-engine to 14.0.4", + "pr": 555 + }, + { + "note": "Relax `to` validation in base wallet subprovider for transactions that deploy contracts", + "pr": 555 + } + ] + }, { "version": "0.9.0", "changes": [ diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json index aaa0f657c..d504397b0 100644 --- a/packages/subproviders/package.json +++ b/packages/subproviders/package.json @@ -51,7 +51,7 @@ "lodash": "^4.17.4", "semaphore-async-await": "^1.5.1", "web3": "^0.20.0", - "web3-provider-engine": "^13.0.1" + "web3-provider-engine": "^14.0.4" }, "devDependencies": { "@0xproject/monorepo-scripts": "^0.1.18", diff --git a/packages/subproviders/src/subproviders/base_wallet_subprovider.ts b/packages/subproviders/src/subproviders/base_wallet_subprovider.ts index 0a9b99ae4..f68d7eb29 100644 --- a/packages/subproviders/src/subproviders/base_wallet_subprovider.ts +++ b/packages/subproviders/src/subproviders/base_wallet_subprovider.ts @@ -9,9 +9,10 @@ import { Subprovider } from './subprovider'; export abstract class BaseWalletSubprovider extends Subprovider { protected static _validateTxParams(txParams: PartialTxParams) { - assert.isETHAddressHex('to', txParams.to); + if (!_.isUndefined(txParams.to)) { + assert.isETHAddressHex('to', txParams.to); + } assert.isHexString('nonce', txParams.nonce); - assert.isHexString('gas', txParams.gas); } private static _validateSender(sender: string) { if (_.isUndefined(sender) || !addressUtils.isAddress(sender)) { diff --git a/packages/testnet-faucets/package.json b/packages/testnet-faucets/package.json index 4350b76ca..4a86594db 100644 --- a/packages/testnet-faucets/package.json +++ b/packages/testnet-faucets/package.json @@ -26,7 +26,7 @@ "lodash": "^4.17.4", "rollbar": "^0.6.5", "web3": "^0.20.0", - "web3-provider-engine": "^13.0.1" + "web3-provider-engine": "^14.0.4" }, "devDependencies": { "@0xproject/tslint-config": "^0.4.16", diff --git a/packages/website/package.json b/packages/website/package.json index 169231fac..0326f864c 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -48,7 +48,7 @@ "thenby": "^1.2.3", "truffle-contract": "2.0.1", "web3": "^0.20.0", - "web3-provider-engine": "^13.0.1", + "web3-provider-engine": "^14.0.4", "whatwg-fetch": "^2.0.3", "xml-js": "^1.3.2" }, -- cgit v1.2.3 From c69984e309404e60a71f4b739f46abdc25c87584 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 24 Apr 2018 19:54:22 +0900 Subject: Fix react type versions to avoid minor version bumps with breaking changes --- packages/react-docs-example/package.json | 2 +- packages/react-docs/package.json | 2 +- packages/react-shared/package.json | 2 +- packages/website/package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'packages') diff --git a/packages/react-docs-example/package.json b/packages/react-docs-example/package.json index 8584ebe9d..c5238f416 100644 --- a/packages/react-docs-example/package.json +++ b/packages/react-docs-example/package.json @@ -27,7 +27,7 @@ "@types/lodash": "4.14.104", "@types/material-ui": "0.18.0", "@types/node": "^8.0.53", - "@types/react": "^16.0.34", + "@types/react": "16.0.41", "@types/react-dom": "^16.0.3", "@types/react-tap-event-plugin": "0.0.30", "awesome-typescript-loader": "^3.1.3", diff --git a/packages/react-docs/package.json b/packages/react-docs/package.json index 50b7c1251..6ea6535ac 100644 --- a/packages/react-docs/package.json +++ b/packages/react-docs/package.json @@ -36,7 +36,7 @@ "@types/lodash": "4.14.104", "@types/material-ui": "0.18.0", "@types/node": "^8.0.53", - "@types/react": "^16.0.34", + "@types/react": "16.0.41", "@types/react-dom": "^16.0.3", "@types/react-scroll": "0.0.31", "basscss": "^8.0.3", diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index c9f0a76e3..0925704f9 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -34,7 +34,7 @@ "@types/lodash": "4.14.104", "@types/material-ui": "0.18.0", "@types/node": "^8.0.53", - "@types/react": "^16.0.34", + "@types/react": "16.0.41", "@types/react-dom": "^16.0.3", "@types/react-scroll": "0.0.31", "basscss": "^8.0.3", diff --git a/packages/website/package.json b/packages/website/package.json index 169231fac..9eef5a88c 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -60,7 +60,7 @@ "@types/material-ui": "0.18.0", "@types/node": "^8.0.53", "@types/query-string": "^5.1.0", - "@types/react": "^16.0.34", + "@types/react": "16.0.41", "@types/react-copy-to-clipboard": "^4.2.0", "@types/react-dom": "^16.0.3", "@types/react-redux": "^4.4.37", -- cgit v1.2.3