1
0
mirror of synced 2026-01-25 10:01:49 -05:00
Files
airbyte/airbyte-webapp/build.gradle
Tim Roes 828b32a3a2 🪟 🔧 Migrate from react-scripts to Vite (#21421)
* Migrate to Vite

* Continue work on vite migration

* More environment fixes

* Add CSP headers to dev server

* Remove react-scripts

* Shim process.env

* Cleanup

* Create ESLint failure for CI test

* create vite-plugins package

* Update nodeJS

* Make eslint warnings fail build

* Remove trailing empty line in nvmrc

* Match package.json with nvmrc

* Fix eslint test breakage

* Revert node upgrade

* Remove setupProxy script

* Change default API endpoints to be http
2023-01-23 21:10:23 +01:00

121 lines
2.9 KiB
Groovy

plugins {
id "base"
id "com.github.node-gradle.node" version "3.3.0"
}
// Use the node version that's defined in the .nvmrc file
def nodeVersion = new File("${projectDir}/.nvmrc").text.trim();
// This array should contain a path to all configs that are common to most build tasks and
// might affect them (i.e. if any of those files change we want to rerun most tasks)
def commonConfigs = [
'.env',
'package.json',
'package-lock.json',
'tsconfig.json',
'.prettierrc.js'
]
node {
download = true
version = nodeVersion
npmInstallCommand = 'ci'
}
npm_run_build {
inputs.files commonConfigs
inputs.file '.eslintrc.js'
inputs.dir 'public'
inputs.dir 'src'
outputs.dir 'build/app'
}
task test(type: NpmTask) {
dependsOn assemble
args = ['run', 'test:ci']
inputs.files commonConfigs
inputs.dir 'src'
}
task licenseCheck(type: NpmTask) {
dependsOn npmInstall
args = ['run', 'license-check']
inputs.files commonConfigs
inputs.file 'scripts/license-check.js'
// The licenseCheck has no outputs, thus we always treat the outpus up to date
// as long as the inputs have not changed
outputs.upToDateWhen { true }
}
task validateLinks(type: NpmTask) {
dependsOn npmInstall
args = ['run', 'validate-links']
// Since the output of this task depends on availability of URLs
// we never want to treat it as "up-to-date" and always want to run it
outputs.upToDateWhen { false }
}
task buildStorybook(type: NpmTask) {
dependsOn npmInstall
args = ['run', 'build:storybook']
inputs.files commonConfigs
inputs.dir '.storybook'
inputs.dir 'public'
inputs.dir 'src'
outputs.dir 'build/storybook'
}
task copyBuildOutput(type: Copy) {
dependsOn copyDocker, npm_run_build
from "${project.projectDir}/build/app"
into 'build/docker/bin/build'
}
task copyDocs(type: Copy) {
dependsOn copyDocker, copyBuildOutput
from "${project.rootProject.projectDir}/docs/integrations"
into "build/docker/bin/build/docs/integrations"
// google-ads.md is blocked by Ad Blockers
rename ('google-ads.md', 'gglad.md')
duplicatesStrategy DuplicatesStrategy.INCLUDE
}
// Copy images that are used in .md integration documentation docs
task copyDocAssets(type: Copy) {
dependsOn copyDocker, copyBuildOutput
from "${project.rootProject.projectDir}/docs/.gitbook"
into "build/docker/bin/build/docs/.gitbook"
duplicatesStrategy DuplicatesStrategy.INCLUDE
}
task copyNginx(type: Copy) {
dependsOn copyDocker
from "${project.projectDir}/nginx"
into "build/docker/bin/nginx"
}
// Those tasks should be run as part of the "check" task
check.dependsOn validateLinks, licenseCheck, test
build.dependsOn buildStorybook
tasks.named("buildDockerImage") {
dependsOn copyDocker
dependsOn copyBuildOutput
dependsOn copyNginx
dependsOn copyDocs
dependsOn copyDocAssets
}