Simplify the checking for existing files.

pull/5370/head
Evan Sangaline 10 months ago committed by Aniket
parent c8c2051bfb
commit 2baaaa97e0
  1. 20
      libs/remix-ws-templates/src/script-templates/sindri/index.ts

@ -4,15 +4,10 @@ export const sindriScripts = async (plugin) => {
// @ts-ignore
(await import('!!raw-loader!./sindri.ts')).default)
const existingFiles = await plugin.call('fileManager', 'readdir', '')
// Only write out the `.sindriignore` file if it doesn't already exist.
let sindriIgnoreExists: boolean
try {
await plugin.call('fileManager', 'readFile', './.sindriignore')
sindriIgnoreExists = true
} catch {
sindriIgnoreExists = false
}
if (!sindriIgnoreExists) {
if (!('.sindriignore' in existingFiles)) {
await plugin.call('fileManager', 'writeFile',
'.sindriignore',
// @ts-ignore
@ -20,14 +15,7 @@ export const sindriScripts = async (plugin) => {
}
// Only write out the `sindri.json` file if it doesn't already exist.
let sindriJsonExists: boolean
try {
await plugin.call('fileManager', 'readFile', './sindri.json')
sindriJsonExists = true
} catch {
sindriJsonExists = false
}
if (!sindriJsonExists) {
if (!('sindri.json' in existingFiles)) {
await plugin.call('fileManager', 'writeFile',
'sindri.json',
// @ts-ignore

Loading…
Cancel
Save