Skip to content

Commit

Permalink
feat: basic d.ts file (#161)
Browse files Browse the repository at this point in the history
`protocol.d.ts` had to move to `protocol.ts` otherwise typescript refuses to include it in the out directory.

Removed the old d.ts generator. It will need to be rewritten anyway.

These new types include private stuff that they probably shouldn't, and are missing documentation. I'll follow up with a better d.ts generator later.

#6
  • Loading branch information
JoelEinbinder authored Dec 6, 2019
1 parent 1c9103e commit 57313e3
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 534 deletions.
6 changes: 3 additions & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ node6-testrunner/*
lib/
*.js
src/generated/*
src/chromium/protocol.d.ts
src/firefox/protocol.d.ts
src/webkit/protocol.d.ts
src/chromium/protocol.ts
src/firefox/protocol.ts
src/webkit/protocol.ts
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ package-lock.json
yarn.lock
/node6
/src/generated/*
/src/chromium/protocol.d.ts
/src/firefox/protocol.d.ts
/src/webkit/protocol.d.ts
/src/chromium/protocol.ts
/src/firefox/protocol.ts
/src/webkit/protocol.ts
/utils/browser/playwright-web.js
/index.d.ts
lib/
playwright-*.tgz
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
!lib/**/*.js
# Injected files are included via lib/generated, see src/injected/README.md
lib/injected/
#types
!lib/**/*.d.ts
!index.d.ts

# root for "playwright" package
!index.js
Expand Down
9 changes: 9 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import * as chromium from './chromium';
import * as firefox from './firefox';
import * as webkit from './webkit';
declare function pickBrowser(browser: 'chromium'): typeof chromium;
declare function pickBrowser(browser: 'firefox'): typeof firefox;
declare function pickBrowser(browser: 'webkit'): typeof webkit;
export = pickBrowser;
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"wunit": "cross-env BROWSER=webkit node test/test.js",
"debug-unit": "node --inspect-brk test/test.js",
"test-doclint": "node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js",
"test": "npm run lint --silent && npm run coverage && npm run test-doclint && npm run test-types && node utils/testrunner/test/test.js",
"test": "npm run lint --silent && npm run coverage && npm run test-doclint && node utils/testrunner/test/test.js",
"prepare": "node install.js",
"lint": "([ \"$CI\" = true ] && eslint --quiet -f codeframe --ext js,ts ./src || eslint --ext js,ts ./src) && npm run tsc && npm run doc",
"doc": "node utils/doclint/cli.js",
Expand All @@ -28,7 +28,6 @@
"watch": "node utils/runWebpack.js --mode='development' --watch --silent | tsc -w -p .",
"apply-next-version": "node utils/apply_next_version.js",
"bundle": "npx browserify -r ./index.js:playwright -o utils/browser/playwright-web.js",
"test-types": "node utils/doclint/generate_types && npx -p typescript@2.1 tsc -p utils/doclint/generate_types/test/",
"unit-bundle": "node utils/browser/test.js"
},
"author": {
Expand Down
5 changes: 2 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"target": "ESNext",
"module": "commonjs",
"lib": ["esnext", "dom"],
"sourceMap": true,
"rootDir": "./src",
"outDir": "./lib",
"strictBindCallApply": true
"strictBindCallApply": true,
"declaration": true
},
"compileOnSave": true,
"include": ["src/**/*.ts"],
Expand Down
221 changes: 0 additions & 221 deletions utils/doclint/generate_types/index.js

This file was deleted.

Loading

0 comments on commit 57313e3

Please sign in to comment.