Skip to content

Commit df1886e

Browse files
author
Brecht Billiet
committed
Refactored architecture, added sourcemaps support, coverage support, karma fixes, wallabyjs fixes, upgraded typescript, cleaned up a lot
1 parent 5700962 commit df1886e

File tree

103 files changed

+590
-1455
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+590
-1455
lines changed

Diff for: .gitignore

+6-91
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,7 @@
1-
### JetBrains template
2-
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android
3-
Studio
4-
5-
*.iml
6-
7-
## Directory-based project format:
8-
.idea/
9-
10-
## File-based project format:
11-
*.ipr
12-
*.iws
13-
14-
## Plugin-specific files:
15-
16-
# IntelliJ
17-
/out/
18-
19-
# mpeltonen/sbt-idea plugin
20-
.idea_modules/
21-
22-
# JIRA plugin
23-
atlassian-ide-plugin.xml
24-
25-
# Crashlytics plugin (for Android Studio and IntelliJ)
26-
com_crashlytics_export_strings.xml
27-
crashlytics.properties
28-
crashlytics-build.properties
29-
### Sass template
30-
.sass-cache/
31-
*.css.map
32-
### OSX template
33-
.DS_Store
34-
.AppleDouble
35-
.LSOverride
36-
37-
# Icon must end with two \r
38-
Icon
39-
40-
# Thumbnails
41-
._*
42-
43-
# Files that might appear in the root of a volume
44-
.DocumentRevisions-V100
45-
.fseventsd
46-
.Spotlight-V100
47-
.TemporaryItems
48-
.Trashes
49-
.VolumeIcon.icns
50-
51-
# Directories potentially created on remote AFP share
52-
.AppleDB
53-
.AppleDesktop
54-
Network Trash Folder
55-
Temporary Items
56-
.apdisk
57-
### Node template
58-
# Logs
59-
logs
60-
*.log
61-
npm-debug.log*
62-
63-
# Runtime data
64-
pids
65-
*.pid
66-
*.seed
67-
68-
# Directory for instrumented libs generated by jscoverage/JSCover
69-
lib-cov
70-
71-
# Coverage directory used by tools like istanbul
72-
coverage
73-
74-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
75-
.grunt
76-
77-
# node-waf configuration
78-
.lock-wscript
79-
80-
# Compiled binary addons (http://nodejs.org/api/addons.html)
81-
build/Release
82-
83-
# Dependency directory
84-
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
851
node_modules
86-
87-
### Custom
88-
dev/
89-
reports/
90-
typings/
91-
src/**/*.js
92-
src/**/*.js.map
2+
dist
3+
reports
4+
typings
5+
out
6+
typings
7+
.idea/

Diff for: .npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
save-prefix = "~"

Diff for: README.md

+49-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,54 @@
11
# angular-typescript-webpack
22

3-
This is Brecht Billiet his architecture to combine typescript, webpack and angular 1.X
3+
Angular + Typescript + Webpack build with Karma and wallaby tests support.
4+
And this all with sourcemaps in production support!!
45

5-
Unittests will be added in the near future
6+
### Install
67

7-
## How to run:
8-
install node and typescript
8+
```sh
9+
npm i webpack tsd typescript -g
10+
npm install
11+
tsd install
12+
git clone [email protected]/brechtbilliet/angular-typescript-webpack.git
13+
cd angular-typescript-webpack
14+
npm start
15+
```
916

10-
type npm start
17+
Then it will automatically open the app in your browser
18+
19+
To run tests
20+
21+
```sh
22+
npm test
23+
```
24+
25+
Coverage
26+
27+
```sh
28+
open reports/coverage/index.html
29+
```
30+
31+
Build
32+
```sh
33+
npm install
34+
tsd install
35+
npm run build
36+
```
37+
38+
39+
### Features
40+
41+
- [x] Build basic Angular app with webpack
42+
- [x] Simple twitter application
43+
- [x] fully tested with Jasmine
44+
- [x] sass support
45+
- [x] Coverage report
46+
- [x] Typescript support
47+
- [x] ES6 modules support
48+
- [x] Running tests in PhantomJS
49+
- [x] Wallaby.js support
50+
- [x] Karma support
51+
- [x] Optimized build package
52+
- [x] Minimal and straightforward setup
53+
- [x] Watches code and refreshes browser with latest changes automatically
54+
- [x] Sourcemap support in develop AND PRODUCTION!!! (don't deploy the js.map file with your application, but use it to debug your production app)

Diff for: karma.conf.js

+49-52
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,61 @@
11
'use strict';
2-
var path = require('path');
3-
var webpackConfig = require('./webpack.test');
4-
var entry = path.resolve(webpackConfig.context, webpackConfig.entry);
5-
var preprocessors = {};
6-
preprocessors[entry] = ['webpack'];
7-
module.exports = function karmaConfig(config) {
2+
3+
var webpackConfig = require('./webpack/webpack.test.js');
4+
require('phantomjs-polyfill')
5+
webpackConfig.entry = {};
6+
7+
module.exports = function (config) {
88
config.set({
9-
frameworks: [
10-
'jasmine'
9+
basePath: '',
10+
frameworks: ['jasmine'],
11+
port: 9876,
12+
colors: true,
13+
logLevel: config.LOG_INFO,
14+
autoWatch: false,
15+
browsers: ['PhantomJS'],
16+
singleRun: true,
17+
autoWatchBatchDelay: 300,
18+
files: [
19+
'./node_modules/phantomjs-polyfill/bind-polyfill.js',
20+
'./src/test.ts'
1121
],
22+
babelPreprocessor: {
23+
options: {
24+
presets: ['es2015']
25+
}
26+
},
27+
preprocessors: {
28+
'src/test.ts': ['webpack'],
29+
'src/**/!(*.spec)+(.js)': ['coverage']
30+
},
31+
webpackMiddleware: {
32+
stats: {
33+
chunkModules: false,
34+
colors: true
35+
}
36+
},
37+
webpack: webpackConfig,
1238
reporters: [
13-
// Reference: https://github.com/mlex/karma-spec-reporter
14-
// Set reporter to print detailed results to console
39+
'dots',
1540
'spec',
16-
// Reference: https://github.com/karma-runner/karma-coverage
17-
// Output code coverage files
1841
'coverage'
1942
],
20-
files: [entry],
21-
preprocessors: preprocessors,
22-
browsers: [
23-
// Run tests using PhantomJS
24-
'PhantomJS2'
25-
],
26-
singleRun: true,
27-
// Configure code coverage reporter
2843
coverageReporter: {
29-
reporters: [{
30-
dir: 'reports/coverage/',
31-
type: 'html'},
32-
//{"type": "text"}
44+
reporters: [
45+
{
46+
dir: 'reports/coverage/',
47+
subdir: '.',
48+
type: 'html'
49+
},{
50+
dir: 'reports/coverage/',
51+
subdir: '.',
52+
type: 'cobertura'
53+
}, {
54+
dir: 'reports/coverage/',
55+
subdir: '.',
56+
type: 'json'
57+
}
3358
]
34-
},
35-
webpack: webpackConfig,
36-
plugins: [
37-
require('karma-webpack'),
38-
require('karma-jasmine'),
39-
require('karma-coverage'),
40-
require('karma-spec-reporter'),
41-
require('karma-phantomjs2-launcher'),
42-
require('karma-typescript-preprocessor')
43-
],
44-
typescriptPreprocessor: {
45-
// options passed to the typescript compiler
46-
options: {
47-
sourceMap: false, // (optional) Generates corresponding .map file.
48-
target: 'ES5', // (optional) Specify ECMAScript target version: 'ES3' (default), or 'ES5'
49-
module: 'commonjs', // (optional) Specify module code generation: 'commonjs' or 'amd'
50-
noImplicitAny: true, // (optional) Warn on expressions and declarations with an implied 'any' type.
51-
noResolve: true, // (optional) Skip resolution and preprocessing.
52-
removeComments: true // (optional) Do not emit comments to output.
53-
},
54-
// extra typing definitions to pass to the compiler (globs allowed)
55-
typings: [
56-
'typings/tsd.d.ts'
57-
],
58-
// transforming the filenames
59-
transformPath: function (path) {
60-
return path.replace(/\.ts$/, '.js');
61-
}
6259
}
6360
});
6461
};

Diff for: package.json

+49-57
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,57 @@
11
{
2-
"name": "tweetapp-typescript",
3-
"version": "0.0.1",
4-
"description": "",
2+
"name": "angular-typescript-webpack",
3+
"version": "0.1.0",
4+
"description": "A seed project for a largescale angular architecture in webpack and typescript",
55
"main": "/",
66
"scripts": {
7-
"build": "tsd install && npm install && webpack --config webpack.build.js --bail --color --NODE_ENV=dev",
8-
"start": "tsd install && npm install && webpack --config webpack.dev.js --watch --NODE_ENV=dev",
7+
"start": "webpack --config webpack/webpack.dev.js --watch --NODE_ENV=dev",
98
"test": "karma start --NODE_ENV=test",
10-
"test:live": "karma start --auto-watch --no-single-run --NODE_ENV=dev"
11-
},
12-
"author": "",
13-
"license": "ISC",
14-
"devDependencies": {
15-
"api-check": "^7.5.0",
16-
"autoprefixer": "^5.2.0",
17-
"babel": "^5.8.23",
18-
"babel-core": "^5.8.25",
19-
"babel-loader": "^5.3.2",
20-
"browser-sync": "^2.8.2",
21-
"browser-sync-webpack-plugin": "^0.2.1",
22-
"compression-webpack-plugin": "^0.2.0",
23-
"css-loader": "^0.19.0",
24-
"extract-text-webpack-plugin": "^0.8.2",
25-
"file-loader": "^0.8.4",
26-
"html-webpack-plugin": "^1.6.1",
27-
"istanbul-instrumenter-loader": "^0.1.3",
28-
"jasmine-core": "^2.3.4",
29-
"karma": "^0.13.3",
30-
"karma-chrome-launcher": "^0.1.7",
31-
"karma-coverage": "^0.5.0",
32-
"karma-jasmine": "^0.3.6",
33-
"karma-phantomjs2-launcher": "^0.3.2",
34-
"karma-spec-reporter": "0.0.20",
35-
"karma-typescript-preprocessor": "0.0.19",
36-
"karma-webpack": "^1.5.0",
37-
"moment": "^2.10.6",
38-
"node-sass": "^3.3.3",
39-
"null-loader": "^0.1.1",
40-
"raw-loader": "^0.5.1",
41-
"sass-loader": "^2.0.1",
42-
"source-map-loader": "^0.1.5",
43-
"style-loader": "^0.12.4",
44-
"ts-loader": "^0.5.5",
45-
"typescript": "^1.6.2",
46-
"typescript-loader": "^1.1.3",
47-
"url-loader": "^0.5.6",
48-
"wallaby-webpack": "0.0.7",
49-
"webpack": "^1.11.0",
50-
"webpack-dev-server": "^1.10.1",
51-
"yargs": "^3.25.0"
9+
"build": "webpack --config webpack/webpack.build.js --NODE_ENV=production"
5210
},
11+
"author": "Brecht Billiet <[email protected]>",
12+
"license": "MIT",
5313
"dependencies": {
54-
"angular": "^1.4.3",
55-
"angular-formly": "^6.24.23",
56-
"angular-formly-templates-bootstrap": "^6.0.0",
57-
"angular-mocks": "^1.4.3",
58-
"angular-route": "^1.4.3",
59-
"bootstrap": "^3.3.5",
60-
"font-awesome": "^4.4.0",
61-
"jquery": "^2.1.4",
62-
"lodash": "^3.10.1",
63-
"toastr": "^2.1.2"
14+
"angular": "1.4.9",
15+
"angular-route": "1.4.9",
16+
"bootstrap": "3.3.6",
17+
"font-awesome": "4.5.0",
18+
"jquery": "2.2.0",
19+
"lodash": "4.0.1"
20+
},
21+
"devDependencies": {
22+
"angular-mocks": "1.4.9",
23+
"angular-module-mocks": "1.2.19",
24+
"babel-core": "6.4.5",
25+
"babel-istanbul": "0.6.0",
26+
"browser-sync": "2.11.1",
27+
"browser-sync-webpack-plugin": "1.0.1",
28+
"compression-webpack-plugin": "0.3.0",
29+
"css-loader": "0.23.1",
30+
"file-loader": "0.8.5",
31+
"html-webpack-plugin": "2.7.2",
32+
"istanbul": "0.4.2",
33+
"istanbul-instrumenter-loader": "0.1.3",
34+
"jasmine": "2.4.1",
35+
"karma": "0.13.19",
36+
"karma-coverage": "0.5.3",
37+
"karma-jasmine": "0.3.6",
38+
"karma-phantomjs-launcher": "1.0.0",
39+
"karma-sourcemap-loader": "0.3.7",
40+
"karma-spec-reporter": "0.0.23",
41+
"karma-typescript-preprocessor": "0.0.21",
42+
"karma-webpack": "1.7.0",
43+
"node-sass": "3.4.2",
44+
"phantomjs": "2.1.3",
45+
"phantomjs-polyfill": "0.0.1",
46+
"phantomjs-prebuilt": "2.1.3",
47+
"raw-loader": "0.5.1",
48+
"sass-loader": "3.1.2",
49+
"style-loader": "0.13.0",
50+
"ts-loader": "0.8.0",
51+
"tsd": "0.6.5",
52+
"typescript": "1.7.5",
53+
"url-loader": "0.5.7",
54+
"wallaby-webpack": "0.0.11",
55+
"webpack": "1.12.12"
6456
}
6557
}

Diff for: src/_all.ts

-2
This file was deleted.

Diff for: src/declarations.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
declare function require(string: string): string;

0 commit comments

Comments
 (0)