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

@ddn/capistrano

v0.2.5

Published

capistranojs, deploy tools like capistrano.rb

Downloads

81

Readme

Capistranojs powered by node.js

Developing...

参考 ruby 的 capistrano, 开发中。。。

Feathers 特点

。。。

Install 安装

$ yarn global add @ddn/capistrano

Use 使用

部署分为两个步骤:

1. 安装本地

$ deploy init

在本地工程目录,生成如下配置文件(建议将下面的deploy文件夹,特别是其中的pem文件夹及其文件,放在.gitignore里)

project
    |___ config 没有就建立;
        |___deploy 没有就建立
                |____ config.js 配置文件
                |____ pem 服务器登录私钥
       

2. 部署任务

$ deploy prod

该命令将初始化服务端环境:

project
    |___current 当前工作目录,通过软连接指向 versions最新版本目录;
    |___versions 各个旧的版本工作目录,方便回滚
    |___shared 数据持久化目录,方便备份和数据安全
            |____ config.* 各种配置文件,可能包含敏感信息
            |____ tmp 缓存文件
            |____ logs 日志文件
            |____ database 数据库文件

执行结果如下:

$ deploy prod

✈ Running prod:prod
✈ Connecting to '47.*.*.21'
[ 'prod' ]
✈ Executing remote task on 47.*.*.21
47.*.*.21 Remote start...
47.*.*.21 $ mkdir -p /var/www/datm-server
47.*.*.21 ● ok
47.*.*.21 $ cd /var/www/datm-server && mkdir -p shareded
47.*.*.21 ● ok
47.*.*.21 $ cd /var/www/datm-server && mkdir -p releases
47.*.*.21 ● ok
47.*.*.21 $ cd /var/www/datm-server && mkdir -p tmp
47.*.*.21 ● ok
47.*.*.21 $ cd /var/www/datm-server && mkdir -p repo
47.*.*.21 ● ok
✈ Remote task on 47.*.*.21 finished after 3.31 s
✈ Executing local task
localhost 上传配置文件
localhost $ rsync --files-from /var/folders/2b/8f4h42vj46g0qnm89v08p9kw0000gn/T/2217801c90c0121dc0cc25d96c6ff6cb -az --rsh="ssh -p22 -i /Users/imfly/Documents/projects/DDN/datm-server/config/deploy/pem/datm.ddn.link.pem" ./ root@47.*.*.21:/var/www/datm-server/shareded
localhost ● ok
✈ Local task finished after 1.5 s
✈ Executing remote task on 47.*.*.21
47.*.*.21 git clone or pull the code...
47.*.*.21 $ cd /var/www/datm-server/repo && if [ ! -f /var/www/datm-server/repo/package.json ]; then git clone [email protected]:datm/datm-server.git . ; else git pull; fi
47.*.*.21 > Already up-to-date.
47.*.*.21 > 
47.*.*.21 ● ok
47.*.*.21 git clone or pull success!
47.*.*.21 $ cd /var/www/datm-server && cp -r repo releases/202002010158
47.*.*.21 ● ok
47.*.*.21 $ cd /var/www/datm-server && echo 202002010158 >> /var/www/datm-server/revisions.log;
47.*.*.21 ● ok
47.*.*.21 $ cd /var/www/datm-server && count=$(wc -l < /var/www/datm-server/revisions.log); if [ $count -gt 5 ]; then sed -i '1d' /var/www/datm-server/revisions.log; fi
47.*.*.21 ● ok
47.*.*.21 $ cd /var/www/datm-server && rm -f current && ln -s releases/202002010158 current
47.*.*.21 ● ok
47.*.*.21 yarn stopping...
47.*.*.21 link shared folders and files...
47.*.*.21 $ cd /var/www/datm-server/current && rm -f config/config.prod.js
47.*.*.21 ● ok
47.*.*.21 $ cd /var/www/datm-server/current && ln -s shareded/config.prod.js config/config.prod.js
47.*.*.21 ● ok
47.*.*.21 yarn install...
47.*.*.21 $ cd /var/www/datm-server/current && yarn
47.*.*.21 > yarn install v1.19.1
47.*.*.21 > [1/5] Validating package.json...
47.*.*.21 > [2/5] Resolving packages...
47.*.*.21 > [3/5] Fetching packages...
47.*.*.21 > info [email protected]: The platform "linux" is incompatible with this module.
47.*.*.21 > info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
47.*.*.21 > [4/5] Linking dependencies...
47.*.*.21 > warning "egg-oss > ali-oss > [email protected]" has unmet peer dependency "co@4".
47.*.*.21 > warning "egg-bin > [email protected]" has incorrect peer dependency "mocha@>=1.18 <6".
47.*.*.21 > warning "egg-bin > [email protected]" has unmet peer dependency "typescript@>= 2.4.2".
47.*.*.21 > warning "eslint-config-egg > @typescript-eslint/eslint-plugin > [email protected]" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
47.*.*.21 > [5/5] Building fresh packages...
47.*.*.21 > Done in 26.52s.
47.*.*.21 > 
47.*.*.21 ● ok
47.*.*.21 yarn migrate...
47.*.*.21 yarn stating...
47.*.*.21 Done, Success!
✈ Remote task on 47.*.*.21 finished after 33 s
✈ Flightplan finished after 38 s

FAQ

  1. 首先保证本地可以登录远程服务器;
$ ssh -i path-to-pem root@your-id
  1. 确保远程可以正常 fork 代码
$ git clone repo_url 

如果无法克隆,按照下列步骤操作

$ ssh -T [email protected]
# [email protected]: Permission denied (publickey).

产生 ssh-key

$ ssh-keygen -t rsa -b 4096 -C '[email protected]'
$ cat ~/.ssh/id_rsa.pub

将产生的 公钥 拷贝到 版本库 -> deploy key 里

  1. bash: yarn: command not found 错误

该错误是使用 nvm 安装的原因,只要下面两步

$ npm config set prefix /usr/local
$ npm i -g yarn
  1. /usr/bin/env: ‘node’: No such file or directory

这也是 nvm 安装,导致没有命令行交互时出现的错误

$ which node
$ ln -s /root/.nvm/versions/node/v10.19.0/bin/node /usr/bin

LICENSE

MIT

Author: imfly [email protected]