From 48796de9dec3de1a8b28b6646bce8a6d299693e6 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Sat, 23 May 2020 20:54:20 -0400 Subject: [PATCH] Update Examples --- build.gradle | 2 ++ examples/typescript/build.gradle | 6 ++-- examples/typescript/src/main/ts/.gitignore | 3 +- examples/typescript/src/main/ts/package.json | 3 +- examples/typescript/src/main/ts/tsconfig.json | 9 +++--- examples/typescript/typescript.build.gradle | 28 ++++++++++++++++++- gradle/wrapper/gradle-wrapper.properties | 2 +- src/main/ts/.gitignore | 2 +- src/main/ts/tsconfig.json | 4 +-- src/main/ts/typedoc.json | 2 +- typescript.build.gradle | 6 ++-- 11 files changed, 47 insertions(+), 20 deletions(-) diff --git a/build.gradle b/build.gradle index ac9c081..bcbaa33 100644 --- a/build.gradle +++ b/build.gradle @@ -70,6 +70,7 @@ publishing { builtBy remapJar } artifact(typescriptAPI) { + classifier 'api' builtBy typescriptAPI } } @@ -78,5 +79,6 @@ publishing { maven { url '/data/maven' } + mavenLocal() } } \ No newline at end of file diff --git a/examples/typescript/build.gradle b/examples/typescript/build.gradle index a4b6ce2..0db5e48 100644 --- a/examples/typescript/build.gradle +++ b/examples/typescript/build.gradle @@ -21,6 +21,8 @@ repositories { } } +apply from: './typescript.build.gradle' + dependencies { minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.minecraft_version}+build.${project.yarn_build}:v2" @@ -28,9 +30,9 @@ dependencies { modImplementation "com.thebrokenrail:scriptcraft:${project.minecraft_version}" include "com.thebrokenrail:scriptcraft:${project.minecraft_version}" -} -apply from: './typescript.build.gradle' + typescript "com.thebrokenrail:scriptcraft:${project.minecraft_version}:api" +} processResources { inputs.property 'version', mod_version diff --git a/examples/typescript/src/main/ts/.gitignore b/examples/typescript/src/main/ts/.gitignore index 426ba21..7d245c9 100644 --- a/examples/typescript/src/main/ts/.gitignore +++ b/examples/typescript/src/main/ts/.gitignore @@ -1,4 +1,3 @@ node_modules/ package-lock.json -scriptcraft/ -lib/ \ No newline at end of file +build/ \ No newline at end of file diff --git a/examples/typescript/src/main/ts/package.json b/examples/typescript/src/main/ts/package.json index 70cecf4..d88f4c5 100644 --- a/examples/typescript/src/main/ts/package.json +++ b/examples/typescript/src/main/ts/package.json @@ -1,7 +1,6 @@ { "devDependencies": { - "typescript": "latest", - "scriptcraft-api": "https://maven.thebrokenrail.com/com/thebrokenrail/scriptcraft/1.15.2/scriptcraft-1.15.2-api.tar.gz" + "typescript": "latest" }, "scripts": { "build": "tsc" diff --git a/examples/typescript/src/main/ts/tsconfig.json b/examples/typescript/src/main/ts/tsconfig.json index ee8c949..aee35ec 100644 --- a/examples/typescript/src/main/ts/tsconfig.json +++ b/examples/typescript/src/main/ts/tsconfig.json @@ -8,13 +8,12 @@ "module": "es2020", "target": "es2020", "removeComments": true, - "typeRoots": ["node_modules/scriptcraft-api/types"], - "rootDir": "src", - "baseUrl": "src", + "typeRoots": ["build/dependencies/types"], "paths": { - "minecraft": ["../node_modules/scriptcraft-api/lib/minecraft/index.d.ts"] + "*": ["*", "../build/dependencies/lib/*"] }, - "outDir": "lib/ts", + "baseUrl": "src", + "outDir": "build/ts", "moduleResolution": "node", "resolveJsonModule": true }, diff --git a/examples/typescript/typescript.build.gradle b/examples/typescript/typescript.build.gradle index 14c283f..2edc049 100644 --- a/examples/typescript/typescript.build.gradle +++ b/examples/typescript/typescript.build.gradle @@ -1,7 +1,7 @@ def typescriptRoot = 'src/main/ts' def typescriptRootFile = new File(rootDir.absolutePath, typescriptRoot) -def typescriptOut = new File(typescriptRootFile, 'lib/ts') +def typescriptOut = new File(typescriptRootFile, 'build/ts') def nodeModules = new File(typescriptRootFile, 'node_modules') @@ -22,6 +22,31 @@ task typescriptInstall(group: 'typescript', type: Exec) { } } +def typescriptDependencies = new File(typescriptRootFile, 'build/dependencies') + +configurations { + typescript { + transitive false + } +} + +task extractTypescriptDependencies(group: 'typescript') { + doFirst { + project.delete { + delete typescriptDependencies + } + typescriptDependencies.mkdirs() + configurations.typescript.resolve().each { file -> + project.copy { + from(zipTree(file).matching { + exclude 'META-INF', 'META-INF/**' + }) + into typescriptDependencies + } + } + } +} + task typescript(group: 'typescript', type: Exec) { inputs.dir typescriptRootFile outputs.dirs typescriptOut @@ -40,6 +65,7 @@ task typescript(group: 'typescript', type: Exec) { } typescript.dependsOn typescriptInstall +typescript.dependsOn extractTypescriptDependencies processResources.dependsOn typescript diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 5baddfb..7ad542d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ #Sat Feb 29 21:58:32 EST 2020 -distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-all.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStorePath=wrapper/dists diff --git a/src/main/ts/.gitignore b/src/main/ts/.gitignore index e2dd579..7d245c9 100644 --- a/src/main/ts/.gitignore +++ b/src/main/ts/.gitignore @@ -1,3 +1,3 @@ node_modules/ package-lock.json -lib/ \ No newline at end of file +build/ \ No newline at end of file diff --git a/src/main/ts/tsconfig.json b/src/main/ts/tsconfig.json index ae86a58..1079dad 100644 --- a/src/main/ts/tsconfig.json +++ b/src/main/ts/tsconfig.json @@ -11,9 +11,9 @@ "typeRoots": ["types"], "rootDir": "src", "baseUrl": "src", - "outDir": "lib/ts", + "outDir": "build/ts", "declaration": true, - "declarationDir": "lib/dts", + "declarationDir": "build/dts", "moduleResolution": "node", "resolveJsonModule": true }, diff --git a/src/main/ts/typedoc.json b/src/main/ts/typedoc.json index 80a80dd..3ebb019 100644 --- a/src/main/ts/typedoc.json +++ b/src/main/ts/typedoc.json @@ -5,5 +5,5 @@ "excludeExternals": true, "excludePrivate": true, "stripInternal": true, - "out": "lib/typedoc" + "out": "build/typedoc" } \ No newline at end of file diff --git a/typescript.build.gradle b/typescript.build.gradle index 050c6de..af23f11 100644 --- a/typescript.build.gradle +++ b/typescript.build.gradle @@ -14,8 +14,8 @@ task typescriptInstall(group: 'typescript', type: Exec) { args 'install' } -def typescriptOut = new File(typescriptRootFile, 'lib/ts') -def dtsOut = new File(typescriptRootFile, 'lib/dts') +def typescriptOut = new File(typescriptRootFile, 'build/ts') +def dtsOut = new File(typescriptRootFile, 'build/dts') task typescript(group: 'typescript', type: Exec) { inputs.dir typescriptRootFile @@ -65,7 +65,7 @@ eslint.dependsOn typescriptInstall processResources.dependsOn typescript -def typedocOut = new File(typescriptRootFile, 'lib/typedoc') +def typedocOut = new File(typescriptRootFile, 'build/typedoc') task typedoc(group: 'typescript', type: Exec) { inputs.dir typescriptRootFile