Git Product home page Git Product logo

rax-scripts's Introduction

Rax Scripts

Rax official engineering tools use @alib/build-scripts . @alib/build-scripts is based on webpack, supports various scenarios through the plugin system, and provides flexible webpack configuration capabilities based on webpack-chain. Users can realize engineering requirements by combining various plugins.

Quick start

Install the latest version and initialize the project

$ npm init rax my-app

Use by installation

$ npm install @alib/build-scripts --save-dev

Configuration build.json

{
  "plugins": [
    ["build-plugin-rax-app", { "targets": ["web"]}]
  ]
}

How to Write Plugin

@alib/build-scripts Itself will not perform any operations, but according plugins configured in build.json to execute engineering commands, for example, an ordinary webapp project configuration is as follows

The plugin needs to export a function. The function will receive two parameters. The first is the pluginAPI provided by build scripts, and the second is the user-defined parameter passed to the plugin

module.exports = (pluginAPI, options) => {
  const { 
    context,
    log,
    onHook 
  } = pluginAPI;
};

pluginAPI

  • context: environment information (command、commandArgs、rootDir、userConfig、pkg)
  • onGetWebpackConfig: You can modify the weback configuration in the form of weback chain
  • onHook: Listening for command runtime events with onHook
  • log: use npmlog
  • registerTask: register webpack task
  • registerUserConfig: Register the top-level configuration field in build.json for user field verification
  • registerCliOption: cli config
  • setValue & getValue Used to register variables in context for communication between plug-ins

lifecycle

start

  • before.start.load Before getting the webpack configuration
  • before.start.run Before webpack execution
  • after.start.compile After compilation, every recompilation will be executed
  • before.start.devServer After the middleware is loaded, before the webpack dev server is started
  • after.start.devServer After the webpack dev server is started

build

  • before.build.load Before getting the webpack configuration
  • before.build.run Before webpack execution
  • after.build.compile End of build

Plugin List

build-plugin-rax-app

Build Single-page application (SPA)

build-plugin-rax-multi-pages

Build Multi-page application (MPA)

build-plugin-rax-component

Build universal component or universal API library

build-plugin-rax-pwa

Build Progressive web application

build-plugin-rax-ssr

Build Server-side rendering application (SSR)

rax-scripts's People

Contributors

aladdin-add avatar andycall avatar bakujun avatar balloonzzq avatar boiawang avatar chenjun1011 avatar chriscindy avatar clarkxia avatar doranyun avatar fyangstudio avatar icemic avatar imgbotapp avatar imsobear avatar lianmin avatar licaomeng avatar orange-c avatar solojiang avatar sylingd avatar wanglijie avatar wssgcg1213 avatar xlianghang avatar yacheng avatar yinhangfeng avatar yuanyan avatar yuysmile 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.