rekit-core

The default module of the rekit-core package. It does two things:

  1. Wraps modularized APIs to Rekit core commands.
  2. Exports other modules. i.e. require('rekit-core').component equals to require('rekit-core/component').
Source:

Members

(static, constant) action

Source:

Quick access to rekit-core/action.

(static, constant) app

Source:

Quick access to rekit-core/app.

(static, constant) component

Source:

Quick access to rekit-core/component.

(static, constant) feature

Source:

Quick access to rekit-core/feature.

(static, constant) style

Source:

Quick access to rekit-core/style.

(static, constant) test

Source:

Quick access to rekit-core/test.

(static, constant) utils

Source:

Quick access to rekit-core/utils.

(static, constant) vio

Source:

Quick access to rekit-core/vio.

(static, constant) vio

Source:

Quick access to rekit-core/vio.

Methods

(static) addAction(feature, name)

Source:

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)

Source:

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)

Source:

Add a component including unit test and style files. It wraps APIs from component, style and test.

Example

Create a container component

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)

Source:

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()

Source:

Handle the parse result of Rekit command, like rekit add component home/hello.

(static) moveAction(source, target)

Source:

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)

Source:

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)

Source:

Move/rename a component including unit test and style files. It wraps APIs from component, style and test.

Example

Rename TopicList to Topics

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)

Source:

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)

Source:

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)

Source:

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)

Source:

Remove a component including unit test and style files. It wraps APIs from component, style and test.

Example

Remove a container component

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)

Source:

Remove a feature.

Parameters:
Name Type Description
name string

the feature name.

Type Definitions

ElementArg

Source:
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