-
Notifications
You must be signed in to change notification settings - Fork 579
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support importConfigs and add test case
- Loading branch information
1 parent
228bf1e
commit 753cfb4
Showing
15 changed files
with
122 additions
and
48 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
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
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
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
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
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
5 changes: 4 additions & 1 deletion
5
.../midway-core/test/fixtures/app-with-configuration/base-app-decorator/src/configuration.ts
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,6 +1,9 @@ | ||
import { Configuration } from '@midwayjs/decorator'; | ||
|
||
@Configuration({ | ||
imports: ['../../midway-plugin-mock/src'], | ||
imports: [ | ||
'../../midway-plugin-mock/src', | ||
'../../midway-plugin-ok/src' | ||
], | ||
}) | ||
export class AutoConfiguraion {} |
4 changes: 2 additions & 2 deletions
4
...on/midway-plugin-ok/src/articleManager.ts → .../midway-plugin-mock/src/replaceManager.ts
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,8 +1,8 @@ | ||
import { Provide } from '@midwayjs/decorator'; | ||
|
||
@Provide() | ||
export class ArticleManager { | ||
export class ReplaceManager { | ||
async getOne() { | ||
return 'ok'; | ||
return 'one article'; | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
...y-core/test/fixtures/app-with-configuration/midway-plugin-ok/src/config/config.default.ts
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,5 @@ | ||
export = { | ||
ok: { | ||
text: 'ok' | ||
} | ||
}; |
5 changes: 5 additions & 0 deletions
5
...way-core/test/fixtures/app-with-configuration/midway-plugin-ok/src/config/config.local.ts
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,5 @@ | ||
export = { | ||
ok: { | ||
text: 'ok1' | ||
} | ||
}; |
6 changes: 5 additions & 1 deletion
6
...es/midway-core/test/fixtures/app-with-configuration/midway-plugin-ok/src/configuration.ts
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,6 +1,10 @@ | ||
import { Configuration } from '@midwayjs/decorator'; | ||
|
||
@Configuration({ | ||
namespace: 'ok' | ||
namespace: 'ok', | ||
importConfigs: [ | ||
'./config/config.default', | ||
'./config/config.local' | ||
] | ||
}) | ||
export class AutoConfiguraion {} |
12 changes: 12 additions & 0 deletions
12
...s/midway-core/test/fixtures/app-with-configuration/midway-plugin-ok/src/replaceManager.ts
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,12 @@ | ||
import { Config, Provide } from '@midwayjs/decorator'; | ||
|
||
@Provide() | ||
export class ReplaceManager { | ||
|
||
@Config('ok.text') | ||
config; | ||
|
||
async getOne() { | ||
return this.config; | ||
} | ||
} |
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
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
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