1.10.2 • Published 2 years ago

@efox/emp-cli v1.10.2

Weekly downloads
420
License
MIT
Repository
github
Last release
2 years ago

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
}
1.10.2

2 years ago

1.10.1

2 years ago

1.10.0

2 years ago

1.9.10

3 years ago

1.9.9-2

3 years ago

1.9.9-0

3 years ago

1.9.9

3 years ago

1.9.8

3 years ago

1.9.7

3 years ago

1.9.6

3 years ago

1.9.5

3 years ago

1.9.4

3 years ago

1.9.3

3 years ago

1.9.2

3 years ago

1.9.1

3 years ago

1.9.0-2-beta.2

3 years ago

1.9.0-2-beta.1

3 years ago

1.9.0-2-beta.0

3 years ago

1.9.0

3 years ago

1.9.0-0

3 years ago

1.8.25

3 years ago

1.8.24

3 years ago

1.8.23

3 years ago

1.8.20-beta.1

3 years ago

1.8.20-beta.0

3 years ago

1.7.16

3 years ago

1.7.17

3 years ago

1.7.18

3 years ago

1.8.20

3 years ago

1.8.21

3 years ago

1.8.22

3 years ago

1.8.19-beta.1

3 years ago

1.8.19

3 years ago

1.8.18

3 years ago

1.8.17

3 years ago

1.8.16

3 years ago

1.8.15

3 years ago

1.8.14

3 years ago

1.8.13-beta.1

3 years ago

1.8.11-beta.3

3 years ago

1.8.12

3 years ago

1.8.13

3 years ago

1.8.11-beta.2

3 years ago

1.8.11-beta.1

3 years ago

1.8.11-beta.0

3 years ago

1.8.9

3 years ago

1.8.10

3 years ago

1.8.8

3 years ago

1.8.7

3 years ago

1.8.6

3 years ago

1.8.5

3 years ago

1.8.2

3 years ago

1.8.1

3 years ago

1.8.4

3 years ago

1.8.3

3 years ago

1.8.0

3 years ago

1.7.15

3 years ago

1.7.14

3 years ago

1.7.13

3 years ago

1.7.12

3 years ago

1.7.10

3 years ago

1.7.11

3 years ago

1.7.9

3 years ago

1.7.8

3 years ago

1.7.7

3 years ago

1.7.6

3 years ago

1.7.5

3 years ago

1.7.4

3 years ago

1.7.3

3 years ago

1.7.2

3 years ago

1.7.1

3 years ago

1.7.0

3 years ago

1.6.20

3 years ago

1.6.19

3 years ago

1.6.18

3 years ago

1.6.17

3 years ago

1.6.16

3 years ago

1.6.15

3 years ago

1.6.14

3 years ago

1.6.13-beta3

3 years ago

1.6.13-beta2

3 years ago

1.6.13-beta1

3 years ago

1.6.13-beta

3 years ago

1.6.13

3 years ago

1.6.12

3 years ago

1.6.11

3 years ago

1.6.9

3 years ago

1.6.8-beta4

3 years ago

1.6.8-beta3

3 years ago

1.6.8-beta2

3 years ago

1.6.10-beta

3 years ago

1.6.9-beta

3 years ago

1.6.8-beta-plus

3 years ago

1.6.8-beta

3 years ago

1.6.8

3 years ago

1.6.7

3 years ago

1.6.6-beta

3 years ago

1.6.6-beta-plus

3 years ago

1.6.5

3 years ago

1.6.3

3 years ago

1.6.3-beta.2

3 years ago

1.6.4

3 years ago

1.6.2

3 years ago

1.6.1

3 years ago

1.6.0

3 years ago

1.5.4

3 years ago

1.5.3

3 years ago

1.5.2

3 years ago

1.5.1

3 years ago

1.5.0

3 years ago

1.4.3

3 years ago

1.4.2

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.3.1

3 years ago

1.2.10

3 years ago

1.2.11

3 years ago

1.2.9

3 years ago

1.2.7

3 years ago

1.2.6

3 years ago

1.2.5

3 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.2.0

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.1.21

3 years ago

1.1.20

3 years ago

1.1.19

3 years ago

1.1.18

3 years ago

1.1.17

3 years ago

1.1.16

3 years ago

1.1.15

3 years ago

1.1.14

3 years ago

1.1.13

3 years ago

1.1.12

3 years ago

1.1.11

3 years ago

1.1.10

3 years ago

1.1.9

3 years ago

1.1.8

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.1

4 years ago

1.1.2

4 years ago

1.1.0

4 years ago

1.0.34

4 years ago

1.0.33

4 years ago

1.0.32

4 years ago

1.0.31

4 years ago

1.0.30

4 years ago

1.0.29

4 years ago

1.0.28

4 years ago

1.0.27

4 years ago

1.0.26

4 years ago

1.0.25

4 years ago

1.0.24

4 years ago

1.0.23

4 years ago

1.0.22

4 years ago

1.0.20

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago