npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fastlion-amis

v1.2.5-3.0-beta

Published

一种MIS页面生成工具

Downloads

2,590

Readme

fastlion-amis


  1. 拉取至本地
git clone http://git.fastlion.cn/front/fastlion-amis.git
  1. 调试源码
npm install
npm run start
  1. 项目打包
npm run build
  1. 更多文档请查看
  • fastlion-amis使用文档 以下是一份前端开发规范的基本文档,它可以帮助团队在前端项目中保持一致的编码风格和最佳实践。请根据您的项目需求进行适当的定制和扩展。

开发规范

1. 命名规范

1.1 文件和文件夹命名

  • 使用有意义的文件和文件夹命名,遵循驼峰命名法。
  • 文件扩展名应该使用小写字母。

示例:

  • Good: userService.js
  • Bad: my_file_Name.JS

1.2 变量和函数命名

  • 使用有意义的变量和函数名,遵循驼峰命名法。
  • 对于常量,使用全大写字母和下划线分隔。

示例:

// 变量和函数
const userName = 'pengjie';
function calculateTotalPrice() {}

// 常量
const MAX_ATTEMPTS = 5;

1.3 类名命名

  • 使用帕斯卡命名法(每个单词首字母大写)来命名类。

示例:

class ShoppingCart {}

1.4 组件命名

  • React 组件使用帕斯卡命名法,并且应该以名词形式命名。
  • 使用明确的和描述性的名称,以便于理解组件的作用。

示例:

// Good
class UserProfile {}

// Bad
class Data {}

2. 代码结构

2.1 缩进和格式化

  • 使用4个空格进行代码缩进。
  • 保持一致的代码格式化风格,可以使用工具(如ESLint)来自动检查和修复。

2.2 文件结构

  • 组织项目文件结构,将相关文件组合到相应的文件夹中(如组件、工具、样式等)。

示例:

/src
  /components
    /Header
      Header.js
      Header.css
    /Footer
      Footer.js
      Footer.css
  /utils
    api.js
  /styles
    main.css

3. 注释

  • 使用注释来解释复杂的代码、算法或不明显的意图。
  • 避免不必要的注释,代码应该尽量自解释性。

示例:

// Good: 注释解释了这段代码的作用
function calculateTotalPrice() {
  // 计算商品总价
  // ...
}

// Bad: 不必要的注释
let x = 0; // 初始化x

4. 变量和常量

4.1 变量声明

  • 使用 const 声明不会被重新赋值的变量,使用 let 声明可能会被重新赋值的变量。
  • 避免使用 var

示例:

const age = 25;
let userName = 'JohnDoe';

4.2 常量

  • 使用 const 声明常量,常量名称应该使用全大写字母和下划线分隔。

示例:

const MAX_ATTEMPTS = 5;

5. 函数

  • 函数应该短小且单一责任。
  • 使用函数注释来描述函数的参数、返回值和作用。

示例:

/**
 * 计算两个数字的和
 * @param {number} a - 第一个数字
 * @param {number} b - 第二个数字
 * @returns {number} 两个数字的和
 */
function add(a, b) {
  return a + b;
}

6. 异步操作

  • 使用 async/await 来处理异步操作,以提高可读性。
  • 使用 try/catch 来捕获和处理异步操作中的错误。

示例:

async function fetchData() {
  try {
    const response = await fetch('https://api.example.com/data');
    const data = await response.json();
    return data;
  } catch (error) {
    console.error('Error fetching data:', error);
    throw error;
  }
}

7. 样式

  • 使用 CSS 预处理器(如Sass或Less)来组织和管理样式。
  • 遵循命名约定(如BEM)来命名CSS类,以确保样式的可维护性。

8. 测试

  • 编写单元测试和集成测试,以确保代码的质量和稳定性。
  • 使用测试框架(如Jest或Mocha)来运行测试用例。

9. 版本控制

  • 使用版本控制系统(如Git)来管理代码,定期提交和推送更改。
  • 使用分支来进行特性开发,避免在主分支上进行直接修改。

10. 文档

  • 为项目编写文档,包括代码注释、API文档、使用说明等。
  • 使用代码注释来解释复杂的逻辑和算法。

11. 最佳实践

  • 遵循最佳实践和设计模式,以提高代码质量和可维护性。
  • 不断学习和更新前端知识,保持技术栈的现代性。

请注意,

以上规范只是一个基本指南,具体规范可能因项目需求、团队合作方式和技术栈而异。在项目中,建议与团队一起制定并遵循一致的开发规范。此外,使用自动化工具(如ESLint、Prettier等)来强制执行规范也是一个不错的做法。