Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use @lionweb NPM packages #10

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ serializations:
- path: lioncore-java/core/src/test/resources/serialization/lioncore.json
kind: m3
repo: Java
- path: lioncore-typescript/models/meta/lioncore.json
- path: lioncore-typescript/packages/artifacts/chunks/languages/lioncore.json
kind: m3
repo: TypeScript

schemas:
- path: lioncore-typescript/schemas/lioncore.serialization.schema.json
- path: lioncore-typescript/packages/artifacts/schemas/lioncore.serialization.schema.json
kind: m3

4 changes: 4 additions & 0 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@
"run-tests": "deno test --allow-read src/",
"watch-tests": "deno test --watch --allow-read src/",
"lock-deps": "deno cache --reload --lock=deno.lock --lock-write src/deps.ts"
},
"imports": {
"lionweb-core": "npm:@lionweb/core@0.5.0-beta.0",
"lionweb-utilities": "npm:@lionweb/utilities@0.1.0-beta.0"
}
}
34 changes: 18 additions & 16 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions src/m3-instances.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {assertEquals} from "./deps.ts"
import {readFileAsJson} from "../../repos/lioncore-typescript/src-utils/json.ts"
import {sortSerialization} from "../../repos/lioncore-typescript/src-utils/serialization-utils.ts"
import {deserializeLanguage} from "../../repos/lioncore-typescript/src/m3/deserializer.ts"
import {SerializationChunk} from "../../repos/lioncore-typescript/src/serialization.ts"

import {sortedSerialization} from "lionweb-utilities"
import {deserializeLanguage, SerializationChunk} from "lionweb-core"

import {readFileAsJson} from "./utils/json.ts"
import {fromRoot, pathOfSerialization} from "./config.ts"


Expand All @@ -16,7 +17,7 @@ Deno.test("M3 instances (Deno)", async (tctx) => {
await tctx.step("check whether Java and TypeScript serializations match", async () => {
const serializationJava = await readFileAsJson(fromRoot(pathOfSerialization("m3", "Java"))) as SerializationChunk
const serializationTypeScript = await readFileAsJson(fromRoot(pathOfSerialization("m3", "TypeScript"))) as SerializationChunk
assertEquals(sortSerialization(serializationJava), sortSerialization(serializationTypeScript))
assertEquals(sortedSerialization(serializationJava), sortedSerialization(serializationTypeScript))
})

})
Expand Down
39 changes: 0 additions & 39 deletions src/utils/json-validator.ts

This file was deleted.

168 changes: 0 additions & 168 deletions src/utils/json.schema.json

This file was deleted.

11 changes: 11 additions & 0 deletions src/utils/json.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const asPrettyString = (json: unknown): string =>
JSON.stringify(json, null, 2)


export const writeJsonAsFile = (path: string, json: unknown): Promise<void> =>
Deno.writeTextFile(path, asPrettyString(json))


export const readFileAsJson = async (path: string): Promise<unknown> =>
JSON.parse(await Deno.readTextFile(path))

Loading