Skip to content

Commit

Permalink
Merge pull request #28 from kitesjs/dev-xoptions
Browse files Browse the repository at this point in the history
Dev extension options
  • Loading branch information
vunb authored Sep 14, 2019
2 parents 3d1ef3a + 293c384 commit 66c6ab1
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 49 deletions.
10 changes: 0 additions & 10 deletions packages/common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@ Template-based Web Application Framework

**Kites** is a framework providing `dynamic applications` assembling and `Template-based` extracting. Namely it contains a lot of templates and extensions to help building a new application quickly.

Take a look at this:

```ts
@Launcher({
imports?: [], // ... kites extensions manually imported here
discover?: Array<string> | string | boolean; // autodiscover extensions in app's child directories or given path
})
class App {}
```

Features
=======

Expand Down
10 changes: 0 additions & 10 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@ Template-based Web Application Framework

**Kites** is a framework providing `dynamic applications` assembling and `Template-based` extracting. Namely it contains a lot of templates and extensions to help building a new application quickly.

Take a look at this:

```ts
@Launcher({
imports?: [], // ... kites extensions manually imported here
discover?: Array<string> | string | boolean; // autodiscover extensions in app's child directories or given path
})
class App {}
```

Features
=======

Expand Down
3 changes: 3 additions & 0 deletions packages/core/engine/kites-instance.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ describe('kites engine', () => {
}).init();

expect(app.aKitesExtensionInitialized).eq(true, 'found a kites extension which has initialized!');
expect(app.options.sample).eql({
always: 'be here'
}, 'read extension options!');
});

it('should accept plain function as an extension', async () => {
Expand Down
5 changes: 4 additions & 1 deletion packages/core/extensions/extensions-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,14 @@ class ExtensionsManager extends EventEmitter {
private useOne(extension: KitesExtension) {
// extends options
// Review _.assign(), _.defaults(), or _.merge?
const xname = extension.name && extension.name.toLowerCase();
const options = _.assign<
ExtensionOptions,
ExtensionOptions | undefined,
ExtensionOptions | undefined>({}, extension.options, this.kites.options[extension.name && extension.name.toLowerCase()]);
ExtensionOptions | undefined>({}, extension.options, this.kites.options[xname]);

extension.options = options;
this.kites.options[xname] = options;

if (options.enabled === false) {
this.kites.logger.debug(`Extension ${extension.name} is disabled, skipping`);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
name: 'sample',
main: 'main.js',
dependencies: [],
hasPublicPart: false,
options: {
always: 'be here'
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = function (kites, definition) {
kites.aKitesExtensionInitialized = true
}
kites.aKitesExtensionInitialized = true;
}
10 changes: 0 additions & 10 deletions packages/express/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@ Template-based Web Application Framework

**Kites** is a framework providing `dynamic applications` assembling and `Template-based` extracting. Namely it contains a lot of templates and extensions to help building a new application quickly.

Take a look at this:

```ts
@Launcher({
imports?: [], // ... kites extensions manually imported here
discover?: Array<string> | string | boolean; // autodiscover extensions in app's child directories or given path
})
class App {}
```

Features
=======

Expand Down
10 changes: 0 additions & 10 deletions packages/rest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@ Template-based Web Application Framework

**Kites** is a framework providing `dynamic applications` assembling and `Template-based` extracting. Namely it contains a lot of templates and extensions to help building a new application quickly.

Take a look at this:

```ts
@Launcher({
imports?: [], // ... kites extensions manually imported here
discover?: Array<string> | string | boolean; // autodiscover extensions in app's child directories or given path
})
class App {}
```

Features
=======

Expand Down

0 comments on commit 66c6ab1

Please sign in to comment.