Skip to content

Commit 91effd4

Browse files
committed
Prepare *.pdex and make install work
1 parent 02815b6 commit 91effd4

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

p5js/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ tasks.register<Zip>("createPdex") {
5555
dependsOn("createMode")
5656
from(tasks.named("createMode"))
5757

58-
archiveBaseName.set("p5js_mode")
5958
archiveExtension.set("pdex")
6059
destinationDirectory.set(layout.buildDirectory)
6160
}

p5js/library/mode.properties

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name=p5.js Mode POC
2+
category=Unknown
3+
authors=[Stef Tervelde](http://steftervel.de)
4+
url=https://github.com/stefterv/p5js-mode
5+
sentence=P5.js Mode for Processing
6+
paragraph=
7+
version=1
8+
prettyVersion=1
9+
lastUpdated=0
10+
minRevision=0
11+
maxRevision=0
12+
imports=

p5js/src/main/kotlin/p5jsEditor.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)