Skip to content

Commit 3d724f8

Browse files
committed
chore(sdk): concat entry script path in wasm path
1 parent 51c20ad commit 3d724f8

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

typegraph/node/sdk/src/tg_deploy.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
import { ArtifactResolutionConfig } from "./gen/interfaces/metatype-typegraph-core.js";
55
import { TypegraphOutput } from "./typegraph.js";
66
import { wit_utils } from "./wit.js";
7-
import * as process from "process";
8-
import * as fs from "fs";
9-
import * as path from "path";
7+
import * as process from "node:process";
8+
import * as fs from "node:fs";
9+
import * as path from "node:path";
1010

1111
export class BasicAuth {
1212
constructor(public username: string, public password: string) {
@@ -80,7 +80,7 @@ export async function tgDeploy(
8080
throw new Error(`file path ${filePath} should start with ${prefix}`);
8181
}
8282

83-
const currDir = process.cwd();
83+
const currDir = path.dirname(path.resolve(process.argv[1]));
8484
filePath = filePath.slice(prefix.length);
8585
filePath = `${currDir}/${filePath}`;
8686
const fileContent: Buffer = fs.readFileSync(filePath);

typegraph/node/sdk/src/utils/file_utils.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
22
// SPDX-License-Identifier: MPL-2.0
33

4-
import * as fs from "fs";
5-
import * as crypto from "crypto";
4+
import * as fs from "node:fs";
5+
import * as crypto from "node:crypto";
6+
import * as path from "node:path";
67

78
export function getFileHash(filePath: string): Promise<string> {
89
return new Promise((resolve, reject) => {
10+
const currDir = path.dirname(path.resolve(process.argv[1]));
11+
filePath = `${currDir}/${filePath}`;
912
const hash = crypto.createHash("sha256");
1013
const fileDescriptor = fs.openSync(filePath, "r");
1114

0 commit comments

Comments
 (0)