Skip to content

Commit

Permalink
Merge pull request #58 from jeffijoe/ts-rewrite
Browse files Browse the repository at this point in the history
TypeScript Rewrite + Mocha->Jest + various refactors
  • Loading branch information
jeffijoe authored Nov 20, 2017
2 parents 80e7065 + 79eecfd commit a213dab
Show file tree
Hide file tree
Showing 58 changed files with 3,778 additions and 2,557 deletions.
6 changes: 0 additions & 6 deletions .eslintrc

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ coverage
.DS_Store
.vscode/
examples/babel/package-lock.json
lib
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
examples
test
__tests__
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cache:
- node_modules

# Lint errors should trigger a failure.
before_script: npm run lint
before_script: npm run lint && npm run build

# Code coverage
after_success:
Expand Down
131 changes: 65 additions & 66 deletions README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions examples/babel/src/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { asClass, createContainer, ResolutionMode } from '../../../'
import { asClass, createContainer, InjectionMode } from '../../../'
import { TestService } from './services/testService'
import { DependentService } from './services/dependentService'

const container = createContainer({
resolutionMode: ResolutionMode.CLASSIC
injectionMode: InjectionMode.CLASSIC
})

container.register({
Expand Down
17 changes: 10 additions & 7 deletions examples/typescript/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import {
AwilixContainer,
createContainer,
asClass,
ResolutionMode
} from '../../..'
InjectionMode
} from '../../../src/awilix'
import TestService from './services/TestService'
import DependentService from './services/DependentService'

// Create the container
const container: AwilixContainer = createContainer({
resolutionMode: ResolutionMode.CLASSIC
const container = createContainer({
injectionMode: InjectionMode.CLASSIC
})

// Register the classes
Expand All @@ -19,8 +19,11 @@ container.register({
depService: asClass(DependentService).classic()
})

// Resolve a dependency
let dep: DependentService = container.cradle.depService
// Resolve a dependency using the cradle.
let dep1: DependentService = container.cradle.depService
// Resolve a dependency using `resolve`
let dep2 = container.resolve<DependentService>('depService')

// Test that all is well, should produce 'Hello world!'
console.log(dep.getInnerData())
console.log(dep1.getInnerData())
console.log(dep2.getInnerData())
9 changes: 2 additions & 7 deletions examples/typescript/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
"target": "es5",
"noImplicitAny": true
},
"include": [
"test/**/*.ts"
],
"exclude": [
"dist",
"node_modules"
]
"include": ["src/**/*.ts"],
"exclude": ["dist", "node_modules"]
}
302 changes: 0 additions & 302 deletions index.d.ts

This file was deleted.

8 changes: 0 additions & 8 deletions lib/AwilixError.js

This file was deleted.

Loading

0 comments on commit a213dab

Please sign in to comment.