Skip to content

Commit

Permalink
chore: add badges
Browse files Browse the repository at this point in the history
* chore: add build status and download badges

* chore: add codecov upload step

* chore: add codecov badge
  • Loading branch information
Evyweb authored Nov 10, 2024
1 parent 4957dfb commit 98b024f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,19 @@ jobs:
node-version: 20.x
cache: "npm"

- run: npm ci
- run: npm run lint
- run: npm test
- run: npm run build
- name: Install dependencies
run: npm ci

- name: Linting
run: npm run lint

- name: Tests
run: npm run test:coverage

- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

- name: Build
run: npm run build
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# A simple IOC container for Typescript
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/evyweb/ioctopus/main.yml)
[![codecov](https://codecov.io/gh/Evyweb/ioctopus/graph/badge.svg?token=A3Z8UCNHDY)](https://codecov.io/gh/Evyweb/ioctopus)
![NPM Downloads](https://img.shields.io/npm/dm/%40evyweb%2Fioctopus)

![logo-ioctopus.png](assets/logo-ioctopus.png)

Expand Down Expand Up @@ -250,10 +253,12 @@ To use the scoped scope, you need to create a scope using runInScope.

```typescript
container.bind(DI.MY_SERVICE).toClass(MyServiceClass, [DI.DEP1, DI.DEP2], 'scoped');
const instance1 = undefined;
const instance2 = undefined;

container.runInScope(() => {
const instance1 = container.get<MyServiceClassInterface>(DI.MY_SERVICE);
const instance2 = container.get<MyServiceClassInterface>(DI.MY_SERVICE);
instance1 = container.get<MyServiceClassInterface>(DI.MY_SERVICE);
instance2 = container.get<MyServiceClassInterface>(DI.MY_SERVICE);

console.log(instance1 === instance2); // true
});
Expand Down

0 comments on commit 98b024f

Please sign in to comment.