Don't overwrite `sindri.json` if it exists.

pull/4512/head
Evan Sangaline 10 months ago committed by Aniket
parent 23b7f99e59
commit 36fe74c552
  1. 30
      libs/remix-ws-templates/src/script-templates/sindri/index.ts

@ -1,15 +1,23 @@
export const sindriScripts = async (plugin) => {
await plugin.call('fileManager', 'writeFile',
'scripts/sindri/sindri.ts' ,
// @ts-ignore
(await import('!!raw-loader!./sindri.ts')).default)
await plugin.call('fileManager', 'writeFile',
'scripts/sindri/sindri.ts' ,
// @ts-ignore
(await import('!!raw-loader!./sindri.ts')).default)
await plugin.call('fileManager', 'writeFile',
'sindri.json' ,
// Only write out the `sindri.json` file if it doesn't already exist.
let sindriJsonExists: boolean
try {
await plugin.call('fileManager', 'readFile', './fake.json')
sindriJsonExists = true
} catch {
sindriJsonExists = false
}
if (!sindriJsonExists) {
await plugin.call('fileManager', 'writeFile',
'sindri.json',
// @ts-ignore
(await import('raw-loader!./sindri.conf')).default)
await plugin.call('fileManager', 'open', 'scripts/sindri/sindri.ts')
}
}
await plugin.call('fileManager', 'open', 'scripts/sindri/sindri.ts')
}

Loading…
Cancel
Save