fes.js Documentation

repository·master·Indexed 23 days ago

https://github.com/webankfintech/fes.js

A comprehensive frontend application solution built on Vue.js 3.0 designed for rapid development of management consoles. It features a plugin-based architecture, routing-centric design, and supports both Vite and Webpack builders. The framework emphasizes convention over configuration and provides tools for state management, permission control, and multi-environment configuration via .fes.js and .env files.

Tokens
76.6K
Snippets
178
Records
385
Agent score
82%

What's inside fes.js

  1. Overview of Fes.js core concepts

    master

    Fes.js is a frontend application solution designed around the principles of Convention over Configuration, Configuration-driven, and Component-based design.

    Key characteristics include:

    • Plugin-based Architecture: A complete plugin system covering the entire lifecycle (compilation and runtime). It is inspired by Umi's mechanism.
    • Routing-centric: Supports both configuration-based routing and convention-based routing.
    • Vue.js 3.0 Based: Leverages the rich Vue ecosystem with a smooth learning curve.
    • Extensible: Plugins can manage both build-time and runtime capabilities, coordinated by the Fes.js core.
  2. What is Fes.js?

    master

    Fes.js is a comprehensive frontend application solution built on Vue 3.0. It provides a complete workflow from development to deployment, addressing common setup tasks like routing, API encapsulation, layout implementation, and permission management.

    Key features include:

    • Fast: Built-in support for routing, development, and building, with plugins for testing, layout, permissions, internationalization, state management, API requests, data dictionaries, and SvgIcon.
    • Simple: Follows the "Convention over Configuration" philosophy. It uses consistent API entries and provides a unified plugin configuration entry point.
    • Robust: Focuses on page content development while providing unit testing and coverage testing capabilities to ensure quality.
    • Extensible: Implements a complete lifecycle and plugin mechanism (inspired by Umi) that allows plugins to manage both compile-time and runtime behaviors.
    • Future-proof: Utilizes modern technologies like Vue 3.0 and Webpack 5, with ongoing exploration of Vite.
  3. Explore Fes.js plugins

    master
    Fes.js provides a wide range of plugins that encapsulate common technology stacks, allowing developers to complete most daily tasks within the Fes.js ecosystem. You can extend your project's capabilities by installing specific plugins for features like state management, internationalization, or microservices.
  4. How Fes.js works: Architecture and Plugins

    master

    Fes.js works by encapsulating common technology stacks into individual plugins. This convergence allows developers to complete the majority of daily tasks using only the Fes.js core and its ecosystem.

    Plugins and Plugin Sets

    Fes.js supports both individual Plugins and Plugin Sets. Plugin sets are used to group related plugins together to provide specialized support for different business types or application requirements, helping to manage dependencies efficiently.

  5. Use dir path rules for value extraction

    master

    The dir option allows you to specify a path to extract data from the enum's value object. It supports object properties, array indices, and mixed access:

    • Object properties: A, A.B
    • Array indices: [0], [0][1]
    • Mixed: A[0], [0].A, A[0].B

    Note: If the enum value is a primitive type, dir rules are ignored and the value itself is returned.

  6. Access Fes.js APIs via @fesjs/fes

    master

    Fes.js unifies all API entry points. All runtime APIs, including built-in Fes.js APIs and those provided by plugins, are exported through the @fesjs/fes package. You should use this package as your primary import source for runtime functionality.

    import { someApi } from '@fesjs/fes';
  7. Core concepts of Fes.js

    master

    Fes.js is designed to solve the overhead of setting up front-end environments, routing, API encapsulation, and authority management. Its core philosophy includes:

    • Fast: Built-in routing and development tools with a wide array of plugins for daily development needs.
    • Easy: Based on Vue 3.0 and follows the "Convention over Configuration" principle. It provides a unified plugin configuration entry and consistent APIs.
    • Strong: Focuses on reducing bugs by allowing developers to focus on page content, supported by unit testing and coverage capabilities.
    • Expanded: Implements a complete lifecycle and plugin mechanism (inspired by Umi) that manages both compile-time and runtime processes.
    • Future-proof: Built on modern technologies like Vue 3.0 and Webpack 5, with ongoing exploration of Vite.
  8. Configure Fes.js plugins and builders via package.json

    master

    In your package.json, @fesjs/fes is the core dependency. Fes.js automatically registers dependencies based on their naming prefixes:

    • Plugins/Presets: Dependencies starting with @fesjs/preset-, @fesjs/plugin-, @webank/fes-preset-, @webank/fes-plugin-, fes-preset-, or fes-plugin- are automatically registered as plugins or plugin sets.
    • Builders: Dependencies starting with @fesjs/builder- are automatically registered as builders.
  9. Plugin Lifecycle Hooks

    master

    Plugins can hook into different stages of the Fes.js lifecycle:

    • onPluginReady: Triggered when plugin initialization is complete. Note that config and paths are not yet parsed at this stage.
    • onStart: Triggered before command registration. config and paths are available here.
    • onGenerateFiles: Triggered before Webpack compilation. This is the recommended place for generating or writing temporary files.
    • onExit: Triggered when the development server exits.