Giter VIP home page Giter VIP logo

jm-cli's Introduction

CLI

Getting Started

CLI for build Typescript & React App jm-cli 是 mygzb 前端团队使用的项目运行和构建工具。提供了高性能, 强团队编码规范, 约定大于配置的构建环境. 可以让开发者更专注于业务的开发, 增强项目的可维护性.

安装

yarn global add @gdjiami/cli
# or
npm i -g @gdjiami/cli

jm help

jm-cli 支持在全局模式调用,也支持作为项目的依赖调用。我们推荐后者,因为他和项目是绑定版本的,不会应该版本不兼容而无法运行。

创建项目

jm create my-app

上面的命令将创建一个默认的项目。 项目结构如下:

my-app
├── README.md
├── node_modules
├── package.json
├── yarn.lock
├── global.d.ts
├── tsconfig.json
├── tslint.json
├── .gitignore
├── .env
├── .env.production
├── .env.development
├── public
└── src
    ├── layouts
    |   └── layout.pug
    ├── css
    |   └── ...
    ├── components
    |   └── ...
    ├── containers
    |   └── ...
    ├── admin.pug
    ├── admin.tsx
    ├── index.pug
    └── index.tsx

jm-cli 天然支持多页应用,这里的 admin.pug 和 index.pug 就是两个应用入口。jm-cli 会搜索与它们同名的 Typescript 入口文件。 项目结构的具体详情将在 Folder Structure 中说明。现在可以打开项目目录运行:

cd my-app

NPM Scripts

新创建的项目会内置以下命令

start

在开发服务器中运行,默认运行在 8080 端口,在启动成功后会自动开发默认浏览器.

build

编译生产环境包,资源将输出到 dist 目录

serve

运行生产环境包。这个命令会采用和 start 一样的配置(例如端口和代理配置)来运行服务器,方便测试生产环境包.

analyze

对 webpack 的生产环境包构建进行分析,方便开发者对应用进行拆包优化.

License

jm-cli is open source software licensed as MIT.

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.