@adam_baldwin/module-fs-changes 中文文档教程

发布于 9 年前 浏览 4 更新于 2 年前

Overview

在 docker 容器中执行 npm i module_name 并返回文件系统更改

示例用法

var Docker = require('dockerode');
var docker = new Docker({socketPath: '/var/run/docker.sock'});
var getChanges = require('./index.js');

getChanges(docker, 'node', 'helmet', function (err, changes) {
    console.log(changes);
});

返回的更改对象包括以下键,每个键都是添加、修改或删除的文件数组。

  • modified
  • added
  • deleted

Options

getChanges 需要以下选项

  • docker - connection to dockerode
  • image - name of the image that you want to run npm i module against
  • modulename - can be a modulename or module_name@version
  • callback - function with the signature (err, changes)

scripts

为了在我们自己之后进行清理,我们有一个 scripts/cleanup.sh 将删除挥之不去的图像。 可能有用也可能没用。

Overview

Executes npm i module_name in a docker container and returns file system changes

Example Usage

var Docker = require('dockerode');
var docker = new Docker({socketPath: '/var/run/docker.sock'});
var getChanges = require('./index.js');

getChanges(docker, 'node', 'helmet', function (err, changes) {
    console.log(changes);
});

Returned changes object includes the following keys, which are each an array of files that were added, modified or deleted.

  • modified
  • added
  • deleted

Options

getChanges requires the following options

  • docker - connection to dockerode
  • image - name of the image that you want to run npm i module against
  • modulename - can be a modulename or module_name@version
  • callback - function with the signature (err, changes)

scripts

To clean up after ourselves we have a scripts/cleanup.sh that will remove images that are lingering. May or may not be useful.

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文