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

@deepjs/cdn-cli

v2.0.1

Published

上传资源或部署站点到 cdn

Downloads

6

Readme

cdn-cli 工具

使用

npx pnpm add --global
cdn deploy [source] [target]

功能列表

配置从环境变量里取

  • update 升级 cli 版本
  • deploy [--site] [source] [target] 将选中目录中的文件按当前项目结构上传到目标文件夹
    • 限制上传文件到根目录(但不限制上传目录到根目录)
    • --site 为部署站点模式
    • --preview 仅做上传预览
    • --force 强制覆盖上传(功能关闭)
    • [ ] --headers 设置响应头(需要规则校验, 错误的格式不应该被提交)
      • cache-control: max-age=<seconds> max-age=31536000
      • cache-control: no-cache
  • 配置应用用 STS, 未支持时, 先使用 ~/.cdn.config.js 或环境变量支持
    • init 初始化配置文件 (本地使用)
  • 误传检测
    • 不能再 package.json 文件夹下直接默认操作
  • [ ] refresh <target_path> 刷新 cdn
    • 可刷新 dir 或 file 路径, 支持多个
  • 安全管控
    • 从安全方面考虑, 不应该使用 Ak/Sk 配置, 而应该使用 STS(Security Token Service,临时授权访问) 来操作
    • https://help.aliyun.com/document_detail/28801.html
    • 这里可以尝试通过 serverless 来提供 STS 服务
    • --token <token_url> 通过 token 上传 oss
  • 接入发布系统
    • 可使用环境变量配置 Ak/Sk 等
  • 关于浏览

配置

  • 可配置多个上传空间
  • 可控制同时上传多个空间

访问域名和空间无强绑定关系

常见问题

如果你想禁用 pnpm 管理包, 可以添加以下 script

"scripts": {
  "preinstall": "npx only-allow pnpm",
}

如果 node 版本比较低(node@version < 14), 则不能使用 @deepjs/cdn-cli@2

此时需要使用 commonjs 版本 @deepjs/cdn-cli@1

参考:

  • 前端CLI脚手架思路解析
  • https://www.npmjs.com/package/cdn-cli
  • https://www.npmjs.com/package/webpack-alioss-plugin
  • https://github.com/aikefang/qiniu-tool