diff --git a/scripts/authors.ts b/scripts/authors.ts index b616ceb8601..b52898244b6 100644 --- a/scripts/authors.ts +++ b/scripts/authors.ts @@ -4,7 +4,7 @@ import child_process = require("child_process"); type Author = { displayNames: string[]; - preferedName?: string; + preferredName?: string; emails: string[]; }; @@ -20,7 +20,7 @@ const authorsPath = path.resolve("../AUTHORS.md"); function getKnownAuthors(): Author[] { const segmentRegExp = /\s?([^<]+)\s+<([^>]+)>/g; - const preferedNameRegeExp = /\s?#\s?([^#]+)$/; + const preferredNameRegeExp = /\s?#\s?([^#]+)$/; const knownAuthors: Author[] = []; if (!fs.existsSync(mailMapPath)) { @@ -37,13 +37,13 @@ function getKnownAuthors(): Author[] { author.displayNames.push(match[1]); author.emails.push(match[2]); } - if (match = preferedNameRegeExp.exec(line)) { - author.preferedName = match[1]; + if (match = preferredNameRegeExp.exec(line)) { + author.preferredName = match[1]; } if (!author.emails) continue; knownAuthors.push(author); - if (line.indexOf("#") > 0 && !author.preferedName) { - throw new Error("Could not match prefered name for: " + line); + if (line.indexOf("#") > 0 && !author.preferredName) { + throw new Error("Could not match preferred name for: " + line); } // console.log("===> line: " + line); // console.log(JSON.stringify(author, undefined, 2)); @@ -52,7 +52,7 @@ function getKnownAuthors(): Author[] { } function getAuthorName(author: Author) { - return author.preferedName || author.displayNames[0]; + return author.preferredName || author.displayNames[0]; } function getKnownAuthorMaps() { diff --git a/scripts/bisect-test.ts b/scripts/bisect-test.ts index 948b272470f..cc0248f6d64 100644 --- a/scripts/bisect-test.ts +++ b/scripts/bisect-test.ts @@ -5,7 +5,7 @@ import cp = require('child_process'); import fs = require('fs'); -// Slice off 'node bisect-test.js' from the commandline args +// Slice off 'node bisect-test.js' from the command line args var args = process.argv.slice(2); function tsc(tscArgs: string, onExit: (exitCode: number) => void) { diff --git a/scripts/createBenchmark.ts b/scripts/createBenchmark.ts index 6148d80bf2c..254c0d99af0 100644 --- a/scripts/createBenchmark.ts +++ b/scripts/createBenchmark.ts @@ -30,7 +30,7 @@ var rawCompilerSources = ""; sourceFiles.forEach(f=> { rawCompilerSources += "\r\n" + fs.readFileSync(path.join(tsSourceDir, f)).toString(); }); -var compilerSoruces = `var compilerSources = ${JSON.stringify(rawCompilerSources) };`; +var compilerSources = `var compilerSources = ${JSON.stringify(rawCompilerSources) };`; // .js code for the compiler, what we are actually testing var rawCompilerJavaScript = fs.readFileSync(path.join(tsBuildDir, "tsc.js")).toString(); @@ -38,7 +38,7 @@ rawCompilerJavaScript = rawCompilerJavaScript.replace("ts.executeCommandLine(ts. // lib.d.ts sources var rawLibSources = fs.readFileSync(path.join(tsBuildDir, "lib.d.ts")).toString(); -var libSoruces = `var libSources = ${JSON.stringify(rawLibSources) };`; +var libSources = `var libSources = ${JSON.stringify(rawLibSources) };`; // write test output if (!fs.existsSync(testOutputDir)) { @@ -48,7 +48,7 @@ if (!fs.existsSync(testOutputDir)) { // 1. compiler ts sources, used to test fs.writeFileSync( path.join(testOutputDir, "compilerSources.js"), - `${ compilerSoruces } \r\n ${ libSoruces }`); + `${ compilerSources } \r\n ${ libSources }`); // 2. the compiler js sources + a call the compiler fs.writeFileSync( diff --git a/scripts/generateLocalizedDiagnosticMessages.ts b/scripts/generateLocalizedDiagnosticMessages.ts index a9183c8ddbe..98bae170baa 100644 --- a/scripts/generateLocalizedDiagnosticMessages.ts +++ b/scripts/generateLocalizedDiagnosticMessages.ts @@ -1,177 +1,177 @@ -import * as fs from "fs"; -import * as path from "path"; -import * as xml2js from "xml2js"; - -function main(): void { - const args = process.argv.slice(2); - if (args.length !== 3) { - console.log("Usage:"); - console.log("\tnode generateLocalizedDiagnosticMessages.js "); - return; - } - - const inputPath = args[0]; - const outputPath = args[1]; - const diagnosticsMapFilePath = args[2]; - - // generate the lcg file for enu - generateLCGFile(); - - // generate other langs - fs.readdir(inputPath, (err, files) => { - handleError(err); - files.forEach(visitDirectory); - }); - - return; - - function visitDirectory(name: string) { - const inputFilePath = path.join(inputPath, name, "diagnosticMessages", "diagnosticMessages.generated.json.lcl"); - - fs.readFile(inputFilePath, (err, data) => { - handleError(err); - xml2js.parseString(data.toString(), (err, result) => { - handleError(err); - if (!result || !result.LCX || !result.LCX.$ || !result.LCX.$.TgtCul) { - console.error("Unexpected XML file structure. Expected to find result.LCX.$.TgtCul."); - process.exit(1); - } - const outputDirectoryName = getPreferedLocaleName(result.LCX.$.TgtCul).toLowerCase(); - if (!outputDirectoryName) { - console.error(`Invalid output locale name for '${result.LCX.$.TgtCul}'.`); - process.exit(1); - } - writeFile(path.join(outputPath, outputDirectoryName, "diagnosticMessages.generated.json"), xmlObjectToString(result)); - }); - }); - } - - /** - * A locale name is based on the language tagging conventions of RFC 4646 (Windows Vista - * and later), and is represented by LOCALE_SNAME. - * Generally, the pattern - is used. Here, language is a lowercase ISO 639 - * language code. The codes from ISO 639-1 are used when available. Otherwise, codes from - * ISO 639-2/T are used. REGION specifies an uppercase ISO 3166-1 country/region identifier. - * For example, the locale name for English (United States) is "en-US" and the locale name - * for Divehi (Maldives) is "dv-MV". - * - * If the locale is a neutral locale (no region), the LOCALE_SNAME value follows the - * pattern . If it is a neutral locale for which the script is significant, the - * pattern is -