Closed milgner closed 1 year ago
For the syntax, this is a Gradle thing and with 8.1-rc-1 there's experimental support for enabling that kind of syntax in the Kotlin DSL as well
For the issue at hand this is unfortunately a limitation in the plugin, package.json
is picked up from the project folder and I guess the recommendation here would be to move package.json
to the same directory as your build script or possibly make a separate project just for the frontend (but I suspect that it might look weird with your layout)
There isn't any good reason to not allow you to manually do this change, but I'd have to add that support and I'm suffering through dental issues right now so it'll take me a while to get that done and released.
In short, it's a missing feature but with the project layouts I've previously seen this hasn't been an issue. Though most of them have been like the examples/simple-node project
First of all, I hope that your dental issues get better, soon. If it's indeed just a missing feature, I can look into adding support for that, too.
Oh actually, this might already exist, I was looking at the wrong branch
If you set nodeProjectDir
in the node extension (as you have) then this should work, so this might actually be a bug rather than a missing feature
The weird part here is, there's actually a test for this and it's been passing: https://github.com/node-gradle/gradle-node-plugin/blob/0125322/src/test/groovy/com/github/gradle/node/pnpm/task/PnpmInstall_integTest.groovy#L91-L111
Hi there, I'm Ronald, the creator of JobRunr and I was currently evaluating whether this plugin would for the JobRunr.
I'm also in need of the workingDir setting as the REACT code is in the folder src/main/resources/org/jobrunr/dashboard/frontend
.
I noticed that I'm also bumping into this bug:
task npmRunBuild(type: NodeTask) {
workingDir = new File(projectDir, 'src/main/resources/org/jobrunr/dashboard/frontend')
logger.warn('Setting working dir to ' + new File(projectDir, 'src/main/resources/org/jobrunr/dashboard/frontend'))
script = file('package.json')
args = ['run', 'build']
}
The output:
...
Setting working dir to /Users/rdehuyss/Projects/Personal/jobrunr/jobrunr/core/src/main/resources/org/jobrunr/dashboard/frontend
...
* What went wrong:
A problem was found with the configuration of task ':core:npmRunBuild' (type 'NodeTask').
- In plugin 'com.github.node-gradle.node' type 'com.github.gradle.node.task.NodeTask' property 'script' specifies file '/Users/rdehuyss/Projects/Personal/jobrunr/jobrunr/core/package.json' which doesn't exist.
@rdehuyss iirc all you should need to set is nodeProjectDir
on the extension itself like here
I guess in this case it's very un-intuitive that the tasks themselves configure some things
I'm not able to reproduce this and the tests pass, this is probably our documentation being bad. But if anyone has a reproducer let me know and I'll fix it immediately
(It may also have been accidentally fixed in 6.0.0, but the tests passed even before my changes)
My
package.json
isn't in the same directory as mybuild.gradle.kts
but insrc/frontend
.I tried this
along with
but none of these made any difference: I still get
It also strikes as a little bit strange that I'd have to call
workingDir.set(...)
instead ofworkingDir = ...
but I guess that might be because Groovy and Kotlin having different concepts of mutability.In any case, it's not clear whether I'm just doing something wrong, there is a bug or a missing feature? I couldn't find any equivalent to specifying the path to
package.json
.