{"id":22351883,"url":"https://github.com/screwdriver-cd/build-bookend","last_synced_at":"2025-07-30T07:31:55.829Z","repository":{"id":48824368,"uuid":"73953149","full_name":"screwdriver-cd/build-bookend","owner":"screwdriver-cd","description":"Setup bookends for builds with plugins","archived":false,"fork":false,"pushed_at":"2023-04-07T18:10:46.000Z","size":33,"stargazers_count":0,"open_issues_count":0,"forks_count":3,"subscribers_count":20,"default_branch":"master","last_synced_at":"2024-11-06T17:12:17.726Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://cd.screwdriver.cd/pipelines/aeeba3ecbdf02ddaf2343f415d6b6afcfe27aab9","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/screwdriver-cd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-16T19:22:58.000Z","updated_at":"2022-10-17T22:10:21.000Z","dependencies_parsed_at":"2023-01-22T20:15:53.630Z","dependency_job_id":null,"html_url":"https://github.com/screwdriver-cd/build-bookend","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/screwdriver-cd%2Fbuild-bookend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/screwdriver-cd%2Fbuild-bookend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/screwdriver-cd%2Fbuild-bookend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/screwdriver-cd%2Fbuild-bookend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/screwdriver-cd","download_url":"https://codeload.github.com/screwdriver-cd/build-bookend/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228106386,"owners_count":17870438,"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-12-04T12:16:15.308Z","updated_at":"2024-12-04T12:16:15.894Z","avatar_url":"https://github.com/screwdriver-cd.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Build Bookend\n[![Version][npm-image]][npm-url] ![Downloads][downloads-image] [![Build Status][status-image]][status-url] [![Open Issues][issues-image]][issues-url] ![License][license-image]\n\n\u003e creates setup and teardown steps for builds\n\n## Usage\n\n```bash\nnpm install screwdriver-build-bookend\n```\n\n### Using the bookend interface\nExtend the bookend interface in this module. You will need to define `getSetupCommand` and `getTeardownCommand` to return the commands needed to execute and return these in a promise.\n\n```js\nconst { BookendInterface } = require('screwdriver-build-bookend');\n\nclass MyBookend extends BookendInterface {\n    getSetupCommand() {\n        return Promise.resolve('echo \"hello world\"');\n    }\n    getTeardownCommand() {\n        return Promise.resolve('echo \"goodbye world\"');\n    }\n}\n\nmodule.exports = MyBookend;\n```\n\n### Getting final bookend commands\nUse the Bookend module to combine a set of BookendInterface based modules into single set of setup and teardown commands. See more examples in [the tests](https://github.com/screwdriver-cd/screwdriver-build-bookend/blob/master/test/index.test.js).\n\n```js\nconst SampleBookend = require('sd-sample-bookend');\nconst { Bookend } = require('screwdriver-build-bookend');\nconst b = new Bookend(\n    // Provide a set of default instantiated plugins\n    { 'sample': new SampleBookend() },\n    /*\n        Provide a list of plugins to use for setup and teardown, by name or with a config object\n        You can also choose to include your own modules with a config, these will be initialized for you with the given config.\n        The following config will use the default sample plugin, then the users my-bookend plugin\n     */\n    {\n        default: {\n            setup: [ 'sample', { name: 'my-bookend', config: { foo: 'bar' } }],\n            teardown: [ 'sample', { name: 'my-bookend', config: { foo: 'bar' } }]\n        },\n        // You can switch bookends for each build cluster when multi build cluster is enabled\n        clusterName: {\n            // You can specify an alias for bookends\n            setup: [ 'sample', { name: 'my-bookend-module-with-long-name', alias: 'my-bookend', config: { foo: 'bar' } }],\n            teardown: [ 'sample', { name: 'my-bookend', config: { foo: 'bar' } }]\n        }\n    }\n);\n\n// Get the setup commands [ { name: 'setup-sample', command: '...' }, { name: 'setup-my-bookend', command: '...' } ] given the models and configuration for the pipeline, job, and build\nb.getSetupCommands({ pipeline, job, build }).then((commands) =\u003e { ... });\n\n// Get the teardown command [ { name: 'teardown-sample', command: '...' }, { name: 'teardown-my-bookend', command: '...' } ] given the models and configuration for the pipeline, job, and build\nb.getTeardownCommands({ pipeline, job, build }).then((commands) =\u003e { ... });\n```\n\n## Testing\n\n```bash\nnpm test\n```\n\n## License\n\nCode licensed under the BSD 3-Clause license. See LICENSE file for terms.\n\n[npm-image]: https://img.shields.io/npm/v/screwdriver-build-bookend.svg\n[npm-url]: https://npmjs.org/package/screwdriver-build-bookend\n[downloads-image]: https://img.shields.io/npm/dt/screwdriver-build-bookend.svg\n[license-image]: https://img.shields.io/npm/l/screwdriver-build-bookend.svg\n[issues-image]: https://img.shields.io/github/issues/screwdriver-cd/screwdriver.svg\n[issues-url]: https://github.com/screwdriver-cd/screwdriver/issues\n[status-image]: https://cd.screwdriver.cd/pipelines/29/badge\n[status-url]: https://cd.screwdriver.cd/pipelines/29\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscrewdriver-cd%2Fbuild-bookend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscrewdriver-cd%2Fbuild-bookend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscrewdriver-cd%2Fbuild-bookend/lists"}