Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions es6-babel-react-flux-karma/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

## Getting started

You'll need [node / npm](https://nodejs.org/) and [tsd](http://definitelytyped.org/tsd/) installed globally. To get up and running just enter:
You'll need [node / npm](https://nodejs.org/) and [Typings](https://github.com/typings/typings) installed globally. To get up and running just enter:

```
npm install
tsd install
typings install
npm run serve
```

This will:

1. Download the npm packages you need
2. Download the typings from DefinitelyTyped that you need.
2. Download the type definitions you need.
3. Compile the code and serve it up at [http://localhost:8080](http://localhost:8080)

Now you need dev tools. There's a world of choice out there; there's [Atom](https://atom.io/), there's [VS Code](https://www.visualstudio.com/en-us/products/code-vs.aspx), there's [Sublime](http://www.sublimetext.com/). There's even something called [Visual Studio](http://www.visualstudio.com). It's all your choice really.
Expand Down
45 changes: 32 additions & 13 deletions es6-babel-react-flux-karma/gulp/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,42 @@ var Server = require('karma').Server;
var path = require('path');
var gutil = require('gulp-util');

module.exports = {
watch: function() {
// Documentation: https://karma-runner.github.io/0.13/dev/public-api.html
var karmaConfig = {
configFile: path.join(__dirname, '../karma.conf.js'),
singleRun: false,
function runTests(options) {
// Documentation: https://karma-runner.github.io/0.13/dev/public-api.html
var karmaConfig = {
configFile: path.join(__dirname, '../karma.conf.js'),
singleRun: !options.shouldWatch,

plugins: ['karma-webpack', 'karma-jasmine', 'karma-mocha-reporter', 'karma-sourcemap-loader', 'karma-phantomjs-launcher'],
reporters: ['mocha']
};

// Fancy runner
plugins: ['karma-webpack', 'karma-jasmine', 'karma-mocha-reporter', /*'karma-junit-reporter', 'karma-coverage', */'karma-sourcemap-loader', 'karma-phantomjs-launcher'],
reporters: ['mocha']
};
if (options.done) {
karmaConfig.plugins.push('karma-junit-reporter');
karmaConfig.reporters.push('junit');
} else {
karmaConfig.plugins.push('karma-notify-reporter');
karmaConfig.reporters.push('notify');
}

new Server(karmaConfig, karmaCompleted).start();
new Server(karmaConfig, karmaCompleted).start();

function karmaCompleted(exitCode) {
gutil.log('Karma has exited with:', exitCode);
function karmaCompleted(exitCode) {
if (options.done) {
if (exitCode === 1) {
gutil.log('Karma: tests failed with code ' + exitCode);
} else {
gutil.log('Karma completed!');
}
options.done();
}
else {
process.exit(exitCode);
}
}
}

module.exports = {
run: function(done) { return runTests({ shouldWatch: false, done: done }); },
watch: function() { return runTests({ shouldWatch: true }); }
};
8 changes: 5 additions & 3 deletions es6-babel-react-flux-karma/gulp/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
var gulp = require('gulp');
var gutil = require('gulp-util');
var webpack = require('webpack');
var failPlugin = require('webpack-fail-plugin');
var WebpackNotifierPlugin = require('webpack-notifier');
var webpackConfig = require('../webpack.config.js');

Expand All @@ -14,12 +15,13 @@ function buildProduction(done) {
myProdConfig.plugins = myProdConfig.plugins.concat(
new webpack.optimize.CommonsChunkPlugin({ name: 'vendor', filename: 'vendor.[hash].js' }),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin()
new webpack.optimize.UglifyJsPlugin(),
failPlugin
);

// run webpack
webpack(myProdConfig, function(err, stats) {
if(err) { throw new gutil.PluginError('webpack:build', err); }
if (err) { throw new gutil.PluginError('webpack:build', err); }
gutil.log('[webpack:build]', stats.toString({
colors: true
}));
Expand All @@ -46,7 +48,7 @@ function createDevCompiler() {
function buildDevelopment(done, devCompiler) {
// run webpack
devCompiler.run(function(err, stats) {
if(err) { throw new gutil.PluginError('webpack:build-dev', err); }
if (err) { throw new gutil.PluginError('webpack:build-dev', err); }
gutil.log('[webpack:build-dev]', stats.toString({
chunks: false,
colors: true
Expand Down
6 changes: 3 additions & 3 deletions es6-babel-react-flux-karma/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,19 @@
"karma-coverage": "^0.5.2",
"karma-jasmine": "^0.3.6",
"karma-junit-reporter": "^0.3.7",
"karma-mocha-reporter": "^1.1.1",
"karma-mocha-reporter": "^2.0.0",
"karma-notify-reporter": "^0.1.1",
"karma-phantomjs-launcher": "^1.0.0",
"karma-phantomjs-shim": "^1.1.1",
"karma-sourcemap-loader": "^0.3.6",
"karma-webpack": "^1.7.0",
"phantomjs": "^2.1.3",
"phantomjs-prebuilt": "^2.1.4",
"react": "^0.14.3",
"react-addons-test-utils": "^0.14.3",
"react-dom": "^0.14.3",
"ts-loader": "^0.8.1",
"typescript": "^1.8.0",
"webpack": "^1.12.2",
"webpack-fail-plugin": "^1.0.4",
"webpack-notifier": "^1.2.1"
}
}
15 changes: 7 additions & 8 deletions es6-babel-react-flux-karma/src/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"compileOnSave": false,
"filesGlob": [
"../typings/**/*.*.ts",
"!../typings/jasmine/jasmine.d.ts",
"!../typings/react/react-addons-test-utils.d.ts",
"../typings/browser/**/*.*.ts",
"!../typings/browser/ambient/jasmine/index.d.ts",
"!../typings/browser/ambient/react-addons-test-utils/index.d.ts",
"**/*.{ts,tsx}"
],
"compilerOptions": {
Expand All @@ -15,11 +15,10 @@
"sourceMap": true
},
"files": [
"../typings/flux/flux.d.ts",
"../typings/node/node.d.ts",
"../typings/react/react-dom.d.ts",
"../typings/react/react.d.ts",
"../typings/tsd.d.ts",
"../typings/browser/ambient/flux/index.d.ts",
"../typings/browser/ambient/node/index.d.ts",
"../typings/browser/ambient/react-dom/index.d.ts",
"../typings/browser/ambient/react/index.d.ts",
"actions/GreetingActions.ts",
"components/App.tsx",
"components/Greeting.tsx",
Expand Down
15 changes: 7 additions & 8 deletions es6-babel-react-flux-karma/test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compileOnSave": false,
"filesGlob": [
"**/*.{ts,tsx}",
"../typings/**/*.*.ts"
"../typings/browser/**/*.*.ts"
],
"compilerOptions": {
"jsx": "preserve",
Expand All @@ -19,13 +19,12 @@
"components/Greeting.tests.tsx",
"components/WhoToGreet.tests.tsx",
"stores/GreetingStore.tests.ts",
"../typings/flux/flux.d.ts",
"../typings/jasmine/jasmine.d.ts",
"../typings/node/node.d.ts",
"../typings/react/react-addons-test-utils.d.ts",
"../typings/react/react-dom.d.ts",
"../typings/react/react.d.ts",
"../typings/tsd.d.ts"
"../typings/browser/ambient/flux/index.d.ts",
"../typings/browser/ambient/jasmine/index.d.ts",
"../typings/browser/ambient/node/index.d.ts",
"../typings/browser/ambient/react-addons-test-utils/index.d.ts",
"../typings/browser/ambient/react-dom/index.d.ts",
"../typings/browser/ambient/react/index.d.ts"
],
"exclude": [],
"atom": {
Expand Down
27 changes: 0 additions & 27 deletions es6-babel-react-flux-karma/tsd.json

This file was deleted.

12 changes: 12 additions & 0 deletions es6-babel-react-flux-karma/typings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "es6-babel-react-flux-karma",
"version": false,
"ambientDependencies": {
"jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#bcd5761826eb567876c197ccc6a87c4d05731054",
"flux": "github:DefinitelyTyped/DefinitelyTyped/flux/flux.d.ts#bcd5761826eb567876c197ccc6a87c4d05731054",
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#bcd5761826eb567876c197ccc6a87c4d05731054",
"react": "github:DefinitelyTyped/DefinitelyTyped/react/react.d.ts#bcd5761826eb567876c197ccc6a87c4d05731054",
"react-dom": "github:DefinitelyTyped/DefinitelyTyped/react/react-dom.d.ts#bcd5761826eb567876c197ccc6a87c4d05731054",
"react-addons-test-utils": "github:DefinitelyTyped/DefinitelyTyped/react/react-addons-test-utils.d.ts#bcd5761826eb567876c197ccc6a87c4d05731054"
}
}