MCPcopy Create free account
hub / github.com/IgorWarzocha/howcode / main

Function main

scripts/dev-electron.ts:87–120  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

85}
86
87async function main() {
88 await waitForBuildArtifacts()
89 await startElectronProcess()
90
91 for (const filePath of watchedFiles) {
92 watchFile(filePath, { interval: 250 }, (current, previous) => {
93 if (current.mtimeMs !== previous.mtimeMs) {
94 scheduleRestart()
95 }
96 })
97 }
98
99 const cleanup = () => {
100 if (restartTimer) {
101 clearTimeout(restartTimer)
102 restartTimer = null
103 }
104
105 for (const filePath of watchedFiles) {
106 unwatchFile(filePath)
107 }
108
109 stopElectronProcess()
110 }
111
112 process.once('SIGINT', () => {
113 cleanup()
114 process.exit(0)
115 })
116 process.once('SIGTERM', () => {
117 cleanup()
118 process.exit(0)
119 })
120}
121
122void main().catch((error) => {
123 console.error(error)

Callers 1

dev-electron.tsFile · 0.70

Calls 4

waitForBuildArtifactsFunction · 0.85
startElectronProcessFunction · 0.85
scheduleRestartFunction · 0.85
cleanupFunction · 0.85

Tested by

no test coverage detected