Skip to content

Commit

Permalink
[generated] Run dprint
Browse files Browse the repository at this point in the history
[git-generate]
test -f ./node_modules/.bin/dprint || npm ci
npx dprint fmt
  • Loading branch information
jakebailey committed Jan 22, 2023
1 parent 2a8adfa commit 670a8de
Show file tree
Hide file tree
Showing 424 changed files with 84,105 additions and 21,911 deletions.
74 changes: 64 additions & 10 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,53 @@

"@typescript-eslint/naming-convention": [
"error",
{ "selector": "typeLike", "format": ["PascalCase"], "filter": { "regex": "^(__String|[A-Za-z]+_[A-Za-z]+)$", "match": false } },
{ "selector": "interface", "format": ["PascalCase"], "custom": { "regex": "^I[A-Z]", "match": false }, "filter": { "regex": "^I(Arguments|TextWriter|O([A-Z][a-z]+[A-Za-z]*)?)$", "match": false } },
{ "selector": "variable", "format": ["camelCase", "PascalCase", "UPPER_CASE"], "leadingUnderscore": "allow", "filter": { "regex": "^(_{1,2}filename|_{1,2}dirname|_+|[A-Za-z]+_[A-Za-z]+)$", "match": false } },
{ "selector": "function", "format": ["camelCase", "PascalCase"], "leadingUnderscore": "allow", "filter": { "regex": "^[A-Za-z]+_[A-Za-z]+$", "match": false } },
{ "selector": "parameter", "format": ["camelCase"], "leadingUnderscore": "allow", "filter": { "regex": "^(_+|[A-Za-z]+_[A-Z][a-z]+)$", "match": false } },
{ "selector": "method", "format": ["camelCase", "PascalCase"], "leadingUnderscore": "allow", "filter": { "regex": "^([0-9]+|[A-Za-z]+_[A-Za-z]+)$", "match": false } },
{ "selector": "memberLike", "format": ["camelCase"], "leadingUnderscore": "allow", "filter": { "regex": "^([0-9]+|[A-Za-z]+_[A-Za-z]+)$", "match": false } },
{ "selector": "enumMember", "format": ["camelCase", "PascalCase"], "leadingUnderscore": "allow", "filter": { "regex": "^[A-Za-z]+_[A-Za-z]+$", "match": false } },
{
"selector": "typeLike",
"format": ["PascalCase"],
"filter": { "regex": "^(__String|[A-Za-z]+_[A-Za-z]+)$", "match": false }
},
{
"selector": "interface",
"format": ["PascalCase"],
"custom": { "regex": "^I[A-Z]", "match": false },
"filter": { "regex": "^I(Arguments|TextWriter|O([A-Z][a-z]+[A-Za-z]*)?)$", "match": false }
},
{
"selector": "variable",
"format": ["camelCase", "PascalCase", "UPPER_CASE"],
"leadingUnderscore": "allow",
"filter": { "regex": "^(_{1,2}filename|_{1,2}dirname|_+|[A-Za-z]+_[A-Za-z]+)$", "match": false }
},
{
"selector": "function",
"format": ["camelCase", "PascalCase"],
"leadingUnderscore": "allow",
"filter": { "regex": "^[A-Za-z]+_[A-Za-z]+$", "match": false }
},
{
"selector": "parameter",
"format": ["camelCase"],
"leadingUnderscore": "allow",
"filter": { "regex": "^(_+|[A-Za-z]+_[A-Z][a-z]+)$", "match": false }
},
{
"selector": "method",
"format": ["camelCase", "PascalCase"],
"leadingUnderscore": "allow",
"filter": { "regex": "^([0-9]+|[A-Za-z]+_[A-Za-z]+)$", "match": false }
},
{
"selector": "memberLike",
"format": ["camelCase"],
"leadingUnderscore": "allow",
"filter": { "regex": "^([0-9]+|[A-Za-z]+_[A-Za-z]+)$", "match": false }
},
{
"selector": "enumMember",
"format": ["camelCase", "PascalCase"],
"leadingUnderscore": "allow",
"filter": { "regex": "^[A-Za-z]+_[A-Za-z]+$", "match": false }
},
{ "selector": "property", "format": null }
],

Expand Down Expand Up @@ -99,7 +138,15 @@
"no-new-func": "error",
"no-new-wrappers": "error",
"no-return-await": "error",
"no-restricted-globals": ["error", { "name": "setTimeout" }, { "name": "clearTimeout" }, { "name": "setInterval" }, { "name": "clearInterval" }, { "name": "setImmediate" }, { "name": "clearImmediate" }],
"no-restricted-globals": [
"error",
{ "name": "setTimeout" },
{ "name": "clearTimeout" },
{ "name": "setInterval" },
{ "name": "clearInterval" },
{ "name": "setImmediate" },
{ "name": "clearImmediate" }
],
"no-sparse-arrays": "error",
"no-template-curly-in-string": "error",
"no-throw-literal": "error",
Expand Down Expand Up @@ -133,7 +180,14 @@
"files": ["*.mjs", "*.mts"],
"rules": {
// These globals don't exist outside of CJS files.
"no-restricted-globals": ["error", { "name": "__filename" }, { "name": "__dirname" }, { "name": "require" }, { "name": "module" }, { "name": "exports" }]
"no-restricted-globals": [
"error",
{ "name": "__filename" },
{ "name": "__dirname" },
{ "name": "require" },
{ "name": "module" },
{ "name": "exports" }
]
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"[typescript][javascript][json][jsonc]": {
// "editor.formatOnSave": true,
"editor.defaultFormatter": "dprint.dprint"
}
},

// To ignore commits listed in .git-blame-ignore-revs in GitLens:
// "gitlens.advanced.blame.customArguments": [
Expand Down
107 changes: 91 additions & 16 deletions Herebyfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,23 @@ import _glob from "glob";
import util from "util";
import chalk from "chalk";
import fsExtra from "fs-extra";
import { Debouncer, Deferred, exec, getDiffTool, getDirSize, memoize, needsUpdate, readJson } from "./scripts/build/utils.mjs";
import { localBaseline, localRwcBaseline, refBaseline, refRwcBaseline, runConsoleTests } from "./scripts/build/tests.mjs";
import {
Debouncer,
Deferred,
exec,
getDiffTool,
getDirSize,
memoize,
needsUpdate,
readJson,
} from "./scripts/build/utils.mjs";
import {
localBaseline,
localRwcBaseline,
refBaseline,
refRwcBaseline,
runConsoleTests,
} from "./scripts/build/tests.mjs";
import { buildProject, cleanProject, watchProject } from "./scripts/build/projects.mjs";
import { localizationDirectories } from "./scripts/build/localization.mjs";
import cmdLineOptions from "./scripts/build/options.mjs";
Expand Down Expand Up @@ -110,7 +125,12 @@ const localize = task({
dependencies: [generateDiagnostics],
run: async () => {
if (needsUpdate(diagnosticMessagesGeneratedJson, generatedLCGFile)) {
await exec(process.execPath, ["scripts/generateLocalizedDiagnosticMessages.mjs", "src/loc/lcl", "built/local", diagnosticMessagesGeneratedJson], { ignoreExitCode: true });
await exec(process.execPath, [
"scripts/generateLocalizedDiagnosticMessages.mjs",
"src/loc/lcl",
"built/local",
diagnosticMessagesGeneratedJson,
], { ignoreExitCode: true });
}
},
});
Expand Down Expand Up @@ -289,7 +309,10 @@ function entrypointBuildTask(options) {
const outDir = path.dirname(options.output);
await fs.promises.mkdir(outDir, { recursive: true });
const moduleSpecifier = path.relative(outDir, options.builtEntrypoint);
await fs.promises.writeFile(options.output, `module.exports = require("./${moduleSpecifier.replace(/[\\/]/g, "/")}")`);
await fs.promises.writeFile(
options.output,
`module.exports = require("./${moduleSpecifier.replace(/[\\/]/g, "/")}")`,
);
},
});

Expand All @@ -313,13 +336,19 @@ function entrypointBuildTask(options) {
const watch = task({
name: `watch-${options.name}`,
hiddenFromTaskList: true, // This is best effort.
dependencies: (options.buildDeps ?? []).concat(options.mainDeps ?? []).concat(cmdLineOptions.bundle ? [] : [shim]),
dependencies: (options.buildDeps ?? []).concat(options.mainDeps ?? []).concat(
cmdLineOptions.bundle ? [] : [shim],
),
run: () => {
// These watch functions return promises that resolve once watch mode has started,
// allowing them to operate as regular tasks, while creating unresolved promises
// in the background that keep the process running after all tasks have exited.
if (!printedWatchWarning) {
console.error(chalk.yellowBright("Warning: watch mode is incomplete and may not work as expected. Use at your own risk."));
console.error(
chalk.yellowBright(
"Warning: watch mode is incomplete and may not work as expected. Use at your own risk.",
),
);
printedWatchWarning = true;
}

Expand Down Expand Up @@ -363,7 +392,12 @@ export const dtsServices = task({
description: "Bundles typescript.d.ts",
dependencies: [buildServices],
run: async () => {
if (needsUpdate("./built/local/typescript/tsconfig.tsbuildinfo", ["./built/local/typescript.d.ts", "./built/local/typescript.internal.d.ts"])) {
if (
needsUpdate("./built/local/typescript/tsconfig.tsbuildinfo", [
"./built/local/typescript.d.ts",
"./built/local/typescript.internal.d.ts",
])
) {
await runDtsBundler("./built/local/typescript/typescript.d.ts", "./built/local/typescript.d.ts");
}
},
Expand Down Expand Up @@ -412,8 +446,16 @@ export const dtsLssl = task({
description: "Bundles tsserverlibrary.d.ts",
dependencies: [buildLssl],
run: async () => {
if (needsUpdate("./built/local/tsserverlibrary/tsconfig.tsbuildinfo", ["./built/local/tsserverlibrary.d.ts", "./built/local/tsserverlibrary.internal.d.ts"])) {
await runDtsBundler("./built/local/tsserverlibrary/tsserverlibrary.d.ts", "./built/local/tsserverlibrary.d.ts");
if (
needsUpdate("./built/local/tsserverlibrary/tsconfig.tsbuildinfo", [
"./built/local/tsserverlibrary.d.ts",
"./built/local/tsserverlibrary.internal.d.ts",
])
) {
await runDtsBundler(
"./built/local/tsserverlibrary/tsserverlibrary.d.ts",
"./built/local/tsserverlibrary.d.ts",
);
}
},
});
Expand Down Expand Up @@ -536,7 +578,13 @@ export const watchOtherOutputs = task({
name: "watch-other-outputs",
description: "Builds miscelaneous scripts and documents distributed with the LKG",
hiddenFromTaskList: true,
dependencies: [watchCancellationToken, watchTypingsInstaller, watchWatchGuard, generateTypesMap, copyBuiltLocalDiagnosticMessages],
dependencies: [
watchCancellationToken,
watchTypingsInstaller,
watchWatchGuard,
generateTypesMap,
copyBuiltLocalDiagnosticMessages,
],
});

export const local = task({
Expand Down Expand Up @@ -614,7 +662,10 @@ export const runTestsAndWatch = task({
if (!token.signaled) {
running = true;
try {
await runConsoleTests(testRunner, "mocha-fivemat-progress-reporter", /*runInParallel*/ false, { token, watching: true });
await runConsoleTests(testRunner, "mocha-fivemat-progress-reporter", /*runInParallel*/ false, {
token,
watching: true,
});
}
catch {
// ignore
Expand Down Expand Up @@ -773,7 +824,10 @@ export const updateSublime = task({
dependencies: [tsserver],
run: async () => {
for (const file of ["built/local/tsserver.js", "built/local/tsserver.js.map"]) {
await fs.promises.copyFile(file, path.resolve("../TypeScript-Sublime-Plugin/tsserver/", path.basename(file)));
await fs.promises.copyFile(
file,
path.resolve("../TypeScript-Sublime-Plugin/tsserver/", path.basename(file)),
);
}
},
});
Expand Down Expand Up @@ -809,7 +863,10 @@ export const produceLKG = task({
.concat(localizationTargets)
.filter(f => !fs.existsSync(f));
if (missingFiles.length > 0) {
throw new Error("Cannot replace the LKG unless all built targets are present in directory 'built/local/'. The following files are missing:\n" + missingFiles.join("\n"));
throw new Error(
"Cannot replace the LKG unless all built targets are present in directory 'built/local/'. The following files are missing:\n"
+ missingFiles.join("\n"),
);
}
const sizeBefore = getDirSize("lib");
await exec(process.execPath, ["scripts/produceLKG.mjs"]);
Expand Down Expand Up @@ -841,19 +898,37 @@ export const clean = task({
export const configureNightly = task({
name: "configure-nightly",
description: "Runs scripts/configurePrerelease.mjs to prepare a build for nightly publishing",
run: () => exec(process.execPath, ["scripts/configurePrerelease.mjs", "dev", "package.json", "src/compiler/corePublic.ts"]),
run: () =>
exec(process.execPath, [
"scripts/configurePrerelease.mjs",
"dev",
"package.json",
"src/compiler/corePublic.ts",
]),
});

export const configureInsiders = task({
name: "configure-insiders",
description: "Runs scripts/configurePrerelease.mjs to prepare a build for insiders publishing",
run: () => exec(process.execPath, ["scripts/configurePrerelease.mjs", "insiders", "package.json", "src/compiler/corePublic.ts"]),
run: () =>
exec(process.execPath, [
"scripts/configurePrerelease.mjs",
"insiders",
"package.json",
"src/compiler/corePublic.ts",
]),
});

export const configureExperimental = task({
name: "configure-experimental",
description: "Runs scripts/configurePrerelease.mjs to prepare a build for experimental publishing",
run: () => exec(process.execPath, ["scripts/configurePrerelease.mjs", "experimental", "package.json", "src/compiler/corePublic.ts"]),
run: () =>
exec(process.execPath, [
"scripts/configurePrerelease.mjs",
"experimental",
"package.json",
"src/compiler/corePublic.ts",
]),
});

export const help = task({
Expand Down
16 changes: 15 additions & 1 deletion scripts/build/localization.mjs
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
export const localizationDirectories = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-br", "ru", "tr", "zh-cn", "zh-tw"].map(f => f.toLowerCase());
export const localizationDirectories = [
"cs",
"de",
"es",
"fr",
"it",
"ja",
"ko",
"pl",
"pt-br",
"ru",
"tr",
"zh-cn",
"zh-tw",
].map(f => f.toLowerCase());
16 changes: 15 additions & 1 deletion scripts/build/options.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,21 @@ import os from "os";
const ci = ["1", "true"].includes(process.env.CI ?? "");

const parsed = minimist(process.argv.slice(2), {
boolean: ["dirty", "light", "colors", "lkg", "soft", "fix", "failed", "keepFailed", "force", "built", "ci", "bundle", "typecheck"],
boolean: [
"dirty",
"light",
"colors",
"lkg",
"soft",
"fix",
"failed",
"keepFailed",
"force",
"built",
"ci",
"bundle",
"typecheck",
],
string: ["browser", "tests", "break", "host", "reporter", "stackTraceLimit", "timeout", "shards", "shardId"],
alias: {
/* eslint-disable quote-props */
Expand Down
13 changes: 10 additions & 3 deletions scripts/build/projects.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,16 @@ class ProjectQueue {
}
}

const execTsc = (/** @type {string[]} */ ...args) => exec(process.execPath, [resolve(findUpRoot(), cmdLineOptions.lkg ? "./lib/tsc.js" : "./built/local/tsc.js"), "-b", ...args], { hidePrompt: true });

const projectBuilder = new ProjectQueue(projects => execTsc(...(cmdLineOptions.bundle ? [] : ["--emitDeclarationOnly", "false"]), ...projects));
const execTsc = (/** @type {string[]} */ ...args) =>
exec(process.execPath, [
resolve(findUpRoot(), cmdLineOptions.lkg ? "./lib/tsc.js" : "./built/local/tsc.js"),
"-b",
...args,
], { hidePrompt: true });

const projectBuilder = new ProjectQueue(projects =>
execTsc(...(cmdLineOptions.bundle ? [] : ["--emitDeclarationOnly", "false"]), ...projects)
);

/**
* @param {string} project
Expand Down
Loading

0 comments on commit 670a8de

Please sign in to comment.