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

gsg-client

v1.1.3

Published

这个是固守的脚手架命令工具

Downloads

17

Readme

项目介绍

此项目乃固守前端脚手架命令工具,脚手架地址

目录

安装

npm install gsg-client@latest -g

使用

说明

命令参数格式:
[xxx]  // 可选参数
<xxx> // 必填参数

基础

gsg -h // 查看帮助
gsg -v // 查看版本

查看脚手架列表

gsg l

构建项目

gsg i [脚手架名称,默认 gsg-scaffold]

快速合并推送分支

gsg push <branch> [options]  // git 快捷操作
  branch: 分支名称 只支持 'test,release,master' 
  Options:
    -m, --msg <msg>  commit 信息 (default: "update") 
    -h, --help       output usage information

例如:gsg push test -m 'xxx'  // -m可选 提交当前分支然后合并到test,然后push
例如:gsg push release -m 'xxx'  // -m可选 提交当前分支然后合并到release,然后push,注:如果release上有未发布正式的版本,则会提示
例如:gsg push master -m 'fixbug'   // -m必填 以--squash的方式合并origin/release 到master,然后push

部署项目

gsg  d [env] [options]
  env: 环境名称,详见配置文件说明,默认:default
  Options:
    -c, --config <config>  配置文件相对路径 (default: "./deploy.config.js")
    -h, --help             output usage information

例如:gsg d   // 部署default环境
例如:gsg d test   // 部署test环境
例如:gsg d -c './config/deploy.config.js'   // 使用./config/deploy.config.js配置部署efault环境

部署配置文件说明 ./deploy.config.js

// config 的属性 defalt,test,release,prod 作为 gsg d 命令的 env 参数,读取对应的配置

const path = require('path');

const config = {
  test: {
    host: '10.10.100.2', // 服务器地址
    user: 'root', // 用户
    password: 'G3Sde1d2', // 密码
    remotePath: '/home/tomcat/node/demo-admin', // 服务器文件目录
    pm2App: 'demo-admin', // pm2本项目的 app名字
  },
  release: {
    host: '10.10.100.113',
    user: 'tomcat',
    password: '12354@qwsf',
    remotePath: '/data/demo-admin',
    pm2App: 'demo-admin',
  },
  prod: {}, //没有host配置则不传远端,仅本地构建打包
};
Object.keys(config).forEach((env) => {
  const baseCofig = {
    zipName: `${path.basename(process.cwd())}-${env}.zip`, // zip 压缩后的临时文件名
    files: ['app', 'client', 'package.json'], // 需要压缩的文件夹和文件
    pm2Cmd: '/usr/local/node/bin/pm2', // 服务器pm2命令位置
    build: 'build', // 构建命令
  };
  config[env] = { ...baseCofig, ...config[env] };
});
config.default = config.test; // 默认发布到test环境
module.exports = config;

运行mock服务

gsg mock [options]
  Options:
    -c, --config <config>  :配置文件相对路径 (default: "./mock.config.js")
    -h, --help             output usage information

例如:gsg mock // 启动mock服务

mock 配置文件说明 ./mock.config.js

module.exports = {
  db: './mock', // mock数据位置 mock数据格式详见下面说明
  port: 3000, // mock服务端口
  prefix: '/api', // mock接口前缀,包含这个前缀的才会作为mock接口
};

mock 数据说明 ./mock/a/b/c.js

// 创建路径建议配合 mk 命令: gsg mk mock/a/b/c.js // 以上 mock 配置接口访问 127.0.0.1:3000/api/a/b/c

例1:
module.exports = function fn() {
  return {
    "code": 1,
    "message": null,
    "data": [ ]
  };
};
例2:
module.exports = function fn(req, res) {
  // req 和 res 的其他用法参考node http模块
  console.log('😈😈😈😈😈: fn -> req', req.query); // url 参数对象
  console.log('😈😈😈😈😈: fn -> req', req.pathname); // url pathname
  const data = {
    "code": 1,
    "message": null,
    "data": [
      {
        "name": "北京市",
        "id": "11",
      }
    ]
  }
  res.end(JSON.stringify(data));
};

mock 数据说明 ./mock/a/b/c.json

// 以上 mock 配置接口访问 127.0.0.1:3000/api/a/b/c

{
  "code": 1,
  "message": null,
  "data": [
    {
      "upId": "123",
      "name": "北京市",
      "id": "11",
      "kindId": "1"
    }
  ]
}

创建文件或者目录

gsg mk <name>
  name: (必填)文件或者目录路径

例如:gsg mk a/b 在当前目录下创建a/b 目录
例如:gsg mk a/b/c.js 在当前目录下创建a/b/c.js 文件

解析excel

gsg excel [options]
  Options:
    -c, --config <config>  :配置文件相对路径 (default: "./excel.config.js")
    -h, --help             output usage information

例如:gsg excel // 解析excel

mock 配置文件说明 ./excel.config.js

module.exports = {
  entry: './测试.xlsx', // [必填] excel文件
  output: './测试.json', // [可选] 默认为excel同名的json文件
  transform: (data) => { // [可选] 读出来的数据进行转换
    return data;
  },
};

通过jenkins发布版本

gsg publish <branch>
  branch:(必填)git分支[环境]名称(test,release)

例如:gsg publish test // 发布测试
例如:gsg publish release // 发布预生产