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.
What's inside Mamba-Forever
- 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.
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.
Install dependencies using pnpm
The project requirespnpmfor 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 -vInitialize and run a Mamba-Forever project
To start a new project with Mamba-Forever, you must first install the
nk-cliglobally.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 serveFrontend learning and best practice guides
Curated educational resources for frontend and security:
- Best Practices: mobile-web-best-practice for mobile web development.
- Security: hacksplaining for learning network security.
- Tooling: npx guide for the correct usage of the npx package runner.
Perform page navigation
For navigating between pages, it is recommended to use theuseGohook 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 {}; }, });Define and register route modules
Route configurations are stored insrc/router/routes. Files located insrc/router/routes/modulesare treated as route modules and are automatically registered by the system without requiring manual imports. Each module should export a default object of typeAppRouteModule.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;Follow Git commit message conventions with CommitLint
The project uses
commitlintto 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 featurefix: A bug fixstyle: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)perf: A code change that improves performancerefactor: A code change that neither fixes a bug nor adds a featurerevert: Reverts a previous committest: Adding missing tests or correcting existing testsdocs: Documentation only changeschore: Updates to build tasks, package manager configs, etc.workflow: Improvements to workflowsci: CI configuration changesmod: Modifications that do not fit other categorieswip: Work in progresstypes: Type definition changes
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.
Implement custom SVG Sprite icons
To use custom SVG icons, place the.svgfiles in thesrc/assets/iconsdirectory. You can then render these icons using either theSvgIconcomponent or the genericIconcomponent.<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>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.
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
.envfile syntax highlighting.