{"id":18682827,"url":"https://github.com/yandex/tartifacts","last_synced_at":"2025-04-12T04:21:54.408Z","repository":{"id":66917708,"uuid":"58732862","full_name":"yandex/tartifacts","owner":"yandex","description":":package: Create artifacts for your assemblies","archived":false,"fork":false,"pushed_at":"2020-07-16T07:23:38.000Z","size":234,"stargazers_count":20,"open_issues_count":10,"forks_count":9,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-25T23:51:21.782Z","etag":null,"topics":["artifacts","copy","glob","patterns","tar","tarball"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yandex.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-13T11:15:52.000Z","updated_at":"2024-01-03T17:38:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"e87e87b9-b56b-4d6e-a137-e835d1e20dcb","html_url":"https://github.com/yandex/tartifacts","commit_stats":null,"previous_names":["blond/tartifacts"],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yandex%2Ftartifacts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yandex%2Ftartifacts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yandex%2Ftartifacts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yandex%2Ftartifacts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yandex","download_url":"https://codeload.github.com/yandex/tartifacts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248514445,"owners_count":21116963,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["artifacts","copy","glob","patterns","tar","tarball"],"created_at":"2024-11-07T10:12:55.912Z","updated_at":"2025-04-12T04:21:54.379Z","avatar_url":"https://github.com/yandex.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"tartifacts\n==========\n\n[![NPM Status][npm-img]][npm]\n[![Travis Status][test-img]][travis]\n[![Windows Status][appveyor-img]][appveyor]\n[![Coverage Status][coverage-img]][coveralls]\n[![Dependency Status][david-img]][david]\n\n[npm]:          https://www.npmjs.org/package/tartifacts\n[npm-img]:      https://img.shields.io/npm/v/tartifacts.svg\n\n[travis]:       https://travis-ci.org/blond/tartifacts\n[test-img]:     https://img.shields.io/travis/blond/tartifacts/master.svg?label=tests\n\n[appveyor]:     https://ci.appveyor.com/project/blond/tartifacts\n[appveyor-img]: https://img.shields.io/appveyor/ci/blond/tartifacts/master.svg?label=windows\n\n[coveralls]:    https://coveralls.io/r/blond/tartifacts\n[coverage-img]: https://img.shields.io/coveralls/blond/tartifacts/master.svg\n\n[david]:        https://david-dm.org/blond/tartifacts\n[david-img]:    https://img.shields.io/david/blond/tartifacts/master.svg\n\n\nThe tool to create artifacts for your assemblies.\n\nCopy only the necessary files and pack them in `tar.gz` file.\n\nIt works much faster than removing unnecessary files and packing with command-line utility `tar`.\n\nFor example, **1 minute** vs **10 seconds** for project with 20 thousand files (80 Mb).\n\nInstall\n-------\n\n```\n$ npm install --save tartifacts\n```\n\nUsage\n-----\n\n```js\nconst writeArtifacts = require('tartifacts');\nconst artifacts = [\n    {\n        name: 'artifact.tar.gz',\n        patterns: ['sources/**', '!sources/exlib/**'],\n        tar: true,\n        gzip: { level: 9 }\n    },\n    {\n        name: 'artifact-dir',\n        includes: 'sources/**',\n        excludes: 'sources/exlib/**',\n        dotFiles: false // exclude dotfiles, override general settings\n    }\n];\n\nwriteArtifacts(artifacts, {\n    root: './path/to/my-project/', // files of artifacts will be searched from root by artifact patterns,\n                                   // for example: ./path/to/my-project/sources/**\n    destDir: './dest/',\n    dotFiles: true,    // include dotfiles\n    emptyFiles: true,  // include empty files\n    emptyDirs: true    // include empty directories\n})\n.then(() =\u003e console.log('Copying and packaging of artifacts completed!'))\n.catch(console.error);\n```\n\nor advanced one which is especially useful for `watch` mode\n\n```js\nconst Tartifacts = require('tartifacts').Tartifacts;\nconst tartifacts = new Tartifacts({\n    watch: true // files and directories will be added to the destination artifact\n                // in runtime as soon as they appear on the file system\n});\n\nprocess.on('SIGTERM', () =\u003e tartifacts.closeArtifacts());\n\ntartifacts.writeArtifacts({\n    name: 'artifact.tar.gz',\n    patterns: ['sources/**']\n})\n.then(() =\u003e {\n    // will be resolved only after \"tartifacts.closeArtifacts()\"\" call on \"SIGTERM\" event\n    // and all artifacts are ready\n})\n```\n\nAPI\n---\n\n### writeArtifacts(artifacts, [options])\n\nSearchs files of artifact by glob patterns and writes them to artifact in fs.\n\n### Tartifacts([options])\n\nConstructor which creates an instance of Tartifacts with the methods described below.\n\n#### Tartifacts.prototype.writeArtifacts(artifacts)\n\nDoes the same as function `writeArtifacts`.\n\n#### Tartifacts.prototype.closeArtifacts\n\nMethod which is useful when artifacts are created in `watch` mode and should be called in order to resolve `Tartifacts.prototype.writeArtifacts` (see the [usage](#usage) above).\n\n### artifacts\n\nType: `object`, `object[]`\n\nThe info about artifacts or one artifact.\n\nEach artifact object has the following fields:\n\n* [name](#artifactname)\n* [root](#artifactroot)\n* [destDir](#artifactdestdir)\n* [patterns](#artifactpatterns)\n* [includes](#artifactincludes)\n* [excludes](#artifactexcludes)\n* [tar](#artifacttar)\n* [gzip](#artifactgzip)\n* [followSymlinks](#followsymlinks)\n* [dotFiles](#artifactdotfiles)\n* [emptyFiles](#artifactemptyfiles)\n* [emptyDirs](#artifactemptydirs)\n* [transform](#transform)\n* [watch](#artifactwatch)\n\n#### artifact.name\n\nType: `string`\n\nThe artifact name of file or directory.\n\n#### artifact.root\n\nType: `string`\n\nDefault: `precess.cwd()`\n\nThe path to root directory.\n\nThe `patterns`, `includes` and `excludes` will be resolved from `root`.\n\n#### artifact.destDir\n\nType: `string`\n\nThe path to destination directory of artifact.\n\nThe `dest` and `name` will be resolved from `destDir`. If `destDir` is not specified, `dest` and `name` will be resolved from `root`.\n\n#### artifact.patterns\n\nType: `string`, `string[]`, `object`\n\nDefault: `[]`\n\nThe paths to files which need to be included or excluded.\n\nRead more about patterns in [glob](https://github.com/isaacs/node-glob#glob-primer) package.\n\n#### artifact.includes\n\nType: `string`, `string[]`\n\nDefault: `[]`\n\nThe paths to files which need to be included.\n\n#### artifact.excludes\n\nType: `string`, `string[]`\n\nDefault: `[]`\n\nThe paths to files which need to be excluded.\n\nCan be specifed as an object:\n\n```js\n{\n    name: 'artifact',\n    patterns: {\n        './subdir1': ['dir1/**'],\n        './subdir2': ['dir2/**']\n    }\n}\n```\n\nThis means that all files which match `dir1/**` will be added to directory `artifact/subdir1` and all files which match `dir2/**` will be added to directory `artifact/subdir2`, so, for example, file `./dir1/file.ext` will be added to artifact as `./artifact/subdir1/dir1/file.ext` and file, for `./dir2/file.ext` will be added to artifact as `./artifact/subdir2/dir2/file.ext`.\n\n#### artifact.tar\n\nType: `boolean`\n\nDefault: `false`\n\nIf `true`, destination directory will be packed to tarball file.\n\nOtherwise files of artifact will be copied to destination directory.\n\n#### artifact.gzip\n\nType: `boolean`, `object`\n\nDefault: `false`\n\nIf `true`, tarball file will be gzipped.\n\nTo change the compression level pass object with `level` field.\n\n#### artifact.followSymlinks\n\nType: `boolean`\n\nDefault: `false`\n\nFollow symlinked files and directories.\n\n*Note that this can result in a lot of duplicate references in the presence of cyclic links.*\n\n#### artifact.dotFiles\n\nType: `boolean`\n\nDefault: `true`\n\nInclude dotfiles.\n\n#### artifact.emptyFiles\n\nType: `boolean`\n\nDefault: `true`\n\nInclude empty files.\n\n#### artifact.emptyDirs\n\nType: `boolean`\n\nDefault: `true`\n\nInclude empty directories.\n\n#### artifact.transform\n\nType: `Function`\n\nDefault: `null`\n\nIt allows you to modify files before they are archived/copied.\n\nTransform function has one argument with type `{path: string, relative: string, base: string, cwd: string, history: string[]}` and should return the modified chunk or array of chunks.\n\nNote: now support only sync functions\n\n[Example](./examples/transform.js)\n\n### artifact.watch\n\nType: `boolean`\n\nDefault: `false`\n\nTartifacts will work in an observe mode which means that all files and directories will be added to a destination directory or archive as soon as they appear on a file system.\n\nNote: it is recommended to use this mode with the advanced API which is described in the [usage](#usage) above in order to have the ability to stop the tool\n\n### options\n\nType: `object`\n\nAllows you to configure settings for write artifacts.\n\nThe options specify general settings for all artifacts:\n\n * [root](#artifactroot)\n * [destDir](#artifactdestdir)\n * [tar](#artifacttar)\n * [gzip](#artifactgzip)\n * [followSymlinks](#followsymlinks)\n * [dotFiles](#artifactdotfiles)\n * [emptyFiles](#artifactemptyfiles)\n * [emptyDirs](#artifactemptydirs)\n * [transform](#transform)\n * [watch](#artifactwatch)\n\nLicense\n-------\n\nMIT © [Andrew Abramov](https://github.com/blond)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyandex%2Ftartifacts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyandex%2Ftartifacts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyandex%2Ftartifacts/lists"}