Skip to content

Commit c6e6c3a

Browse files
committed
feat(typescript): initial TypeScript setup
- Adds TypeScript loader to Webpack configuration - Upgrade Webpack dependencies to latest - Modifies TravisCI build to publish from correct directories - Adds TS linting (in conjunction to current 'standard' lint) - Updates TS Declarations to be lint compatible Initial work for #76
1 parent 2275e2c commit c6e6c3a

14 files changed

Lines changed: 4260 additions & 627 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ coverage
2323
# Compiled binary addons (http://nodejs.org/api/addons.html)
2424
build/Release
2525
dist
26+
dist-web
2627

2728
# Dependency directory
2829
node_modules

.travis.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,10 @@ deploy:
3939
tags: true
4040
branch: master
4141
node: '6'
42-
- provider: npm
43-
email: pact-foundation@googlegroups.com
44-
api_key:
45-
secure: jvmoyItvKvPrPZjWtD8/l12fjkIunhdBaKduPjzrJ9xGrnRRigI+NY6WVdWlPJ6IMbHi5f258idUhrP3nTL7QCPMSIb0P/JZyrrkHliPLyRhBP+yc/s+AuzYJm09O454JgvxnWuENGsLtR5q6swo6pDGFwthIyAHL/O8AXEavz3jG7GULjwIL/LtBKCzoK+L4WdS8SC0X8WUP6+/hgoiqmydHWKn23EQuw7Ia8ETp6yTuihuap/x8y869HUU+8+punx62Fav6ChsR8olN0WOakI9hC4B+dmz7TRRPTCN2WGa68f5UctAedSba2T/ChBpufAPnHJYAz2T372OMjQtHuD14DDVHoar6X3I5djaq6M1k06hJ7WMTCP0gItaUXMiy6I5Nlo/5tvOIXsUxiO3Ll7GzK5rpj/pqwIrm6Ecda9kPMzaC6IdEPZ9v+yglSd9zsbs2wfAuXlfJvH5/3oeWSCdIzYwJL8v63xQienxhxfAfMLqXP+GyuntqIV/NrHuunpSAjZGqXALJ5Ff1oWybQQVPDTlxWi4VdHfrw1lhPwUWVzNbaFq8hsnrujmLcpq0/X3p3QXgEMB2A3pJ49mm2Y9/YI9m2MPryhBL1x1WmtI+1udONlb1VIeU6KOUUulUXufRPv5gS/3NnisdhYj7KkF4GyrPaQYQAxh8tvy9Xs
46-
skip_cleanup: true
47-
on:
48-
tags: true
49-
branch: master
50-
node: '6'
5142
- provider: script
5243
skip_cleanup: true
53-
script: npm publish dist --access public
44+
script: ./scripts/deploy.sh
5445
on:
55-
branch: master
5646
tags: true
47+
branch: master
5748
node: '6'

config/webpack.web.config.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
/* eslint-disable */
2-
var path = require('path');
3-
var webpack = require('webpack');
4-
5-
var DIST = path.resolve(__dirname, '../dist');
6-
var APP = path.resolve(__dirname, '../src');
2+
const path = require('path');
3+
const webpack = require('webpack');
4+
const DIST = path.resolve(__dirname, '../dist-web');
5+
const APP = path.resolve(__dirname, '../src');
76

87
module.exports = {
98
entry: path.resolve(APP, 'pact-web.js'),
@@ -14,27 +13,33 @@ module.exports = {
1413
umdNamedDefine: true,
1514
filename: 'pact-web.js'
1615
},
16+
resolve: {
17+
extensions: ['.ts', '.tsx', '.js']
18+
},
1719
target: 'web',
18-
externals: ['mitm'],
1920
node: {
2021
net: 'empty'
2122
},
2223
module: {
2324
loaders: [
24-
{ test: /\.tsx?$/, loader: 'ignore-loader' },
25+
{
26+
test: /\.tsx?$/,
27+
loader: 'awesome-typescript-loader'
28+
},
2529
{
2630
loader: 'babel-loader',
2731
test: APP,
2832
exclude: /node_modules/,
29-
query: { presets: ['es2015'] }
33+
query: {
34+
presets: ['es2015']
35+
}
3036
}
31-
]
37+
],
3238
},
3339
plugins: [
3440
new webpack.DefinePlugin({ 'global.GENTLY': false }),
3541
new webpack.IgnorePlugin(/vertx/),
36-
new webpack.optimize.DedupePlugin(),
37-
new webpack.NoErrorsPlugin()
42+
new webpack.NoEmitOnErrorsPlugin()
3843
],
3944
devtool: 'source-map'
4045
}

karma/jasmine/karma.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = function (config) {
1313

1414
// list of files / patterns to load in the browser
1515
files: [
16-
'../../dist/pact-web.js',
16+
'../../dist-web/pact-web.js',
1717
// Example Using NPM package
1818
// 'node_modules/pact-web/pact-web.js',
1919
'client.js',

karma/mocha/karma.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module.exports = function (config) {
1414
// list of files / patterns to load in the browser
1515
files: [
1616
// if you are using this example to setup your own project load pact from the node_modules directory
17-
'../../dist/pact-web.js',
17+
'../../dist-web/pact-web.js',
1818
// Example Using NPM package
1919
// 'node_modules/pact-web/pact-web.js',
2020
'client.js',

0 commit comments

Comments
 (0)