Git Product home page Git Product logo

lerna-react's Introduction

lerna + react-styleguide + craco + typescript

安装 lerna

yarn global add lerna

创建根目录

mkdir lerna-react
cd lerna-react

lerna init --independent
#or(使用统一版本)
lerna init

项目结构

floder-structure

创建一个公共组件库

yarn create react-app ra-material-ui --template typescript
  • 配置ra-material-ui(packages/ra-material-ui/README.md)

使用CRA创建typesctip react项目

cd packages/
yarn create react-app admin --template typescript
  • 配置`ra-material-ui(packages/admin/README.md)

  • admin模块具体配置](packages/admin/README.md)

配置支持 yarn workspace

  • 配置 lerna-react/package.json
    lerna-react/package.json
  • 配置 lerna-react/lerna.json
    lerna-react/lerna.json

基本启动命令 (全局启动命令配置在各项目最后有写)最终的lerna-react/package.json文件为:

{
    "name": "root",
    "private": true,
    "devDependencies": {
        "lerna": "^4.0.0"
    },
    "workspaces": [
        "packages/*"
    ],
    "npmClient": "yarn",
    "scripts": {
        "guide": "yarn lerna run styleguide --stream",
        "admin": "yarn lerna run start --stream"
    }
}

全局命令

yarn guide
yarn admin

基于CRA(create-react-app)添加测试项目test-sample

cd packages/
yarn create react-app test-sample --template typescript
lerna clean
yarn install

启动

cd packages/test-sample
yarn start
  • 此项目,暂时不调用其它模块,故不与其它模块做集成,着重点关注于测试本身 测试相关说明

lerna-react's People

Contributors

leiwang0418 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 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.