Skip to content

Commit

Permalink
folder refactor: ts in /src, js in /dist (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed Dec 20, 2017
1 parent 7a25f96 commit d3ee63b
Show file tree
Hide file tree
Showing 19 changed files with 21 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1 +1,2 @@
node_modules
dist
8 changes: 4 additions & 4 deletions .npmignore
Expand Up @@ -10,8 +10,8 @@ test/
.travis.yml
gulpfile.js

# exclude source TypeScript files
*.ts
# ignore TypeScript source files
src/

# allow TypeScript Declaration Files
!*.d.ts
# allow JS & TypeScript declaration files
!dist/
4 changes: 4 additions & 0 deletions chrome-launcher/index.js
@@ -0,0 +1,4 @@
// This provides legacy support for a previously documented require pattern
// const chromeLauncher = require('chrome-launcher/chrome-launcher');

module.exports = require('../');
3 changes: 1 addition & 2 deletions compiled-check.js
Expand Up @@ -7,8 +7,7 @@ module.exports = function(filename) {
if (!fs.existsSync(path.join(__dirname, filename))) {
console.log(
'Oops! Looks like the chrome-launcher files needs to be compiled. Please run:');
console.log(' yarn install-launcher; yarn build-launcher;');
console.log('More at: https://github.com/GoogleChrome/lighthouse#develop');
console.log(' yarn; yarn build;');
process.exit(1);
}
}
4 changes: 2 additions & 2 deletions manual-chrome-launcher.js
Expand Up @@ -13,8 +13,8 @@
* chrome-debug --enable-extensions
*/

require('./compiled-check.js')('chrome-launcher.js');
const {launch} = require('./chrome-launcher');
require('./compiled-check.js')('./dist/chrome-launcher.js');
const {launch} = require('./dist/chrome-launcher');

const args = process.argv.slice(2);
let chromeFlags;
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "chrome-launcher",
"main": "index.js",
"main": "./dist/index.js",
"scripts": {
"build": "tsc",
"dev": "tsc -w",
Expand Down
2 changes: 1 addition & 1 deletion scripts/format.sh
@@ -1,5 +1,5 @@
#!/usr/bin/env bash

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

./node_modules/.bin/clang-format -i -style=file $FILES
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/check-formatting.sh
Expand Up @@ -12,4 +12,4 @@ check_formatting ()
fi
}

check_formatting "`find . -type f \! -path '*node_modules*' \! -name '*.d.ts' -name '*.ts'`"
check_formatting "`find src -type f -name '*.ts'`"
2 changes: 1 addition & 1 deletion test/chrome-launcher-test.ts
Expand Up @@ -5,7 +5,7 @@
*/
'use strict';

import {Launcher} from '../chrome-launcher';
import {Launcher} from '../src/';
import {spy, stub} from 'sinon';
import * as assert from 'assert';

Expand Down
2 changes: 1 addition & 1 deletion test/launch-signature-test.ts
Expand Up @@ -6,7 +6,7 @@

'use strict';

import {launch} from '../chrome-launcher';
import {launch} from '../src/';
import * as assert from 'assert';

const log = require('lighthouse-logger');
Expand Down
2 changes: 1 addition & 1 deletion test/random-port-test.ts
Expand Up @@ -16,7 +16,7 @@
'use strict';

import * as assert from 'assert';
import {getRandomPort} from '../random-port';
import {getRandomPort} from '../src/random-port';

describe('Random port generation', () => {
it('generates a valid random port number', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/utils-test.ts
Expand Up @@ -16,7 +16,7 @@
'use strict';

import * as assert from 'assert';
import {toWinDirFormat} from '../utils';
import {toWinDirFormat} from '../src/utils';

describe('WSL path format to Windows', () => {
it('transforms basic path', () => {
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"outDir": "dist",
"target": "es2016",
"declaration": true,
"noImplicitAny": true,
Expand All @@ -15,6 +16,6 @@
"node_modules"
],
"include": [
"*.ts"
"src"
]
}

0 comments on commit d3ee63b

Please sign in to comment.