@@ -8,7 +8,6 @@ import * as tc from "@actions/tool-cache";
8
8
import fs from "fs" ;
9
9
import path from "path" ;
10
10
import * as os from "os" ;
11
- import { join } from "node:path" ;
12
11
import * as semver from "semver" ;
13
12
14
13
async function move ( src : string , dest : string ) {
@@ -99,21 +98,21 @@ async function downloadAndCacheTypst(version: string) {
99
98
found = await tc . extractTar ( found , undefined , "xJ" ) ;
100
99
core . debug ( `Extracted archive for Typst version: '${ version } '.` ) ;
101
100
}
102
- found = join ( found , folder ) ;
101
+ found = path . join ( found , folder ) ;
103
102
found = await tc . cacheDir ( found , "typst" , version ) ;
104
103
core . info ( `Typst ${ version } added to cache at '${ found } '.` ) ;
105
104
return found ;
106
105
}
107
106
108
107
const TYPST_PACKAGES_DIR = {
109
108
linux : ( ) =>
110
- join (
109
+ path . join (
111
110
process . env . XDG_CACHE_HOME ||
112
- ( os . homedir ( ) ? join ( os . homedir ( ) , ".cache" ) : undefined ) ! ,
111
+ ( os . homedir ( ) ? path . join ( os . homedir ( ) , ".cache" ) : undefined ) ! ,
113
112
"typst/packages"
114
113
) ,
115
- darwin : ( ) => join ( process . env . HOME ! , "Library/Caches" , "typst/packages" ) ,
116
- win32 : ( ) => join ( process . env . LOCALAPPDATA ! , "typst/packages" ) ,
114
+ darwin : ( ) => path . join ( process . env . HOME ! , "Library/Caches" , "typst/packages" ) ,
115
+ win32 : ( ) => path . join ( process . env . LOCALAPPDATA ! , "typst/packages" ) ,
117
116
} [ process . platform as string ] ! ( ) ;
118
117
119
118
async function cachePackages ( cachePackage : string ) {
@@ -184,7 +183,7 @@ async function downloadLocalPackages(packages: {
184
183
await Promise . all (
185
184
Object . entries ( packages . local ) . map ( async ( [ key , value ] ) => {
186
185
core . info ( `Downloading package: '${ key } ' from '${ value } '.` ) ;
187
- const packageDir = join ( packagesDir , key ) ;
186
+ const packageDir = path . join ( packagesDir , key ) ;
188
187
if ( ! fs . existsSync ( packageDir ) ) {
189
188
fs . mkdirSync ( packageDir ) ;
190
189
core . debug ( `Created directory for package: '${ packageDir } '.` ) ;
@@ -220,14 +219,14 @@ async function downloadLocalPackages(packages: {
220
219
const innerPath = path . join ( packageResponse , dirContent [ 0 ] ) ;
221
220
const stats = fs . statSync ( innerPath ) ;
222
221
if ( stats . isDirectory ( ) ) {
223
- const packageVersion = getPackageVersion ( join ( innerPath , "typst.toml" ) ) ;
224
- move ( innerPath , join ( packageDir , packageVersion ) ) ;
222
+ const packageVersion = getPackageVersion ( path . join ( innerPath , "typst.toml" ) ) ;
223
+ move ( innerPath , path . join ( packageDir , packageVersion ) ) ;
225
224
}
226
225
} else {
227
226
const packageVersion = getPackageVersion (
228
- join ( packageResponse , "typst.toml" )
227
+ path . join ( packageResponse , "typst.toml" )
229
228
) ;
230
- move ( packageResponse , join ( packageDir , packageVersion ) ) ;
229
+ move ( packageResponse , path . join ( packageDir , packageVersion ) ) ;
231
230
}
232
231
core . info ( `Downloaded ${ key } to ${ packageDir } ` ) ;
233
232
} )
0 commit comments