Improve Structure
ScriptCraft/pipeline/head There was a failure building this commit Details

This commit is contained in:
TheBrokenRail 2020-04-28 12:44:44 -04:00
parent 2539e98a44
commit 855fd08287
21 changed files with 69 additions and 54 deletions

1
.gitignore vendored
View File

@ -15,7 +15,6 @@ classes/
# vscode
.settings/
.vscode/
bin/
.classpath
.project

View File

@ -1,5 +1,8 @@
# ScriptCraft
JS API for Minecraft
## API
[View TypeDoc](https://jenkins.thebrokenrail.com/job/ScriptCraft/job/master/TypeDoc/)
## Changelog
[View Changelog](CHANGELOG.md)

View File

@ -1,34 +0,0 @@
interface JavaObject {
discriminator: 'JavaObject';
}
type BridgeValueType = void | string | number | boolean | JavaObject | BridgeValueType[];
type BridgeType = (...args: BridgeValueType[]) => BridgeValueType;
interface ScriptCraft {
useBridge(name: string, ...args: BridgeValueType[]): BridgeValueType;
bridges: { [key: string]: BridgeType };
}
declare const __scriptcraft__: ScriptCraft;
interface Console {
log(...args: string[]): void;
info(...args: string[]): void;
warn(...args: string[]): void;
error(...args: string[]): void;
dir(...args: string[]): void;
debug(...args: string[]): void;
trace(...args: string[]): void;
assert(condition: boolean, ...args: string[]): void;
}
declare const console: Console;
declare module 'scriptcraft-core' {
function addBridge(name: string, bridge: BridgeType): void;
function useBridge(name: string, ...args: BridgeValueType[]): BridgeValueType;
}

View File

@ -16,28 +16,42 @@
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"rules": {
"no-extra-parens": "off",
"@typescript-eslint/no-extra-parens": "error",
"semi": "off",
"@typescript-eslint/semi": "error",
"curly": "error",
"indent": "off",
"@typescript-eslint/indent": ["error", 4],
"arrow-parens": ["error", "as-needed"],
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-use-before-define": "off",
"quotes": ["error", "single"],
"quotes": "off",
"@typescript-eslint/quotes": ["error", "single"],
"eol-last": ["error", "always"],
"no-eq-null": "error",
"no-unneeded-ternary": "error",
"block-spacing": "error",
"camelcase": "error",
"camelcase": "off",
"@typescript-eslint/camelcase": "error",
"comma-dangle": ["error", "never"],
"func-call-spacing": ["error", "never"],
"func-call-spacing": "off",
"@typescript-eslint/func-call-spacing": ["error", "never"],
"function-call-argument-newline": ["error", "never"],
"implicit-arrow-linebreak": ["error", "beside"],
"linebreak-style": ["error", "unix"],
"no-trailing-spaces": "error",
"no-lonely-if": "error",
"no-var": "error",
"prefer-arrow-callback": "error"
"prefer-arrow-callback": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/prefer-readonly": "error",
"brace-style": "off",
"@typescript-eslint/brace-style": "error",
"dot-notation": "off",
"@typescript-eslint/dot-notation": "error",
"no-extra-semi": "off",
"@typescript-eslint/no-extra-semi": "error"
}
}

5
src/main/ts/.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,5 @@
{
"recommendations": [
"dbaeumer.vscode-eslint"
]
}

11
src/main/ts/.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,11 @@
{
"[typescript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"files.autoSave": "afterDelay",
"typescript.updateImportsOnFileMove.enabled": "always",
"eslint.format.enable": true,
"editor.insertSpaces": true,
"editor.detectIndentation": false,
"editor.tabSize": 4
}

View File

@ -73,7 +73,7 @@ export class CustomBlock {
/**
* @internal
*/
settings: BlockSettings;
readonly settings: BlockSettings;
constructor(settings: BlockSettings) {
this.settings = settings;

View File

@ -0,0 +1,26 @@
interface JavaObject {
discriminator: 'JavaObject';
}
type BridgeValueType = void | string | number | boolean | JavaObject | BridgeValueType[];
type BridgeType = (...args: readonly BridgeValueType[]) => BridgeValueType;
interface Console {
log(...args: readonly string[]): void;
info(...args: readonly string[]): void;
warn(...args: readonly string[]): void;
error(...args: readonly string[]): void;
dir(...args: readonly string[]): void;
debug(...args: readonly string[]): void;
trace(...args: readonly string[]): void;
assert(condition: boolean, ...args: readonly string[]): void;
}
declare const console: Console;
declare module 'scriptcraft-core' {
function addBridge(name: string, bridge: BridgeType): void;
function useBridge(name: string, ...args: readonly BridgeValueType[]): BridgeValueType;
}

View File

@ -1,6 +1,6 @@
def typescriptOut = new File(buildDir, 'generated/typescript')
def typescriptRoot = 'src/main/js'
def typescriptRoot = 'src/main/ts'
def typescriptRootFile = new File(rootDir.absolutePath, typescriptRoot)
task typescript(group: 'build') {
@ -19,7 +19,7 @@ task typescript(group: 'build') {
executable 'npm'
args 'run', 'build', '--'
args '--outDir', new File(typescriptOut, 'scriptcraft').absolutePath
args '--outDir', typescriptOut.absolutePath
}
}
}
@ -58,16 +58,7 @@ task typedoc(group: 'documentation') {
}
processResources {
from typescriptOut.absolutePath
}
task typedocJar(type: Jar) {
classifier 'typedoc'
from typedocOut
}
typedocJar.dependsOn typedoc
artifacts {
archives typedocJar
from(typescriptOut.absolutePath) {
into 'scriptcraft'
}
}