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

upload-release-tools

v1.0.3

Published

主要用于封装了一些与 Docker 镜像打包、推送和远程服务器上传相关的操作。

Downloads

4

Readme

介绍

主要用于封装了一些与 Docker 镜像打包、推送和远程服务器上传相关的操作。

  1. loginToDocker(host, port) 函数用于登录到远程 Docker 仓库。它首先检查 Docker 服务是否启动,然后提示用户输入镜像仓库的用户名和密码,并使用 docker login 命令登录到远程镜像仓库。

  2. execCommand(commands, config) 函数用于执行一组命令。它接受一个命令数组和一个配置对象作为参数,循环执行每个命令。如果命令中包含 Docker 相关的操作并且 Docker 尚未登录,则会先调用 loginToDocker 函数进行登录。

  3. execBeforeCheck(configuration) 函数用于在上传到服务器之前进行一些检查,比如校验 Node.js 版本是否符合约定的版本要求。

  4. uploadTools({ config, commands }) 函数是一个异步函数,它首先调用 execBeforeCheck 函数进行检查,然后调用 execCommand 函数执行命令。

这个封装的目的是将 Docker 相关的操作和上传到远程服务器的操作进行封装,使得代码更加模块化和可复用。通过调用 uploadTools 函数并传入配置和命令,可以方便地完成 Docker 镜像的打包、推送和远程服务器上传操作。

代码示例

// 在上面的介绍中使用此包需要按照如下方式传入对应的所需参数;
const uploadTools = require("upload-release-tools");
const config = {
  host: "", // 必传项  服务器 IP 例:127.0.0.1
  port: "", // 必传项  远程服务器端口 例:8888
  nodeVersion: "", // 选传项 项目依赖的 nodeVersion 例:14
};

const commands = ["npm run build"]; // 一些执行命令放在这里

uploadTools({ config, commands });

使用方式

npm i upload-release-tools

在 packeage.json 中配置

"scripts": {
"release": "node ./bin/release.js ",
}

在/bin/release.js 中添加:

const uploadTools = require("upload-release-tools");
const config = {
  host: "127.0.0.1",
  port: "8000",
  nodeVersion: "16",
};
const commands = ["npm run build", "docker build ..."];
uploadTools({ config, commands });

运行命令:

yarn release

git 代码地址:https://gitee.com/chen_yan1/release-tools