Skip to content

Commit a968b4b

Browse files
Merge pull request #75 from RobotlegsJS/tsconfig
Update TypeScript Compiler Options
2 parents 49720f1 + 5ca047b commit a968b4b

File tree

10 files changed

+73
-58
lines changed

10 files changed

+73
-58
lines changed

.gitignore

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
.idea
22
.nyc_output
3-
build
4-
dev
3+
coverage
4+
dist/lib
5+
dist-test
56
lib
7+
lib-test
68
node_modules
7-
typings
8-
coverage
9-
inversify.d.ts
109
*.as
1110
*.iml
1211
src/**/*.js

.npmignore

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
/.nyc_output
33
/.vscode
44
/coverage
5-
/dev
65
/dist
6+
/dist-test
77
/docs
8-
/lib/test
8+
/lib-test
99
/not-ported-extensions
1010
/src
1111
/test
@@ -15,20 +15,14 @@ CODE_OF_CONDUCT.md
1515
CONTRIBUTING.md
1616
ISSUE_TEMPLATE.md
1717
PULL_REQUEST_TEMPLATE.md
18-
bower.json
1918
karma.conf.js
2019
tsconfig.json
2120
tsconfig.test.json
22-
tsfmt.json
2321
tslint.json
2422
tslint.test.json
25-
typings.json
2623
webpack.config.js
2724
yarn.lock
28-
.codeclimate.yml
2925
.editorconfig
30-
.eslintignore
31-
.eslintrc
3226
.gitignore
3327
.istanbul.yml
3428
.npmignore

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424

2525
- Enforce TSLint rules (see #55).
2626

27-
- Update TypeScript Compiler Options (see #53).
27+
- Update TypeScript Compiler Options to be more strict and to generate inline source maps (see #53, #75).
28+
29+
- Use [tslib](https://github.com/Microsoft/tslib) library to avoid duplicated declarations (see #75).
2830

2931
- Update dev dependencies to latest version.
3032

dist/signals.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

karma.conf.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
process.env.TEST = true;
2-
process.env.NODE_ENV = 'test';
2+
process.env.NODE_ENV = "test";
33

4-
const webpack = require("webpack");
5-
const path = require("path");
6-
const webpackConfig = require('./webpack.config.js')({ production: false, karma: true });
4+
const webpackConfig = require("./webpack.config.js")({ production: false, karma: true });
75

86
delete webpackConfig.entry;
97

10-
module.exports = function(config) {
8+
module.exports = config => {
119

1210
var configuration = {
1311
basePath: "",
@@ -20,7 +18,7 @@ module.exports = function(config) {
2018
files: [
2119
"./test/**/**/**.test.ts",
2220
{
23-
pattern: '**/*.map',
21+
pattern: "**/*.map",
2422
served: true,
2523
included: false,
2624
watched: true
@@ -65,14 +63,14 @@ module.exports = function(config) {
6563
colors: true,
6664
logLevel: config.LOG_INFO,
6765
autoWatch: true,
68-
browsers: ['Chrome']
66+
browsers: []
6967
};
7068

7169
if (process.env.TRAVIS) {
72-
configuration.browsers = ['PhantomJS'];
70+
configuration.browsers.push("PhantomJS");
7371
configuration.plugins.push("karma-phantomjs-launcher");
7472
} else {
75-
configuration.browsers = ['PhantomJS'];
73+
configuration.browsers.push("PhantomJS");
7674
configuration.plugins.push("karma-phantomjs-launcher");
7775
}
7876

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
"tslint:test": "tslint --config tslint.test.json --project tsconfig.test.json",
1414
"tslint": "npm run tslint-check:src && npm run tslint-check:test && npm run tslint:src && npm run tslint:test",
1515
"autoformat": "prettier --config .prettierrc --write {src,test}{/,/**/}{*,*.test}.ts",
16-
"clean-up": "rimraf .nyc_output && rimraf coverage && rimraf lib",
17-
"compile": "tsc -d",
16+
"clean-up": "rimraf .nyc_output && rimraf coverage && rimraf lib && rimraf lib-test && rimraf dist-test",
17+
"compile:src": "tsc -d --importHelpers",
18+
"compile:test": "tsc -p tsconfig.test.json -d --importHelpers",
1819
"dev": "webpack",
1920
"build": "webpack --env.production",
20-
"prepare": "npm run clean-up && npm run compile",
21+
"prepare": "npm run clean-up && npm run compile:src",
2122
"prepublishOnly": "publish-please guard",
2223
"publish-please": "npm run tslint && npm run autoformat && npm run clean-up && npm run build && npm run test && publish-please"
2324
},
@@ -62,6 +63,9 @@
6263
"url": "https://github.com/RobotlegsJS/SignalsJS/issues"
6364
},
6465
"homepage": "https://github.com/RobotlegsJS/SignalsJS#readme",
66+
"dependencies": {
67+
"tslib": "^1.9.3"
68+
},
6569
"devDependencies": {
6670
"@types/bluebird": "^3.5.23",
6771
"@types/chai": "^4.1.4",

tsconfig.json

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,21 @@
22
"compilerOptions": {
33
"outDir": "lib",
44
"target": "es5",
5-
"lib": ["es6", "dom"],
5+
"lib": ["es7", "dom"],
6+
"sourceMap": true,
7+
"inlineSources": true,
68
"module": "commonjs",
79
"moduleResolution": "node",
8-
"declaration": true,
10+
"removeComments": true,
11+
"strict": false,
912
"noImplicitAny": true,
10-
"noUnusedParameters": false,
13+
"strictNullChecks": false,
14+
"noImplicitThis": false,
15+
"alwaysStrict": true,
1116
"noUnusedLocals": true,
12-
"removeComments": true,
13-
"sourceMap": false
17+
"noUnusedParameters": false,
18+
"noImplicitReturns": true,
19+
"noFallthroughCasesInSwitch": true
1420
},
1521
"include": [
1622
"./src/**/*.ts"

tsconfig.test.json

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
11
{
2+
"extends": "./tsconfig.json",
23
"compilerOptions": {
3-
"outDir": "lib",
4-
"target": "es5",
5-
"lib": ["es6", "dom"],
6-
"module": "commonjs",
7-
"moduleResolution": "node",
8-
"declaration": true,
9-
"noImplicitAny": true,
10-
"noUnusedParameters": false,
11-
"noUnusedLocals": true,
12-
"removeComments": true,
13-
"sourceMap": true
4+
"outDir": "lib-test"
145
},
156
"include": [
167
"./src/**/*.ts",

webpack.config.js

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
const webpack = require('webpack');
2-
const path = require('path');
3-
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
1+
const webpack = require("webpack");
2+
const path = require("path");
3+
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
44

5-
module.exports = (env => {
5+
module.exports = env => {
66

77
if (!env) env = { production: false, karma: false };
88

99
let mode = env.production ? "production" : "development";
1010
let tsconfig = !env.karma ? "tsconfig.json" : "tsconfig.test.json";
11-
let output = env.production ? "dist" : "dev";
11+
let output = env.production ? "dist" : "dist-test";
1212
let filename = env.production ? "signals.min.js" : "signals.js";
1313

1414
return {
1515
mode: mode,
16+
1617
entry: {
1718
main: path.join(__dirname, "src/index.ts")
1819
},
@@ -48,12 +49,32 @@ module.exports = (env => {
4849

4950
plugins: (
5051
(env.production)
51-
? [ new UglifyJSPlugin() ]
52+
? []
5253
: [ new webpack.SourceMapDevToolPlugin({ test: /\.ts$/i }) ]
5354
),
5455

56+
optimization:
57+
(env.production)
58+
? {
59+
concatenateModules: true,
60+
minimize: true,
61+
minimizer: [
62+
new UglifyJsPlugin({
63+
cache: true,
64+
parallel: 4,
65+
uglifyOptions: {
66+
output: {
67+
comments: false
68+
}
69+
}
70+
})
71+
]
72+
}
73+
: {}
74+
,
75+
5576
resolve: {
56-
extensions: ['.ts', '.js', '.json']
77+
extensions: [".ts", ".js", ".json"]
5778
}
5879
}
59-
});
80+
};

yarn.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3360,9 +3360,9 @@ ip@^1.1.0, ip@^1.1.2, ip@^1.1.4, ip@^1.1.5:
33603360
version "1.1.5"
33613361
resolved "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz#bdded70114290828c0a039e72ef25f5aaec4354a"
33623362

3363-
ipaddr.js@1.6.0:
3364-
version "1.6.0"
3365-
resolved "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.6.0.tgz#e3fa357b773da619f26e95f049d055c72796f86b"
3363+
ipaddr.js@1.8.0:
3364+
version "1.8.0"
3365+
resolved "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz#eaa33d6ddd7ace8f7f6fe0c9ca0440e706738b1e"
33663366

33673367
is-accessor-descriptor@^0.1.6:
33683368
version "0.1.6"
@@ -5361,11 +5361,11 @@ promisify-event@^1.0.0:
53615361
pinkie-promise "^2.0.0"
53625362

53635363
proxy-addr@~2.0.3:
5364-
version "2.0.3"
5365-
resolved "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.3.tgz#355f262505a621646b3130a728eb647e22055341"
5364+
version "2.0.4"
5365+
resolved "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz#ecfc733bf22ff8c6f407fa275327b9ab67e48b93"
53665366
dependencies:
53675367
forwarded "~0.1.2"
5368-
ipaddr.js "1.6.0"
5368+
ipaddr.js "1.8.0"
53695369

53705370
proxy-agent@~3.0.0:
53715371
version "3.0.1"
@@ -6749,7 +6749,7 @@ ts-node@^7.0.0:
67496749
source-map-support "^0.5.6"
67506750
yn "^2.0.0"
67516751

6752-
tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0:
6752+
tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3:
67536753
version "1.9.3"
67546754
resolved "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286"
67556755

0 commit comments

Comments
 (0)