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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@efox/emp-cli

v1.10.2

Published

> Base on Webpack5 Module Federation Micro Frontends solution!

Downloads

733

Readme

EMP CLI

Base on Webpack5 Module Federation Micro Frontends solution!

English | 简体中文

🙋‍♂️ Quick start

  • Initialize EMP project: npx @efox/emp-cli init

📦 Install

npm i -g @efox/emp-cli or yarn global add @efox/emp-cli

👨‍🔧 Features update

Change Log

👨‍💻 Command

  • emp init Initialize project

    • emp init -t <remote-template-url>

    The list of custom templates needs to use JSON format ("template name": "git link")

    {
      "react": "https://github.com/efoxTeam/emp-react-template.git",
      "vue2":"https://github.com/efoxTeam/emp-vue2-template.git"
    }
  • emp dev Development

    • emp dev --hot Hot update
    • emp dev --open Open the development page
    • emp dev -rm Pull the remote declaration file into the src directory
      • -rm --remote:The default is to get the remote address from the remoteBaseUrlList field in package.json in the format
      • {
          "remoteBaseUrlList": [
            {
              "url": "https://com/index.d.ts",
              "name": "project.d.ts"
            }
          ]
        } 
  • emp build Build

    • emp build --env Specify the deployment environment
    • emp build --analyze Analyze
    • emp build --ts Build the production environment, generate index.d.ts to dist directory at the same time
      • emp build --ts -p [types path] -n [types name] types path default relative path is disttypes name default type file name is index.d.ts
  • emp tsc generate index.d.ts to dist directory

    • emp build --ts -p [types path] -n [types name] types path default relative path is disttypes name default type file name is index.d.ts
  • emp tss <remote-url> Synchronization remote type

    • emp tss <remote-url> -p [types path] -n [types name] types path default relative path is srctypes name default type file name is empType.d.ts
  • emp serve Formal service

  • emp help

  • emp dist:ts Synchronize local declaration files to subprojects

    • emp tsc && emp dist:ts && emp dev
    • dist:ts:default reads the local package.json childPath field to loop output, try to keep base project and project project in the same level, package.json:
    • {
        "childPath": [
          {
            "path": "project",
            "name": "xxx.d.ts"
          },
          {
            "path": "/User/project",
            "name": "xxx.d.ts"
          }
        ]
      }

🧞‍♂️ Command plugin development guide

  • command - define the name of the command line command
  • description - description, it will be shown in help
  • option - Define parameters. It accepts four parameters. In the first parameter, it can enter the short name -a and the long name -app, separated by | or,. When used on the command line, these two are equivalent. The difference is The latter can be obtained through callbacks in the program; the second is the description, which will be displayed in the help message; the third parameter is the callback function, and the parameter it receives is a string. Sometimes we need a command line to create multiple Module, you need a callback to process; the fourth parameter is the default value
  • action - Register a callback function, here you need to pay attention to the current callback does not support let declaration variables

plugin, the package name prefix needs to be emp-plugin-*, cli.js is the emp global plugin entry.

  • Create a new project with emp-plugin- as the project prefix, and the plugin entry is cli.js
module.exports = program => {
  program
    .command('helloWorldPlugin')
    .option('-i, --item <item>')
    .description([
      `It is plugin description`,
    ])
    .action(({item}) => {
      console.log(`Plugin ${item}`)
    })
}
  • After the development is completed (emp-plugin-example is only the example package name, the specific package name is subject to the actual package name):
  • Install via yarn:
    • yarn global add emp-plugin-example
  • Install via npm:
    • npm install emp-plugin-example -g

Start emp under the command to use the plugin

✍🏻 Environment variable

  • MODE_ENV webpack mode Environment variable , use process.env.EMP_ENV
  • EMP_ENV use emp dev --env prod Set up to distinguish the deployment environment , use process.env.EMP_ENV

👨🏻‍🏭 Plugin

👩🏻‍💻 VSCODE SETTINGS

{
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true // eslint Auto format
  },
  "typescript.tsdk": "node_modules/typescript/lib", // ts css module type check
  "typescript.enablePromptUseWorkspaceTsdk": true   // ts css module type check
}