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

nice-upload

v0.4.1

Published

静态资源上传工具--配套的服务端代码 [nice-static-server](https://github.com/liujinyu1029/nice-static-server.git)

Downloads

18

Readme

nice-upload -- 静态资源上传工具

nice-upload 上传spa打包后的dist文件到静态服务器.推荐全局安装.然后可以使用nice-upload命令

配套后台服务端程序 nice-static-server

PS:两种上传模式:

  1. 【直接上传】push命令 :直接上传整个文件夹or某个文件,但要先通过url命令设置‘全局’上传路径;
  2. 【通过配置文件上传】conf命令:依据配置文件".uploadrc.js",实现更复杂的上传规则,配置文件可以用init命令初始化。(注:当.uploadrc.js中配置了上传路径属性uploadUrl时,会优先使用该路径,如果没有配置,则会用‘全局’上传路径,如果没有‘全局’路径,则要通过url配置)

Install

$ npm i -g nice-upload

help

$ nice-upload -h

静态资源上传工具

Options:
  -V,  --version        output the version number
  -h,  --help           output usage information

Commands:
  [default]             查看nice-upload基础信息与全局配置
  url    [uploadUrl]    查看[修改]上传路径
  push   [file/folder]  上传[单个文件/文件夹]
  init                  初始化上传配置文件.uploadrc.js
  conf                  按照配置文件.uploadrc.js规则 进行上传操作

Usage

$ nice-upload  // 默认命令 查看nice-upload基础信息
    nice-upload @0.2.1
    静态资源上传工具--配套的服务端代码 [nice-static-server](https://github.com/liujinyu1029/nice-static-server.git)
    -----------------------------------------------------
    [warning] 尚未配置上传路径, 请执行 `nice-upload url [uploadUrl]` 进行添加

$ nice-upload url http://118.24.107.17:9001/upload  // 修改全局配置 上传地址
    [change] 上传地址修改为: http://118.24.107.17:9001/upload

$ nice-upload url // 查看 全局配置 上传地址
    [已配][上传路径] http://118.24.107.173:9001/upload

Example

1、使用push命令直接上传(单个文件 或 整个文件夹) PS:push命令,走的是全局配置的上传地址

$ nice-upload push dist/static/img/404.a57b6f3.png
    [success] http://nice.server.com/resources/dist/static/img/404.a57b6f3.png

$ nice-upload push dist
    [success] http://nice.server.com/resources/dist/static/fonts/element-icons.6f0a763.ttf
    [success] http://nice.server.com/resources/dist/static/js/0.1745a4856fe5f21285eb.js
    [success] http://nice.server.com/resources/dist/static/css/app.0f9fe41a0c4ad7cb0260.css
    ...

2、使用conf命令通过配置文件上传 conf命令只依赖于init出的.uploadrc.js配置文件,会忽略全局配置的上传路径

$ nice-upload init 
    [init] 成功初始化配置文件.uploadrc.js

$ vim .uploadrc.js 

    module.exports = {
      uploadUrl: 'http://nice.server.com/upload',
      uploadList: [{
        files: 'dist/static/', // 上传整个文件夹
        prefix: 'nice'  // 修改存储路径
      }]
    }

$ nice-upload conf  // [等效于 `nice-upload conf` 命令]
    [success] http://nice.server.com/resources/nice/fonts/element-icons.6f0a763.ttf
    [success] http://nice.server.com/resources/nice/js/0.1745a4856fe5f21285eb.js
    [success] http://nice.server.com/resources/nice/css/app.0f9fe41a0c4ad7cb0260.css
    ...

3、通过配置文件实现多种上传方式

module.exports = {
  // 上传地址 [必须参数] 
  uploadUrl: 'http://localhost:9001/uploadResources',  

  // 上传文件列表
  uploadList: [{
    files: 'dist/js/a.js' // 上传独立文件
  },{
    files: 'dist/js/a.js', // 上传独立文件
    prefix: 'myjs/' // prefix非必传,传的话会替换在服务器端的保存路径
  },{
    files: 'dist/static', // 上传整个文件夹
    prefix: 'mystatic' 
  },{
    files: 'dist/js/*.map', // 支持glob规则,选择性只上传.map文件
    prefix: 'mydist/js'
  }]
}

TODO

  • None

LICENSE

MIT