|
|
import org.gradle.internal.os.OperatingSystem;
|
|
|
|
|
|
plugins {
|
|
|
id "org.implab.gradle-typescript" version "1.3.4"
|
|
|
}
|
|
|
|
|
|
def isWindows = OperatingSystem.current().isWindows();
|
|
|
|
|
|
npm {
|
|
|
npmCmd = isWindows ? 'npm.cmd' : 'npm';
|
|
|
}
|
|
|
|
|
|
sources {
|
|
|
main { me ->
|
|
|
ts {
|
|
|
// to check typings with the compiler
|
|
|
srcDir me.typings
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
typescript {
|
|
|
compilerOptions {
|
|
|
lib = ["es5", "dom", "scripthost", "es2015.promise", "es2015.symbol", "es2015.iterable"]
|
|
|
declaration = true
|
|
|
types = ["requirejs"]
|
|
|
module = "amd"
|
|
|
it.target = "es5"
|
|
|
moduleResolution = "node"
|
|
|
// traceResolution = true
|
|
|
|
|
|
}
|
|
|
|
|
|
// для варианта с локальными tsc, eslint, tslint
|
|
|
tscCmd = "${projectDir}/node_modules/.bin/" + (isWindows ? 'tsc.cmd' : 'tsc')
|
|
|
esLintCmd = "${projectDir}/node_modules/.bin/" + (isWindows ? 'eslint.cmd' : 'eslint')
|
|
|
tsLintCmd = "${projectDir}/node_modules/.bin/" + (isWindows ? 'tslint.cmd' : 'tslint')
|
|
|
}
|
|
|
|
|
|
configureTsTest {
|
|
|
compilerOptions {
|
|
|
types = [
|
|
|
"../main/typings/dojo/modules",
|
|
|
"../main/typings/dijit/modules",
|
|
|
"../main/typings/dojo/NodeList-fx"
|
|
|
]
|
|
|
module = "ESNext"
|
|
|
it.target = "ESNext"
|
|
|
}
|
|
|
}
|
|
|
|
|
|
npmPackMeta {
|
|
|
meta {
|
|
|
name = "@$npmScope/$project.name"
|
|
|
}
|
|
|
}
|
|
|
|
|
|
task npmPackTypings(type: Copy) {
|
|
|
dependsOn typings
|
|
|
|
|
|
npmPackContents.dependsOn it
|
|
|
|
|
|
from typescript.typingsDir
|
|
|
into npm.packageDir
|
|
|
}
|
|
|
|
|
|
task printVersion {
|
|
|
doLast {
|
|
|
println "packageName: ${npmPackMeta.metadata.get().name}";
|
|
|
println "version: $version";
|
|
|
println "target: $typescript.compilerOptions.target";
|
|
|
println "module: $typescript.compilerOptions.module";
|
|
|
}
|
|
|
}
|