Compare commits
4 Commits
48515b0fc0
...
v1.1.0
Author | SHA1 | Date | |
---|---|---|---|
423f014219
|
|||
e57810d9d3
|
|||
568e5abbc3
|
|||
14f7b74d0f
|
17
dist/143.index.js
vendored
Normal file
17
dist/143.index.js
vendored
Normal file
File diff suppressed because one or more lines are too long
17
dist/379.index.js
vendored
Normal file
17
dist/379.index.js
vendored
Normal file
File diff suppressed because one or more lines are too long
17
dist/576.index.js
vendored
Normal file
17
dist/576.index.js
vendored
Normal file
File diff suppressed because one or more lines are too long
17
dist/611.index.js
vendored
Normal file
17
dist/611.index.js
vendored
Normal file
File diff suppressed because one or more lines are too long
17
dist/694.index.js
vendored
Normal file
17
dist/694.index.js
vendored
Normal file
File diff suppressed because one or more lines are too long
17
dist/699.index.js
vendored
Normal file
17
dist/699.index.js
vendored
Normal file
File diff suppressed because one or more lines are too long
17
dist/766.index.js
vendored
Normal file
17
dist/766.index.js
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
export const id = 766;
|
||||
export const ids = [766];
|
||||
export const modules = {
|
||||
|
||||
/***/ 1766:
|
||||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
||||
/* harmony export */ });
|
||||
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({"boolean":"un booleano","code-action.block-state-sort-keys":"Ordina stato blocco","code-action.fix-file":"Aggiusta tutti i problemi auto-aggiustabili in questo file","code-action.fix-workspace":"Aggiusta tutti i problemi auto-aggiustabili nel spazio di lavoro","code-action.id-attribute-datafix":"Aggiorna il nome di questo attributo a 1.16","code-action.id-complete-default-namespace":"Completa il namespace predefinito","code-action.id-omit-default-namespace":"Ommetti il namespace predefinito","code-action.id-zombified-piglin-datafix":"Cambia questo ID a quello di un Piglin Zombificato","code-action.nbt-compound-sort-keys":"Ordina i tag NBT composti","code-action.nbt-type-to-byte":"Converti in un tag NBT di byte","code-action.nbt-type-to-double":"Converti in un tag NBT double","code-action.nbt-type-to-float":"Converti in un tag NBT float","code-action.nbt-type-to-int":"Converti in un tag NBT int","code-action.nbt-type-to-long":"Converti in un tag NBT long","code-action.nbt-type-to-short":"Converti in un tag NBT short","code-action.nbt-uuid-datafix":"Aggiorna questo UUID a 1.16","code-action.selector-sort-keys":"Ordina gli argomenti di selettore","code-action.string-double-quote":"Quota questa stringa con doppie virgolette","code-action.string-single-quote":"Quota questa stringa con singole virgolette","code-action.string-unquote":"De-quota questa stringa","code-action.vector-align-0.0":"Allinea questo vettore all'origine del blocco","code-action.vector-align-0.5":"Allinea questo vettore al centro del blocco","conjunction.and_2":"e ","conjunction.and_3+_1":",","conjunction.and_3+_2":", e","conjunction.or_2":"o","conjunction.or_3+_1":",","conjunction.or_3+_2":", o","duplicate-key":"Chiave duplicate %0%","ending-quote":"quotazione finale %0%","entity":"un'entità","expected":"Previsto %0%","expected-got":"Aspettato %0% ma ricevuto %1%","integer":"un numero intero","integer.between":"un numero intero da %0% a %1%","key-not-following-convention":"Chiave invalida %0% che non segue il convegno %1%","long":"un long","mcfunction.parser.leading-slash.unexpected":"Barra '/' inaspettata","not-matching-any-child":"Fallito a combaciare con qualsiasi figli nell'albero del sintassi del commando","nothing":"niente","number":"un numero","number-range":"un intervallo di numeri","number-range.missing-min-and-max":"Aspettato un valore minimo o massimo","number.<=":"un numero meno o uguale a %0%","number.>=":"un numero maggiore o uguale a %0%","number.between":"un numero da %0% a %1%","objective":"un oggettivo","punc.period":".","punc.quote":"'%0%'","quote":"una quotazione ('\"o\"')","score-holder":"un contenitore di punteggio","server.new-version":"Il Server di Linguaggio Datapack é stato aggiornato a una nuova versione: %0%","server.remove-cache-file":"Il file del cache di DHP è stato spostato in un luogo in memoria da VSCose. Ora puoi tranquillamente cancellare il brutto file '.datapack' nel tuo spazio di lavoro.","server.show-release-notes":"Mostra appunti di pubblicazione","string":"uno string","tag":"un tag","team":"una squadra","time-unit":"un unità di tempo","too-many-block-affected":"Troppi blocchi nell'area (massimo: %0%, specificati: %1%)","unexpected-character":"Trovati caratteri che non sono da a-z, da 0-9 o [/._-]","unexpected-datapack-tag":"I tag non sono permessi qui","unexpected-default-namespace":"Namespace predefinito dovrebbe essere ommesso qui","unexpected-local-coordinate":"La coordinata locale %0% non è permessa","unexpected-nbt":"Questo tag non esiste qui","unexpected-nbt-array-type":"Tipo di array invalido %0%. Deve essere un tipo 'B', 'I' o 'L'","unexpected-nbt-path-filter":"Filtri composti sono esclusivamente usati per i tag composti","unexpected-nbt-path-index":"Gli indici sono solo usati per le liste, gli tag e gli array","unexpected-nbt-path-key":"Le chiavi sono solo usati per i tag composti","unexpected-nbt-path-sub":"Il tag corrente non ha elementi extra","unexpected-omitted-default-namespace":"Il namespace predefinito non può essere omesso qui","unexpected-relative-coordinate":"Coordinata %0% non è permessa","unexpected-scoreboard-sub-slot":"Solo il 'sidebar' ha sub-posti","unknown-command":"Commando sconosciuto","unknown-key":"Chiave sconisciuta","unquoted-string":"una stringa non quotata","unsorted-keys":"Chiavi non ordinati","uuid":"un UUID","vector":"Un vettore"});
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
17
dist/944.index.js
vendored
Normal file
17
dist/944.index.js
vendored
Normal file
File diff suppressed because one or more lines are too long
26
dist/check_datapack.d.ts
vendored
26
dist/check_datapack.d.ts
vendored
@@ -1 +1,25 @@
|
||||
export declare function checkDatapack(rootDir: String, version: String): Promise<void>;
|
||||
import * as core from '@spyglassmc/core';
|
||||
export interface ActionOptions {
|
||||
/**
|
||||
* If set to true, all errors are reported. If set to false, only the first error is reported
|
||||
*/
|
||||
reportAllErrors: boolean;
|
||||
/**
|
||||
* If set to true, each error is described, indicating the exact issue. If set to false, only the number of errors in each file is reported
|
||||
*/
|
||||
verbose: boolean;
|
||||
}
|
||||
export declare class CustomService extends core.Service {
|
||||
rootDir: string;
|
||||
options: ActionOptions;
|
||||
constructor(rootDir: string, version: string, options: ActionOptions);
|
||||
shutdown(): Promise<void>;
|
||||
private listFilesByExtension;
|
||||
private makeFileUrl;
|
||||
private getFileContent;
|
||||
private getLineAndColumn;
|
||||
private getErrorProperties;
|
||||
checkFile(path: string, lang: string): Promise<boolean>;
|
||||
checkAllFiles(): Promise<boolean>;
|
||||
}
|
||||
export declare function checkDatapack(rootDir: string, version: string, reportAll: boolean, verbose: boolean): Promise<void>;
|
||||
|
2
dist/check_datapack.d.ts.map
vendored
2
dist/check_datapack.d.ts.map
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"","sourceRoot":"","sources":["file:///home/louis/Documents/spyglassmc-action/src/check_datapack.ts"],"names":[],"mappings":"AAAA,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEnF"}
|
||||
{"version":3,"file":"","sourceRoot":"","sources":["file:///home/louis/Documents/spyglassmc-action/src/check_datapack.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAA;AAQxC,MAAM,WAAW,aAAa;IAC1B;;OAEG;IACH,eAAe,EAAE,OAAO,CAAA;IAExB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAA;CACnB;AAkBD,qBAAa,aAAc,SAAQ,IAAI,CAAC,OAAO;IAC3C,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,aAAa,CAAA;gBAEV,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa;IAiD9D,QAAQ;IAMd,OAAO,CAAC,oBAAoB;IAI5B,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,gBAAgB;IAOxB,OAAO,CAAC,kBAAkB;IAUpB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IA+BvD,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC;CA2B1C;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBzH"}
|
60241
dist/index.js
vendored
60241
dist/index.js
vendored
File diff suppressed because one or more lines are too long
437
package-lock.json
generated
437
package-lock.json
generated
@@ -13,7 +13,8 @@
|
||||
"@actions/github": "^6.0.1",
|
||||
"@spyglassmc/core": "^0.4.34",
|
||||
"@spyglassmc/java-edition": "^0.3.45",
|
||||
"@spyglassmc/mcdoc": "^0.3.38"
|
||||
"@spyglassmc/mcdoc": "^0.3.38",
|
||||
"glob": "^11.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^24.3.1",
|
||||
@@ -74,6 +75,41 @@
|
||||
"node": ">=14"
|
||||
}
|
||||
},
|
||||
"node_modules/@isaacs/balanced-match": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz",
|
||||
"integrity": "sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==",
|
||||
"engines": {
|
||||
"node": "20 || >=22"
|
||||
}
|
||||
},
|
||||
"node_modules/@isaacs/brace-expansion": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@isaacs/brace-expansion/-/brace-expansion-5.0.0.tgz",
|
||||
"integrity": "sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA==",
|
||||
"dependencies": {
|
||||
"@isaacs/balanced-match": "^4.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "20 || >=22"
|
||||
}
|
||||
},
|
||||
"node_modules/@isaacs/cliui": {
|
||||
"version": "8.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz",
|
||||
"integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==",
|
||||
"dependencies": {
|
||||
"string-width": "^5.1.2",
|
||||
"string-width-cjs": "npm:string-width@^4.2.0",
|
||||
"strip-ansi": "^7.0.1",
|
||||
"strip-ansi-cjs": "npm:strip-ansi@^6.0.1",
|
||||
"wrap-ansi": "^8.1.0",
|
||||
"wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/auth-token": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-4.0.0.tgz",
|
||||
@@ -310,6 +346,28 @@
|
||||
"ncc": "dist/ncc/cli.js"
|
||||
}
|
||||
},
|
||||
"node_modules/ansi-regex": {
|
||||
"version": "6.2.2",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz",
|
||||
"integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/ansi-regex?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/ansi-styles": {
|
||||
"version": "6.2.3",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz",
|
||||
"integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/anymatch": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
|
||||
@@ -532,6 +590,22 @@
|
||||
"fsevents": "~2.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/color-convert": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||
"dependencies": {
|
||||
"color-name": "~1.1.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/color-name": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
||||
},
|
||||
"node_modules/commander": {
|
||||
"version": "2.20.3",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
||||
@@ -542,6 +616,19 @@
|
||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
|
||||
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
|
||||
},
|
||||
"node_modules/cross-spawn": {
|
||||
"version": "7.0.6",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
||||
"integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
|
||||
"dependencies": {
|
||||
"path-key": "^3.1.0",
|
||||
"shebang-command": "^2.0.0",
|
||||
"which": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/decompress": {
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/decompress/-/decompress-4.2.1.tgz",
|
||||
@@ -665,6 +752,16 @@
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/eastasianwidth": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
|
||||
"integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA=="
|
||||
},
|
||||
"node_modules/emoji-regex": {
|
||||
"version": "9.2.2",
|
||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz",
|
||||
"integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="
|
||||
},
|
||||
"node_modules/end-of-stream": {
|
||||
"version": "1.4.5",
|
||||
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz",
|
||||
@@ -760,6 +857,21 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/foreground-child": {
|
||||
"version": "3.3.1",
|
||||
"resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz",
|
||||
"integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==",
|
||||
"dependencies": {
|
||||
"cross-spawn": "^7.0.6",
|
||||
"signal-exit": "^4.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/fs-constants": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
|
||||
@@ -833,6 +945,28 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/glob": {
|
||||
"version": "11.0.3",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-11.0.3.tgz",
|
||||
"integrity": "sha512-2Nim7dha1KVkaiF4q6Dj+ngPPMdfvLJEOpZk/jKiUAkqKebpGAWQXAq9z1xu9HKu5lWfqw/FASuccEjyznjPaA==",
|
||||
"dependencies": {
|
||||
"foreground-child": "^3.3.1",
|
||||
"jackspeak": "^4.1.1",
|
||||
"minimatch": "^10.0.3",
|
||||
"minipass": "^7.1.2",
|
||||
"package-json-from-dist": "^1.0.0",
|
||||
"path-scurry": "^2.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"glob": "dist/esm/bin.mjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": "20 || >=22"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/glob-parent": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
|
||||
@@ -961,6 +1095,14 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/is-fullwidth-code-point": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
|
||||
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/is-glob": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
|
||||
@@ -1012,6 +1154,33 @@
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
|
||||
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="
|
||||
},
|
||||
"node_modules/isexe": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="
|
||||
},
|
||||
"node_modules/jackspeak": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.1.1.tgz",
|
||||
"integrity": "sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ==",
|
||||
"dependencies": {
|
||||
"@isaacs/cliui": "^8.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": "20 || >=22"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/lru-cache": {
|
||||
"version": "11.2.1",
|
||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.1.tgz",
|
||||
"integrity": "sha512-r8LA6i4LP4EeWOhqBaZZjDWwehd1xUJPCJd9Sv300H0ZmcUER4+JPh7bqqZeqs1o5pgtgvXm+d9UGrB5zZGDiQ==",
|
||||
"engines": {
|
||||
"node": "20 || >=22"
|
||||
}
|
||||
},
|
||||
"node_modules/make-dir": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz",
|
||||
@@ -1039,6 +1208,28 @@
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/minimatch": {
|
||||
"version": "10.0.3",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.3.tgz",
|
||||
"integrity": "sha512-IPZ167aShDZZUMdRk66cyQAW3qr0WzbHkPdMYa8bzZhlHhO3jALbKdxcaak7W9FfT2rZNpQuUu4Od7ILEpXSaw==",
|
||||
"dependencies": {
|
||||
"@isaacs/brace-expansion": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "20 || >=22"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/minipass": {
|
||||
"version": "7.1.2",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
|
||||
"integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",
|
||||
"engines": {
|
||||
"node": ">=16 || 14 >=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/normalize-path": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
|
||||
@@ -1063,11 +1254,39 @@
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"node_modules/package-json-from-dist": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz",
|
||||
"integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw=="
|
||||
},
|
||||
"node_modules/pako": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz",
|
||||
"integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug=="
|
||||
},
|
||||
"node_modules/path-key": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
|
||||
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/path-scurry": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz",
|
||||
"integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==",
|
||||
"dependencies": {
|
||||
"lru-cache": "^11.0.0",
|
||||
"minipass": "^7.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": "20 || >=22"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/pend": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",
|
||||
@@ -1225,6 +1444,36 @@
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/shebang-command": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
||||
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
|
||||
"dependencies": {
|
||||
"shebang-regex": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/shebang-regex": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
|
||||
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/signal-exit": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
|
||||
"integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/string_decoder": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
||||
@@ -1238,6 +1487,94 @@
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||
},
|
||||
"node_modules/string-width": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz",
|
||||
"integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==",
|
||||
"dependencies": {
|
||||
"eastasianwidth": "^0.2.0",
|
||||
"emoji-regex": "^9.2.2",
|
||||
"strip-ansi": "^7.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/string-width-cjs": {
|
||||
"name": "string-width",
|
||||
"version": "4.2.3",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
|
||||
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
||||
"dependencies": {
|
||||
"emoji-regex": "^8.0.0",
|
||||
"is-fullwidth-code-point": "^3.0.0",
|
||||
"strip-ansi": "^6.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/string-width-cjs/node_modules/ansi-regex": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
||||
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/string-width-cjs/node_modules/emoji-regex": {
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="
|
||||
},
|
||||
"node_modules/string-width-cjs/node_modules/strip-ansi": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
||||
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
||||
"dependencies": {
|
||||
"ansi-regex": "^5.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/strip-ansi": {
|
||||
"version": "7.1.2",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz",
|
||||
"integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==",
|
||||
"dependencies": {
|
||||
"ansi-regex": "^6.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/strip-ansi?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/strip-ansi-cjs": {
|
||||
"name": "strip-ansi",
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
||||
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
||||
"dependencies": {
|
||||
"ansi-regex": "^5.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/strip-ansi-cjs/node_modules/ansi-regex": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
||||
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/strip-dirs": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-dirs/-/strip-dirs-2.1.0.tgz",
|
||||
@@ -1403,6 +1740,20 @@
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/which": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
||||
"dependencies": {
|
||||
"isexe": "^2.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"node-which": "bin/node-which"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/which-typed-array": {
|
||||
"version": "1.1.19",
|
||||
"resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.19.tgz",
|
||||
@@ -1423,6 +1774,90 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/wrap-ansi": {
|
||||
"version": "8.1.0",
|
||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz",
|
||||
"integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==",
|
||||
"dependencies": {
|
||||
"ansi-styles": "^6.1.0",
|
||||
"string-width": "^5.0.1",
|
||||
"strip-ansi": "^7.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/wrap-ansi-cjs": {
|
||||
"name": "wrap-ansi",
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
|
||||
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
|
||||
"dependencies": {
|
||||
"ansi-styles": "^4.0.0",
|
||||
"string-width": "^4.1.0",
|
||||
"strip-ansi": "^6.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/wrap-ansi-cjs/node_modules/ansi-regex": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
||||
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/wrap-ansi-cjs/node_modules/ansi-styles": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||
"dependencies": {
|
||||
"color-convert": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/wrap-ansi-cjs/node_modules/emoji-regex": {
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="
|
||||
},
|
||||
"node_modules/wrap-ansi-cjs/node_modules/string-width": {
|
||||
"version": "4.2.3",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
|
||||
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
||||
"dependencies": {
|
||||
"emoji-regex": "^8.0.0",
|
||||
"is-fullwidth-code-point": "^3.0.0",
|
||||
"strip-ansi": "^6.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/wrap-ansi-cjs/node_modules/strip-ansi": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
||||
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
||||
"dependencies": {
|
||||
"ansi-regex": "^5.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "spyglassmc-action",
|
||||
"version": "1.0.0",
|
||||
"version": "1.1.0",
|
||||
"description": "Check your Minecraft datapack for syntax or schema errors using SpyglassMC",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@@ -22,6 +22,7 @@
|
||||
"@actions/github": "^6.0.1",
|
||||
"@spyglassmc/core": "^0.4.34",
|
||||
"@spyglassmc/java-edition": "^0.3.45",
|
||||
"@spyglassmc/mcdoc": "^0.3.38"
|
||||
"@spyglassmc/mcdoc": "^0.3.38",
|
||||
"glob": "^11.0.3"
|
||||
}
|
||||
}
|
||||
|
@@ -1,3 +1,204 @@
|
||||
export async function checkDatapack(rootDir: String, version: String): Promise<void> {
|
||||
console.log(`Checking datapack in directory ${rootDir} for Minecraft version ${version}`)
|
||||
import * as action from '@actions/core'
|
||||
import * as core from '@spyglassmc/core'
|
||||
import * as je from '@spyglassmc/java-edition'
|
||||
import * as mcdoc from '@spyglassmc/mcdoc'
|
||||
import { NodeJsExternals } from '@spyglassmc/core/lib/nodejs.js'
|
||||
import path from "path"
|
||||
import { glob } from "glob"
|
||||
import fs from "fs"
|
||||
|
||||
export interface ActionOptions {
|
||||
/**
|
||||
* If set to true, all errors are reported. If set to false, only the first error is reported
|
||||
*/
|
||||
reportAllErrors: boolean
|
||||
|
||||
/**
|
||||
* If set to true, each error is described, indicating the exact issue. If set to false, only the number of errors in each file is reported
|
||||
*/
|
||||
verbose: boolean
|
||||
}
|
||||
|
||||
class ActionLogger implements core.Logger {
|
||||
error(data: any, ...args: any[]): void {
|
||||
action.error(data)
|
||||
}
|
||||
info(data: any, ...args: any[]): void {
|
||||
action.info(data)
|
||||
}
|
||||
log(data: any, ...args: any[]): void {
|
||||
action.debug(data)
|
||||
}
|
||||
warn(data: any, ...args: any[]): void {
|
||||
action.warning(data)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export class CustomService extends core.Service {
|
||||
rootDir: string
|
||||
options: ActionOptions
|
||||
|
||||
constructor(rootDir: string, version: string, options: ActionOptions) {
|
||||
rootDir = path.resolve(rootDir)
|
||||
action.info(`rootDir = ${rootDir}`)
|
||||
action.info(`version = ${version}`)
|
||||
const fullRootDir = core.fileUtil.ensureEndingSlash("file://" + rootDir)
|
||||
const config = {
|
||||
env: {
|
||||
gameVersion: version,
|
||||
feature: {
|
||||
codeActions: false,
|
||||
colors: false,
|
||||
completions: false,
|
||||
documentHighlighting: false,
|
||||
documentLinks: false,
|
||||
foldingRanges: false,
|
||||
formatting: false,
|
||||
hover: false,
|
||||
inlayHint: {
|
||||
enabledNodes: []
|
||||
},
|
||||
semanticColoring: false,
|
||||
selectionRanges: false,
|
||||
signatures: false
|
||||
}
|
||||
}
|
||||
}
|
||||
super({
|
||||
logger: new ActionLogger(),
|
||||
profilers: new core.ProfilerFactory(console, [
|
||||
'cache#load',
|
||||
'cache#save',
|
||||
'project#init',
|
||||
'project#ready',
|
||||
]),
|
||||
project: {
|
||||
cacheRoot: 'file:///tmp/.cache/',
|
||||
defaultConfig: core.ConfigService.merge(
|
||||
core.VanillaConfig,
|
||||
config
|
||||
),
|
||||
externals: NodeJsExternals,
|
||||
initializers: [mcdoc.initialize, je.initialize],
|
||||
projectRoots: [fullRootDir],
|
||||
},
|
||||
})
|
||||
this.rootDir = rootDir
|
||||
this.options = options
|
||||
}
|
||||
|
||||
async shutdown() {
|
||||
action.startGroup("Shutdown")
|
||||
await this.project.close()
|
||||
action.endGroup()
|
||||
}
|
||||
|
||||
private listFilesByExtension(extension: string) {
|
||||
return glob(path.join(this.rootDir, `**/*.${extension}`))
|
||||
}
|
||||
|
||||
private makeFileUrl(path: string) {
|
||||
return "file://" + path
|
||||
}
|
||||
|
||||
private getFileContent(path: string) {
|
||||
return fs.readFileSync(path, {
|
||||
encoding: "utf-8"
|
||||
})
|
||||
}
|
||||
|
||||
private getLineAndColumn(pos: number, content: string) {
|
||||
const before = content.slice(0, pos)
|
||||
const line = before.split("\n").length
|
||||
const col = pos - before.lastIndexOf("\n")
|
||||
return { line, col }
|
||||
}
|
||||
|
||||
private getErrorProperties(error: core.LanguageError, path: string, content: string): action.AnnotationProperties {
|
||||
const {line: startLine, col: startColumn} = this.getLineAndColumn(error.range.start, content)
|
||||
const {line: endLine, col: endColumn} = this.getLineAndColumn(error.range.end, content)
|
||||
return {
|
||||
file: path,
|
||||
startLine, startColumn,
|
||||
endLine, endColumn
|
||||
}
|
||||
}
|
||||
|
||||
async checkFile(path: string, lang: string): Promise<boolean> {
|
||||
const url = this.makeFileUrl(path)
|
||||
const content = this.getFileContent(path)
|
||||
this.project.onDidOpen(url, lang, 0, content)
|
||||
const docAndNode = this.project.getClientManaged(url)
|
||||
if (!docAndNode) {
|
||||
action.error(`File ${path} is not loaded`)
|
||||
return false
|
||||
}
|
||||
const { node } = docAndNode
|
||||
const errors = core.FileNode.getErrors(node)
|
||||
if (errors.length !== 0) {
|
||||
const msg = `${errors.length} error${errors.length > 1 ? "s" : ""} in ${path}`
|
||||
|
||||
if (this.options.verbose) {
|
||||
action.startGroup(msg)
|
||||
for (const err of errors) {
|
||||
action.error(
|
||||
err.message,
|
||||
this.getErrorProperties(err, path, content)
|
||||
)
|
||||
}
|
||||
action.endGroup()
|
||||
} else {
|
||||
action.error(msg)
|
||||
}
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
async checkAllFiles(): Promise<boolean> {
|
||||
const jsonFiles = await this.listFilesByExtension("json")
|
||||
const funcFiles = await this.listFilesByExtension("mcfunction")
|
||||
action.info(
|
||||
"Files to check:" + "\n" +
|
||||
`- JSON: ${jsonFiles.length}` + "\n" +
|
||||
`- Function: ${funcFiles.length}`
|
||||
)
|
||||
let success = true
|
||||
for (const jsonFile of jsonFiles) {
|
||||
if (!this.checkFile(jsonFile, "json")) {
|
||||
success = false
|
||||
if (!this.options.reportAllErrors) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const funcFile of funcFiles) {
|
||||
if (!this.checkFile(funcFile, "mcfunction")) {
|
||||
success = false
|
||||
if (!this.options.reportAllErrors) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
return success
|
||||
}
|
||||
}
|
||||
|
||||
export async function checkDatapack(rootDir: string, version: string, reportAll: boolean, verbose: boolean): Promise<void> {
|
||||
action.startGroup("Initialization")
|
||||
const service = new CustomService(rootDir, version, {
|
||||
reportAllErrors: reportAll,
|
||||
verbose: verbose
|
||||
})
|
||||
|
||||
await service.project.ready()
|
||||
action.endGroup()
|
||||
|
||||
const success = await service.checkAllFiles()
|
||||
if (!success) {
|
||||
action.setFailed("Some files contain errors")
|
||||
}
|
||||
|
||||
await service.shutdown()
|
||||
}
|
11
src/index.ts
11
src/index.ts
@@ -3,12 +3,11 @@ import { checkDatapack } from "./check_datapack.js"
|
||||
|
||||
async function run(): Promise<void> {
|
||||
try {
|
||||
const rootDir = core.getInput("dir")
|
||||
let version = core.getInput("version")
|
||||
if (version === "") {
|
||||
version = "auto"
|
||||
}
|
||||
await checkDatapack(rootDir, version)
|
||||
const rootDir = core.getInput("rootDir")
|
||||
const version = core.getInput("version")
|
||||
const reportAll = core.getBooleanInput("reportAllErrors")
|
||||
const verbose = core.getBooleanInput("verbose")
|
||||
await checkDatapack(rootDir, version, reportAll, verbose)
|
||||
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
|
Reference in New Issue
Block a user