Replaced hardcoded API URLs with environment-specific configurations. Added new environments (development, beta, production) with respective settings. Updated build scripts and Angular file replacements to support environment-based builds.
59 lines
1.6 KiB
Plaintext
59 lines
1.6 KiB
Plaintext
import com.github.gradle.node.NodeExtension
|
|
import com.github.gradle.node.npm.task.NpmTask
|
|
|
|
plugins {
|
|
id("com.github.node-gradle.node") version "7.1.0"
|
|
id("base") // This adds the standard Gradle lifecycle tasks like "build"
|
|
}
|
|
|
|
node {
|
|
download.set(true)
|
|
version.set("22.14.0")
|
|
npmVersion.set("10.9.2")
|
|
workDir.set(file("${project.projectDir}/node"))
|
|
npmWorkDir.set(file("${project.projectDir}/node"))
|
|
}
|
|
|
|
// Clean the distribution directory
|
|
tasks.register<Delete>("cleanDist") {
|
|
description = "Clean the distribution directory"
|
|
delete("dist")
|
|
}
|
|
|
|
// Create a task that will run npm build
|
|
tasks.register("npmBuild") {
|
|
description = "Run 'npm run build'"
|
|
group = "build"
|
|
|
|
doLast {
|
|
// Use nodeCommand directly from the plugin
|
|
project.exec {
|
|
workingDir(project.projectDir)
|
|
|
|
// Use node's npm to ensure it works on all environments
|
|
val nodeDir = "${project.projectDir}/node"
|
|
val isWindows = System.getProperty("os.name").lowercase().contains("windows")
|
|
|
|
if (isWindows) {
|
|
val npmCmd = file(nodeDir).listFiles()?.find { it.name.startsWith("npm") && it.isDirectory }?.let {
|
|
"${it.absolutePath}/npm.cmd"
|
|
} ?: "$nodeDir/node_modules/npm/bin/npm.cmd"
|
|
|
|
commandLine(npmCmd, "run", "build:dev")
|
|
} else {
|
|
val npmExecutable = file(nodeDir).listFiles()?.find { it.name.startsWith("npm") && it.isDirectory }?.let {
|
|
"${it.absolutePath}/bin/npm"
|
|
} ?: "$nodeDir/node_modules/npm/bin/npm"
|
|
|
|
commandLine(npmExecutable, "run", "build:beta")
|
|
}
|
|
}
|
|
}
|
|
|
|
dependsOn("npmInstall")
|
|
}
|
|
|
|
tasks.named("assemble") {
|
|
dependsOn("npmBuild")
|
|
}
|