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

ldb-nl

v0.0.5

Published

@ldb-cli for never-land

Downloads

74

Readme

@ldb 提供的能力

更新日志

create 命令

@ldb create/c <type> 安装NeverLand-PC模版,分为Mock、Pure、General版本

Mock

模拟了登录和菜单的部分功能,可以根据自己的需要进行修改

Pure

没有权限管理和路由管理的相关内容,适合单一的PC项目

General

增加了一个用户管理中心的配套PC框架,适配了Oauth,菜单、操作、角色权限,用户管理中心,请联系我哦

add 命令

@ldb add <type>

fileWay 文件路径

增加文件路径,一般应用于NGINX部署时的路径问题

customForm 自定义表单

开发中

api

安装api生成工具,

关于autoApi

作用、目的
作用在于简化开发`API`文件,简化`API`引用,目的亦在于此。目前支持自定义、`YAPI`导出的`JSON`文件的生成。`JSON`文件的命名规范为`<api.custom.json>`或`<api.yapi.json>`。
逻辑
  1. 首先需要在src/utils/request.js中要定义好axios或者fetch或者其他能提供ajax能力的方法,,因为api相关文件中的需要调用请求。 autoApi中通过以下语句进行引用
import { axios } from '@/utils/request';

所以请不要export default 你的ajax方法 2. 关于生成api目标文件的依据json格式,@ldb会读取特定的文件中的apiJson文件,特定文件夹为/src/ldb-tool/api-json(没有会自动创建);如果你使用命令行生成api,那么证明你本地已经安装了autoApi的源码,那么你可以根据自己的需要修改这个目标文件,下面是apiJson.json的字段说明及可能的用法

{
    "port":"http://your.api.ip:port/api-gateway/",//这个port可能是访问的地址,如果写上ip的话 axios 或者 fetch 的baseUrl就不需要配置了,
  //“port”:"/api-gateway",//也可以这么写,只写api访问网关,这个网关可以作为反向代理的通配符,也可以拼写到axios或者其他ajax能力的baseUrl后面,
  //提供 get、post、put、delete四种请求方式的api生成,
    "get": [
        {
            "name":""//这是你api的调用名,如果没有这个字段或根据api的最后两个反斜杠进行驼峰拼接
            "api":"/some-address/some-function",
            // header会将内容插入request headers中
            "header: {
                "Content-Type": "application/x-www-form-urlencoded",//默认为JSON传参数,如果此种需要formData的需要在你的发送请求的过滤器中添加 new FormData() 的过程,
            },
            "remark":"通知公告列表",//remark 字段为备注字段,autoApi会将此字段添加到方法备注中,不过一般用不到,
        }
    ],
    "post":[{...}],
    "put":[{...}],
    "delete":[{...}]
}

3.生成所有的 api.js 之后会通过 /src/api/index.js 发布,所以一定不要用含有index的名称命名你的apiJson文件,当你需要使用api的时候,你需要在使用的文件中进行饮用

import api from '@/api'
或者 你可以在main.js中使用
然后 
VUE.protoType.$api = api 然后全局vue文件使用

list2Tree

提供一个将list转化为tree的工具函数,添加此工具函数后会有详细注解,此工具提供了一个递归的树生成器,可以根据实际业务修改返回格式和添加需要的业务字段

quillEditorImg

添加一个富文本编辑器组件,富文本编辑器为vue-quill-editor,此组件覆盖了原来的图片功能,使用通过上传接口上传的图片,防止Base64过大导致富文本过大的问题

build命令

@ldb build/b <type>

api

根据apijson 生成api文件

  1. 首先会读取 执行命令当前目录/src/ldb-tool/api-json(没有会创建)中的api-json.json文件,文件夹名称任意,只要不包含index即可
  2. 生成文件会放置于执行命令当前目录/src/api(没有会创建)下

list <基于ANT-D UI制作>

根据listJson生成 列表页面,可以生成带tree的列表页

  1. 首先读取./src/ldb-tool/template/list-json.json
  2. 然后根据命令行提示输入模板json文件名称和输出目标地址
  3. 文件名称同模板文件

form <基于ANT-D UI制作>

根据formJson生成 表单页面,用于新增和编辑

  1. 首先读取./src/ldb-tool/template/form-json.json,然后检测是否有规则校验文件(没有则添加formRules.js,提供一些常用的规则校验,姓名、手机号、邮箱、长度、身份证等)
  2. 然后根据命令行提示输入模板json文件名称和输出目标地址
  3. 文件名称同模板文件

detail <基于ANT-D UI制作>

根据detailJson生成 表单页面,用于新增和编辑

  1. 首先读取./src/ldb-tool/template/detail-json.json,然后判断是否拥有detail-item组件,没有则添加
  2. 然后根据命令行提示输入模板json文件名称和输出目标地址
  3. 文件名称同模板文件

generate命令<测试阶段>

@ldb generate/g <template>

此命令区别于build list/form/detailbuild命令生成页面适用于使用@ldb create/c创建的前端框架(Vue2,UI:AndtD)模板,generante/g命令生成简易模板适用于刘大彪-NeverLand(达·芬奇)前端(Vue3,UI:ElementPlus)模板,此后@ldb将向NeverLand系列耦合。命令使用的JSON模板使用达芬奇的多租户版本(但丁)提供的页面模板生成器生成的JSON模板,但丁会通过用户输入的数据库表名称(单个或多个表)返回表结构中的字段,通过用户勾选字段生成list、form、detail的JSON模板,JSON模板格式附后。

命令提供以下选项
.option('-a,--all', '生成全部模版包括动态组件页、列表、表单、详情')
.option('-l,--list', '生成列表模版')
.option('-f,--form', '生成表单模版')
.option('-d,--detail', '生成详情模版')

选项中-a,--all优先级最高,如果不包含-a,--all另外三个选项取第一个生成,如果没有选项默认为全部生成。

模板格式:

{
  "moduleName": "userManage",
  "list": {
    "search": [
        {
            "field": "_id",
            "label": "",
            "dataType": "varchar",
            "maxLength": "36",
            "nullable": "NO"
        },
        {
            "field": "account",
            "label": "用户账号",
            "dataType": "varchar",
            "maxLength": "50",
            "nullable": "NO"
        },
    ],
    "list": [
        {
            "field": "_id",
            "label": "",
            "dataType": "varchar",
            "maxLength": "36",
            "nullable": "NO"
        },
        {
            "field": "account",
            "label": "用户账号",
            "dataType": "varchar",
            "maxLength": "50",
            "nullable": "NO"
        },
    ]
  },
  "form": [
    {
      "title": "用户信息",
      "fields": [
        {
            "field": "_id",
            "label": "",
            "dataType": "varchar",
            "maxLength": "36",
            "nullable": "NO"
        },
        {
            "field": "account",
            "label": "用户账号",
            "dataType": "varchar",
            "maxLength": "50",
            "nullable": "NO"
        },
      ]
    }
  ],
  "detail": [
    {
      "title": "用户详情",
      "fields": [
        {
            "field": "_id",
            "label": "",
            "dataType": "varchar",
            "maxLength": "36",
            "nullable": "NO"
        },
        {
            "field": "account",
            "label": "用户账号",
            "dataType": "varchar",
            "maxLength": "50",
            "nullable": "NO"
        },
      ]
    }
  ],
  "fields": [
    {
      "field": "_id",
      "label": "",
      "dataType": "varchar",
      "maxLength": "36",
      "nullable": "NO"
    },
    {
      "field": "account",
      "label": "用户账号",
      "dataType": "varchar",
      "maxLength": "50",
      "nullable": "NO"
    }
  ]
}