Skip to content

Transform artifacts #79

@blond

Description

@blond

Now we can create artifact with JS object.

const tartifacts = require('tartifacts');

const artifacts = [
    {
        dest: 'artifact.tar.gz',
        includes: 'sources/**',
        excludes: 'sources/exlib/**'
        tar: true,
        gzip: { level: 1 }
    }
];

tartifacts(artifact)
    .then(() => console.log('Copying or packaging completed!'))
    .catch(err => console.log(err));

In the artifact will be added found files.

But we may need change files in artifact.

For example you may need add prefix to all files, or add files to artifact.

const tartifacts = require('tartifacts');
const rename = require('gulp-rename');
const add = require('gulp-add');

const artifact = tartifacts.tartifact({
    dest: 'artifact.tar.gz',
    includes: 'sources/**',
    excludes: 'sources/exlib/**'
    tar: true,
    gzip: { level: 1 }
})
.pipe(rename(path => { path.dirname += "/path/to/prefix"; }))
.pipe(add('filename1.txt', 'First file contents'));

tartifacts(artifact)
    .then(() => console.log('Copying or packaging completed!'))
    .catch(err => console.log(err));

The artifact created with tartifacts.tartifact should be Readable Stream with object chunks in vinyl format.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions