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

@boyuai/static-deploy-tool

v1.3.0

Published

静态文件部署工具,一条命令自动部署文件夹或大文件到阿里云OSS

Downloads

2

Readme

static-deploy-tool

静态文件部署工具,一条命令自动部署文件夹或大文件到阿里云OSS

安装

全局安装

npm i -g static-deploy-tool

也可以直接使用npx,无需安装

常用命令

同步文件夹到远程

sync <local> <remote>

同步本地build文件夹到远程Bucket: my-bucket下的production/home文件夹

static-deploy-tool sync build production/home -k LTAI4Fnxxxxx -s 1wWQo9JQpSxxxx -b my-bucket

该命令会首先逐个上传本地文件到远程目录,并根据md5比对跳过已有文件。之后删除远程存在但本地没有的文件。

如果包含index.htmlindex.htm文件,则这类文件会在最后被上传,确保所以资源上传完毕后再更新index

上传大文件到远程

put <local> <remote>

使用分片上传的方式,将本地build/code.tar.gz文件上传到远程

static-deploy-tool put build/code.tar.gz production/code.tar.gz -k LTAI4Fnxxxxx -s 1wWQo9JQpSxxxx -b my-bucket

将会展示上传进度百分比,并且对于错误的分片自动重试

复制远程文件

copy <source> <dest>

复制远程文件platform/sandbox/latest.tar.gzplatform/production/latest.tar.gz

static-deploy-tool copy platform/sandbox/latest.tar.gz platform/production/latest.tar.gz -k LTAI4Fnxxxxx -s 1wWQo9JQpSxxxx -b my-bucket

配置

$ node cli --help
Options:
  -V, --version              output the version number
  -k, --ak [ak]              Access Key Id
  -s, --sk [sk]              Secret Access Key
  -r, --region [region]      Region
  -b, --bucket [bucket]      Bucket
  -e, --endpoint [endpoint]  Optional, will override region setting
  -h, --help                 output usage information

环境变量

除了用参数,也可以用环境变量

OSS_AK 等同于 --ak
OSS_SK 等同于 --sk
OSS_REGION 等同于 --region
OSS_BUCKET 等同于 --bucket
OSS_ENDPOINT 等同于 --endpoint

阿里云内网加速

指定endpoint参数为内网地址

static-deploy-tool sync build production/home -k LTAI4Fnxxxxx -s 1wWQo9JQpSxxxx -b my-bucket -e oss-cn-shanghai-internal.aliyuncs.com

全球加速

用于GitHub Actions等国外服务传文件回国内有奇效,指定endpoint为oss-accelerate.aliyuncs.com

需要开通这个Bucket的全球加速功能

static-deploy-tool sync build production/home -k LTAI4Fnxxxxx -s 1wWQo9JQpSxxxx -b my-bucket -e oss-accelerate.aliyuncs.com

使用 Github Action

- uses: wangsijie/static-deploy-tool@v1
  with:
    oss-ak: ${{ secrets.OSS_AK }}
    oss-sk: ${{ secrets.OSS_SK }}
    oss-region: ${{ secrets.OSS_REGION }}
    oss-bucket: ${{ secrets.OSS_BUCKET }}
    oss-endpoint: oss-accelerate.aliyuncs.com
    local-path: __tests__/files
    remote-path: static-deploy-tool-test/action-sync