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

feat: upgrade jco and prepare sdk build #420

Merged
merged 19 commits into from
Oct 2, 2023
Merged
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 .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
env:
PYTHON_VERSION: "3.8"
POETRY_VERSION: "1.4.1"
DENO_VERSION: "1.37.0"
DENO_VERSION: "1.37.1"
REGISTRY_IMAGE: ghcr.io/${{ github.repository_owner }}/typegate

jobs:
Expand Down Expand Up @@ -143,7 +143,7 @@ jobs:
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
- run: |
mkdir -p ./digests
digest="${{ steps.prd.outputs.digest }}"
digest="${{ steps.build.outputs.digest }}"
touch "./digests/${digest#sha256:}"
- uses: actions/upload-artifact@v3
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ env:
PROTOC_VERSION: "v24.x"
POETRY_VERSION: "1.4.1"
DENO_BINDGEN_URL: https://deno.land/x/deno_bindgen@0.8.1/cli.ts
DENO_VERSION: "1.37.0"
DENO_VERSION: "1.37.1"
PNPM_VERSION: "8.6.11"
NODE_VERSION: "19.8.1"
WASM_TOOLS_VERSION: "1.0.37"
JCO_VERSION: "0.9.4"
JCO_VERSION: "0.12.1"
WASMEDGE_VERSION: "0.12.1"
RUST_BACKTRACE: "full"

Expand Down Expand Up @@ -332,7 +332,7 @@ jobs:
wasm-tools component new target/wasm32-unknown-unknown/debug/typegraph_core.wasm -o $WASM_FILE
rm -rf typegraph/deno/gen
jco transpile $WASM_FILE -o typegraph/deno/gen --no-nodejs-compat --map "*=../src/imports.ts"
bash typegraph/deno/dev/fix-declarations.sh
deno run -A typegraph/deno/dev/fix-declarations.ts
rm -rf typegraph/python_next/typegraph_next/gen
poetry run python -m wasmtime.bindgen $WASM_FILE --out-dir typegraph/python_next/typegraph_next/gen

Expand Down
4 changes: 1 addition & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
"website/.docusaurus": true,
"website/node_modules": true
},
"python.formatting.provider": "black",
"python.linting.flake8Enabled": true,
"python.linting.enabled": true,
"deno.importMap": "typegate/deno.json",
"deno.enablePaths": [
"typegate",
"dev",
"examples/templates/deno",
"typegraph/core/tests/typegraphs/deno",
"typegraph/deno"
],
Expand Down
2 changes: 1 addition & 1 deletion dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG RUST_VERSION=1.72.1
ARG DENO_VERSION=1.37.0
ARG DENO_VERSION=1.37.1
ARG DISTROLESS_TAG=nonroot

# must match distroless version
Expand Down
18 changes: 9 additions & 9 deletions dev/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ export {
fromFileUrl,
join,
resolve,
} from "https://deno.land/std@0.198.0/path/mod.ts";
export { parse as parseFlags } from "https://deno.land/std@0.198.0/flags/mod.ts";
export { expandGlobSync } from "https://deno.land/std@0.198.0/fs/mod.ts";
export { cyan, green } from "https://deno.land/std@0.198.0/fmt/colors.ts";
} from "https://deno.land/std@0.202.0/path/mod.ts";
export { parse as parseFlags } from "https://deno.land/std@0.202.0/flags/mod.ts";
export { expandGlobSync } from "https://deno.land/std@0.202.0/fs/mod.ts";
export { cyan, green } from "https://deno.land/std@0.202.0/fmt/colors.ts";
export {
mergeReadableStreams,
TextLineStream,
} from "https://deno.land/std@0.198.0/streams/mod.ts";
export { groupBy } from "https://deno.land/std@0.198.0/collections/group_by.ts";
export type { WalkEntry } from "https://deno.land/std@0.198.0/fs/mod.ts";
export * as yaml from "https://deno.land/std@0.198.0/yaml/mod.ts";
export * as semver from "https://deno.land/std@0.198.0/semver/mod.ts";
} from "https://deno.land/std@0.202.0/streams/mod.ts";
export { groupBy } from "https://deno.land/std@0.202.0/collections/group_by.ts";
export type { WalkEntry } from "https://deno.land/std@0.202.0/fs/mod.ts";
export * as yaml from "https://deno.land/std@0.202.0/yaml/mod.ts";
export * as semver from "https://deno.land/std@0.202.0/semver/mod.ts";

// https://github.com/hayd/deno-udd/pull/108
// export { udd } from "https://deno.land/x/udd@0.8.2/mod.ts";
Expand Down
4 changes: 2 additions & 2 deletions dev/lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ dev:
PROTOC_VERSION: v24.x
RUST_VERSION: 1.72.1
DENO_BINDGEN_URL: 'https://deno.land/x/deno_bindgen@0.8.1/cli.ts'
DENO_VERSION: 1.37.0
DENO_VERSION: 1.37.1
NODE_VERSION: 19.8.1
PNPM_VERSION: 8.6.11
CARGO_INSTA_VERSION: 1.30.0
WASM_TOOLS_VERSION: 1.0.37
JCO_VERSION: 0.9.4
JCO_VERSION: 0.12.1
WASMTIME_VERSION: 10.0.1
WASMEDGE_VERSION: 0.12.1
TYPEGRAPH_VERSION: 0.0.2
Expand Down
13 changes: 8 additions & 5 deletions dev/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,21 @@ import { getLockfile, projectDir } from "./utils.ts";

const lockfile = await getLockfile();

const outDir = resolve(projectDir, "../typegraph/node");
const outDir = resolve(projectDir, "./typegraph/node");
await dnt.emptyDir(outDir);

await dnt.build({
entryPoints: [resolve(projectDir, "../typegraph/deno/mod.ts")],
entryPoints: [resolve(projectDir, "./typegraph/deno/src/mod.ts")],
outDir,
shims: {
deno: true,
},
scriptModule: false,
typeCheck: false,
packageManager: "pnpm",
package: {
name: "@metatypedev/typegraph",
version: lockfile.dev.lock.METATYPE_VERSION,
version: "0.0.1", //lockfile.dev.lock.METATYPE_VERSION,
description: lockfile.dev.lock.TAGLINE,
license: "MPL-2.0",
repository: {
Expand All @@ -30,8 +33,8 @@ await dnt.build({
},
postBuild() {
Deno.copyFileSync(
resolve(projectDir, "LICENSE-MPL-2.0.md"),
resolve(outDir, "LICENSE.md"),
resolve(projectDir, "./dev/LICENSE-MPL-2.0.md"),
resolve(outDir, "./LICENSE.md"),
);
},
});
4 changes: 4 additions & 0 deletions dev/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ for (let i = 0; i < testFiles.length; i += threads) {

for (const { status, output, testFile } of tests) {
for await (const line of output) {
if (line.startsWith("warning: skipping duplicate package")) {
// https://github.com/rust-lang/cargo/issues/10752
continue;
}
console.log(line);
}
console.log("\n");
Expand Down
36 changes: 36 additions & 0 deletions examples/templates/deno/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
import { Policy, t, typegraph } from "@typegraph/deno/src/mod.ts";
import { DenoRuntime } from "@typegraph/deno/src/runtimes/deno.ts";
import { PythonRuntime } from "@typegraph/deno/src/runtimes/python.ts";

import { Policy, t, typegraph } from "../../../../typegraph/deno/src/mod.ts";
import { DenoRuntime } from "../../../../typegraph/deno/src/runtimes/deno.ts";
import { PythonRuntime } from "../../../../typegraph/deno/src/runtimes/python.ts";
*/

import { PythonRuntime } from "https://github.com/metatypedev/typegraph/raw/main/deno/src/runtimes/python.ts";
import {
Policy,
t,
typegraph,
} from "https://github.com/metatypedev/typegraph/raw/main/deno/src/mod.ts";
import { DenoRuntime } from "https://github.com/metatypedev/typegraph/raw/main/deno/src/runtimes/deno.ts";

typegraph("test-multiple-runtimes", (g) => {
const pub = Policy.public();
const deno = new DenoRuntime();
const python = new PythonRuntime();

g.expose({
add: t.func(
t.struct({ "first": t.float(), "second": t.float() }),
t.float(),
python.fromLambda("lambda x: x['first'] + x['second']"),
).withPolicy(pub),
multiply: deno.func(
t.struct({ "first": t.float(), "second": t.float() }),
t.float(),
{ code: "({first, second}) => first * second" },
).withPolicy(pub),
});
});
28 changes: 28 additions & 0 deletions examples/templates/node/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import * as meta from "@metatypedev/typegraph/esm/src/mod.ts";

console.log(meta);

/*
import { Policy, t, typegraph } from "@typegraph/deno/src/mod.ts";
import { DenoRuntime } from "@metatypedev/typegraph/deno/src/runtimes/deno.ts";
import { PythonRuntime } from "@typegraph/deno/src/runtimes/python.ts";

typegraph("test-multiple-runtimes", (g) => {
const pub = Policy.public();
const deno = new DenoRuntime();
const python = new PythonRuntime();

g.expose({
add: t.func(
t.struct({ "first": t.float(), "second": t.float() }),
t.float(),
python.fromLambda("lambda x: x['first'] + x['second']"),
).withPolicy(pub),
multiply: deno.func(
t.struct({ "first": t.float(), "second": t.float() }),
t.float(),
{ code: "({first, second}) => first * second" },
).withPolicy(pub),
});
});
*/
18 changes: 18 additions & 0 deletions examples/templates/node/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "example",
"version": "1.0.0",
"description": "",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "ts-node api.ts"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@metatypedev/typegraph": "^0.0.1"
},
"devDependencies": {
"ts-node": "^10.9.1"
}
}
Loading
Loading