Skip to content

Commit 683306f

Browse files
authored
chore: Update dependencies. Fixed up readme (microsoft#11)
* Update dependencies * chore: Specify node version * docs: Rename codeblock syntax for npm * docs: Add yarn to docs * chore: Migrate to new husky config * fix: Set CORRECT node version
1 parent f59282d commit 683306f

File tree

5 files changed

+295
-408
lines changed

5 files changed

+295
-408
lines changed

.huskyrc.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"hooks": {
3+
"pre-push": "npm test"
4+
}
5+
}

README.md

+17-12
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,16 @@ constructor injection.
1717
* [Contributing](#contributing)
1818

1919
## Installation
20-
20+
Install by `npm`
2121
```sh
2222
npm install --save tsyringe
2323
```
2424

25+
**or** install with `yarn` (this project is developed using `yarn`)
26+
```sh
27+
yarn install --save tsyringe
28+
```
29+
2530
Modify your `tsconfig.json` to include the following settings
2631
```json
2732
{
@@ -38,7 +43,7 @@ Class decorator factory that allows the class' dependencies to be injected at
3843
runtime.
3944

4045
#### Usage
41-
```TypeScript
46+
```typescript
4247
import {decorators} from "tsyringe";
4348
const {injectable} = decorators;
4449

@@ -59,7 +64,7 @@ Class decorator factory that registers the class as a singleton within the
5964
global container.
6065

6166
#### Usage
62-
```TypeScript
67+
```typescript
6368
import {decorators} from "tsyringe";
6469
const {singleton} = decorators;
6570

@@ -82,7 +87,7 @@ a parameterless constructor that has dependencies auto-resolved.
8287
**Note** Resolution is performed using the global container
8388

8489
#### Usage
85-
```TypeScript
90+
```typescript
8691
import {decorators} from "tsyringe";
8792
const {autoInjectable} = decorators;
8893

@@ -105,7 +110,7 @@ Parameter decorator factory that allows for interface and other non-class
105110
information to be stored in the constructor's metadata
106111

107112
#### Usage
108-
```TypeScript
113+
```typescript
109114
import {decorators} from "tsyringe";
110115
const {injectable, inject} = decorators;
111116

@@ -124,11 +129,11 @@ class Foo {
124129
Since classes have type information at runtime, we can resolve them without any
125130
extra information.
126131

127-
```TypeScript
132+
```typescript
128133
// Foo.ts
129134
export class Foo {}
130135
```
131-
```TypeScript
136+
```typescript
132137
// Bar.ts
133138
import {Foo} from "./Foo";
134139
import {decorators} from "tsyringe";
@@ -139,7 +144,7 @@ export class Bar {
139144
constructor(public myFoo: Foo) {}
140145
}
141146
```
142-
```TypeScript
147+
```typescript
143148
// main.ts
144149
import {container} from "tsyringe";
145150
import {Bar} from "./Bar";
@@ -152,20 +157,20 @@ const myBar = container.resolve(Bar);
152157
Interfaces don't have type information at runtime, so we need to decorate them
153158
with `@inject(...)` so the container knows how to resolve them.
154159

155-
```TypeScript
160+
```typescript
156161
// SuperService.ts
157162
export interface SuperService {
158163
// ...
159164
}
160165
```
161-
```TypeScript
166+
```typescript
162167
// TestService.ts
163168
import {SuperService} from "./SuperService";
164169
export class TestService implements SuperService {
165170
//...
166171
}
167172
```
168-
```TypeScript
173+
```typescript
169174
// Client.ts
170175
import {decorators} from "tsyringe";
171176
const {injectable, inject} = decorators;
@@ -175,7 +180,7 @@ export class Client {
175180
constructor(@inject("SuperService") private service: SuperService) {}
176181
}
177182
```
178-
```TypeScript
183+
```typescript
179184
// main.ts
180185
import {Client} from "./Client";
181186
import {TestService} from "./TestService";

jest.config.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ module.exports = {
1111
],
1212
globals: {
1313
"ts-jest": {
14-
tsConfigFile: "tests/tsconfig.json",
15-
skipBabel: true
14+
tsConfig: "tests/tsconfig.json"
1615
}
1716
},
1817
moduleFileExtensions: [

package.json

+7-5
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
"build": "rimraf ./dist ./types && tsc -p ./src",
88
"test": "npm run lint && jest",
99
"test:coverage": "jest --coverage",
10-
"lint": "tslint -p src && tslint -p tests",
11-
"prepush": "npm test"
10+
"lint": "tslint -p src && tslint -p tests"
1211
},
1312
"repository": {
1413
"type": "git",
@@ -22,6 +21,9 @@
2221
"ioc",
2322
"container"
2423
],
24+
"engines": {
25+
"node": ">= 6.0.0"
26+
},
2527
"types": "types/index.d.ts",
2628
"author": "Steven Hobson-Campbell",
2729
"license": "MIT",
@@ -35,12 +37,12 @@
3537
"devDependencies": {
3638
"@types/jest": "^23.3.9",
3739
"@types/node": "^8.10.16",
38-
"husky": "^0.14.3",
40+
"husky": "^1.2.0",
3941
"jest": "^23.6.0",
4042
"rimraf": "^2.6.2",
41-
"ts-jest": "^22.4.6",
43+
"ts-jest": "^23.10.5",
4244
"tslint": "^5.10.0",
4345
"tslint-eslint-rules": "^5.3.1",
44-
"typescript": "^2.8.3"
46+
"typescript": "^3.1.6"
4547
}
4648
}

0 commit comments

Comments
 (0)