Skip to content

Commit

Permalink
Iniial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
zender committed Apr 13, 2016
0 parents commit 0c5400f
Show file tree
Hide file tree
Showing 99 changed files with 2,558 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# http://editorconfig.org

root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
insert_final_newline = false
trim_trailing_whitespace = false
48 changes: 48 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# Commenting this out is preferred by some people, see
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
/node_modules/
/typings/

# Users Environment Variables
.lock-wscript
.tsdrc
.typingsrc

#IDE configuration files
.idea
.vscode
*.iml

/tools/**/*.js
dist
dev
docs
lib
test
tmp

gulpfile.js
gulpfile.js.map

61 changes: 61 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"es3": false,
"forin": true,
"freeze": true,
"immed": true,
"indent": 2,
"latedef": "nofunc",
"newcap": true,
"noarg": true,
"noempty": true,
"nonbsp": true,
"nonew": true,
"plusplus": false,
"quotmark": "single",
"undef": true,
"unused": false,
"strict": false,
"maxparams": 10,
"maxdepth": 5,
"maxstatements": 40,
"maxcomplexity": 8,
"maxlen": 140,

"asi": false,
"boss": false,
"debug": false,
"eqnull": true,
"esnext": false,
"evil": false,
"expr": false,
"funcscope": false,
"globalstrict": false,
"iterator": false,
"lastsemic": false,
"laxbreak": false,
"laxcomma": false,
"loopfunc": true,
"maxerr": false,
"moz": false,
"multistr": false,
"notypeof": false,
"proto": false,
"scripturl": false,
"shadow": false,
"sub": true,
"supernew": false,
"validthis": false,
"noyield": false,

"browser": true,
"node": true,

"globals": {
"angular": false,
"ng": false
}
}
8 changes: 8 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "stylelint-config-standard",
"rules": {
"block-no-empty": null,
"at-rule-empty-line-before": null,
"rule-non-nested-empty-line-before": null
}
}
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Design Patterns Typescript

This is a collection of known design patterns and some sample code how to implement them in Typescript. Every pattern has a small list of example.

## Installation

**Note** that this project requires node v4.x.x or higher and npm 2.14.7.

You must have `ts-node` installed as global.

```bash
npm install -g ts-node
```

```bash
git clone https://github.com/zender/design-patterns.git

cd design-patterns
```

## Install the project's dependencies

```bash
npm install
```

## Running tests

```bash
npm test
```


## Patterns

The patterns can be structured in roughly three different categories. Please click on [the link](http://www.tutorialspoint.com/design_pattern/) for a full explanation of the pattern.

## [Creational](Creational)


## [Structural](Structural)



## [Behavioral](Behavioral)

* [ChainOfResponsibilities](/src/Behavioral/ChainOfResponsibility/index.md)
* [Command](/src/Behavioral/Command/index.md)

## Contribute

Please feel free to fork and extend existing or add your own examples and send a pull request with your changes!
44 changes: 44 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# AppVeyor file
# http://www.appveyor.com/docs/appveyor-yml
# This file: cloned from https://github.com/gruntjs/grunt/blob/master/appveyor.yml

# Build version format
version: "{build}"

# Test against this version of Node.js
environment:
nodejs_version: "4.1.0"
# https://github.com/DefinitelyTyped/tsd#tsdrc
# Token has no scope (read-only access to public information)
TSD_GITHUB_TOKEN: "9b18c72997769f3867ef2ec470e626d39661795d"

build: off

clone_depth: 10

# Fix line endings on Windows
init:
- git config --global core.autocrlf true

install:
- ps: Install-Product node $env:nodejs_version
- npm install -g npm
- ps: $env:path = $env:appdata + "\npm;" + $env:path
- npm install

test_script:
# Output useful info for debugging.
- node --version && npm --version
# We test multiple Windows shells because of prior stdout buffering issues
# filed against Grunt. https://github.com/joyent/node/issues/3584
- ps: "npm --version # PowerShell" # Pass comment to PS for easier debugging
- npm test


notifications:
- provider: Webhook
url: https://webhooks.gitter.im/e/cfd8ce5ddee6f3a0b0c9
on_build_success: false
on_build_failure: true
on_build_status_changed: true

115 changes: 115 additions & 0 deletions gulpfile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import * as gulp from 'gulp';
import * as runSequence from 'run-sequence';
import {loadTasks} from './tools/utils';
import {SEED_TASKS_DIR, PROJECT_TASKS_DIR} from './tools/config';

loadTasks(SEED_TASKS_DIR);
loadTasks(PROJECT_TASKS_DIR);


// --------------
// Build dev.
gulp.task('build.dev', (done: any) =>
runSequence('clean.dev',
'tslint',
'css-lint',
'build.assets.dev',
'build.html_css',
'build.js.dev',
'build.index.dev',
done));

// --------------
// Build dev watch.
gulp.task('build.dev.watch', (done: any) =>
runSequence('build.dev',
'watch.dev',
done));

// --------------
// Build e2e.
gulp.task('build.e2e', (done: any) =>
runSequence('clean.dev',
'tslint',
'build.assets.dev',
'build.js.e2e',
'build.index.dev',
done));

// --------------
// Build prod.
gulp.task('build.prod', (done: any) =>
runSequence('clean.prod',
'tslint',
'css-lint',
'build.assets.prod',
'build.html_css',
'copy.js.prod',
'build.js.prod',
'build.bundles',
'build.bundles.app',
'build.index.prod',
done));

// --------------
// Build test.
gulp.task('build.test', (done: any) =>
runSequence('clean.dev',
'tslint',
'build.assets.dev',
'build.js.test',
'build.index.dev',
done));

// --------------
// Build test watch.
gulp.task('build.test.watch', (done: any) =>
runSequence('build.test',
'watch.test',
done));

// --------------
// Build tools.
gulp.task('build.tools', (done: any) =>
runSequence('clean.tools',
'build.js.tools',
done));

// --------------
// Docs
gulp.task('docs', (done: any) =>
runSequence('build.docs',
'serve.docs',
done));

// --------------
// Serve dev
gulp.task('serve.dev', (done: any) =>
runSequence('build.dev',
'server.start',
'watch.dev',
done));

// --------------
// Serve e2e
gulp.task('serve.e2e', (done: any) =>
runSequence('build.e2e',
'server.start',
'watch.e2e',
done));


// --------------
// Serve prod
gulp.task('serve.prod', (done: any) =>
runSequence('build.prod',
'server.prod',
done));


// --------------
// Test.
gulp.task('test', (done: any) =>
runSequence('build.test',
'karma.start',
done));
Loading

0 comments on commit 0c5400f

Please sign in to comment.