Skip to content

Commit

Permalink
Merge pull request #1406 from phac-nml/gradle-node-optimizations
Browse files Browse the repository at this point in the history
BUILD: gradle buildWebapp enhancements
  • Loading branch information
joshsadam authored Nov 8, 2022
2 parents 47ee6d6 + 4db2639 commit 0824d2f
Show file tree
Hide file tree
Showing 4 changed files with 236 additions and 12 deletions.
14 changes: 9 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -304,15 +304,19 @@ tasks.register<PnpmTask>("cleanWebapp") {
}

tasks.register<PnpmTask>("buildWebapp") {
dependsOn(":cleanWebapp")
pnpmCommand.set(listOf("build"))
inputs.dir("${project.projectDir}/src/main/webapp/resources")
inputs.files(fileTree("${project.projectDir}/src/main/webapp/resources"))
inputs.file("${project.projectDir}/src/main/webapp/package.json")
inputs.file("${project.projectDir}/src/main/webapp/pnpm-lock.yaml")

outputs.dir("${project.projectDir}/src/main/webapp/dist")

dependsOn(":pnpmInstall")
pnpmCommand.set(listOf("clean", "build"))
}

tasks.register<PnpmTask>("startWebapp") {
dependsOn(":cleanWebapp")
pnpmCommand.set(listOf("start"))
dependsOn(":pnpmInstall")
pnpmCommand.set(listOf("clean", "start"))
inputs.dir("${project.projectDir}/src/main/webapp/resources")
outputs.dir("${project.projectDir}/src/main/webapp/dist")
}
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pluginManagement {
gradlePluginPortal()
}
plugins {
id("com.github.node-gradle.node") version "3.4.0"
id("com.github.node-gradle.node") version "3.5.0"
id("io.spring.dependency-management") version "1.0.11.RELEASE"
id("org.gradle.test-retry") version "1.4.0"
id("org.springframework.boot") version "2.7.4"
Expand Down
13 changes: 7 additions & 6 deletions src/main/webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"version": "1.0.0",
"license": "Apache-2.0",
"scripts": {
"build": "webpack --mode production",
"start": "webpack --mode development --watch",
"clean": "rm -rf dist/ pages/templates/i18n/",
"test": "jest resources/js/**/*.test.js",
"test_watch": "jest --watch resources/js/**/*.test.js",
"lint": "eslint --ext resources/js/**/*.{js,jsx,ts,tsx}"
"build": "run-z --then webpack --mode production",
"start": "run-z --then webpack --mode development --watch",
"clean": "run-z --then rm -rf dist/ pages/templates/i18n/",
"test": "run-z --then jest resources/js/**/*.test.js",
"test_watch": "run-z --then jest --watch resources/js/**/*.test.js",
"lint": "run-z --then eslint --ext resources/js/**/*.{js,jsx,ts,tsx}"
},
"browserslist": [
"last 2 Chrome versions",
Expand Down Expand Up @@ -128,6 +128,7 @@
"prettier": "^2.7.0",
"properties-reader": "^2.2.0",
"react-is": "^17.0.2",
"run-z": "^1.10.1",
"speed-measure-webpack-plugin": "^1.5.0",
"terser-webpack-plugin": "^5.3.1",
"typescript": "^4.7.2",
Expand Down
Loading

0 comments on commit 0824d2f

Please sign in to comment.