@yukiakai/artifact
v1.0.2
Published
Build deployment artifacts from project files.
Maintainers
Readme
@yukiakai/artifact
Build deployment artifacts from project files.
@yukiakai/artifact provides a simple and reusable way to assemble a deployment artifact by copying selected files and directories into a clean output directory.
It is designed for release pipelines where source repositories and deployment repositories are kept separate.
Features
- Clean output directory before building
- Copy files and directories
- Preserve directory structure
- Remap source paths to different output paths
- Validate missing source files
- Lightweight with zero runtime dependencies
Installation
npm install @yukiakai/artifactExample
import { ArtifactBuilder } from '@yukiakai/artifact';
const builder = new ArtifactBuilder({
rootDir: process.cwd(),
outputDir: './artifact',
});
builder.build({
assets: [
{
source: 'dist',
target: 'dist',
},
{
source: 'package.json',
target: 'package.json',
},
{
source: 'README.md',
target: 'README.md',
},
{
source: 'workspace/release/publish.yml',
target: '.github/workflows/release.yml',
},
],
});API
ArtifactBuilder
new ArtifactBuilder({
rootDir,
outputDir,
});build()
builder.build({
assets,
});Each build:
- Cleans the output directory.
- Validates all asset sources.
- Copies every asset into the output directory.
Asset
interface ArtifactAsset {
source: string;
target: string;
}| Property | Description |
| -------- | ------------------------------------------------- |
| source | File or directory relative to the project root |
| target | Destination path relative to the output directory |
Use Cases
- npm package publishing
- GitHub Actions release workflows
- Artifact repositories
- CI/CD pipelines
- Deployment packaging
License
MIT Yuki Akai
