From f4a2e227e1a7224fbbe9c99d9aa033d176a9c4de Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sun, 29 Jul 2018 21:58:39 +0200 Subject: Remove all in-package monorepo-scripts by adding doc gen/upload and aggregate release note publishing to publish script --- packages/react-shared/package.json | 6 ++---- packages/react-shared/src/monorepo_scripts/postpublish.ts | 8 -------- 2 files changed, 2 insertions(+), 12 deletions(-) delete mode 100644 packages/react-shared/src/monorepo_scripts/postpublish.ts (limited to 'packages/react-shared') diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index bb9211752..6b4501e83 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -9,10 +9,9 @@ "types": "lib/index.d.ts", "scripts": { "lint": "tslint --project .", - "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts", + "build": "tsc", "watch_without_deps": "tsc -w", - "clean": "shx rm -rf lib scripts", - "manual:postpublish": "yarn build; node ./scripts/postpublish.js" + "clean": "shx rm -rf lib" }, "author": "Fabio Berger", "license": "Apache-2.0", @@ -26,7 +25,6 @@ }, "devDependencies": { "@0xproject/dev-utils": "^1.0.3", - "@0xproject/monorepo-scripts": "^1.0.4", "@0xproject/tslint-config": "^1.0.4", "copyfiles": "^1.2.0", "make-promises-safe": "^1.1.0", diff --git a/packages/react-shared/src/monorepo_scripts/postpublish.ts b/packages/react-shared/src/monorepo_scripts/postpublish.ts deleted file mode 100644 index dcb99d0f7..000000000 --- a/packages/react-shared/src/monorepo_scripts/postpublish.ts +++ /dev/null @@ -1,8 +0,0 @@ -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); -- cgit v1.2.3 From 11869122b4fe00c834347f9911985d7b2572bc9b Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 1 Aug 2018 17:33:28 +0200 Subject: Update React-scroll, getting rid of the need to manually set the url hash --- packages/react-shared/package.json | 4 ++-- packages/react-shared/src/components/anchor_title.tsx | 2 +- .../react-shared/src/components/nested_sidebar_menu.tsx | 17 +++-------------- 3 files changed, 6 insertions(+), 17 deletions(-) (limited to 'packages/react-shared') diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index 6b4501e83..9f4cfd624 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -39,7 +39,7 @@ "@types/node": "^8.0.53", "@types/react": "*", "@types/react-dom": "*", - "@types/react-scroll": "0.0.31", + "@types/react-scroll": "1.5.3", "basscss": "^8.0.3", "is-mobile": "^0.2.2", "lodash": "^4.17.4", @@ -48,7 +48,7 @@ "react-dom": "15.6.1", "react-highlight": "0xproject/react-highlight", "react-markdown": "^3.2.2", - "react-scroll": "^1.5.2", + "react-scroll": "^1.7.10", "react-tap-event-plugin": "^2.0.1" }, "publishConfig": { diff --git a/packages/react-shared/src/components/anchor_title.tsx b/packages/react-shared/src/components/anchor_title.tsx index 473b994bf..451ba1729 100644 --- a/packages/react-shared/src/components/anchor_title.tsx +++ b/packages/react-shared/src/components/anchor_title.tsx @@ -69,13 +69,13 @@ export class AnchorTitle extends React.Component - + {finalMenuItemName} @@ -128,12 +125,11 @@ export class NestedSidebarMenu extends React.Component ); } - private _onMenuItemClick(name: string): void { - const id = utils.getIdFromName(name); - utils.setUrlHash(id); - if (!_.isUndefined(this.props.onMenuItemClick)) { - this.props.onMenuItemClick(); - } - } } -- cgit v1.2.3 From 5e3bbbbb3c5be91be7c81f92f42e34edd02ea264 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 1 Aug 2018 18:56:31 +0200 Subject: Use our fork of react-scroll that fixes scrolling within an absolutely positioned div to work correctly. See: https://github.com/fisshy/react-scroll/pull/330 --- packages/react-shared/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/react-shared') diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index 9f4cfd624..ab0e2b7bd 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -48,7 +48,7 @@ "react-dom": "15.6.1", "react-highlight": "0xproject/react-highlight", "react-markdown": "^3.2.2", - "react-scroll": "^1.7.10", + "react-scroll": "0xproject/react-scroll#similar-to-pr-330", "react-tap-event-plugin": "^2.0.1" }, "publishConfig": { -- cgit v1.2.3 From 32e1c2ac970069f5251bd3cd7a31072f0547cf2c Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 1 Aug 2018 19:02:20 +0200 Subject: Add padding above anchor titles so they show up nice when scrolled to --- packages/react-shared/src/components/nested_sidebar_menu.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/react-shared') diff --git a/packages/react-shared/src/components/nested_sidebar_menu.tsx b/packages/react-shared/src/components/nested_sidebar_menu.tsx index 10bcb7d8c..4b1c2f365 100644 --- a/packages/react-shared/src/components/nested_sidebar_menu.tsx +++ b/packages/react-shared/src/components/nested_sidebar_menu.tsx @@ -93,7 +93,7 @@ export class NestedSidebarMenu extends React.Component Date: Fri, 3 Aug 2018 18:28:56 +0200 Subject: Display camelCase names all-caps properly --- .../src/components/markdown_section.tsx | 2 +- .../src/components/nested_sidebar_menu.tsx | 2 +- packages/react-shared/src/utils/utils.ts | 22 ++++++++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) (limited to 'packages/react-shared') diff --git a/packages/react-shared/src/components/markdown_section.tsx b/packages/react-shared/src/components/markdown_section.tsx index 3b65b3075..09b214548 100644 --- a/packages/react-shared/src/components/markdown_section.tsx +++ b/packages/react-shared/src/components/markdown_section.tsx @@ -42,7 +42,7 @@ export class MarkdownSection extends React.Component { - const finalSectionName = utils.convertDashesToSpaces(sectionName); + const finalSectionName = utils.convertCamelCaseToSpaces(sectionName); if (this.props.shouldDisplaySectionHeaders) { // tslint:disable-next-line:no-unused-variable const id = utils.getIdFromName(sectionName); diff --git a/packages/react-shared/src/utils/utils.ts b/packages/react-shared/src/utils/utils.ts index 93c7e9f7b..6dd0b9993 100644 --- a/packages/react-shared/src/utils/utils.ts +++ b/packages/react-shared/src/utils/utils.ts @@ -33,6 +33,28 @@ export const utils = { convertDashesToSpaces(text: string): string { return text.replace(/-/g, ' '); }, + convertCamelCaseToSpaces(text: string): string { + const charArray = _.map(text, (char, i) => { + const isNumber = !_.eq(_.parseInt(char), NaN); + const isPrevNumber = i !== 0 && !_.eq(_.parseInt(text[i - 1]), NaN); + if (isNumber && (i == 0 || isPrevNumber)) { + return char; + } + if (char === char.toUpperCase() && i !== 0) { + return ` ${char}`; + } + return char; + }); + let finalText = charArray.join(''); + const exceptions = { 'EIP ': 'E I P', 'ZRX ': 'Z R X', 'ERC ': 'E R C' }; + _.each(exceptions, (spaced, normal) => { + console.log(finalText, spaced, normal); + if (_.includes(finalText, spaced)) { + finalText = finalText.replace(spaced, normal); + } + }); + return finalText; + }, getEtherScanLinkIfExists( addressOrTxHash: string, networkId: number, -- cgit v1.2.3 From ff3c77f7c47475d77defecfeb894a8c86c003997 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 6 Aug 2018 10:48:18 -0400 Subject: Remove stray console.lgos --- packages/react-shared/src/utils/utils.ts | 1 - 1 file changed, 1 deletion(-) (limited to 'packages/react-shared') diff --git a/packages/react-shared/src/utils/utils.ts b/packages/react-shared/src/utils/utils.ts index 6dd0b9993..ce7effaff 100644 --- a/packages/react-shared/src/utils/utils.ts +++ b/packages/react-shared/src/utils/utils.ts @@ -48,7 +48,6 @@ export const utils = { let finalText = charArray.join(''); const exceptions = { 'EIP ': 'E I P', 'ZRX ': 'Z R X', 'ERC ': 'E R C' }; _.each(exceptions, (spaced, normal) => { - console.log(finalText, spaced, normal); if (_.includes(finalText, spaced)) { finalText = finalText.replace(spaced, normal); } -- cgit v1.2.3 From 1a89905ab9602ccd81c5702bcc13246cd1f6960b Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 6 Aug 2018 15:39:21 -0400 Subject: Remove hash spy for now --- packages/react-shared/src/components/anchor_title.tsx | 1 - packages/react-shared/src/components/nested_sidebar_menu.tsx | 2 -- 2 files changed, 3 deletions(-) (limited to 'packages/react-shared') diff --git a/packages/react-shared/src/components/anchor_title.tsx b/packages/react-shared/src/components/anchor_title.tsx index 451ba1729..01857aa6b 100644 --- a/packages/react-shared/src/components/anchor_title.tsx +++ b/packages/react-shared/src/components/anchor_title.tsx @@ -69,7 +69,6 @@ export class AnchorTitle extends React.Component @@ -125,7 +124,6 @@ export class NestedSidebarMenu extends React.Component -- cgit v1.2.3 From d49af66add3f59a5da48d3d2b364cfcfd18fe04a Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 8 Aug 2018 09:32:14 -0400 Subject: Add additional special-case acronym --- packages/react-shared/src/utils/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/react-shared') diff --git a/packages/react-shared/src/utils/utils.ts b/packages/react-shared/src/utils/utils.ts index ce7effaff..0c0e7722c 100644 --- a/packages/react-shared/src/utils/utils.ts +++ b/packages/react-shared/src/utils/utils.ts @@ -46,7 +46,7 @@ export const utils = { return char; }); let finalText = charArray.join(''); - const exceptions = { 'EIP ': 'E I P', 'ZRX ': 'Z R X', 'ERC ': 'E R C' }; + const exceptions = { 'EIP ': 'E I P', 'ZRX ': 'Z R X', 'ERC ': 'E R C', RPC: 'R P C' }; _.each(exceptions, (spaced, normal) => { if (_.includes(finalText, spaced)) { finalText = finalText.replace(spaced, normal); -- cgit v1.2.3 From 386b5bb122c189496e83da46cf53e8dfe83f0ee6 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 8 Aug 2018 09:33:20 -0400 Subject: Add back hashSpy --- packages/react-shared/src/components/anchor_title.tsx | 1 + packages/react-shared/src/components/nested_sidebar_menu.tsx | 2 ++ 2 files changed, 3 insertions(+) (limited to 'packages/react-shared') diff --git a/packages/react-shared/src/components/anchor_title.tsx b/packages/react-shared/src/components/anchor_title.tsx index 01857aa6b..451ba1729 100644 --- a/packages/react-shared/src/components/anchor_title.tsx +++ b/packages/react-shared/src/components/anchor_title.tsx @@ -69,6 +69,7 @@ export class AnchorTitle extends React.Component @@ -124,6 +125,7 @@ export class NestedSidebarMenu extends React.Component -- cgit v1.2.3 From b7c119b2aaaa2f3579ca4aeef198eca7f38f1216 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 22 Aug 2018 18:52:17 +0100 Subject: Fix many linter errors that showed up upon upgrading tsutil --- packages/react-shared/src/utils/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/react-shared') diff --git a/packages/react-shared/src/utils/utils.ts b/packages/react-shared/src/utils/utils.ts index 0c0e7722c..d6b2a5cf5 100644 --- a/packages/react-shared/src/utils/utils.ts +++ b/packages/react-shared/src/utils/utils.ts @@ -37,7 +37,7 @@ export const utils = { const charArray = _.map(text, (char, i) => { const isNumber = !_.eq(_.parseInt(char), NaN); const isPrevNumber = i !== 0 && !_.eq(_.parseInt(text[i - 1]), NaN); - if (isNumber && (i == 0 || isPrevNumber)) { + if (isNumber && (i === 0 || isPrevNumber)) { return char; } if (char === char.toUpperCase() && i !== 0) { -- cgit v1.2.3 From 27d329ff2559c643b54489d0796bb2c2fcda264f Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 22 Aug 2018 23:44:46 +0100 Subject: Replace complicated camelCase to spaces logic with change-case package --- packages/react-shared/package.json | 1 + packages/react-shared/src/utils/utils.ts | 21 ++------------------- 2 files changed, 3 insertions(+), 19 deletions(-) (limited to 'packages/react-shared') diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index 5df4648ee..d73d6c162 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -41,6 +41,7 @@ "@types/react-dom": "*", "@types/react-scroll": "1.5.3", "basscss": "^8.0.3", + "change-case": "^3.0.2", "is-mobile": "^0.2.2", "lodash": "^4.17.5", "material-ui": "^0.17.1", diff --git a/packages/react-shared/src/utils/utils.ts b/packages/react-shared/src/utils/utils.ts index d6b2a5cf5..15c55c04b 100644 --- a/packages/react-shared/src/utils/utils.ts +++ b/packages/react-shared/src/utils/utils.ts @@ -1,3 +1,4 @@ +import changeCase = require('change-case'); import isMobile = require('is-mobile'); import * as _ from 'lodash'; import { scroller } from 'react-scroll'; @@ -34,25 +35,7 @@ export const utils = { return text.replace(/-/g, ' '); }, convertCamelCaseToSpaces(text: string): string { - const charArray = _.map(text, (char, i) => { - const isNumber = !_.eq(_.parseInt(char), NaN); - const isPrevNumber = i !== 0 && !_.eq(_.parseInt(text[i - 1]), NaN); - if (isNumber && (i === 0 || isPrevNumber)) { - return char; - } - if (char === char.toUpperCase() && i !== 0) { - return ` ${char}`; - } - return char; - }); - let finalText = charArray.join(''); - const exceptions = { 'EIP ': 'E I P', 'ZRX ': 'Z R X', 'ERC ': 'E R C', RPC: 'R P C' }; - _.each(exceptions, (spaced, normal) => { - if (_.includes(finalText, spaced)) { - finalText = finalText.replace(spaced, normal); - } - }); - return finalText; + return changeCase.snake(text).replace(/_/g, ' '); }, getEtherScanLinkIfExists( addressOrTxHash: string, -- cgit v1.2.3 From 04e4fe251a4c791239ec893b94ae7f4a7f9d0b53 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 23 Aug 2018 00:08:21 +0100 Subject: Prettier fix --- packages/react-shared/src/utils/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/react-shared') diff --git a/packages/react-shared/src/utils/utils.ts b/packages/react-shared/src/utils/utils.ts index 15c55c04b..142aea85d 100644 --- a/packages/react-shared/src/utils/utils.ts +++ b/packages/react-shared/src/utils/utils.ts @@ -35,7 +35,7 @@ export const utils = { return text.replace(/-/g, ' '); }, convertCamelCaseToSpaces(text: string): string { - return changeCase.snake(text).replace(/_/g, ' '); + return changeCase.snake(text).replace(/_/g, ' '); }, getEtherScanLinkIfExists( addressOrTxHash: string, -- cgit v1.2.3