Mamba-Forever Documentation

website·Indexed 30 days ago

https://mamba-in.github.io/cloud-notes/

Documentation for Mamba-Forever, a project based on Vue 3.0 and Vite. It includes guides on routing, component registration, styling with Less and Tailwind CSS 2.5.0+, external module integration, and linting configurations using CommitLint.

Tokens
8.6K
Snippets
28
Records
60
Agent score
75%

What's inside Mamba-Forever

  1. Overview of Mamba-Forever Framework

    Mamba-Forever is an out-of-the-box solution for developing medium-to-large scale admin dashboards. It is built on a modern tech stack including Vue 3.0, Vite, Ant-Design-Vue, and TypeScript. Key features include secondary encapsulated components, utility functions, hooks, dynamic menus, permission validation, and button-level access control.
  2. Overview of project linting and formatting tools

    The project integrates several tools to ensure code consistency, reduce bugs, and improve maintainability. The primary tools used are:

    • eslint: Validates general code format and standards.
    • stylelint: Validates CSS and Less specifications.
    • prettier: Handles automatic code formatting.
    • commitlint: Validates Git commit message standards.
  3. Install dependencies using pnpm

    The project requires pnpm for dependency management. If pnpm is not installed, use one of the following commands to install it globally.
    # Install pnpm globally via npm
    npm install -g pnpm
    
    # Or install via Homebrew on Mac
    brew install pnpm
    
    # Verify installation
    pnpm -v
  4. Initialize and run a Mamba-Forever project

    To start a new project with Mamba-Forever, you must first install the nk-cli globally.

    Critical Constraint: Ensure that the directory where the code is stored and all its parent directories contain no Chinese characters or spaces, otherwise the project will fail to start after installing dependencies.

    # Install CLI
    pnpm add -g nk-cli
    
    # Create project
    kk create <app-name>
    # Or use: nk-cli create <app-name>
    
    # Run project
    cd <app-name>
    pnpm serve
  5. Perform page navigation

    For navigating between pages, it is recommended to use the useGo hook provided by the project.
    import { useGo } from '/@/hooks/web/usePage';
    import { defineComponent } from 'vue';
    
    export default defineComponent({
      setup() {
        const go = useGo();
    
        // Navigate to a specific page enum or path
        go(PageEnum.Home);
        return {};
      },
    });
  6. Define and register route modules

    Route configurations are stored in src/router/routes. Files located in src/router/routes/modules are treated as route modules and are automatically registered by the system without requiring manual imports. Each module should export a default object of type AppRouteModule.
    import type { AppRouteModule } from '/@/router/types';
    import { LAYOUT } from '/@/router/constant';
    
    const dashboard: AppRouteModule = {
      path: '/about',
      name: 'About',
      component: LAYOUT,
      redirect: '/about/index',
      meta: {
        hideChildrenInMenu: true,
        title: 'About',
        orderNo: 100000,
      },
      children: [
        {
          path: 'index',
          name: 'AboutPage',
          component: () => import('/@/views/sys/about/index.vue'),
          meta: {
            title: 'About',
            icon: 'simple-icons:about-dot-me',
            hideMenu: true,
          },
        },
      ],
    };
    
    export default dashboard;
  7. Follow Git commit message conventions with CommitLint

    The project uses commitlint to enforce a standardized Git commit message format based on the Angular/Vue convention. Commit messages should start with one of the following types to categorize the change:

    • feat: A new feature
    • fix: A bug fix
    • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
    • perf: A code change that improves performance
    • refactor: A code change that neither fixes a bug nor adds a feature
    • revert: Reverts a previous commit
    • test: Adding missing tests or correcting existing tests
    • docs: Documentation only changes
    • chore: Updates to build tasks, package manager configs, etc.
    • workflow: Improvements to workflows
    • ci: CI configuration changes
    • mod: Modifications that do not fit other categories
    • wip: Work in progress
    • types: Type definition changes
  8. Prepare the development environment for Cloud Notes

    To develop with Cloud Notes, ensure the following software is installed on your local machine:

    • Pnpm: Version 6.x is required. Newer versions may cause dependency installation failures.
    • Node.js: Version 12.x or higher is required. Note that version 13.x is explicitly unsupported; version 14.x or higher is recommended.
    • Git: Required for version control.
  9. Implement custom SVG Sprite icons

    To use custom SVG icons, place the .svg files in the src/assets/icons directory. You can then render these icons using either the SvgIcon component or the generic Icon component.
    <template>
      <!-- Method 1: Using SvgIcon component directly -->
      <SvgIcon name="test" />
    
      <!-- Method 2: Using Icon component with |svg suffix -->
      <Icon name="test|svg" />
    </template>
    
    <script>
      import { defineComponent } from 'vue';
      import { SvgIcon, Icon } from '/@/components/Icon';
      export default defineComponent({
        components: { SvgIcon, Icon },
      });
    </script>
  10. Frontend development learning and practice resources

    A collection of repositories for improving programming skills and exploring creative frontend projects:

    • build-your-own-x: Guides for implementing bots, databases, and neural networks in various languages.
    • javascript-algorithms: Learning algorithms through frontend knowledge.
    • app-ideas: A collection of project ideas with clear goals and complexity levels for practice.
    • WebGL-Fluid-Simulation: High-quality WebGL interactive fluid simulation.
    • react-kawaii: A React library for cute cartoon faces.
  11. Configure VS Code for Cloud Notes development

    To improve development efficiency and ensure consistent code formatting, the following VS Code extensions are recommended:

    • Volar: Essential for Vue 3 development.
    • Tailwindcss IntelliSense: Provides autocomplete for Tailwind CSS.
    • ESLint: For script code checking.
    • Prettier: For general code formatting.
    • Stylelint: For CSS formatting.
    • Iconify IntelliSense: For Iconify icon support.
    • DotENV: For .env file syntax highlighting.