@@ -51,9 +51,10 @@ class p5jsEditor(base: Base, path: String?, state: EditorState?, mode: Mode?): E
5151 val folder = sketch.folder
5252 val name = sketch.name
5353
54- // TODO: `getContentFile` is deprecated; what is the suggested "built-in JAR Resources system"?
55- var javascriptFolder = Platform .getContentFile(" modes/p5js/js" )
56- javascriptFolder.listFiles().forEach { it.copyTo(File (folder, it.name), true ) }
54+ // TODO: `getContentFile` is deprecated; move to JAR resource system if time allows
55+ var javascriptFolder = mode?.getContentFile(" js" )
56+ // TODO: Better error handling in case Electron scaffolding is not found
57+ javascriptFolder?.listFiles()?.forEach { it.copyTo(File (folder, it.name), true ) }
5758
5859 // TODO: Find a better way to load actual sketch file
5960 val indexHtml = """
@@ -82,6 +83,7 @@ class p5jsEditor(base: Base, path: String?, state: EditorState?, mode: Mode?): E
8283 """ .trimIndent()
8384 File (" $folder /index.html" ).writeText(indexHtml)
8485
86+ runNpmActions(folder, TYPE .npm, listOf (" install" , " -g" , " pnpm" ))
8587 // --dangerously-allow-all-builds allows electron in particular to install properly
8688 runNpmActions(folder, TYPE .pnpm, listOf (" install" , " --dangerously-allow-all-builds" ))
8789 }
@@ -194,7 +196,7 @@ class p5jsEditor(base: Base, path: String?, state: EditorState?, mode: Mode?): E
194196 }
195197
196198 enum class TYPE {
197- pnpm, npx
199+ npm, pnpm, npx
198200 }
199201
200202 val processes = mutableListOf<Process >()
0 commit comments