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

yss-toolchain

v0.1.10

Published

yushuisheng toolchain

Downloads

26

Readme

yss-toolchain - 个人工具集

概览

  1. 安装

  2. 模块

    1. 日志模块
    2. 上传模块

安装

npm install --save-dev yss-toolchain

模块

日志模块

单/多页面,多环境环境打包
需要先在 package.json 里添加初始版本号

y-cli build-log

| 参数 | 是否必填 | 名称 | 类型 | 默认值 | 说明 | | ----------------------- | ----- | ---- | ------ | --------------- | ----- | | --branch(-b) | false | 分支 | array | ['master'] | - | | --author(-a) | false | 作者 | array | ['Tom'] | - | | --environment(-e) | false | 环境 | string | 'development' | - | | --environmentSuffix(-s) | false | 分支后缀 | string | 'dev' | 和 environment 对应 | | --project(-p) | false | 多页面 | string | 'null' | 多页面使用,自定义多页面名称,不是项目项目 |

初始版本号

  • 单页面 package.json
{
  "version": "1.0.0",
  "version_[environmentSuffix]": "1.0.0",
  "version_[environmentSuffix]": "1.0.0"
}
  • 多页面 package.json
{
  "version": "1.0.0",
  "[project]_version_[environmentSuffix]": "1.0.0",
  "[project]_version_[environmentSuffix]": "1.0.0",
  "[project]_version_[environmentSuffix]": "1.0.0",
  "[project]_version_[environmentSuffix]": "1.0.0"
}
  • 示例

单页面

y-cli build-log -b dev -e development -s dev

多页面

y-cli build-log -b dev -e development -s dev -p a

上传模块

自动上传并更新服务端包(node-ssh)
需要先通过 cross-env 设置配置文件路径 UPLOAD_CONFIG_PATH(相对路径或绝对路径)
服务端需要在目标目录下添加 unzip.sh 文件,用于解压压缩包

cross-env UPLOAD_CONFIG_PATH=test\\upload.prod.json y-cli upload

y-cli upload

| 参数 | 是否必填 | 名称 | 类型 | 默认值 | 说明 | | ----------------------- | ----- | ---- | ------ | --------------- | ----- | | --environment(-e) | false | 环境 | string | 'development' | 'development' 或 'production' 二选一 | --directory(-d) | false | 打包目录 | string | 'dist' | 需要上传的文件夹名称 | | --update(-u) | false | 更新 | string | 'false' | 是否自动更新 |

UPLOAD_CONFIG_PATH

JSON key

| 参数 | 是否必填 | 名称 | 类型 | 默认值 | 说明 | | ----------------------- | ----- | ---- | ------ | --------------- | ----- | | projectName | true | 项目名称 | string | - | package.json 的 name | MultiPageBuildName | true | 多页面名称 | string | - | 自定义多页面名称或和打包目录文件名称相同

JSON value

| 参数 | 是否必填 | 名称 | 类型 | 默认值 | 说明 | | ----------------------- | ----- | ---- | ------ | --------------- | ----- | | host | true | IP | string | - | 插件 node-ssh 连接参数 | pathUrl | true | 路径 | string | - | 插件 node-ssh 连接参数
| username | true | 用户名 | string | - | 插件 node-ssh 连接参数 | password | true | 密码 | string | - | 插件 node-ssh 连接参数 | privateKeyPath | true | 文件密码 | string | - | 插件 node-ssh 连接参数,与 password 二选一 | port | true | 端口 | number | - | 插件 node-ssh 连接参数 | environment | true | 环境 | string | 'development' | 'development' 或 'production' 二选一 | distName | true | 打包目录 | string | 'dist' | 需要上传并压缩的文件夹名称 | | isMultiPage | false | 多页面 | boolean | undefined | 一个项目下,多页面使用 |

  • UPLOAD_CONFIG_PATH 配置文件示例
{
 "projectName": {
    "host": "111.00.00.111",
    "pathUrl": "/file",
    "username": "root",
    "password": "123456",
    "port": 22,
    "environment": "production",
    "distName": "dist"
  },
  "projectName": {
    "isMultiPage": true,
    "MultiPageBuildName": {
      "host": "111.00.00.111",
      "pathUrl": "/file/test1",
      "username": "root",
      "password": "MTIzNDU2",
      "port": 22,
      "environment": "production",
      "distName": "test-1"
    },
    "MultiPageBuildName": {
      "host": "111.00.00.111",
      "pathUrl": "/file/test2",
      "username": "root",
      "password": "MTIzNDU2",
      "port": 22,
      "environment": "production",
      "distName": "test-2"
    }
  }
}
  • 示例
cross-env UPLOAD_CONFIG_PATH=..\\upload.dev.json y-cli upload -e production -d dist -u true
  • unzip.sh 示例
#!/bin/bash

# 当前脚本的文件名
script_name=$(basename "$0")

# 不可删除的文件夹名称数组,按需添加多个文件夹名称
protected_folders=("dist.zip")

# 构建 find 命令的排除条件
exclude_conditions=(! -name "$script_name")
for folder in "${protected_folders[@]}"; do
  exclude_conditions+=(! -name "$folder")
done

# 删除当前目录下的所有文件和文件夹,除了这个脚本本身和不可删除的文件夹
find . -mindepth 1 -maxdepth 1 "${exclude_conditions[@]}" -exec rm -rf {} +

# 解压 dist.zip 文件,并覆盖现有文件
unzip -o dist.zip