From afe427d5a98c50837de79c2d375f27cb1db34b51 Mon Sep 17 00:00:00 2001 From: mandolyte Date: Thu, 10 Dec 2020 11:24:18 -0500 Subject: [PATCH] fixes for undefineds and material-table --- .npmignore | 2 +- .yalcignore | 16 +++++++++++ package.json | 7 +++++ src/core/orig-quote-check.js | 6 ++--- src/core/tn-table-row-check.js | 2 +- src/core/tn-table-text-check.js | 2 +- src/demos/RenderProcessedResults.js | 41 ++++++++++++++++++++++++++--- src/index.js | 2 +- 8 files changed, 68 insertions(+), 10 deletions(-) create mode 100644 .yalcignore diff --git a/.npmignore b/.npmignore index 10877963..f286a148 100644 --- a/.npmignore +++ b/.npmignore @@ -8,7 +8,7 @@ # Nor do we need any of the styleguidist stuff from the core ./styleguide.* -./src/code/*.md +./src/**/*.md # Nor do we need some of the extra stuff ./scripts/ diff --git a/.yalcignore b/.yalcignore new file mode 100644 index 00000000..f286a148 --- /dev/null +++ b/.yalcignore @@ -0,0 +1,16 @@ +# We don't need any of the demo stuff in the NPM package +./src/demos/ + +# We don't need the testing stuff in the NPM package +./cypress/ +./src/__tests__/ +./dist/__tests__/ + +# Nor do we need any of the styleguidist stuff from the core +./styleguide.* +./src/**/*.md + +# Nor do we need some of the extra stuff +./scripts/ +./makeNoticeList.py +./noticeList.txt diff --git a/package.json b/package.json index 2b193039..847940b4 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,13 @@ "engines": { "node": ">=4" }, + "yscripts": { + "_comment1": "use this for the scripts when using yalc", + "_comment2": "change name of this object to 'scripts' and the current scripts to say 'xscripts'", + "_comment3": "and revert when done.", + "prepublishOnly": "rm -fr ./dist & babel ./src --out-dir ./dist -s inline && rm -rf ./dist/demos ./dist/__tests__", + "xprepublishOnly": "rm -fr ./dist & babel ./src --out-dir ./dist -s inline" + }, "scripts": { "prepublishOnly": "rm -fr ./dist & babel ./src --out-dir ./dist -s inline && yarn test:unit", "predeploy": "yarn styleguide:build", diff --git a/src/core/orig-quote-check.js b/src/core/orig-quote-check.js index 650e8fe6..d2db8514 100644 --- a/src/core/orig-quote-check.js +++ b/src/core/orig-quote-check.js @@ -74,12 +74,12 @@ export async function checkOriginalLanguageQuote(languageCode, fieldName, fieldT // console.log(`getOriginalPassage(${bookID}, ${C}, ${V})…`); let username; try { - username = optionalCheckingOptions.originalLanguageRepoUsername; + username = optionalCheckingOptions?.originalLanguageRepoUsername; } catch (qcoError) { } if (!username) username = languageCode === 'en' ? 'unfoldingWord' : 'Door43-Catalog'; // ??? !!! let branch; try { - branch = optionalCheckingOptions.originalLanguageRepoBranch; + branch = optionalCheckingOptions?.originalLanguageRepoBranch; } catch (qcunError) { } if (!branch) branch = 'master'; const getFile_ = (optionalCheckingOptions && optionalCheckingOptions.getFile) ? optionalCheckingOptions.getFile : cachedGetFile; @@ -268,7 +268,7 @@ export async function checkOriginalLanguageQuote(languageCode, fieldName, fieldT verseText = optionalCheckingOptions.originalLanguageVerseText; } catch (gcVTerror) { } if (!verseText) {// not supplied, so then we need to get it ourselves - if (optionalCheckingOptions.disableAllLinkFetchingFlag) + if (optionalCheckingOptions?.disableAllLinkFetchingFlag) return colqResult; // nothing else we can do here else { verseText = await getOriginalPassage(bookID, C, V, optionalCheckingOptions); diff --git a/src/core/tn-table-row-check.js b/src/core/tn-table-row-check.js index b4405c24..f7ee0994 100644 --- a/src/core/tn-table-row-check.js +++ b/src/core/tn-table-row-check.js @@ -429,7 +429,7 @@ export async function checkTN_TSVDataRow(languageCode, line, bookID, givenC, giv && supportReference !== 'guidelines-sonofgodprinciples') addNoticePartial({ priority: 788, message: "Only 'Just-In-Time Training' TA articles allowed here", fieldName: 'SupportReference', extract: supportReference, rowID, location: ourRowLocation }); SRSuggestion = ourCheckTextField(rowID, 'SupportReference', supportReference, true, ourRowLocation, optionalCheckingOptions); - if (!optionalCheckingOptions.disableAllLinkFetchingFlag) + if (!optionalCheckingOptions?.disableAllLinkFetchingFlag) await ourCheckSupportReferenceInTA(rowID, 'SupportReference', supportReference, ourRowLocation, optionalCheckingOptions); if (occurrenceNote.indexOf(supportReference) < 0) // The full link is NOT in the note! addNoticePartial({ priority: 787, message: "Link to TA should also be in OccurrenceNote", fieldName: 'SupportReference', extract: supportReference, rowID, location: ourRowLocation }); diff --git a/src/core/tn-table-text-check.js b/src/core/tn-table-text-check.js index a166373d..5759ba1c 100644 --- a/src/core/tn-table-text-check.js +++ b/src/core/tn-table-text-check.js @@ -227,7 +227,7 @@ export async function checkTN_TSVText(languageCode, bookID, filename, tableText, } } - if (optionalCheckingOptions.disableAllLinkFetchingFlag) + if (optionalCheckingOptions?.disableAllLinkFetchingFlag) addNoticePartial({ priority: 20, message: "Note that 'disableAllLinkFetchingFlag' was set so link targets were not checked", location: ourLocation }); addSuccessMessage(`Checked all ${(lines.length - 1).toLocaleString()} data line${lines.length - 1 === 1 ? '' : 's'}${ourLocation}.`); diff --git a/src/demos/RenderProcessedResults.js b/src/demos/RenderProcessedResults.js index 9e6e896e..714d4139 100644 --- a/src/demos/RenderProcessedResults.js +++ b/src/demos/RenderProcessedResults.js @@ -1,8 +1,43 @@ import React from 'react'; -// import { forwardRef } from 'react'; +import { forwardRef } from 'react'; // NOTE: The following line is currently giving compile warnings -- a problem in a dependency it seems import MaterialTable from 'material-table'; +import AddBox from '@material-ui/icons/AddBox'; +import ArrowDownward from '@material-ui/icons/ArrowDownward'; +import Check from '@material-ui/icons/Check'; +import ChevronLeft from '@material-ui/icons/ChevronLeft'; +import ChevronRight from '@material-ui/icons/ChevronRight'; +import Clear from '@material-ui/icons/Clear'; +import DeleteOutline from '@material-ui/icons/DeleteOutline'; +import Edit from '@material-ui/icons/Edit'; +import FilterList from '@material-ui/icons/FilterList'; +import FirstPage from '@material-ui/icons/FirstPage'; +import LastPage from '@material-ui/icons/LastPage'; +import Remove from '@material-ui/icons/Remove'; +import SaveAlt from '@material-ui/icons/SaveAlt'; +import Search from '@material-ui/icons/Search'; +import ViewColumn from '@material-ui/icons/ViewColumn'; + +const tableIcons = { + Add: forwardRef((props, ref) => ), + Check: forwardRef((props, ref) => ), + Clear: forwardRef((props, ref) => ), + Delete: forwardRef((props, ref) => ), + DetailPanel: forwardRef((props, ref) => ), + Edit: forwardRef((props, ref) => ), + Export: forwardRef((props, ref) => ), + Filter: forwardRef((props, ref) => ), + FirstPage: forwardRef((props, ref) => ), + LastPage: forwardRef((props, ref) => ), + NextPage: forwardRef((props, ref) => ), + PreviousPage: forwardRef((props, ref) => ), + ResetSearch: forwardRef((props, ref) => ), + Search: forwardRef((props, ref) => ), + SortArrow: forwardRef((props, ref) => ), + ThirdStateCheck: forwardRef((props, ref) => ), + ViewColumn: forwardRef((props, ref) => ) +}; // const RENDER_PROCESSED_RESULTS_VERSION = '0.5.6'; @@ -157,11 +192,11 @@ export function RenderRawResults({ results }) { Raw Results: ; } diff --git a/src/index.js b/src/index.js index a5d41d52..99fc5a73 100644 --- a/src/index.js +++ b/src/index.js @@ -1,2 +1,2 @@ -export * from './demos'; +//export * from './demos'; export * from './core';