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

deploy-kit-miluer

v0.0.5

Published

A nice deployment tool supports ftp and sftp. Used directly or with built-in plugins, such as webpack-plugin.

Downloads

5

Readme

Deploy-kit

A nice deployment tool supports ftp and sftp. Used directly or with built-in plugins, such as webpack-plugin.

image

yarn add deploy-kit --dev

Basic usage

const client = require('deploy-kit')

client.sftp({
  // sever account, address, port
  server: 'user:[email protected]:22',
  // deploy all files in the directory
  workspace: __dirname + '/dist',
  // ignore the matched files (glob pattern: https://github.com/isaacs/node-glob#glob-primer)
  // support array of glob pattern
  ignore: '**/*.map',
  // where the files are placed on the server
  deployTo: '/data1/htdocs/testapp',
  // you can specify different place for each file
  rules: [
    {
      test: /dist\/(.*)$/,
      // $1, $2... means the parenthesized substring matches
      // [$n] will be replaced with matched string
      dest: 'public/static/[$1]'
    },
    {
      test: /views\/((?:[^/]+\/)*?[^\/]+).html$/,
      dest: 'app/views/[$1].phtml'
    }
  ]
})
.exec()

or use ftp

client.ftp({
  ...
})
.exec()

options:

option | type | description -------- | ----- | --------- server | string | server info includes username, password, address, and port. e.g. user:[email protected]:22 workspace | string | deploy all files in the directory ignore | string or array of string | ignore the matched files (glob pattern: https://github.com/isaacs/node-glob#glob-primer) deployTo | string | where the files are placed. rules | array of rule | rule use to speicify different place for each file. each rule has a test and a dest property. hasContinual | boolean | has continual upload to server, after every file change build.

about rule:

{
  test: /dist\/(.*)$/,
  // $1, $2... means the parenthesized substring matches
  // [$n] will be replaced with matched string
  dest: 'public/static/[$1]'
}

test property is a RegExp pattern, use to match specified file with realpath of the file. dest property is the custom filename of matched file. you can extract any part from realpath as a part of dest by parenthesis.

Command Line Interface(CLI)

$ ./bin/deploy-sftp --server user:pwd@server_address:port --ignore **/*.map ./dist /data1/htdocs/testapp
$ ./bin/deploy-ftp ...

cli options:


  Usage: deploy-sftp [options] [workspace] [deployTo]


  Options:

    -V, --version           output the version number
    -c, --config <path>     use configuration from this file
    -s, --server <address>  server account, address. (e.g. user:pwd@address:port)
    -i, --ignore <pattern>  ignore the matched files
    -h, --help              output usage information

  Examples:

    // use configuration from a file
    $ deploy-sftp --config deploy.js
    // deploy files in ./dist to /data1/htdocs/testapp on 10.13.1.2
    $ deploy-sftp -s user:[email protected]:22 --i *.map ./dist /data1/htdocs/testapp

  version: 3.1.0

using config file

You can use configuration file instead of cli args. Just create a deploy.js file in the root directory of your project and exports your configuration like this:

module.exports = {
  server: '',
  workspace: '',
  ignore: '',
  deployTo: '',
  rules: []
}

Runing directly without any arg.

$ ./bin/deploy-sftp

If you prefer to place the configuration file in another place, you can use -c, --config <path> option like this:

$ ./bin/deploy-sftp --config ./config/your_conf.js

Used with plugins

each plugin can called like this:

new DeployPlugin([config])

config is optional. if you omitted the config, Deploy-kit will automatic load the deploy.js from the process.cwd().

  • sftp-webpack-plugin
const DeployPlugin = require('deploy-kit/plugins/sftp-webpack-plugin')

// webpack configuration
moudle.exports = {
  ...
  plugins: [
    new DeployPlugin()
  ]
}

todos:

  • sftp-gulp-plugin
  • ftp-gulp-plugin
  • sftp-fis-plugin

How to write a plugin

todo