{"id":13532243,"url":"https://github.com/Farfetch/garment","last_synced_at":"2025-04-01T20:31:40.972Z","repository":{"id":41602952,"uuid":"278150413","full_name":"Farfetch/garment","owner":"Farfetch","description":"Tool for managing monorepos","archived":true,"fork":false,"pushed_at":"2024-01-03T12:25:03.000Z","size":1947,"stargazers_count":44,"open_issues_count":0,"forks_count":10,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-11-02T19:34:06.568Z","etag":null,"topics":["build-system","farfetch","hacktoberfest","javascript","monorepo","nodejs","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/Farfetch.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-07-08T17:16:07.000Z","updated_at":"2024-01-03T12:25:35.000Z","dependencies_parsed_at":"2024-01-03T13:35:06.842Z","dependency_job_id":"35a67924-0f27-4e5f-8593-b95702d4590c","html_url":"https://github.com/Farfetch/garment","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Farfetch%2Fgarment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Farfetch%2Fgarment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Farfetch%2Fgarment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Farfetch%2Fgarment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Farfetch","download_url":"https://codeload.github.com/Farfetch/garment/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246709923,"owners_count":20821297,"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":["build-system","farfetch","hacktoberfest","javascript","monorepo","nodejs","typescript"],"created_at":"2024-08-01T07:01:09.365Z","updated_at":"2025-04-01T20:31:35.960Z","avatar_url":"https://github.com/Farfetch.png","language":"TypeScript","readme":"# Garment\n\n\u003e This project is no longer being actively maintained.\nFARFETCH has decided to archive this project, as widely adopted alternatives, like [Nx](https://nx.dev/), have become available.\n\u003e \n\u003e We won't be accepting pull requests or responding to issues for this project anymore. Thank you for your understanding.\n\nGarment is a toolkit for building applications using modern tools and scalable development practices. It encourages the monorepo way of building applications and provides a consistent developer experience across projects.\n\nGarment toolchain enables you to:\n\n- Use modern tooling in a consistent way across your organization\n- Have a similar developer experience across any project\n- Share code easily between multiple applications\n- Automate common tasks\n- Have fast builds and tests in projects of any size\n\n## Why Garment ?\n\n### Scalability\n\nAs an application codebase grows in size and number of contributors it's a good practice to split it into smaller composable and independent modules, but common tasks like build and test, tend to become really slow in these codebases. In order to keep the speed at the optimal level, Garment employs various technics such as dependency graph analysis, parallel execution, incremental builds, and caching of successful runs.\n\n### Autonomy\n\nGarment allows to defining tasks, configurations, and tooling per project ensuring that projects and teams remain autonomous while working in the same repository\n\n### Developer Experience\n\nGarment provides a common way of adding new tools to your projects, it enables teams to build on top of each other while providing a fast and reliable developer experience for projects of any size. It also provides a common way of automating common tasks such as creating boilerplates and generators\n\n### Extensibility\n\nYou can easily support many different tools and workflows to fit your project needs with Garment Runners.\n\n## Getting Started\n\nTo start using Garment we first need to install it\n\n    yarn add @garment/cli\n\n_We recommend the usage of yarn with due to its native workspaces support and deterministic lockfile_\n\nAfter Garment is installed we can initialize it in a current folder by running\n\n    yarn garment init\n\nIt will create `garment.json` file with a following structure\n\n```json\n{\n  \"presets\": {},\n  \"projects\": {},\n  \"schematics\": []\n}\n```\n\nFrom now on we can populate our workspace with projects.\n\n\u003e If you want to start using Garment in existing Lerna or Yarn Workspaces project, you can use `yarn garment init --from (lerna | yarn | folder)`\n\n### To learn about all available commands, please check the docs for [CLI](/docs/CLI.md)\n\nLet's say we have a monorepo with two JavaScript packages\n\n    monorepo/\n    node_modules/\n    packages/\n      package-a/\n        src/\n          index.js\n        package.json\n      package-b/\n        src/\n          index.js\n        package.json\n    yarn.lock\n    package.json\n\nHere's how our `garment.json` would look like after we add our packages.\n\n```json\n{\n  \"presets\": {},\n  \"projects\": {\n    \"package-a\": {\n      \"path\": \"packages/package-a\"\n    },\n    \"package-b\": {\n      \"path\": \"packages/package-b\"\n    }\n  },\n  \"schematics\": []\n}\n```\n\n## Defining Tasks\n\nNow that the basic setup for your project is done, you'll want to add some tasks to perform work on your codebase\n\n```json\n{\n  \"presets\": {},\n  \"projects\": {\n    \"package-a\": {\n      \"path\": \"packages/package-a\",\n      \"tasks\": {\n        \"build\": {\n          \"runner\": \"babel\",\n          \"input\": \"{{projectDir}}/src/**/*.js\",\n          \"output\": \"{{projectDir}}/dist\"\n        }\n      }\n    },\n    \"package-b\": {\n      \"path\": \"packages/package-b\",\n      \"tasks\": {\n        \"build\": {\n          \"runner\": \"babel\",\n          \"input\": \"{{projectDir}}/src/**/*.js\",\n          \"output\": \"{{projectDir}}/dist\"\n        }\n      }\n    }\n  },\n  \"schematics\": []\n}\n```\n\nYou'll notice that each task has a mandatory runner key, runners are the abstraction garment uses to integrate external tools into your workflow.\n\nWhile tasks allow you to define an id and a set of options to perform some task, Runners will be the ones who perform the actual work.\n\nNotice that you don't need to specify the full path for a task input/output, `{{projectDir}}` get's aliased to your project path at runtime\n\n[Configuration](/docs/Configuration.md)\n\n## Runners\n\nYou can think of Runners as a plugin that abstracts away tooling configuration and can be reused across tasks and projects.\n\nModern applications run many tools on top of your code for tasks such as build, test, lint, and bundle.\n\nRunners provide a common configuration and interface for those tools, and Garment integrates them into a single workflow.\n\nThis makes it easy to integrate and incrementally adopt new tools in your projects\n\n[Creating a Runner](/docs/creating_runner.md)\n\n## Presets\n\nFor projects with common workflows, you can create a preset. A preset is a common configuration of a runner which can be reused by multiple projects\n\n```json\n{\n  \"presets\": {\n    \"babel-package\": {\n      \"tasks\": {\n        \"build\": {\n          \"runner\": \"babel\",\n          \"input\": \"{{projectDir}}/src/**/*.js\",\n          \"output\": \"{{projectDir}}/dist\"\n        }\n      }\n    }\n  },\n  \"projects\": {\n    \"package-a\": {\n      \"path\": \"packages/package-a\",\n      \"extends\": [\"babel-package\"]\n    },\n    \"package-b\": {\n      \"path\": \"packages/package-b\",\n      \"extends\": [\"babel-package\"]\n    }\n  },\n  \"schematics\": []\n}\n```\n\n## Schematics\n\nSchematics are code generators that can be used to automate common tasks like creating new packages or components or even integrating a new Runner into an existing project. Schematics are also a great way of automating conventions and rules, making projects consistent in an automated way.\n\n### Why schematics\n\n\u003e Manipulating the code in an application has the potential to be both very powerful and correspondingly dangerous. For example, creating a file that already exists would be an error, and if it was applied immediately, it would discard all the other changes applied so far. The Angular Schematics tooling guards against side effects and errors by creating a virtual file system. A schematic describes a pipeline of transformations that can be applied to the virtual file system. When a schematic runs, the transformations are recorded in memory, and only applied in the real file system once they're confirmed to be valid.\n\nYou can use schematics in your project just by telling garment which schematics package to look for in the `garment.json` file\n\n```json\n{\n  \"schematics\": [\"@garment/standard-schematics\"]\n}\n```\n\nThen you can run the `generate` command to have access to all the schematics in the package provided\n\n    yarn garment generate\n\n[Creating schematics](/docs/creating_schematics.md)\n\n## Contributing\n\nRead the [Contributing guidelines](CONTRIBUTING.md)\n\n### Disclaimer\n\nBy sending us your contributions, you are agreeing that your contribution is made subject to the terms of our [Contributor Ownership Statement](https://github.com/Farfetch/.github/blob/master/COS.md)\n\n## Maintainers\n\nList of [Maintainers](MAINTAINERS.md)\n\n## License\n\n[MIT](LICENSE.md)\n","funding_links":[],"categories":["TypeScript","构建系统和依赖性管理工具"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFarfetch%2Fgarment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFarfetch%2Fgarment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFarfetch%2Fgarment/lists"}