task install(type: Exec) {
    workingDir "$projectDir.absolutePath"
    commandLine "npm", "i"
    commandLine "yarn", "install"
}

String getArtifactsPath() {
    return "$projectDir.absolutePath/artifacts/"
}

task clean() {
    doLast {
        new File(getArtifactsPath()).deleteDir()
    }
}

task build(type: Exec, dependsOn: install) {
    commandLine "yarn"
    commandLine "yarn", "compile"
}

task makeArtifact(type: Copy) {
    dependsOn(tasks.getByName("clean"))
    dependsOn(tasks.getByName("build"))
    from("$projectDir.absolutePath/dist/js/") { include "uikit.min.*" }
    from("$projectDir.absolutePath/dist/css/") { include "uikit-core.min.*" }
    into getArtifactsPath()
}