File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 4
4
import { ArtifactResolutionConfig } from "./gen/interfaces/metatype-typegraph-core.js" ;
5
5
import { TypegraphOutput } from "./typegraph.js" ;
6
6
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" ;
10
10
11
11
export class BasicAuth {
12
12
constructor ( public username : string , public password : string ) {
@@ -80,7 +80,7 @@ export async function tgDeploy(
80
80
throw new Error ( `file path ${ filePath } should start with ${ prefix } ` ) ;
81
81
}
82
82
83
- const currDir = process . cwd ( ) ;
83
+ const currDir = path . dirname ( path . resolve ( process . argv [ 1 ] ) ) ;
84
84
filePath = filePath . slice ( prefix . length ) ;
85
85
filePath = `${ currDir } /${ filePath } ` ;
86
86
const fileContent : Buffer = fs . readFileSync ( filePath ) ;
Original file line number Diff line number Diff line change 1
1
// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
2
2
// SPDX-License-Identifier: MPL-2.0
3
3
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" ;
6
7
7
8
export function getFileHash ( filePath : string ) : Promise < string > {
8
9
return new Promise ( ( resolve , reject ) => {
10
+ const currDir = path . dirname ( path . resolve ( process . argv [ 1 ] ) ) ;
11
+ filePath = `${ currDir } /${ filePath } ` ;
9
12
const hash = crypto . createHash ( "sha256" ) ;
10
13
const fileDescriptor = fs . openSync ( filePath , "r" ) ;
11
14
You can’t perform that action at this time.
0 commit comments