-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
161 changed files
with
11,073 additions
and
5,266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
parser: '@typescript-eslint/parser' | ||
plugins: | ||
- '@typescript-eslint' | ||
parserOptions: | ||
ecmaVersion: 2018 | ||
sourceType: module | ||
project: | ||
- ./tsconfig.json | ||
- ./tsconfig.spec.json | ||
extends: | ||
- 'plugin:@typescript-eslint/recommended' | ||
- 'plugin:@typescript-eslint/recommended-requiring-type-checking' | ||
- 'plugin:jest/recommended' | ||
- 'prettier' | ||
- 'prettier/@typescript-eslint' | ||
rules: | ||
'@typescript-eslint/explicit-member-accessibility': off | ||
'@typescript-eslint/no-angle-bracket-type-assertion': off | ||
'@typescript-eslint/no-parameter-properties': off | ||
'@typescript-eslint/explicit-function-return-type': off | ||
'@typescript-eslint/member-delimiter-style': off | ||
'@typescript-eslint/no-inferrable-types': off | ||
'@typescript-eslint/no-explicit-any': off | ||
'@typescript-eslint/member-ordering': 'error' | ||
'@typescript-eslint/no-unused-vars': | ||
- 'error' | ||
- args: 'none' | ||
# TODO: Remove these and fixed issues once we merged all the current PRs. | ||
'@typescript-eslint/ban-types': off | ||
'@typescript-eslint/no-unsafe-return': off | ||
'@typescript-eslint/no-unsafe-assignment': off | ||
'@typescript-eslint/no-unsafe-call': off | ||
'@typescript-eslint/no-unsafe-member-access': off | ||
'@typescript-eslint/explicit-module-boundary-types': off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
root: ./docs | ||
structure: | ||
readme: README.md | ||
summary: SUMMARY.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: npm | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
time: "10:00" | ||
timezone: Europe/Budapest | ||
open-pull-requests-limit: 5 | ||
versioning-strategy: increase | ||
commit-message: | ||
prefix: build | ||
include: scope |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
titleAndCommits: true | ||
allowMergeCommits: false | ||
scopes: | ||
- deps | ||
- deps-dev | ||
types: | ||
- feat | ||
- fix | ||
- docs | ||
- style | ||
- refactor | ||
- perf | ||
- test | ||
- build | ||
- ci | ||
- chore | ||
- revert | ||
- merge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Dependabot auto-merge | ||
on: | ||
pull_request | ||
jobs: | ||
dependabot: | ||
runs-on: ubuntu-latest | ||
if: github.actor == 'dependabot[bot]' | ||
steps: | ||
- name: 'Auto approve PR by Dependabot' | ||
uses: hmarr/auto-approve-action@v2.0.0 | ||
with: | ||
github-token: "${{ secrets.TYPESTACK_BOT_TOKEN }}" | ||
- name: 'Comment merge command' | ||
uses: actions/github-script@v3 | ||
with: | ||
github-token: ${{secrets.TYPESTACK_BOT_TOKEN }} | ||
script: | | ||
await github.issues.createComment({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: context.issue.number, | ||
body: '@dependabot squash and merge' | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
|
||
name: CD | ||
on: | ||
release: | ||
types: [created] | ||
jobs: | ||
publish: | ||
name: Publish to NPM | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
registry-url: https://registry.npmjs.org | ||
- run: npm ci --ignore-scripts | ||
- run: npm run prettier:check | ||
- run: npm run lint:check | ||
- run: npm run test:ci | ||
- run: npm run build:es2015 | ||
- run: npm run build:esm5 | ||
- run: npm run build:cjs | ||
- run: npm run build:umd | ||
- run: npm run build:types | ||
- run: cp LICENSE build/LICENSE | ||
- run: cp README.md build/README.md | ||
- run: jq 'del(.devDependencies) | del(.scripts)' package.json > build/package.json | ||
- run: npm publish ./build | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: CI | ||
on: [push, pull_request] | ||
jobs: | ||
checks: | ||
name: Linters | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-node@v1 | ||
- run: npm ci --ignore-scripts | ||
- run: npm run prettier:check | ||
- run: npm run lint:check | ||
tests: | ||
name: Tests | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: ['10.x', '12.x', '14.x'] | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Setting up Node.js (v${{ matrix.node-version }}.x) | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: node --version | ||
name: Check Node.js version | ||
- run: npm ci --ignore-scripts | ||
- run: npm run test:ci | ||
- run: npm install codecov -g | ||
if: ${{ matrix.node-version == '14.x' }} | ||
- run: codecov -f ./coverage/clover.xml -t ${{ secrets.CODECOV_TOKEN }} | ||
if: ${{ matrix.node-version == '14.x' }} | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-node@v1 | ||
- run: npm ci --ignore-scripts | ||
- run: npm run build:es2015 | ||
- run: npm run build:esm5 | ||
- run: npm run build:cjs | ||
- run: npm run build:umd | ||
- run: npm run build:types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: 'Lock inactive threads' | ||
on: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
jobs: | ||
lock: | ||
name: Lock closed issues | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: dessant/lock-threads@v2 | ||
with: | ||
github-token: ${{ github.token }} | ||
issue-lock-inactive-days: 30 | ||
pr-lock-inactive-days: 30 | ||
issue-lock-comment: > | ||
This issue has been automatically locked since there | ||
has not been any recent activity after it was closed. | ||
Please open a new issue for related bugs. | ||
pr-lock-comment: > | ||
This pull request has been automatically locked since there | ||
has not been any recent activity after it was closed. | ||
Please open a new issue for related bugs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,52 @@ | ||
.vscode/ | ||
.idea/ | ||
# Log files | ||
logs | ||
*.log | ||
*.tmp | ||
*.tmp.* | ||
log.txt | ||
npm-debug.log* | ||
|
||
# Testing output | ||
lib-cov/** | ||
coverage/** | ||
|
||
# Environment files | ||
.env | ||
|
||
# Dependency directories | ||
node_modules | ||
|
||
# MacOS related files | ||
*.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
._* | ||
UserInterfaceState.xcuserstate | ||
|
||
# Windows related files | ||
Thumbs.db | ||
Desktop.ini | ||
$RECYCLE.BIN/ | ||
|
||
# IDE - Sublime | ||
*.sublime-project | ||
*.sublime-workspace | ||
|
||
# IDE - VSCode | ||
.vscode/** | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
|
||
# IDE - IntelliJ | ||
.idea | ||
|
||
# Compilation output folders | ||
dist/ | ||
build/ | ||
node_modules/ | ||
npm-debug.log | ||
tmp/ | ||
out-tsc/ | ||
temp | ||
|
||
# Files for playing around locally | ||
playground.ts | ||
playground.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
printWidth: 120 | ||
tabWidth: 2 | ||
useTabs: false | ||
semi: true | ||
singleQuote: true | ||
trailingComma: es5 | ||
bracketSpacing: true | ||
arrowParens: avoid |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,73 @@ | ||
# Changelog | ||
|
||
## 0.9.0 - 2021.01.10 | ||
|
||
### BREAKING CHANGES | ||
|
||
#### Unregistered types are not resolved | ||
|
||
Prior to this version when an unknown constructable type was requested from the default container it was added automatically | ||
to the container and returned. This behavior has changed and now a `ServiceNotFoundError` error is thrown. | ||
|
||
#### Changed container reset behavior | ||
|
||
Until now resetting a container removed all dependency declarations from the container. From now on the default behavior | ||
is to remove the created instances only but not the definitions. This means requesting a Service again from the container | ||
won't result in a `ServiceNotFoundError` but will create a new instance of the requested function again. | ||
|
||
The old behavior can be restored with passing the `{ strategy: 'resetServices'}` to the `ContainerInstance.reset` function. | ||
|
||
### Changed | ||
|
||
- **[BREAKING]** unknown values are not resolved anymore (ref #87) | ||
- **[BREAKING]** resetting a container doesn't remove the service definitions only the created instances by default | ||
- **[BREAKING]** container ID can be string only now | ||
- default container ID changed from `undefined` to `default` | ||
- stricter type definitions and assertions across the project | ||
- updated the wording of `ServiceNotFoundError` to better explain which service is missing (#138) | ||
- updated various dev-dependencies | ||
- various changes to project tooling | ||
|
||
### Fixed | ||
|
||
- fixed a bug where requesting service with circular dependencies from a scoped container would result in Maximum call stack size exceeded error (ref #112) | ||
- fixed a bug where `@Inject`-ed properties were not injected in inherited child classes (ref #102) | ||
- fixed a typing issue which prevented using abstract class as service identifier (ref #144) | ||
- fixed a bug which broke transient services when `Container.reset()` was called (ref #157) | ||
- fixed some typos in the getting started documentation | ||
|
||
## 0.8.0 | ||
|
||
* added new type of dependency injection - function DI | ||
* now null can be stored in the container for values | ||
- added new type of dependency injection - function DI | ||
- now null can be stored in the container for values | ||
|
||
## 0.7.2 | ||
|
||
* fixed bug with inherited services | ||
- fixed bug with inherited services | ||
|
||
## 0.7.1 | ||
|
||
* fixed the way how global services work | ||
- fixed the way how global services work | ||
|
||
## 0.7.0 | ||
|
||
* added javascript support | ||
* removed deprecated `@Require` decorator | ||
* added support for transient services | ||
* now service constructors cannot accept non-service arguments | ||
* added `@InjectMany` decorator to support injection of "many" values | ||
* fixed the way how global services work | ||
- added javascript support | ||
- removed deprecated `@Require` decorator | ||
- added support for transient services | ||
- now service constructors cannot accept non-service arguments | ||
- added `@InjectMany` decorator to support injection of "many" values | ||
- fixed the way how global services work | ||
|
||
## 0.6.1 | ||
|
||
* added `Container.has` method | ||
- added `Container.has` method | ||
|
||
## 0.6.0 | ||
|
||
* added multiple containers support | ||
* added grouped (tagged) containers support | ||
* removed `provide` method, use `set` method instead | ||
* deprecated `Require` decorator. Use es6 imports instead or named services | ||
* inherited classes don't need to be decorated with `@Service` decorator | ||
* other small api changes | ||
* now `Handler`'s `value` accepts a container which requests the value | ||
- added multiple containers support | ||
- added grouped (tagged) containers support | ||
- removed `provide` method, use `set` method instead | ||
- deprecated `Require` decorator. Use es6 imports instead or named services | ||
- inherited classes don't need to be decorated with `@Service` decorator | ||
- other small api changes | ||
- now `Handler`'s `value` accepts a container which requests the value |
Oops, something went wrong.