npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

friday-micro

v0.0.2

Published

`friday-micro` 基于`qiankun`,提供了`qiankun`的基础能力之外,封装了一些扩展和配置。在应用需要使用微服务时,需要安装到这个模块。

Readme

friday-micro

friday-micro 基于qiankun,提供了qiankun的基础能力之外,封装了一些扩展和配置。在应用需要使用微服务时,需要安装到这个模块。

安装

$ npm install friday-micro --save 

or 

$ yarn add friday-micro --save 

friday-micro可以脱离friday框架单独使用

配置一个微服务

master


import micro from 'friday-micro'

micro.registerMicroApps([{
  // slave name
  name: 'slave-project', // app name registered
  // slave的远端地址
  entry: '//localhost:3001',
  // slave 服务的dom地址
  container: '#subapp-viewport',
  // 触发这个slave
  activeRule: '/react16',
}])
// 启动微服务, 这个start和 app.start不同, micro.start 在start之后,可以选择场景触发。
micro.start()

slave

slave 只需要将服务接口暴露出来即可。webpack配置friday-template 已经配置好,无需修改

import Friday from 'friday-core'
// 微服务中的slave 需要添加该文件在entry 入口上方,用来添加静态资源地址
import '@friday/micro/lib/public-path'

const lifecycle = app.start('#root')

export const bootstrap = lifecycle.bootstrap

export const mount = lifecycle.mount

export const unmount = lifecycle.unmount

slave 应用需要配置一下webpack将微服务的出口暴露出来 :

friday-template中的config-override.js中可以看到下方三个配置项,分别功能为:

  • devServerCorsOrHeader 添加cors,在开发环境中进行跨域
  • OverrideMicroOutPut 暴露微服务出口
  • addEntryAttribute 微服务标记出口文件
const { 
  devServerCorsOrHeader, 
  OverrideMicroOutPut, 
  addEntryAttribute  
} = require('@friday/micro-webpack-plugin')

module.exports = {
  webpack: override(
    ...
    // 微服务暴露出口
    OverrideMicroOutPut(packageName),
    // 微服务标记出口文件
    addWebpackPlugin(
      addEntryAttribute()
    )
  ),
  devServer: overrideDevServer(
    // 添加cors
    devServerCorsOrHeader()
  )
}

API

qiankun api

friday-micro继承qiankun所有的方法,在这就不多叙述

inMicroservice(): boolean

inMicroservice提供判断应用是否在微服务应用中的能力,返回一个boolean

DevelopmentLogin: React.FC

DevelopmentLogin是个react组件,提供了一个通用的微服务登录页面,用于在脱离master应用之后也能独立运行

interface DevelopmentLogin {
  title?: string
  onSumbit(username: string, password: string): void
}

const DevelopmentLogin: React.FC<DevelopmentLogin>

public-path.js

如果是微服务中的slave应用中,我们需要通过__webpack_public_path__变量将静态资源动态导入到webpack中,所以需要添加该文件在entry 入口上方引入 public-path.js静态文件。 用法如下


import 'friday-micro/lib/public-path'