-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add @definitelytyped/dtslint-runner #6
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
d23bd76
WIP unify dtslint-runner and types-publisher
andrewbranch bcb6cfb
Finish main implementation
andrewbranch 28b799e
Finish(?) combined implementation
andrewbranch 20f28a0
Delete obsolete stuff and move tests around
andrewbranch 70251ad
Fix problems
andrewbranch 564e200
Delete package-lock
andrewbranch a6e4d27
Disable npm ci for now because it doesn’t really work
andrewbranch c9c23f9
Merge branch 'master' into dtslint-runner
andrewbranch 0c1b642
Update dependency versions
andrewbranch abe877f
Again
andrewbranch 30482ad
utils is at 0.0.26
andrewbranch f34e069
Merge branch 'master' into dtslint-runner
andrewbranch b51857f
Remove old exceptions
andrewbranch b395bd0
Fix package.json versions
andrewbranch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
...test/tester/get-affected-packages.test.ts → ...parser/test/get-affected-packages.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 3 additions & 9 deletions
12
...publisher/test/tester/test-runner.test.ts → packages/definitions-parser/test/git.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,35 @@ | ||
import { TypingsVersionsRaw, License, PackageId } from "../src/packages"; | ||
|
||
export function testo(o: { [s: string]: () => void }) { | ||
for (const k of Object.keys(o)) { | ||
test(k, o[k], 100_000); | ||
} | ||
} | ||
|
||
export function createTypingsVersionRaw( | ||
name: string, | ||
dependencies: PackageId[], | ||
testDependencies: string[] | ||
): TypingsVersionsRaw { | ||
return { | ||
"1.0.0": { | ||
libraryName: name, | ||
typingsPackageName: name, | ||
dependencies, | ||
testDependencies, | ||
files: ["index.d.ts"], | ||
libraryMajorVersion: 1, | ||
libraryMinorVersion: 0, | ||
pathMappings: [], | ||
contributors: [{ name: "Bender", url: "futurama.com", githubUsername: "bender" }], | ||
minTsVersion: "2.3", | ||
typesVersions: [], | ||
license: License.MIT, | ||
packageJsonDependencies: [], | ||
contentHash: "11111111111111", | ||
projectName: "zombo.com", | ||
globals: [], | ||
declaredModules: [] | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
src | ||
test | ||
logs | ||
.DS_Store | ||
.vscode | ||
*.tsbuildinfo | ||
tsconfig.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# @definitelytyped/dtslint-runner | ||
|
||
A unification of [dtslint-runner](https://github.com/DefinitelyTyped/dtslint-runner) and [the CI part of types-publisher](https://github.com/microsoft/types-publisher/blob/master/src/tester/test-runner.ts). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
electron-localshortcut | ||
electron-prompt | ||
electron-window-state | ||
electron-spellchecker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "@definitelytyped/dtslint-runner", | ||
"version": "0.0.30-next.1", | ||
"description": "Run dtslint on DefinitelyTyped packages", | ||
"homepage": "https://github.com/microsoft/DefinitelyTyped-tools#readme", | ||
"license": "MIT", | ||
"main": "dist/index.js", | ||
"bin": "dist/index.js", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/microsoft/DefinitelyTyped-tools.git" | ||
}, | ||
"scripts": { | ||
"test": "echo \"Error: run tests from root\" && exit 1" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/microsoft/DefinitelyTyped-tools/issues" | ||
}, | ||
"dependencies": { | ||
"@definitelytyped/definitions-parser": "0.0.30-next.1", | ||
"@definitelytyped/utils": "0.0.30-next.0", | ||
"dtslint": "^3.4.1", | ||
"fs-extra": "^9.0.0", | ||
"stats-lite": "^2.2.0", | ||
"yargs": "^15.3.1" | ||
}, | ||
"devDependencies": { | ||
"@types/fs-extra": "^8.1.0", | ||
"@types/stats-lite": "^2.2.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import os from "os"; | ||
import yargs from "yargs"; | ||
import { RunDTSLintOptions } from "./types"; | ||
import { runDTSLint } from "./main"; | ||
import { assertDefined, logUncaughtErrors } from "@definitelytyped/utils"; | ||
|
||
export { runDTSLint, RunDTSLintOptions }; | ||
|
||
if (!module.parent) { | ||
const args = yargs | ||
.options({ | ||
clone: { | ||
group: "DefinitelyTyped acquisition", | ||
description: "Clone DefinitelyTyped before running. Can be used as a boolean flag or set to the SHA to clone.", | ||
conflicts: "path" | ||
}, | ||
path: { | ||
group: "DefinitelyTyped acquisition", | ||
description: "Path to local DefinitelyTyped clone.", | ||
conflicts: "clone", | ||
type: "string", | ||
default: "../DefinitelyTyped" | ||
}, | ||
selection: { | ||
group: "Package selection", | ||
description: "Which packages to test.", | ||
type: "string", | ||
choices: ["all", "affected"], | ||
default: "affected" | ||
}, | ||
nProcesses: { | ||
group: "Parallelism", | ||
description: "How many processes to distribute parallelizable tasks over.", | ||
type: "number", | ||
default: os.cpus().length | ||
}, | ||
shardId: { | ||
group: "Parallelism", | ||
description: "The machine index when sharding a run over multiple machines.", | ||
type: "number", | ||
implies: "shardCount" | ||
}, | ||
shardCount: { | ||
group: "Parallelism", | ||
description: "The total number of machines when sharding a run over multiple machines.", | ||
type: "number", | ||
implies: "shardId" | ||
}, | ||
localTypeScriptPath: { | ||
group: "dtslint options", | ||
description: | ||
"Path to local TypeScript installation to be used by dtslint instead of all supported TypeScript versions.", | ||
type: "string", | ||
conflicts: "onlyTestTsNext" | ||
}, | ||
onlyTestTsNext: { | ||
group: "dtslint options", | ||
description: "Run dtslint only with typescript@next instead of all supported TypeScript versions.", | ||
type: "boolean", | ||
conflicts: "localTypeScriptPath", | ||
default: false | ||
}, | ||
expectOnly: { | ||
group: "dtslint options", | ||
description: "Run only the ExpectType lint rule.", | ||
type: "boolean", | ||
default: false | ||
}, | ||
// Not sure why you’d use this, so I’m hiding it | ||
noInstall: { | ||
hidden: true, | ||
type: "boolean", | ||
default: false | ||
} | ||
}) | ||
.wrap(Math.min(yargs.terminalWidth(), 120)).argv; | ||
|
||
const options: RunDTSLintOptions = { | ||
definitelyTypedAcquisition: args.clone | ||
? { | ||
kind: "clone", | ||
sha: typeof args.clone === "string" ? args.clone : undefined | ||
} | ||
: { | ||
kind: "local", | ||
path: args.path | ||
}, | ||
onlyRunAffectedPackages: args.selection === "affected", | ||
nProcesses: args.nProcesses, | ||
shard: args.shardCount ? { id: assertDefined(args.shardId), count: args.shardCount } : undefined, | ||
localTypeScriptPath: args.localTypeScriptPath, | ||
onlyTestTsNext: args.onlyTestTsNext, | ||
expectOnly: args.expectOnly, | ||
noInstall: args.noInstall | ||
}; | ||
|
||
logUncaughtErrors(async () => { | ||
const failures = await runDTSLint(options); | ||
process.exit(failures); | ||
}); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree with this typography