Skip to content

Commit 325a673

Browse files
authored
Merge pull request #91 from lsndr/v1
version 1.0.0
2 parents 74bdf6b + 764659c commit 325a673

26 files changed

+3932
-3314
lines changed

.eslintrc.js

+49-3
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,58 @@ module.exports = {
33
'eslint:recommended',
44
'plugin:@typescript-eslint/recommended',
55
'plugin:prettier/recommended',
6+
'plugin:import/recommended',
7+
'plugin:import/typescript',
68
],
79
plugins: ['@typescript-eslint'],
8-
rules: {
9-
'@typescript-eslint/no-explicit-any': 'off',
10-
},
10+
ignorePatterns: ['dist', '/coverage', 'node_modules'],
1111
env: {
1212
node: true,
1313
},
14+
overrides: [
15+
{
16+
files: ['*.ts'],
17+
extends: [
18+
'eslint:recommended',
19+
'plugin:@typescript-eslint/recommended',
20+
'plugin:prettier/recommended',
21+
'plugin:import/recommended',
22+
'plugin:import/typescript',
23+
],
24+
parserOptions: {
25+
project: ['tsconfig.eslint.json'],
26+
},
27+
rules: {
28+
'@typescript-eslint/interface-name-prefix': 'off',
29+
'@typescript-eslint/explicit-function-return-type': 'off',
30+
'@typescript-eslint/explicit-module-boundary-types': 'off',
31+
'@typescript-eslint/no-explicit-any': 'off',
32+
'@typescript-eslint/ban-ts-comment': 'off',
33+
'import/no-cycle': 'error',
34+
'import/no-unresolved': 'error',
35+
'@typescript-eslint/no-for-in-array': 'error',
36+
'no-implied-eval': 'off',
37+
'@typescript-eslint/no-implied-eval': 'error',
38+
'@typescript-eslint/no-misused-promises': 'error',
39+
'require-await': 'off',
40+
'@typescript-eslint/require-await': 'error',
41+
'@typescript-eslint/restrict-plus-operands': 'error',
42+
'@typescript-eslint/unbound-method': 'error',
43+
},
44+
settings: {
45+
'import/parsers': {
46+
'@typescript-eslint/parser': ['.ts'],
47+
},
48+
'import/resolver': {
49+
typescript: {},
50+
},
51+
},
52+
},
53+
{
54+
files: ['examples/**/*.ts'],
55+
rules: {
56+
'import/no-unresolved': 'off',
57+
},
58+
},
59+
],
1460
};

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## 1.0.0 - ?
4+
5+
- hooks removed
6+
- added createModule function
7+
- simplified and exported types
8+
- added ModuleRef class
9+
310
## 0.1.1 - 2022-02-13
411

512
- fix: hook invocation message

README.md

+2-19
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ Each module is an isolated DI container. Modules can be used to group related de
3030

3131
@Module({
3232
imports: [/* modules to import */],
33-
hooks: [/* hooks */],
3433
providers: [/* providers */],
3534
exports: [/* providers and modules to export */]
3635
})
@@ -47,14 +46,6 @@ export class AppModule {
4746
// invoked after modules initialisation
4847
}
4948

50-
async beforeHooks() {
51-
// invoked before hooks
52-
}
53-
54-
async afterHooks() {
55-
// invoked after hooks
56-
}
57-
5849
async beforeStop() {
5950
// invoked before application stops
6051
}
@@ -175,17 +166,9 @@ class AppModule {
175166
}
176167
```
177168

178-
## Hooks
179-
180-
Hooks are constructors that can not be injected anywhere but invoked once the application has bootstrapped.
181-
182-
For instance, hooks can be used to register routes of your web application.
183-
184-
See [examples](https://github.com/lsndr/moject/tree/master/examples).
185-
186169
## App Factory
187170

188-
Use `App` class to initialise modules and run hooks as shown below:
171+
Use `App` class to initialise modules and start an app as shown below:
189172

190173
```typescript
191174
import { AppModule } from './app.module';
@@ -197,7 +180,7 @@ const app = App.create(AppModule);
197180
app.start().catch(console.error);
198181
```
199182

200-
Once `app.start` is called, all your modules get initialised, dependencies resolved, and hooks invoked.
183+
Once `app.start` is called, all your modules get initialised and dependencies resolved.
201184

202185
## Logger
203186

0 commit comments

Comments
 (0)