Skip to content

Commit

Permalink
[chrome-launcher] Publish type definitions instead of source TypeScri…
Browse files Browse the repository at this point in the history
…pt files (#2898)

* install rimraf types

* enable outputting declaration files

* disable publishing typescript files

* do not check formatting of d.ts files

* do not format d.ts files
  • Loading branch information
devrelm authored and samccone committed Aug 14, 2017
1 parent a6b71c9 commit 391e204
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ lighthouse-cli/*.js
!chrome-launcher/compiled-check.js
chrome-launcher/*.map
chrome-launcher/*.js
chrome-launcher/*.d.ts

lighthouse-cli/commands/*.map
lighthouse-cli/commands/*.js
Expand Down
6 changes: 6 additions & 0 deletions chrome-launcher/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ test/
.eslintrc.js
.travis.yml
gulpfile.js

# exclude source TypeScript files
*.ts

# allow TypeScript Declaration Files
!*.d.ts
4 changes: 2 additions & 2 deletions chrome-launcher/chrome-launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

import * as childProcess from 'child_process';
import * as fs from 'fs';
import * as net from 'net';
import * as rimraf from 'rimraf';
import * as chromeFinder from './chrome-finder';
import {getRandomPort} from './random-port';
import {DEFAULT_FLAGS} from './flags';
import {makeTmpDir, defaults, delay} from './utils';
import * as net from 'net';
const rimraf = require('rimraf');
const log = require('lighthouse-logger');
const spawn = childProcess.spawn;
const execSync = childProcess.execSync;
Expand Down
3 changes: 2 additions & 1 deletion chrome-launcher/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"test": "mocha --require ts-node/register --reporter=dot test/**/*-test.ts --timeout=10000",
"coverage": "nyc yarn test && nyc report --reporter=text-lcov > lcov.info",
"test-formatting": "test/check-formatting.sh",
"format": "clang-format -i -style=file **/*.ts *.ts"
"format": "scripts/format.sh"
},
"devDependencies": {
"@types/mocha": "^2.2.41",
Expand All @@ -23,6 +23,7 @@
"@types/core-js": "^0.9.41",
"@types/mkdirp": "^0.3.29",
"@types/node": "6.0.66",
"@types/rimraf": "^0.0.28",
"lighthouse-logger": "^1.0.0",
"mkdirp": "0.5.1",
"rimraf": "^2.6.1"
Expand Down
5 changes: 5 additions & 0 deletions chrome-launcher/scripts/format.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

FILES="`find . -type f \! -path '*node_modules*' \! -name '*.d.ts' -name '*.ts'`"

./node_modules/.bin/clang-format -i -style=file $FILES
3 changes: 1 addition & 2 deletions chrome-launcher/test/check-formatting.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ check_formatting ()
fi
}

check_formatting "*.ts"
check_formatting "**/*.ts"
check_formatting "`find . -type f \! -path '*node_modules*' \! -name '*.d.ts' -name '*.ts'`"
1 change: 1 addition & 0 deletions chrome-launcher/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"target": "es2016",
"declaration": true,
"noImplicitAny": true,
"inlineSourceMap": true,
"noEmitOnError": false,
Expand Down
4 changes: 4 additions & 0 deletions chrome-launcher/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
version "6.0.66"
resolved "https://registry.yarnpkg.com/@types/node/-/node-6.0.66.tgz#5680b74a6135d33d4c00447e7c3dc691a4601625"

"@types/rimraf@^0.0.28":
version "0.0.28"
resolved "https://registry.yarnpkg.com/@types/rimraf/-/rimraf-0.0.28.tgz#5562519bc7963caca8abf7f128cae3b594d41d06"

"@types/sinon@^2.3.1":
version "2.3.1"
resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-2.3.1.tgz#5e214093e9e2345219ab0f31bf310c9790ad0712"
Expand Down

0 comments on commit 391e204

Please sign in to comment.