Giter Club home page Giter Club logo

mpx-es-check's Introduction

Mpx-es-check

项目构建产物兼容性检测,避免出现 babel 漏转或者是未经 babel 转码,造成因浏览器语法兼容问题的出错。

install

npm i @mpxjs/es-check --save-dev
// or
npm i @mpxjs/es-check -g

Usage

  • 如果是本地安装:在 package.json 中添加 scripts 命令
"esCheck": "mpx-es-check --module --ecma=6 './dist/*.js'"
  • 如果是全局安装:可直接运行命令
mpx-es-check --module --ecma=6 ./dist/*.js
  • --module 表示以 esModule 模块检测代码,如果不设置则表示使用 script 方式检测代码
  • --ecma 语法规则
    • ecma后表示要检测的最低版本的语法,可以是 (6/ 7/ 8/ 9/ 10/ 11/ 12) 或者是 (2015/ 2016/ 2017/ 2018/ 2019/ 2020/ 2021)
  • ./dist/*.js 检测文件
    • 设置文件匹配的范围,使用 glob pattern 配置的方式, somePath/*.js
    • 在 脚本中使用时需要加 '' 包裹,避免无法正确匹配文件
  • --all 检测实例方法和静态方法
    • --all 在命令中添加 --all 参数会启用实例方法和静态方法的检测
    mpx-es-check --module --ecma=6 --all ./dist/*.js
  • --miniprogram 检测微信小程序语法错误
    • 检测微信小程序中的props声明错误等

结果输出

检测中如果有高版本语法, 则会在终端提示,并将检测结果输出到项目 ./dist/es-check.log 文件中, 如果没有 dist 文件夹,则会在项目根目录输出 log 文件

mpx-es-check's People

Contributors

blackgan3 avatar sky-admin avatar zhuzhh avatar mater1996 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.