@@ -22,17 +22,6 @@ import {
2222import type { PkgManagerName } from "./pkg_manager.ts" ;
2323
2424const args = process . argv . slice ( 2 ) ;
25- let __dirname : string ;
26-
27- // @ts -ignore
28- if ( import . meta. url ) {
29- // @ts -ignore
30- __dirname = path . dirname ( new URL ( import . meta. url ) . pathname ) ;
31- } else {
32- // For Node.js environments that do not support import.meta.url
33- // which means commonjs environments.
34- __dirname = globalThis . __dirname ;
35- }
3625
3726function prettyPrintRow ( rows : [ string , string ] [ ] ) {
3827 let max = 0 ;
@@ -149,7 +138,7 @@ if (args.length === 0) {
149138 process . exit ( 0 ) ;
150139} else if ( args . some ( ( arg ) => arg === "-v" || arg === "--version" ) ) {
151140 const version = JSON . parse (
152- fs . readFileSync ( path . join ( __dirname , ".." , "package.json" ) , "utf-8" ) ,
141+ fs . readFileSync ( path . resolve ( process . cwd ( ) , ".." , "package.json" ) , "utf-8" ) ,
153142 ) . version as string ;
154143 console . log ( version ) ;
155144 process . exit ( 0 ) ;
@@ -159,7 +148,7 @@ if (args.length === 0) {
159148 // `deno publish` cli is under active development and args may change
160149 // frequently.
161150 if ( cmd === "publish" ) {
162- const binFolder = path . join ( __dirname , ".." , ".download" ) ;
151+ const binFolder = path . resolve ( process . cwd ( ) , ".download" ) ;
163152 run ( async ( ) => {
164153 const projectInfo = await findProjectDir ( process . cwd ( ) ) ;
165154 return publish ( process . cwd ( ) , {
0 commit comments