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.
Now we can create artifact with JS object.
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.
The artifact created with
tartifacts.tartifactshould be Readable Stream with object chunks invinylformat.