LocationBasedServices/mowesta/master This commit looks good
Upgrade Angular to 9. Update js dependencies to latest versions. Remove js dependencies that are no longer required. Replace angular client gen with official swagger generator. Change build scripts and adapt code to new client.
62 lines
1.5 KiB
Groovy
62 lines
1.5 KiB
Groovy
plugins {
|
|
id "com.moowork.node" version "1.3.1"
|
|
id 'org.hidetake.swagger.generator' version '2.18.1'
|
|
}
|
|
|
|
description = 'Mowesta Web Angular'
|
|
|
|
dependencies {
|
|
swaggerCodegen 'io.swagger:swagger-codegen-cli:2.4.12'
|
|
}
|
|
|
|
node {
|
|
version = '10.16.0'
|
|
npmVersion = '6.9.0'
|
|
download = true
|
|
}
|
|
|
|
class IoNodeTask extends com.moowork.gradle.node.task.NodeTask {
|
|
@Input
|
|
File inputFile;
|
|
@OutputDirectory
|
|
File outputDir;
|
|
}
|
|
|
|
task cleanApi(type: Delete) {
|
|
delete './src/api', './dist'
|
|
}
|
|
|
|
task ngBuild(type: IoNodeTask) {
|
|
script = file('node_modules/@angular/cli/bin/ng')
|
|
args = ['build', '--prod']
|
|
inputFile = project.file('./src/')
|
|
outputDir = project.file('./dist/')
|
|
}
|
|
|
|
|
|
swaggerSources {
|
|
mowesta {
|
|
inputFile = file(project(':common-api:').buildDir.path + '/swagger/mowesta.json')
|
|
code {
|
|
outputDir = file("./src/api/")
|
|
language = 'typescript-angular'
|
|
configFile = file('apiconfig.json')
|
|
components = [models: true, apis: 'Default', supportingFiles: 'configuration.ts,encoder.ts,api.ts,models.ts,variables.ts']
|
|
wipeOutputDir = true
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
// require api build to access swagger definition
|
|
tasks['resolveSwaggerTemplate'].dependsOn(project(':common-api').tasks['build'])
|
|
// make sure that common api is built before generating the api
|
|
ngBuild.dependsOn(npmInstall)
|
|
// generate the api before running ng build
|
|
ngBuild.dependsOn("generateSwaggerCode")
|
|
// run ng build whenever the project is built
|
|
build.dependsOn("ngBuild")
|
|
|
|
// clean the api folder upon clean
|
|
clean.dependsOn("cleanApi")
|