{"id":13527922,"url":"https://github.com/timkelty/shipit-shared","last_synced_at":"2025-04-06T23:32:03.648Z","repository":{"id":26385885,"uuid":"29835350","full_name":"timkelty/shipit-shared","owner":"timkelty","description":"A set of tasks for Shipit used for symlinking persistent (un-sourced) files and directories on deploy.","archived":false,"fork":false,"pushed_at":"2016-11-22T14:20:49.000Z","size":93,"stargazers_count":47,"open_issues_count":9,"forks_count":17,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-30T01:48:14.707Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/timkelty.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-25T23:00:03.000Z","updated_at":"2024-05-15T15:23:46.000Z","dependencies_parsed_at":"2022-08-24T15:03:36.420Z","dependency_job_id":null,"html_url":"https://github.com/timkelty/shipit-shared","commit_stats":null,"previous_names":[],"tags_count":39,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timkelty%2Fshipit-shared","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timkelty%2Fshipit-shared/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timkelty%2Fshipit-shared/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timkelty%2Fshipit-shared/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timkelty","download_url":"https://codeload.github.com/timkelty/shipit-shared/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247569124,"owners_count":20959758,"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":[],"created_at":"2024-08-01T06:02:06.765Z","updated_at":"2025-04-06T23:32:01.961Z","avatar_url":"https://github.com/timkelty.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# shipit-shared\n\n[![Build Status](https://travis-ci.org/timkelty/shipit-shared.svg)](https://travis-ci.org/timkelty/shipit-shared)\n[![Dependency Status](https://david-dm.org/timkelty/shipit-shared.svg)](https://david-dm.org/timkelty/shipit-shared)\n[![devDependency Status](https://david-dm.org/timkelty/shipit-shared/dev-status.svg)](https://david-dm.org/timkelty/shipit-shared#info=devDependencies)\n[![Join the chat at https://gitter.im/timkelty/shipit-shared](https://img.shields.io/badge/gitter-join%20chat%20%E2%86%92-brightgreen.svg)](https://gitter.im/timkelty/shipit-shared?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\nA set of tasks for [Shipit](https://github.com/shipitjs/shipit) used for symlinking persistent (un-sourced) files and directories on deploy.\n\nBased on the concept of `linked_files`/`linked_dirs` from [Capistrano](http://capistranorb.com/documentation/getting-started/configuration/)\n\n**Features:**\n\n- By default, the `shared` task is triggered on the `updated` event from [shipit-deploy](https://github.com/shipitjs/shipit-deploy)\n- All necessary directories are always created for you, whether you are linking a file or a directory.\n- Optionally set permissions on files.\n- Works via [shipit-cli](https://github.com/shipitjs/shipit) and [grunt-shipit](https://github.com/shipitjs/grunt-shipit)\n\n**Roadmap**\n\n- Optionally copy example files, such as example config files\n\n## Install\n\n```\nnpm install shipit-shared\n```\n\n## Usage\n\n### Example `shipitfile.js`\n\n```js\nmodule.exports = function (shipit) {\n  require('shipit-deploy')(shipit);\n  require('shipit-shared')(shipit);\n\n  shipit.initConfig({\n    default: {\n      shared: {\n        overwrite: true,\n        dirs: [\n          'public/storage',\n          {\n            path: 'db',\n            overwrite: false,\n            chmod: '-R 777',\n          }\n        ],\n        files: [\n          'config/environment.yml',\n          {\n            path: 'config/database.yml',\n            overwrite: false,\n            chmod: '755',\n          }\n        ],\n      }\n    }\n  });\n};\n```\n\nTo trigger on the deploy `published` event, you can simply deploy:\n\n```\nshipit staging deploy\n```\n\nOr you can run the tasks separately :\n\n```\nshipit staging shared\n    shipit staging shared:create-dirs\n    shipit staging shared:link\n        shipit staging shared:link:dirs\n        shipit staging shared:link:files\n```\n\n## Options `shipit.config.shared`\n\n### `shared.dirs`, `shared.files`\n\nType: `Array`\n\nAn array of files/directories to symlink into `current`. String values inherit default settings, objects allow per-item configuration:\n\n```\n'public/storage'\n{\n  path: 'db',\n  overwrite: true,\n  chmod: '-R 777'\n}\n```\n\n#### `path`\n\nType: `String`\n\nPath to the shared file/directory (relative to `current`). \n\n#### `overwrite`\n\nType: `Boolean`\n\nIf the target of the symlink exists in `current`, remove it before creating symlink.\n\n#### `chmod`\n\nType: `String`\n\nOptions passed to the `chmod` command for the given path. \n\n### `shared.basePath`\n\nType: `String`\nDefault: `path.join(shipit.config.deployTo, 'shared')`\n\nThe path where your shared files reside.\n\n### `shared.overwrite`\n\nType: `Boolean`\nDefault: `false`\n\nIf `true`, the target of your symlink (in `current`), **will be removed (via rm -rf)** before creating the symlink. Under normal circumstances, this is fine, as files in `current` have come directly from a git checkout.\n\nIf `false` and the target of your symlink is a file or directory, and error is thrown and the task aborted.\n\nThe default setting of `false` is a safety precaution to prevent unintentionally losing data. See https://github.com/timkelty/shipit-shared/issues/17\n\n### `shared.symlinkPath`\n\nType: `String`\nDefault: `shared.basePath`\n\nThe path that will serve as the source for your symlink. This is usually the same as `shared.basePath`, however it can be [necessary to set this in a `chroot` environment](https://github.com/timkelty/shipit-shared/issues/7).\n\n### `shared.triggerEvent`\nType: `String`, `Boolean`\nDefault: `updated`\n\nTrigger `shared` task on given event name.\nSet to `false` to prevent task from listening to any events.\n(note: Some part of shipit-shared *besides initConfig* needs to be run before it can listen for events)\n\n## Events\n- `shared`\n  + `shared:prepare`\n    + `shared:create-dirs`\n      * Emit event `sharedDirsCreated`\n    + `shared:set-permissions`\n      * Emit event `sharedPermissionsSet`\n  + `shared:link`\n    + `shared:link-dirs`\n      * Emit event `sharedFilesDirs`\n    + `shared:link-files`\n      * Emit event `sharedFilesLinked`\n  + `shared:end`\n    * Emit event `sharedEnd`\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimkelty%2Fshipit-shared","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimkelty%2Fshipit-shared","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimkelty%2Fshipit-shared/lists"}