From 5c03bcc7892e511e370e37f873ee3ae389d98d02 Mon Sep 17 00:00:00 2001 From: syedhasandigi <82388499+syedhasandigi@users.noreply.github.com> Date: Mon, 14 Oct 2024 16:08:26 +0100 Subject: [PATCH] added in readme and updated build script --- README.md | 30 +++++++++++++++++++++++++++++- package.json | 2 +- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2ce67c6..6015d42 100644 --- a/README.md +++ b/README.md @@ -1 +1,29 @@ -# dtdl-parser \ No newline at end of file +# dtdl-parser + +A library for parsing and validating (DTDL)[https://learn.microsoft.com/en-us/azure/digital-twins/concepts-models] ontologies. + +## Prerequisites + +`node` >= 20 +`dotnet` [CLI](https://learn.microsoft.com/en-us/dotnet/core/install/) +Run `dotnet workload install wasm-tools` to install `wasm-tools` + +## Getting started + +Install dependencies + +`npm install` + +Build javascript files + +`npm run build` + +Basic usage + +```javascript +import { parseDirectories, validateDirectories} from "dtdl-parser" +import { getInterop } from 'dtdl-parser/src/interop' + +const parser = await getInterop() +parseDirectories('../dtdl/simple', parser) +``` \ No newline at end of file diff --git a/package.json b/package.json index e5222f8..bb94c5a 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "type": "module", "scripts": { "test": "NODE_ENV=test ./node_modules/.bin/mocha --config ./test/mocharc.json ./src/**/*.test.ts", - "build": "npx swc ./src ./package.json -d ./build --copy-files", + "build": "swc ./src ./package.json -d ./build --copy-files", "clean": "rimraf -rf ./build", "lint": "eslint .", "depcheck": "depcheck"