@nut-project/cli
A framework born for micro frontends
Last updated 3 hours ago by fengzilong .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @nut-project/cli 
SYNC missed versions from official npm registry.

nut logo

NUT Project

npm version dependencies node version build status npm downloads license

Features

  • Flexible layout mechanism
  • File-based router system
  • Customizable layouts and themes
  • Builtin markdown support
  • System events
  • Configuration management
  • Convenient hot reload during development
  • Plugin system

layout / theme HMR

hmr.gif

markdown theme HMR

markdown-theme-hmr.gif

System events

system-events.jpg

Route matching

route-match.jpg

Builtin layouts

default

ocean sakura
ocean sakura

saber

ocean sakura
ocean sakura

now

now

How to write a layout

...

How to write a plugin

A standard plugin looks like

export default {
  name: 'your-superb-plugin',
  // some special plugin need specify type´╝îbut you can ignore this in most cases
  type: 'login',
  apply( ctx = {}, options = {} ) {
    const { api, events } = ctx

    api.expose( 'method_name', () => {} )
    api.expose( 'prop', 'value' )

    events.on( 'system:before-startup', async ctx => {
      await api.axios() // do some request
      await events.pluginEmit( 'some-event', data ) // emit plugin event out
    } )
  }
}

You can expose some methods or props to application, or listen for system events, emit out some event in plugin

Using plugin

nut.config.js

module.exports = {
  plugins: {
    superb: {
      package: 'your-superb-plugin',
      enable: true,
    }
  }
}

superb is the name in current application

Use above plugin for example

// plugin exposed
ctx.use( 'superb', 'method_name' )
ctx.use( 'superb', 'prop' )

// plugin events
ctx.events.on( 'plugin:superb:some-event', async data => {} )

Get started

yarn global add @nut-project/cli
nut # develop locally
nut --prod # build for production

Current Tags

  • 0.3.28                                ...           latest (3 hours ago)

100 Versions

  • 0.3.28                                ...           3 hours ago
  • 0.3.27                                ...           3 days ago
  • 0.3.26                                ...           9 days ago
  • 0.3.25                                ...           14 days ago
  • 0.3.24                                ...           14 days ago
  • 0.3.23                                ...           17 days ago
  • 0.3.22                                ...           17 days ago
  • 0.3.21                                ...           17 days ago
  • 0.3.20                                ...           17 days ago
  • 0.3.19                                ...           24 days ago
  • 0.3.18                                ...           24 days ago
  • 0.3.17                                ...           a month ago
  • 0.3.16                                ...           a month ago
  • 0.3.15                                ...           a month ago
  • 0.3.14                                ...           a month ago
  • 0.3.13                                ...           a month ago
  • 0.3.12                                ...           a month ago
  • 0.3.11                                ...           a month ago
  • 0.3.10                                ...           a month ago
  • 0.3.9                                ...           a month ago
  • 0.3.8                                ...           a month ago
  • 0.3.7                                ...           a month ago
  • 0.3.6                                ...           a month ago
  • 0.3.5                                ...           a month ago
  • 0.3.4                                ...           a month ago
  • 0.3.3                                ...           a month ago
  • 0.3.2                                ...           a month ago
  • 0.3.1                                ...           a month ago
  • 0.3.0                                ...           a month ago
  • 0.2.7-3                                ...           2 months ago
  • 0.2.7-2                                ...           2 months ago
  • 0.2.7-1                                ...           2 months ago
  • 0.2.7-0                                ...           2 months ago
  • 0.2.6                                ...           2 months ago
  • 0.2.5                                ...           2 months ago
  • 0.2.5-33                                ...           2 months ago
  • 0.2.5-32                                ...           2 months ago
  • 0.2.5-31                                ...           2 months ago
  • 0.2.5-30                                ...           2 months ago
  • 0.2.5-29                                ...           2 months ago
  • 0.2.5-28                                ...           2 months ago
  • 0.2.5-27                                ...           2 months ago
  • 0.2.5-26                                ...           2 months ago
  • 0.2.5-25                                ...           2 months ago
  • 0.2.5-24                                ...           2 months ago
  • 0.2.5-23                                ...           2 months ago
  • 0.2.5-22                                ...           2 months ago
  • 0.2.5-21                                ...           2 months ago
  • 0.2.5-20                                ...           2 months ago
  • 0.2.5-19                                ...           2 months ago
  • 0.2.5-18                                ...           2 months ago
  • 0.2.5-17                                ...           2 months ago
  • 0.2.5-16                                ...           2 months ago
  • 0.2.5-15                                ...           2 months ago
  • 0.2.5-14                                ...           2 months ago
  • 0.2.5-13                                ...           2 months ago
  • 0.2.5-12                                ...           2 months ago
  • 0.2.5-11                                ...           2 months ago
  • 0.2.5-10                                ...           2 months ago
  • 0.2.5-9                                ...           2 months ago
  • 0.2.5-8                                ...           2 months ago
  • 0.2.5-7                                ...           2 months ago
  • 0.2.5-6                                ...           2 months ago
  • 0.2.5-5                                ...           2 months ago
  • 0.2.5-4                                ...           3 months ago
  • 0.2.5-3                                ...           3 months ago
  • 0.2.5-2                                ...           3 months ago
  • 0.2.5-1                                ...           3 months ago
  • 0.2.5-0                                ...           3 months ago
  • 0.2.4                                ...           3 months ago
  • 0.2.3                                ...           3 months ago
  • 0.2.2                                ...           3 months ago
  • 0.2.1                                ...           3 months ago
  • 0.2.0                                ...           3 months ago
  • 0.1.10                                ...           3 months ago
  • 0.1.9                                ...           3 months ago
  • 0.1.8                                ...           3 months ago
  • 0.1.7                                ...           3 months ago
  • 0.1.6                                ...           3 months ago
  • 0.1.5                                ...           3 months ago
  • 0.1.3                                ...           3 months ago
  • 0.1.2                                ...           3 months ago
  • 0.1.1                                ...           3 months ago
  • 0.1.0                                ...           3 months ago
  • 0.0.15                                ...           4 months ago
  • 0.0.14                                ...           4 months ago
  • 0.0.13                                ...           4 months ago
  • 0.0.12                                ...           4 months ago
  • 0.0.11                                ...           4 months ago
  • 0.0.10                                ...           4 months ago
  • 0.0.9                                ...           4 months ago
  • 0.0.8                                ...           4 months ago
  • 0.0.7                                ...           4 months ago
  • 0.0.6                                ...           4 months ago
  • 0.0.5                                ...           4 months ago
  • 0.0.4                                ...           4 months ago
  • 0.0.3                                ...           4 months ago
  • 0.0.2                                ...           4 months ago
  • 0.0.1                                ...           5 months ago
  • 0.0.0                                ...           5 months ago
Maintainers (1)
Downloads
Today 15
This Week 40
This Month 252
Last Day 0
Last Week 63
Last Month 1,093
Dependencies (84)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |