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

ginv

v1.0.0-alpha.61

Published

ginv backend framework

Downloads

113

Readme

ginv

ginv backend

Quick Start

npm install ginv

Import ginv in man.ts

import { createApp } from 'vue'
import { createPinia } from 'pinia'
import { createRouter, createWebHistory } from 'vue-router'
import ArcoVue, { Message } from '@arco-design/web-vue'
import ArcoVueIcon from '@arco-design/web-vue/es/icon'
import Ginv, { getRoutes, App, type Config } from 'ginv'

import '@arco-design/web-vue/dist/arco.css'
import 'ginv/index.css'
import iconfont from './assets/font/iconfont.js?url'
import { auth, logout } from '@/api/authorization/auth'
import { getGlobalOptions } from '@/api/authorization/auth'

export const ossConfig = {
  default: {
    bucket: 'default',
    domain: '//assets.ginv.com/'
  }
}

const config: Config = {
  systemCode: 'ginv',
  systemName: 'Ginv管理后台',
  iconfont,
  gallery: false
  authFn: auth
  logoutFn: logout
  // globalFn: getGlobalOptions
}

const router = createRouter({
  history: createWebHistory(),
  routes: getRoutes()
})

const pinia = createPinia()
const app = createApp(App)

// eslint-disable-next-line no-underscore-dangle
// eslint-disable-next-line no-underscore-dangle
Message._context = app._context
const ginv = new Ginv(app, pinia, config)
ginv.bootstrap(router).use(router).use(pinia).use(ArcoVue).use(ArcoVueIcon).mount('#app')

support route params

async import rules will remove the route params.

example:

path: /user/:userId
components file: views/user.vue

path: /user/:userId/info
components file: views/user/info.vue

path: /book/:bookId/:lang
components file: views/book.vue

authFn

example

/**
 * @description 为用户设置多个用户组
 */
export function auth() {
  const user: User = {
    name: '超管',
    avatar: '',
    department: '总经办'
  }
  const theme: Theme = {
    layout: 'default',
    primaryColor: 'default'
  }

  /**
   * menu是路由的name, 值是路由所在页面的按钮的权限值
   */
  const permissions: { [menu: string]: number } = {
    app: 2,
    service: 8,
    erd: 0,
    api: 4,
    http: 0,
    apiHttp: 0,
    grpc: 0,
    apiGrpc: 0,
  }

  const routers: Menu[] = [
    {
      n: 'test', // 路由命名
      p: '/test', // 路由路径
      m: {
        t: '测试',
        i: 'icon-app',
        s: 1,
        v: 1
      }, // 路由meta
      c: [] // 路由children
    },
    {
      n: 'app', // 路由命名
      p: '/app', // 路由路径
      m: {
        t: '应用管理',
        i: 'icon-app',
        s: 1,
        v: 1
      }, // 路由meta
      c: [] // 路由children
    },
    {
      n: 'service', // 路由命名
      p: '/service', // 路由路径
      m: {
        t: '微服务',
        i: 'icon-service',
        s: 1,
        v: 1
      }, // 路由meta
      c: [] // 路由children
    },
    {
      n: 'erd', // 路由命名
      p: '/erd', // 路由路径
      m: {
        t: '数据模型',
        i: 'icon-erd',
        s: 1,
        v: 1
      }, // 路由meta
      c: [] // 路由children
    },
    {
      n: 'api', // 路由命名
      p: '/api', // 路由路径
      m: {
        t: '接口管理',
        i: 'icon-api',
        s: 0,
        v: 1
      }, // 路由meta
      c: [
        {
          n: 'http', // 路由命名
          p: '/api/http', // 路由路径
          m: {
            t: 'HTTP服务接口',
            i: 'icon-http',
            s: 0,
            v: 1
          }, // 路由meta
          c: [
            {
              n: 'apiHttp', // 路由命名
              p: '/api/http/:apiId', // 路由路径
              m: {
                t: '接口详情',
                i: '',
                s: 0,
                v: 0
              }, // 路由meta
              c: [] // 路由children
            }
          ] // 路由children
        },
        {
          n: 'grpc', // 路由命名
          p: '/api/grpc', // 路由路径
          m: {
            t: 'gRPC网关接口',
            i: 'icon-grpc',
            s: 0,
            v: 1
          }, // 路由meta
          c: [
            {
              n: 'apiGrpc', // 路由命名
              p: '/api/grpc/:apiId', // 路由路径
              m: {
                t: '接口详情',
                i: '',
                s: 0,
                v: 0
              }, // 路由meta
              c: [] // 路由children
            }
          ] // 路由children
        }
      ] // 路由children
    },
  ]

  return Promise.resolve({ user, theme, menus: routers, permissions })
  // return request<types.SessionReply>(`/authorization/auth/session`, req)
}

when visit `/test`, we'll get 403 error responese
when visit `/test1`, we'll get 404 error responese
when visit `/app`, we'll get success response

globalFn

export function getGlobalOptions() {
  const globalOptions = [
    { label: '默认', value: 1 },
    { label: '自定义1', value: 2 }
  ]

  const globalValue = 1

  return Promise.resolve({ globalOptions, globalValue })
  // return request<types.globalReply>(`/serviceName/rpcName/methodName`, req)
}

now you can get a global select components on siderbar, and it's default value is: 1