The default module of the rekit-core package. It does two things:
- Wraps modularized APIs to Rekit core commands.
- Exports other modules. i.e.
require('rekit-core').component
equals torequire('rekit-core/component')
.
Members
(static, constant) action
Quick access to rekit-core/action.
(static, constant) app
Quick access to rekit-core/app.
(static, constant) component
Quick access to rekit-core/component.
(static, constant) feature
Quick access to rekit-core/feature.
(static, constant) style
Quick access to rekit-core/style.
(static, constant) test
Quick access to rekit-core/test.
(static, constant) utils
Quick access to rekit-core/utils.
(static, constant) vio
Quick access to rekit-core/vio.
(static, constant) vio
Quick access to rekit-core/vio.
Methods
(static) addAction(feature, name)
Add an action and its unit test.
Parameters:
Name | Type | Description |
---|---|---|
feature |
string | the feature where to create the action. |
name |
string | the action name, will be converted to camel case. |
(static) addAsyncAction(feature, name)
Add an async action using redux-thunk and its unit test.
Parameters:
Name | Type | Description |
---|---|---|
feature |
string | the feature where to create the action. |
name |
string | the action name, will be converted to camel case. |
(static) addComponent(feature, name, args)
Add a component including unit test and style files. It wraps APIs from component
, style
and test
.
Example
const rekitCore = require('rekit-core');
// Add a component named 'TopicList' which is connected to Redux store.
rekitCore.addComponent('home', 'topic-list', { connect: true });
// Write the changes to disk. Otherwise only in memory, see more at rekitCore/vio
rekitCore.vio.flush();
Parameters:
Name | Type | Description |
---|---|---|
feature |
string | the feature where to create the component. |
name |
string | the component name, will be converted to pascal case. |
args |
object | other args. |
(static) addFeature(name)
Add a feature with one sample component. Besides creating feature folder and files, it also registers reducer, router config, style to root config of the app.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | the feature name. |
(static) handleCommand()
Handle the parse result of Rekit command, like rekit add component home/hello
.
(static) moveAction(source, target)
Move/rename an action including unit test.
Parameters:
Name | Type | Description |
---|---|---|
source |
object | which action to be moved, in form of { name: {string}, feature: {string} }. |
target |
object | where to move, in form of { name: {string}, feature: {string} }. |
(static) moveAsyncAction(source, target)
Move/rename an async action including unit test.
Parameters:
Name | Type | Description |
---|---|---|
source |
ElementArg | Which action to be moved. |
target |
ElementArg | Where to move. |
(static) moveComponent(source, target)
Move/rename a component including unit test and style files. It wraps APIs from component
, style
and test
.
Example
const rekitCore = require('rekit-core');
// Rename the component from 'TopicList' to 'Topics'
rekitCore.moveComponent({ feautre: 'home', name: 'topic-list' }, { feautre: 'home', name: 'topics' });
// Write the changes to disk. Otherwise only in memory, see more at rekitCore/vio
rekitCore.vio.flush();
Parameters:
Name | Type | Description |
---|---|---|
source |
object | which component to be moved, in form of { name: {string}, feature: {string} }. |
target |
object | where to move, in form of { name: {string}, feature: {string} }. |
(static) moveFeature(oldName, newName)
Rename a feature
Parameters:
Name | Type | Description |
---|---|---|
oldName |
string | Old name of the feature. |
newName |
string | New name of the feature. |
(static) removeAction(feature, name)
Remove an action and its unit test.
Parameters:
Name | Type | Description |
---|---|---|
feature |
string | the feature of the action. |
name |
string | the action name, will be converted to camel case. |
(static) removeAsyncAction(feature, name)
Remove an async action and its unit test.
Parameters:
Name | Type | Description |
---|---|---|
feature |
string | the feature of the action. |
name |
string | the action name, will be converted to camel case. |
(static) removeComponent(feature, name)
Remove a component including unit test and style files. It wraps APIs from component
, style
and test
.
Example
const rekitCore = require('rekit-core');
// Remove a component named 'TopicList' which is connected to Redux store.
rekitCore.removeComponent('home', 'topic-list');
// Write the changes to disk. Otherwise only in memory, see more at rekitCore/vio
rekitCore.vio.flush();
Parameters:
Name | Type | Description |
---|---|---|
feature |
string | the feature where to create the component. |
name |
string | the component name, will be converted to pascal case. |
(static) removeFeature(name)
Remove a feature.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | the feature name. |
Type Definitions
ElementArg
Properties:
Name | Type | Description |
---|---|---|
feature |
string | The feature of the element. |
name |
string | The name of the element. |
The combination of feature and name of an element like component.
Type:
- Object