Skip to content

Commit

Permalink
refactor: only import exists from deno std so it doesnt give unstable…
Browse files Browse the repository at this point in the history
… warning
  • Loading branch information
shadowtime2000 committed Jan 23, 2021
1 parent 685a5e0 commit 8b03e13
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/file-methods.deno.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * as fs from "https://deno.land/[email protected]/fs/mod.ts"
export { existsSync } from "https://deno.land/[email protected]/fs/exists.ts"
export * as path from "https://deno.land/[email protected]/path/mod.ts"

export const readFileSync = Deno.readTextFileSync
4 changes: 1 addition & 3 deletions src/file-methods.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
export * as fs from 'fs'

export { readFileSync } from 'fs'
export { readFileSync, existsSync } from 'fs'

import * as path from 'path'

Expand Down
8 changes: 4 additions & 4 deletions src/file-utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fs, path, readFileSync } from './file-methods'
import { path, existsSync, readFileSync } from './file-methods'
const _BOM = /^\uFEFF/

// express is set like: app.engine('html', require('eta').renderFile)
Expand Down Expand Up @@ -98,7 +98,7 @@ function getPath(path: string, options: EtaConfig): string {

addPathToSearched(filePath)

return fs.existsSync(filePath)
return existsSync(filePath)
})
) {
// If the above returned true, we know that the filePath was just set to a path
Expand All @@ -110,7 +110,7 @@ function getPath(path: string, options: EtaConfig): string {

addPathToSearched(filePath)

if (fs.existsSync(filePath)) {
if (existsSync(filePath)) {
return filePath
}
}
Expand Down Expand Up @@ -147,7 +147,7 @@ function getPath(path: string, options: EtaConfig): string {

addPathToSearched(filePath)

if (fs.existsSync(filePath)) {
if (existsSync(filePath)) {
includePath = filePath
}
}
Expand Down

0 comments on commit 8b03e13

Please sign in to comment.