Skip to content

Commit a61a7a2

Browse files
committed
Attempt to rewrite the jakefile and fail
1 parent 336c376 commit a61a7a2

13 files changed

+352
-48
lines changed

Jakefile.js

+309-19
Large diffs are not rendered by default.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
"mocha": "latest",
7676
"mocha-fivemat-progress-reporter": "latest",
7777
"q": "latest",
78+
"remove-internal": "^2.9.2",
7879
"run-sequence": "latest",
7980
"sorcery": "latest",
8081
"source-map-support": "latest",

scripts/processDiagnosticMessages.ts

+21-14
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,43 @@
1+
import path = require("path");
2+
import fs = require("fs");
3+
14
interface DiagnosticDetails {
25
category: string;
36
code: number;
47
reportsUnnecessary?: {};
58
isEarly?: boolean;
69
}
710

8-
type InputDiagnosticMessageTable = ts.Map<DiagnosticDetails>;
11+
type InputDiagnosticMessageTable = Map<string, DiagnosticDetails>;
912

1013
function main(): void {
11-
const sys = ts.sys;
12-
if (sys.args.length < 1) {
13-
sys.write("Usage:" + sys.newLine);
14-
sys.write("\tnode processDiagnosticMessages.js <diagnostic-json-input-file>" + sys.newLine);
14+
if (process.argv.length < 3) {
15+
console.log("Usage:");
16+
console.log("\tnode processDiagnosticMessages.js <diagnostic-json-input-file>");
1517
return;
1618
}
1719

1820
function writeFile(fileName: string, contents: string) {
19-
const inputDirectory = ts.getDirectoryPath(inputFilePath);
20-
const fileOutputPath = ts.combinePaths(inputDirectory, fileName);
21-
sys.writeFile(fileOutputPath, contents);
21+
fs.writeFile(path.join(path.dirname(inputFilePath), fileName), contents, { encoding: "utf-8" }, err => {
22+
if (err) throw err;
23+
})
2224
}
2325

24-
const inputFilePath = sys.args[0].replace(/\\/g, "/");
25-
const inputStr = sys.readFile(inputFilePath)!;
26+
const inputFilePath = process.argv[2].replace(/\\/g, "/");
27+
console.log(`Reading diagnostics from ${inputFilePath}`);
28+
const inputStr = fs.readFileSync(inputFilePath, { encoding: "utf-8" });
2629

2730
const diagnosticMessagesJson: { [key: string]: DiagnosticDetails } = JSON.parse(inputStr);
2831

29-
const diagnosticMessages: InputDiagnosticMessageTable = ts.createMapFromTemplate(diagnosticMessagesJson);
32+
const diagnosticMessages: InputDiagnosticMessageTable = new Map();
33+
for (const key in diagnosticMessagesJson) {
34+
if (Object.hasOwnProperty.call(diagnosticMessagesJson, key)) {
35+
diagnosticMessages.set(key, diagnosticMessagesJson[key]);
36+
}
37+
}
3038

31-
const outputFilesDir = ts.getDirectoryPath(inputFilePath);
32-
const thisFilePathRel = ts.getRelativePathToDirectoryOrUrl(outputFilesDir, sys.getExecutingFilePath(),
33-
sys.getCurrentDirectory(), ts.createGetCanonicalFileName(sys.useCaseSensitiveFileNames), /* isAbsolutePathAnUrl */ false);
39+
const outputFilesDir = path.dirname(inputFilePath);
40+
const thisFilePathRel = path.relative(process.cwd(), outputFilesDir);
3441

3542
const infoFileOutput = buildInfoFileOutput(diagnosticMessages, "./diagnosticInformationMap.generated.ts", thisFilePathRel);
3643
checkForUniqueCodes(diagnosticMessages);
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
{
22
"compilerOptions": {
33
"removeComments": false,
4-
"outFile": "processDiagnosticMessages.js",
54
"target": "es5",
65
"declaration": false,
76
"lib": [
87
"es6",
98
"scripthost"
10-
]
9+
],
10+
"types": ["node"]
1111
},
1212
"files": [
13-
"../src/compiler/types.ts",
14-
"../src/compiler/performance.ts",
15-
"../src/compiler/core.ts",
16-
"../src/compiler/sys.ts",
17-
1813
"processDiagnosticMessages.ts"
1914
]
2015
}

scripts/tslint/tsconfig.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
"noUnusedParameters": true,
1111
"strictNullChecks": true,
1212
"module": "commonjs",
13-
"outDir": "../../built/local/tslint"
13+
"outDir": "../../built/local/tslint",
14+
"baseUrl": "../..",
15+
"paths": {
16+
"typescript": ["lib/typescript.d.ts"]
17+
}
1418
}
1519
}

src/cancellationToken/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"extends": "../tsconfig-base",
33
"compilerOptions": {
4-
"outDir": "../built/local/",
4+
"outDir": "../../built/local/",
55
"composite": false,
66
"declaration": false,
77
"removeComments": true,

src/harness/tsconfig.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"extends": "../tsconfig-base",
33
"compilerOptions": {
4-
"outFile": "../built/local/harness.js",
4+
"outFile": "../../built/local/harness.js",
55
"types": [
66
"node", "mocha", "chai"
77
],
@@ -16,7 +16,7 @@
1616
{ "path": "../compiler" },
1717
{ "path": "../services" },
1818
{ "path": "../server" },
19-
{ "path": "../typingsInstallerCore" },
19+
{ "path": "../typingsInstallerCore" }
2020
],
2121

2222
"files": [

src/parser/diagnosticInformationMap.generated.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// <auto-generated />
2-
// generated from './diagnosticInformationMap.generated.ts' by '../../scripts/processDiagnosticMessages.js'
2+
// generated from './diagnosticInformationMap.generated.ts' by 'src\parser'
33
/* @internal */
44
namespace ts {
55
function diag(code: number, category: DiagnosticCategory, key: string, message: string, reportsUnnecessary?: {}): DiagnosticMessage {

src/tsc/tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
],
99
"references": [
1010
{ "path": "../core", "prepend": true },
11+
{ "path": "../parser", "prepend": true },
1112
{ "path": "../compiler", "prepend": true }
1213
]
1314
}

src/tsconfig.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
"files": [],
33
"include": [],
44
"references": [
5-
{ "path": "./tsc" }
5+
{ "path": "./tsc" },
6+
{ "path": "./tsserver" },
7+
{ "path": "./typingsInstaller" },
8+
{ "path": "./watchGuard" },
9+
{ "path": "./cancellationToken" },
10+
{ "path": "./testRunner" }
611
]
712
}

src/tsserver/tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
],
1313
"references": [
1414
{ "path": "../core", "prepend": true },
15+
{ "path": "../parser", "prepend": true },
1516
{ "path": "../compiler", "prepend": true },
1617
{ "path": "../services", "prepend": true },
1718
{ "path": "../server", "prepend": true }

src/typingsInstaller/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "../tsconfig-base",
33
"compilerOptions": {
44
"removeComments": true,
5-
"outFile": "../built/local/typingsInstaller.js",
5+
"outFile": "../../built/local/typingsInstaller.js",
66
"types": [
77
"node"
88
],

src/watchGuard/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "../tsconfig-base",
33
"compilerOptions": {
44
"removeComments": true,
5-
"outFile": "../built/local/watchGuard.js",
5+
"outFile": "../../built/local/watchGuard.js",
66
"types": [
77
"node"
88
],

0 commit comments

Comments
 (0)