File tree Expand file tree Collapse file tree 4 files changed +13
-4
lines changed Expand file tree Collapse file tree 4 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -15,8 +15,7 @@ ScanCode Workbench is based on
1515for using nexB’s [ AboutCode tools] ( https://github.com/nexB/aboutcode ) . This app
1616works on Windows, OS X and Linux operating systems.
1717
18- ![ ScanCode Workbench] ( https://user-images.githubusercontent.com/48476025/185114433-7340ee70-57cd-4586-b7e7-964fe736451a.gif )
19-
18+ ![ ScanCode Workbench] ( /src/assets/images/workbench_intro.gif )
2019
2120## Using
2221
Original file line number Diff line number Diff line change @@ -60,7 +60,16 @@ const Home = () => {
6060 }
6161
6262 function historyItemParser ( historyItem : HistoryItem ) {
63- if ( historyItem . json_path ) {
63+ // During development, re-parse JSON file (Possible schema changes)
64+ // Toggle this if you don't have schema changes & wish to save time in imports
65+ const REIMPORT_JSON_IN_DEV = true ;
66+
67+ if (
68+ REIMPORT_JSON_IN_DEV &&
69+ process . env . NODE_ENV === "development" &&
70+ historyItem . json_path
71+ ) {
72+ console . log ( "Re-import JSON file (Dev mode)" ) ;
6473 if ( ! electronFs . existsSync ( historyItem . json_path ) ) {
6574 return reportInvalidEntry ( historyItem , "JSON" ) ;
6675 }
Original file line number Diff line number Diff line change 1717import Sequelize from "sequelize" ;
1818// eslint-disable-next-line import/no-unresolved
1919import { parse } from "license-expressions" ;
20+ import { parseIfValidJson } from "../../utils/parsers" ;
2021
2122// @TODO
2223// Store an object as a json string internally, but as an object externally
@@ -25,7 +26,7 @@ export function jsonDataType(attributeName: string) {
2526 return {
2627 type : Sequelize . STRING ,
2728 get : function ( ) {
28- return JSON . parse ( this . getDataValue ( attributeName ) ) ;
29+ return parseIfValidJson ( this . getDataValue ( attributeName ) ) ;
2930 } ,
3031 set : function ( val : any ) {
3132 return this . setDataValue ( attributeName , JSON . stringify ( val ) ) ;
You can’t perform that action at this time.
0 commit comments