From 40c9e9eb18b6d911e7d24a4d15fa6a15a5e95e28 Mon Sep 17 00:00:00 2001 From: DexterHuang Date: Mon, 18 Sep 2023 08:13:27 +0800 Subject: [PATCH] validation test --- .gitignore | 1 + contribution/zh-TW/translation-keywords.js | 397 ----------------- contribution/zh-TW/translation-keywords.json | 429 +++++++++++++++++++ package.json | 26 ++ src/Helper/FileHelper.ts | 19 + src/Interface/IValidator.ts | 5 + src/Validate.ts | 13 + src/Validator/TranslationKeywordValidator.ts | 37 ++ tsconfig.json | 109 +++++ workflows/validation.yml | 27 ++ 10 files changed, 666 insertions(+), 397 deletions(-) create mode 100644 .gitignore delete mode 100644 contribution/zh-TW/translation-keywords.js create mode 100644 contribution/zh-TW/translation-keywords.json create mode 100644 package.json create mode 100644 src/Helper/FileHelper.ts create mode 100644 src/Interface/IValidator.ts create mode 100644 src/Validate.ts create mode 100644 src/Validator/TranslationKeywordValidator.ts create mode 100644 tsconfig.json create mode 100644 workflows/validation.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..b512c09d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/contribution/zh-TW/translation-keywords.js b/contribution/zh-TW/translation-keywords.js deleted file mode 100644 index 4d39b9e9..00000000 --- a/contribution/zh-TW/translation-keywords.js +++ /dev/null @@ -1,397 +0,0 @@ -/** - * An array of objects containing English and Chinese translations for various terms and phrases. - * @typedef {Object} Example - * @property {string} eng - The English term or phrase. - * @property {string} trans - The Chinese translation of the term or phrase. - * @property {string[]} match - An array of strings that can be used to match the term or phrase. - */ -/** - * An array of objects containing English and Chinese translations for various terms and phrases. - * @type {Example[]} - */ -const EXAMPLE = [ - { - eng: "Player ${0} is ${1} has been killed during PVP", - trans: "玩家${0}在PVP戰鬥中被${1}擊敗", - match: [ - "" - ], - desc: "Example of how to translate a sentence with variables", - }, - { - eng: "Inventory", - trans: "物品欄", - match: [], - desc: "Shown in inventory page", - }, - { - eng: "Backpack", - trans: "背包", - match: [], - desc: "A separate inventory that player brings to adventure", - }, - { - eng: "Vault", - trans: "倉庫", - match: [], - desc: "A separate inventory that player stores in their apartment, can only be accessed in apartment", - }, - { - eng: "AFK Tasks", - trans: "掛機任務", - match: [ - "afk" - ], - desc: "AFK = away from keyboard, tasks player can perform while they are not actively playing", - }, - { - eng: "AFK", trans: "掛機", match: [], desc: "" - }, - { - eng: "Red Bar", - trans: "霓虹酒吧", - match: [], - desc: "A cool name of a bar player can visit", - }, - { - eng: "Deliveries", - trans: "包裹", - match: [], - desc: "Like an item inbox, player can receive items from other players through the market", - }, - { - eng: "Upper Armour", - trans: "上半身護甲", - match: [], - desc: "A type of armor player can equip on their upper body", - }, - { - eng: "Lower Armour", - trans: "下半身護甲", - match: [], - desc: "A type of armor player can equip on their lower body", - }, - { - eng: "Place Hit", - trans: "下達擊殺令", - match: [], - desc: 'Placing a bounty on another player for a hitman, synonym of "place bounty"', - }, - { - eng: "Dismantle", - trans: "拆解", - match: [], - desc: "Dismantle an item to get components", - }, - { - eng: "Stronghold", - trans: "地城", - match: [], - desc: "Like a dungeon but with a sci-fi name", - }, - { - eng: "Health", - trans: "生命", - match: [], - desc: "Player's Health, also known as HP", - }, - { - eng: "Vitality", trans: "活力", match: [], desc: "An attribute name" - }, - { - eng: "Strength", trans: "力量", match: [], desc: "An attribute name" - }, - { - eng: "Intelligence", - trans: "智力", - match: [], - desc: "An attribute name", - }, - { - eng: "Dexterity", trans: "敏捷", match: [], desc: "An attribute name" - }, - { - eng: "Vitality Attribute", - trans: "活力屬性", - match: [], - desc: "An attribute name added a repeat for AI to easier to understand", - }, - { - eng: "Strength Attribute", - trans: "力量屬性", - match: [], - desc: "An attribute name added a repeat for AI to easier to understand", - }, - { - eng: "Intelligence Attribute", - trans: "智力屬性", - match: [], - desc: "An attribute name added a repeat for AI to easier to understand", - }, - { - eng: "Dexterity Attribute", - trans: "敏捷屬性", - match: [], - desc: "An attribute name added a repeat for AI to easier to understand", - }, - { - eng: "Thieving", - trans: "偷竊", - match: [], - desc: "A job name player can perform", - }, - { - eng: "Scavenge", - trans: "搜括", - match: [], - desc: "A job name player can perform", - }, - { - eng: "Extraction Mission", - trans: "救援任務", - match: [], - desc: "A job name player can perform", - }, - { - eng: "Arclight City", - trans: "幻光之城", - match: [], - desc: "Name of the game, also the name of the city set in the game, when translating this please make it sounds good, does not to be direct translation", - }, - { - eng: "Arclight", - trans: "幻光之城", - match: [], - desc: "Short-term name of the game, also the name of the city set in the game", - }, - { - eng: "Territory", - trans: "領地", - match: [], - desc: "A district area player can take control of", - }, - { - eng: "gang", - trans: "幫派", - match: [], - desc: "Like clans in other games", - }, - { - eng: "Gang Upkeep", - trans: "幫派維護", - match: [], - desc: "A cost player needs to pay to maintain their gang", - }, - { - eng: "Gang Territory", - trans: "幫派領地", - match: [], - desc: "A district area gang can take control of", - }, - { - eng: "Ripperdoc", - trans: "電馭醫生", - match: [], - desc: "An NPC profession name, like a cybernetic doctor", - }, - { - eng: "money", - trans: "歐元", - match: [], - desc: 'Main currency in the game, which is Eurodollars, please translate directly to Eurodollars or simply "money" if more appropriate', - }, - { - eng: "Nano Repairer", - trans: "納米修復器", - match: [], - desc: "An item name used to repair broken equipment", - }, - { - eng: "TaiXing Cybernetic", - trans: "台芯電馭", - match: [ - "taixing" - ], - desc: "A fake company name, specialized in making cybernetic implants and other tech", - }, - { - eng: "TaiXing", - trans: "台芯", - match: [], - desc: "A fake company name, specialized in making cybernetic implants and other tech", - }, - { - eng: "Trauma Team", - trans: "創傷小隊", - match: [], - desc: "An NPC profession name, like a medical rescue team but with guns", - }, - { - eng: "extraction force", - trans: "救援部隊", - match: [], - desc: "Teams work under Trauma Team, like a medical rescue team but with guns", - }, - { - eng: "crew", - trans: "隊伍", - match: [], - desc: "A team of mercenaries player can hire to help them fight", - }, - { - eng: "Implant", trans: "電馭元件", match: [], desc: "" - }, - { - eng: "Cyber psychosis", - trans: "網絡狂躁症", - match: [ - "psychosis" - ], - desc: "Same thing as in the Anime, when a person uses too much cybernetic ability, they will lose their mind", - }, - { - eng: "stats", - trans: "屬性", - match: [ - "stat" - ], - desc: "The attributes of items, like damage, health, armor, etc", - }, - { - eng: "reward", - trans: "獎勵", - match: [], - desc: "A reward player can get from doing quests or other stuff", - }, - { - eng: "calibration", - trans: "校準", - match: [ - "calibrate" - ], - desc: "A process to make equipment work better", - }, - { - eng: "calibrate", - trans: "校準", - match: [], - desc: "A process to make equipment work better", - }, - { - eng: "What is equipment calibration", - trans: "裝備校準是甚麼", - match: [ - "calibrate" - ], - desc: "", - }, - { - eng: "upgrade", - trans: "升級", - match: [], - desc: "A process to make equipment work better, including increasing level, resetting, or adding new stats", - }, - { - eng: "place hit", - trans: "下達擊殺令", - match: [], - desc: "Placing a bounty order on another player", - }, - { - eng: "netrunner", - trans: "駭客", - match: [], - desc: "Hacker in cyberpunk term", - }, - { - eng: "netrunning", - trans: "網絡行走", - match: [], - desc: "Hacking in cyberpunk term", - }, - { - eng: "flatline", - trans: "心跳停止", - match: [], - desc: "Dead in cyberpunk term, will show up in the dead screen with bit writing, supposed to look cool", - }, - { - eng: "cybernet", - trans: "網際網路", - match: [], - desc: '"Internet" in cyberpunk term', - }, - { - eng: "use", trans: "使用", match: [], desc: "Use an item" - }, - { - eng: "next", - trans: "下一步", - match: [], - desc: "In UI context, like a button", - }, - { - eng: "block", - trans: "封鎖", - match: [], - desc: "Block a player from sending messages to you", - }, - { - eng: "bundle", - trans: "禮包", - match: [], - desc: "A bundle of items players can buy in most mobile games", - }, - { - eng: "block chance", - trans: "格擋機率", - match: [], - desc: "A stat of equipment, a chance that players can block incoming damage", - }, - { - eng: "Universal Dollars", - trans: "通用幣", - match: [], - desc: "A fictional currency name in the game, translate to a suitable name in your language", - }, - { - eng: "Cybernetic Enhancer", - trans: "電馭增強器", - match: [ - "enhancer" - ], - desc: "An item name, a cybernetic implant that can enhance players' abilities", - }, - { - eng: "Eurodollars", - trans: "歐元", - match: [ - "eddie" - ], - desc: 'Main currency in the game, which is Eurodollars, please translate directly to Eurodollars or simply "money" if more appropriate', - }, - { - eng: "Lore note", - trans: "背景故事", - match: [ - "lore" - ], - desc: "A note that players can find in the game and read to learn more about the game world", - }, - { - eng: "referral", - trans: "推薦", - match: [ - "refer" - ], - desc: "Referral as in referring a friend to play the game", - }, - { - eng: "refer", - trans: "推薦", - match: [], - desc: "Referral as in referring a friend to play the game", - }, -]; - -EXAMPLE; diff --git a/contribution/zh-TW/translation-keywords.json b/contribution/zh-TW/translation-keywords.json new file mode 100644 index 00000000..997e9dff --- /dev/null +++ b/contribution/zh-TW/translation-keywords.json @@ -0,0 +1,429 @@ +{ + "WHATS_THIS?": "This contains keywords to help the AI to understand the context of the UI texts to translate", + "WHATS_THIS?_2": "please feel free to add new keywords and fix translation error to fit your culture", + "WHATS_THIS?_3": "Only add new keywords if you are sure it will be used in the game, no sentence except for the ones thats already there.", + "keywords": [ + { + "eng": "Player ${0} is ${1} has been killed during PVP", + "trans": "玩家${0}在PVP戰鬥中被${1}擊敗", + "match": [ + "" + ], + "desc": "Example of how to translate a sentence with variables", + "important": true + }, + { + "eng": "What is equipment calibration?", + "trans": "裝備校準是甚麼?", + "match": [ + "calibrate" + ], + "desc": "An example for an sample question", + "important": true + }, + { + "eng": "Inventory", + "trans": "物品欄", + "match": [], + "desc": "Player's main inventory" + }, + { + "eng": "Backpack", + "trans": "背包", + "match": [], + "desc": "A separate inventory that player brings to adventure" + }, + { + "eng": "Vault", + "trans": "倉庫", + "match": [], + "desc": "A separate inventory that player stores in their apartment, can only be accessed in apartment" + }, + { + "eng": "AFK Tasks", + "trans": "掛機任務", + "match": [ + "afk" + ], + "desc": "AFK = away from keyboard, tasks player can perform while they are not actively playing" + }, + { + "eng": "AFK", + "trans": "掛機", + "match": [], + "desc": "Away from keyboard" + }, + { + "eng": "Red Bar", + "trans": "霓虹酒吧", + "match": [], + "desc": "A cool name of a bar player can visit" + }, + { + "eng": "Deliveries", + "trans": "包裹", + "match": [], + "desc": "Like an item inbox, player can receive items from other players through the market" + }, + { + "eng": "Upper Armour", + "trans": "上半身護甲", + "match": [], + "desc": "A type of armor player can equip on their upper body" + }, + { + "eng": "Lower Armour", + "trans": "下半身護甲", + "match": [], + "desc": "A type of armor player can equip on their lower body" + }, + { + "eng": "Place Hit", + "trans": "下達擊殺令", + "match": [], + "desc": "Placing a bounty on another player for a hitman, synonym of \"place bounty\"" + }, + { + "eng": "Dismantle", + "trans": "拆解", + "match": [], + "desc": "Dismantle an item to get components" + }, + { + "eng": "Stronghold", + "trans": "地城", + "match": [], + "desc": "Like a dungeon but with a sci-fi name" + }, + { + "eng": "Health", + "trans": "生命", + "match": [], + "desc": "Player's Health, also known as HP" + }, + { + "eng": "Vitality", + "trans": "活力", + "match": [], + "desc": "An attribute name" + }, + { + "eng": "Strength", + "trans": "力量", + "match": [], + "desc": "An attribute name" + }, + { + "eng": "Intelligence", + "trans": "智力", + "match": [], + "desc": "An attribute name" + }, + { + "eng": "Dexterity", + "trans": "敏捷", + "match": [], + "desc": "An attribute name" + }, + { + "eng": "Vitality Attribute", + "trans": "活力屬性", + "match": [], + "desc": "An attribute name added a repeat for AI to easier to understand" + }, + { + "eng": "Strength Attribute", + "trans": "力量屬性", + "match": [], + "desc": "An attribute name added a repeat for AI to easier to understand" + }, + { + "eng": "Intelligence Attribute", + "trans": "智力屬性", + "match": [], + "desc": "An attribute name added a repeat for AI to easier to understand" + }, + { + "eng": "Dexterity Attribute", + "trans": "敏捷屬性", + "match": [], + "desc": "An attribute name added a repeat for AI to easier to understand" + }, + { + "eng": "Thieving", + "trans": "偷竊", + "match": [], + "desc": "A job name player can perform" + }, + { + "eng": "Scavenge", + "trans": "搜括", + "match": [], + "desc": "A job name player can perform" + }, + { + "eng": "Extraction Mission", + "trans": "救援任務", + "match": [], + "desc": "A job name player can perform" + }, + { + "eng": "Arclight City", + "trans": "幻光之城", + "match": [], + "desc": "Name of the game, also the name of the city set in the game, when translating this please make it sounds good, does not to be direct translation" + }, + { + "eng": "Arclight", + "trans": "幻光之城", + "match": [], + "desc": "Short-term name of the game, also the name of the city set in the game" + }, + { + "eng": "Territory", + "trans": "領地", + "match": [], + "desc": "A district area player can take control of" + }, + { + "eng": "gang", + "trans": "幫派", + "match": [], + "desc": "Like clans in other games" + }, + { + "eng": "Gang Upkeep", + "trans": "幫派維護", + "match": [], + "desc": "A cost player needs to pay to maintain their gang" + }, + { + "eng": "Gang Territory", + "trans": "幫派領地", + "match": [], + "desc": "A district area gang can take control of" + }, + { + "eng": "Ripperdoc", + "trans": "電馭醫生", + "match": [], + "desc": "An NPC profession name, like a cybernetic doctor" + }, + { + "eng": "money", + "trans": "歐元", + "match": [], + "desc": "Main currency in the game, which is Eurodollars, please translate directly to Eurodollars or simply \"money\" if more appropriate" + }, + { + "eng": "Nano Repairer", + "trans": "納米修復器", + "match": [], + "desc": "An item name used to repair broken equipment" + }, + { + "eng": "TaiXing Cybernetic", + "trans": "台芯電馭", + "match": [ + "taixing" + ], + "desc": "A fake company name, specialized in making cybernetic implants and other tech" + }, + { + "eng": "TaiXing", + "trans": "台芯", + "match": [], + "desc": "A fake company name, specialized in making cybernetic implants and other tech" + }, + { + "eng": "Trauma Team", + "trans": "創傷小隊", + "match": [], + "desc": "An NPC profession name, like a medical rescue team but with guns" + }, + { + "eng": "extraction force", + "trans": "救援部隊", + "match": [], + "desc": "Teams work under Trauma Team, like a medical rescue team but with guns" + }, + { + "eng": "crew", + "trans": "隊伍", + "match": [], + "desc": "A team of mercenaries player can hire to help them fight" + }, + { + "eng": "Implant", + "trans": "電馭元件", + "match": [], + "desc": "A cyberpunk term for cybernetic implants, if you don't know what it is please check google" + }, + { + "eng": "Cyber psychosis", + "trans": "網絡狂躁症", + "match": [ + "psychosis" + ], + "desc": "Same thing as in the Anime, when a person uses too much cybernetic ability, they will lose their mind" + }, + { + "eng": "stats", + "trans": "屬性", + "match": [ + "stat" + ], + "desc": "The attributes of items, like damage, health, armor, etc" + }, + { + "eng": "reward", + "trans": "獎勵", + "match": [], + "desc": "A reward player can get from doing quests or other stuff" + }, + { + "eng": "calibration", + "trans": "校準", + "match": [ + "calibrate" + ], + "desc": "A process to make equipment work better" + }, + { + "eng": "calibrate", + "trans": "校準", + "match": [], + "desc": "A process to make equipment work better" + }, + { + "eng": "upgrade", + "trans": "升級", + "match": [], + "desc": "A process to make equipment work better, including increasing level, resetting, or adding new stats" + }, + { + "eng": "place hit", + "trans": "下達擊殺令", + "match": [], + "desc": "Placing a bounty order on another player" + }, + { + "eng": "netrunner", + "trans": "駭客", + "match": [], + "desc": "Hacker in cyberpunk term" + }, + { + "eng": "netrunning", + "trans": "網絡行走", + "match": [], + "desc": "Hacking in cyberpunk term" + }, + { + "eng": "flatline", + "trans": "心跳停止", + "match": [], + "desc": "Dead in cyberpunk term, will show up in the dead screen with bit writing, supposed to look cool" + }, + { + "eng": "cybernet", + "trans": "網際網路", + "match": [], + "desc": "\"Internet\" in cyberpunk term" + }, + { + "eng": "use", + "trans": "使用", + "match": [], + "desc": "Use an item" + }, + { + "eng": "next", + "trans": "下一步", + "match": [], + "desc": "In UI context, like a button" + }, + { + "eng": "block", + "trans": "封鎖", + "match": [], + "desc": "Block a player from sending messages to you" + }, + { + "eng": "bundle", + "trans": "禮包", + "match": [], + "desc": "A bundle of items players can buy in most mobile games" + }, + { + "eng": "block chance", + "trans": "格擋機率", + "match": [], + "desc": "A stat of equipment, a chance that players can block incoming damage" + }, + { + "eng": "Universal Dollars", + "trans": "通用幣", + "match": [], + "desc": "A fictional currency name in the game, translate to a suitable name in your language" + }, + { + "eng": "Cybernetic Enhancer", + "trans": "電馭增強器", + "match": [ + "enhancer" + ], + "desc": "An item name, a cybernetic implant that can enhance players' abilities" + }, + { + "eng": "Eurodollars", + "trans": "歐元", + "match": [ + "eddie" + ], + "desc": "Main currency in the game, which is Eurodollars, please translate directly to Eurodollars or simply \"money\" if more appropriate" + }, + { + "eng": "Lore note", + "trans": "背景故事", + "match": [ + "lore" + ], + "desc": "A note that players can find in the game and read to learn more about the game world" + }, + { + "eng": "referral", + "trans": "推薦", + "match": [ + "refer" + ], + "desc": "Referral as in referring a friend to play the game" + }, + { + "eng": "refer", + "trans": "推薦", + "match": [], + "desc": "Referral as in referring a friend to play the game" + }, + { + "eng": "Scrap Items", + "trans": "報廢物品", + "match": [ + "scrap" + ], + "desc": "Player can scrap items from their inventory, different from dismantle, scrap will give less or no components" + }, + { + "eng": "All", + "trans": "全部", + "match": [], + "desc": "A generic word for 'all' in UI" + }, + { + "eng": "Continue", + "trans": "繼續", + "match": [], + "desc": "A generic word for 'continue' in UI" + } + ] +} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 00000000..46e913dd --- /dev/null +++ b/package.json @@ -0,0 +1,26 @@ +{ + "name": "arclight-city", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "watch": "npx tsx watch src/Validate.ts" + }, + "dependencies": { + "typescript": "^5.2.2" + }, + "devDependencies": { + "@types/node": "^20.6.2" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/DexterHuang/ALCT.git" + }, + "keywords": [], + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/DexterHuang/ALCT/issues" + }, + "homepage": "https://github.com/DexterHuang/ALCT#readme" +} \ No newline at end of file diff --git a/src/Helper/FileHelper.ts b/src/Helper/FileHelper.ts new file mode 100644 index 00000000..2b02ff4b --- /dev/null +++ b/src/Helper/FileHelper.ts @@ -0,0 +1,19 @@ + +import * as fs from 'fs'; + +export class FileHelper { + + static getFilesInDir(dir: string, match: RegExp) { + const files: string[] = []; + const paths = fs.readdirSync(dir); + for (let path of paths) { + path = dir + '/' + path; + if (fs.lstatSync(path).isDirectory()) { + files.push(...this.getFilesInDir(path, match)); + } else if (match.test(path)) { + files.push(path); + } + } + return files; + } +} \ No newline at end of file diff --git a/src/Interface/IValidator.ts b/src/Interface/IValidator.ts new file mode 100644 index 00000000..2b4e24e8 --- /dev/null +++ b/src/Interface/IValidator.ts @@ -0,0 +1,5 @@ + +export interface IValidator { + + validate: () => any; +} \ No newline at end of file diff --git a/src/Validate.ts b/src/Validate.ts new file mode 100644 index 00000000..5a3b90b3 --- /dev/null +++ b/src/Validate.ts @@ -0,0 +1,13 @@ +import * as ts from 'typescript'; +import { IValidator } from './Interface/IValidator'; +import { TranslationKeywordValidator } from './Validator/TranslationKeywordValidator'; + +(async () => { + const VALIDATORS: IValidator[] = [ + new TranslationKeywordValidator() + ] + for (const validator of VALIDATORS) { + await validator.validate(); + } + +})(); \ No newline at end of file diff --git a/src/Validator/TranslationKeywordValidator.ts b/src/Validator/TranslationKeywordValidator.ts new file mode 100644 index 00000000..4837111d --- /dev/null +++ b/src/Validator/TranslationKeywordValidator.ts @@ -0,0 +1,37 @@ +import fs from 'fs'; +import { IValidator } from '../Interface/IValidator'; +import { FileHelper } from '../Helper/FileHelper'; +export class TranslationKeywordValidator implements IValidator { + validate() { + const langs = fs.readdirSync('contribution').filter(f => f.indexOf('.') <= 0 && f !== 'en'); + for (const lang of langs) { + const path = `contribution/${lang}/translation-keywords.json`; + console.log(`Validating ${lang}/translation-keywords.json...`); + if (!fs.existsSync(path)) { + console.log(`${lang}/translation-keywords.json does not exist, skipping...`); + continue; + } + const json = JSON.parse(fs.readFileSync(path, 'utf8')); + if (!json.keywords) { + throw new Error(`${lang}/translation-keywords.json does not contain keyword list`) + } + for (const { eng, trans, desc, match } of json.keywords) { + if (!eng) { + throw new Error(`${lang}/translation-keywords.json contains a keyword without an English translation`) + } + if (!trans) { + throw new Error(`${lang}/translation-keywords.json ${eng} does not contain a 'trans' field`) + } + if (!match) { + throw new Error(`${lang}/translation-keywords.json ${eng} does not contain a 'match' field`) + } + if (!desc) { + throw new Error(`${lang}/translation-keywords.json ${eng} does not contain a 'desc' field`) + } + } + + console.log(`${lang}/translation-keywords.json is valid`); + } + } + +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..a306d49b --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,109 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "Node16", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + // "outDir": "./", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } +} diff --git a/workflows/validation.yml b/workflows/validation.yml new file mode 100644 index 00000000..68fdcbbf --- /dev/null +++ b/workflows/validation.yml @@ -0,0 +1,27 @@ +# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy +# More GitHub Actions for Azure: https://github.com/Azure/actions + +name: Validation workflow + +on: + push: + branches: + - /* + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up Node.js version + uses: actions/setup-node@v1 + with: + node-version: "16.x" + + - name: npm install, build, and test + run: | + npm ci + npx tsx src/Validate.ts