From 1cd68ea2650a4687ce378915e15cdf7405ab9834 Mon Sep 17 00:00:00 2001 From: Kevin F Date: Mon, 18 Mar 2024 12:12:04 +0100 Subject: [PATCH] Update --- .config/dotnet-tools.json | 2 +- docs/scripts_js/ARC.js | 21 ++++++++++++--------- docs/scripts_js/ArcInvestigation.js | 4 ++-- docs/scripts_js/Contracts.js | 6 ++++++ docs/scripts_js/package-lock.json | 16 ++++++++-------- docs/scripts_js/package.json | 4 ++-- tests/ISA/ISA.Json.Tests/Json.Tests.fs | 1 - 7 files changed, 31 insertions(+), 23 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 535dbf2f..c5022fad 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "fable": { - "version": "4.13.0", + "version": "4.15.0", "commands": [ "fable" ] diff --git a/docs/scripts_js/ARC.js b/docs/scripts_js/ARC.js index d6b161c5..e1f03848 100644 --- a/docs/scripts_js/ARC.js +++ b/docs/scripts_js/ARC.js @@ -1,12 +1,15 @@ import {ARC} from "@nfdi4plants/arctrl"; -import {fulfillWriteContract, fulfillReadContract} from "./Contracts.js"; +import {fulfillWriteContract, fulfillReadContract, normalizePathSeparators} from "./Contracts.js"; +import {ArcInvestigation_toJsonString, ArcInvestigation_fromJsonString} from "@nfdi4plants/arctrl/ISA/ISA.Json/ArcTypes/ArcInvestigation.js" +import fs from "fs"; +import path from "path"; // # Create let arc = new ARC() // # Write -const arcRootPath = "C:/Users/Kevin/Desktop/NewTestARCJS" +const arcRootPath = "TestArc" async function write(arcPath, arc) { let contracts = arc.GetWriteContracts() @@ -16,15 +19,11 @@ async function write(arcPath, arc) { }; } -await write(arcRootPath, arc) +// await write(arcRootPath, arc) // # Read // Setup -function normalizePathSeparators (str) { - const normalizedPath = path.normalize(str) - return normalizedPath.replace(/\\/g, '/'); -} export function getAllFilePaths(basePath) { const filesList = [] @@ -55,7 +54,7 @@ async function read(basePath) { let arc = ARC.fromFilePaths(allFilePaths) // Read contracts will tell us what we need to read from disc. let readContracts = arc.GetReadContracts() - console.log(readContracts) + // console.log(readContracts) let fcontracts = await Promise.all( readContracts.map(async (contract) => { let content = await fulfillReadContract(basePath, contract) @@ -69,4 +68,8 @@ async function read(basePath) { // Execution -await read(arcRootPath).then(arc => console.log(arc)) +await read(arcRootPath).then(arc => { + // let json = ArcInvestigation_toJsonString(arc.ISA) + // console.log(json) + console.log(arc) +}) diff --git a/docs/scripts_js/ArcInvestigation.js b/docs/scripts_js/ArcInvestigation.js index 5aca612d..5ff06099 100644 --- a/docs/scripts_js/ArcInvestigation.js +++ b/docs/scripts_js/ArcInvestigation.js @@ -3,7 +3,7 @@ import { ArcInvestigation, Comment$ as Comment} from "@nfdi4plants/arctrl" import {Xlsx} from "@fslab/fsspreadsheet"; // Import ARCtrl Investigation to Spreadsheet transformation import {toFsWorkbook, fromFsWorkbook} from "@nfdi4plants/arctrl/ISA/ISA.Spreadsheet/ArcInvestigation.js" -import {ArcInvestigation_toJsonString, ArcInvestigation_fromJsonString} from "@nfdi4plants/arctrl/ISA/ISA.Json/Investigation.js" +import {ArcInvestigation_toJsonString, ArcInvestigation_fromJsonString} from "@nfdi4plants/arctrl/ISA/ISA.Json/ArcTypes/ArcInvestigation.js" // # Comments @@ -23,7 +23,7 @@ console.log(investigation_comments) let fswb = toFsWorkbook(investigation_comments) -Xlsx.toFile("test.isa.investigation.xlsx", fswb) +// Xlsx.toFile("test.isa.investigation.xlsx", fswb) // Json - Write diff --git a/docs/scripts_js/Contracts.js b/docs/scripts_js/Contracts.js index 30cdd80e..c3220b6a 100644 --- a/docs/scripts_js/Contracts.js +++ b/docs/scripts_js/Contracts.js @@ -4,6 +4,12 @@ import path from "path"; // Write +export function normalizePathSeparators (str) { + const normalizedPath = path.normalize(str) + return normalizedPath.replace(/\\/g, '/'); +} + + export async function fulfillWriteContract (basePath, contract) { function ensureDirectory (filePath) { let dirPath = path.dirname(filePath) diff --git a/docs/scripts_js/package-lock.json b/docs/scripts_js/package-lock.json index b03bb0ca..cc7de25f 100644 --- a/docs/scripts_js/package-lock.json +++ b/docs/scripts_js/package-lock.json @@ -9,8 +9,8 @@ "version": "1.0.0", "license": "MIT", "dependencies": { - "@fslab/fsspreadsheet": "^5.0.0", - "@nfdi4plants/arctrl": "^1.0.0-beta.9" + "@fslab/fsspreadsheet": "^6.0.1", + "@nfdi4plants/arctrl": "^1.2.0" } }, "node_modules/@fast-csv/format": { @@ -41,9 +41,9 @@ } }, "node_modules/@fslab/fsspreadsheet": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@fslab/fsspreadsheet/-/fsspreadsheet-5.0.0.tgz", - "integrity": "sha512-57Uv0F8D2woQjWjltNOBs18bh3yu1u9zLXfYNEgDw4v2pNTO6B1kLcuYF6+EvBVm3dEKpZZ29RnloWXnwJ5tCw==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@fslab/fsspreadsheet/-/fsspreadsheet-6.0.1.tgz", + "integrity": "sha512-2Hs3NPz0MR8qetGbZ7mdoJJWcEEECcrXL+DMp2Vv7WgcalA4eD7i74TT+wl/zaQPo+i1y5mOjzXYtxaOvwP8YA==", "dependencies": { "@nfdi4plants/exceljs": "^0.3.0" } @@ -68,9 +68,9 @@ } }, "node_modules/@nfdi4plants/arctrl": { - "version": "1.0.0-beta.9", - "resolved": "https://registry.npmjs.org/@nfdi4plants/arctrl/-/arctrl-1.0.0-beta.9.tgz", - "integrity": "sha512-xJdZmVpsq1zOpf9ie0S0I4RIg9BzPYPh8WE2PaM0jBXnk2M4GGuL1ZdbXWrAge2cx6E/E71PAG7P3vBb3hsGvQ==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@nfdi4plants/arctrl/-/arctrl-1.2.0.tgz", + "integrity": "sha512-yKroCISerQnIDXd/kKkhTV9tRHAaphcSKw9p8XlQ1QgYk0GTx7i8kor7mGCyzdM3+yRGmQu++mIB5xaUZwxQHg==", "dependencies": { "fable-library": "^1.1.1", "isomorphic-fetch": "^3.0.0" diff --git a/docs/scripts_js/package.json b/docs/scripts_js/package.json index 38a393b8..842650b8 100644 --- a/docs/scripts_js/package.json +++ b/docs/scripts_js/package.json @@ -9,7 +9,7 @@ "author": "Kevin Frey", "license": "MIT", "dependencies": { - "@nfdi4plants/arctrl": "^1.0.0-beta.9", - "@fslab/fsspreadsheet": "^5.0.0" + "@nfdi4plants/arctrl": "^1.2.0", + "@fslab/fsspreadsheet": "^6.0.1" } } diff --git a/tests/ISA/ISA.Json.Tests/Json.Tests.fs b/tests/ISA/ISA.Json.Tests/Json.Tests.fs index 0a2a6aa1..20bf0de5 100644 --- a/tests/ISA/ISA.Json.Tests/Json.Tests.fs +++ b/tests/ISA/ISA.Json.Tests/Json.Tests.fs @@ -195,7 +195,6 @@ let testOntoloyAnnotationLD = ) ] - let testProcessInput = testList "ProcessInput" [