{"id":19622192,"url":"https://github.com/commercetools/sphere-product-type-export","last_synced_at":"2025-02-26T19:17:07.926Z","repository":{"id":40775360,"uuid":"64125610","full_name":"commercetools/sphere-product-type-export","owner":"commercetools","description":"Export your Product Types","archived":false,"fork":false,"pushed_at":"2023-07-19T01:43:43.000Z","size":1340,"stargazers_count":0,"open_issues_count":24,"forks_count":1,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-02-25T14:56:10.027Z","etag":null,"topics":["audit-import-export"],"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/commercetools.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-07-25T10:28:52.000Z","updated_at":"2023-06-08T07:15:54.000Z","dependencies_parsed_at":"2024-11-11T11:32:31.088Z","dependency_job_id":"a3ca3e5f-9d35-4413-a58c-8d15880f176d","html_url":"https://github.com/commercetools/sphere-product-type-export","commit_stats":null,"previous_names":["sphereio/sphere-product-type-export"],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercetools%2Fsphere-product-type-export","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercetools%2Fsphere-product-type-export/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercetools%2Fsphere-product-type-export/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercetools%2Fsphere-product-type-export/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/commercetools","download_url":"https://codeload.github.com/commercetools/sphere-product-type-export/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240917722,"owners_count":19878308,"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":["audit-import-export"],"created_at":"2024-11-11T11:26:31.092Z","updated_at":"2025-02-26T19:17:07.908Z","avatar_url":"https://github.com/commercetools.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![commercetools logo][commercetools-icon]][commercetools]\n# sphere-product-type-export\n\n[![Travis][travis-badge]][travis-url]\n[![Codecov][codecov-badge]][codecov-url]\n[![npm][npm-lic-badge]][npm-lic-url]\n[![semantic-release][semantic-release-badge]][semantic-release-url]\n[![Commitizen friendly][commitizen-badge]][commitizen-url]\n[![NPM version][npm-image]][npm-url]\n\nA library that helps with exporting [product-types](http://dev.commercetools.com/http-api-projects-productTypes.html) from the [Commercetools Platform](http://www.commercetools.com/).\nThis library is built to be used in conjunction with [sphere-node-cli](https://github.com/sphereio/sphere-node-cli).\n\n## Features\n- Export product types from your CTP project\n- Creates 2 files - product type / attributes matrix and attributes list - that can be used to reimport product types\n\n## Configuration\nThe configuration object may contain:\n- `config`: configuration object that may contain the following options\n  - `delimiter`: the delimiter to be used in the csv (_default_: `,`)\n  - `outputFolder` (_required_): the folder used to store the exported product types and attributes\n  - `exportFormat` (_optional_): output format, supported are `csv`, `xlsx` (_default_: `csv`)\n  - `encoding` (_optional_): encoding used when saving data, supported encodings are listed [here](https://github.com/ashtuchkin/iconv-lite/wiki/Supported-Encodings) (_default_: `utf8`)\n  - `where` (_optional_): where predicate used to filter exported productTypes. More info [here](http://dev.commercetools.com/http-api.html#predicates)\n  - `includeProductTypeInAttributes` (_optional_): flag to be used when all the attibutes need to be exported\n- `sphereClientConfig`: see the [sphere-node-sdk docs](http://sphereio.github.io/sphere-node-sdk/) for more information on this\n\n## Usage\n\nThis module can be used as a command line tool as well as a node.js module.\n\n### CLI\nBefore using this module in the command line, install it with a `global` flag.\n```sh\nnpm install sphere-product-type-export -g\n```\n\n#### Command\nCommand accepts following arguments:\n- The `--projectKey` or `-p` parameter is required and contains a project key which should be used when exporting productTypes. \n- The `--outputFolder` or `-o` parameter is required and contains a path to an output folder where the output will be saved. \n- The `--accessToken` or `-t` parameter tells module if it should use access token instead of clientId and clientSecret. \n- The `--sphereHost` parameter tells module whether to use a different API URL. \n- The `--sphereProtocol` parameter tells module whether to use a different protocol. \n- The `--where` or `-w` parameter can be used for filtering productTypes before exporting.\n- The `--exportFormat` parameter specifies in which format (CSV or XLSX) shoud it save exported productTypes (default is CSV). \n- The `--delimiter` or `-d` parameter specifies what delimiter should be used when exporting to CSV (default is ',').\n- The `--compressOutput` or `-c` parameter specifies whether to archive export files after export is done (default is false). \n- The `--encoding` parameter specifies in which encoding should be exported CSV files (default is utf8). \n- The `includeProductTypeInAttributes` flag to be used when all the attibutes need to be exported.\n\nTo export all productTypes in the CSV format we can run this command:\n```bash\nproduct-type-export -p project-key -o tmp\n```\n\n#### Output\n```sh\nExport successful!\n{\n  \"errors\": [],\n  \"exported\": {\n    \"productTypes\": 3,\n    \"attributes\": 18\n  }\n}\n```\nIn the `tmp` folder there will be created two files `attributes.csv` and `products-to-attributes.csv` which describe exported productTypes.\n\n\n### JS\nIf you want more control, you can also use this library directly in JavaScript. To do this you first need to install it:\n\n```sh\nnpm install sphere-product-type-export --save\n```\n\nThen you can use it to export product types like so:\n\n```js\nexport ProductTypeExport from 'sphere-product-type-export'\n\nconst config = {\n  sphereClientConfig: {\n    config: {\n      project_key: \u003cPROJECT_KEY\u003e,\n      client_id: '*********',\n      client_secret: '*********'\n    }\n  },\n  config: {\n    outputFolder: '',\n    delimiter: '',       // default: ,\n    compressOutput: '',  // default: false\n    exportFormat: '',    // default: csv\n    encoding: '',        // default: utf8\n    where: '',           // default: ''\n  }\n}\nconst productTypeExport = ProductTypeExport(config)\n\nproductTypeExport.run()\n.then(() =\u003e {\n  // done exporting the productType\n  // look at the summary to see errors\n  productTypeExport.summary\n  // the summary hast the following structure\n  // {\n  //   errors: [],\n  //   exported: [\u003csome-name\u003e],\n  //   successfulExports: 1\n  // }\n})\n```\n\n## Contributing\n  See [CONTRIBUTING.md](CONTRIBUTING.md) file for info on how to contribute to this library\n\n[commercetools]: https://commercetools.com/\n[commercetools-icon]: https://cdn.rawgit.com/commercetools/press-kit/master/PNG/72DPI/CT%20logo%20horizontal%20RGB%2072dpi.png\n[travis-badge]: https://img.shields.io/travis/sphereio/sphere-product-type-export.svg?style=flat-square\n[travis-url]: https://travis-ci.org/sphereio/sphere-product-type-export\n\n[codecov-badge]: https://img.shields.io/codecov/c/github/sphereio/sphere-product-type-export.svg?style=flat-square\n[codecov-url]: https://codecov.io/github/sphereio/sphere-product-type-export\n\n[npm-lic-badge]: https://img.shields.io/npm/l/sphere-product-type-export.svg?style=flat-square\n[npm-lic-url]: http://spdx.org/licenses/MIT\n\n[semantic-release-badge]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square\n[semantic-release-url]: https://github.com/semantic-release/semantic-release\n\n[commitizen-badge]: https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat-square\n[commitizen-url]: http://commitizen.github.io/cz-cli/\n\n[npm-url]: https://npmjs.org/package/sphere-product-type-export\n[npm-image]: http://img.shields.io/npm/v/sphere-product-type-export.svg?style=flat-square\n[npm-downloads-image]: https://img.shields.io/npm/dt/sphere-product-type-export.svg?style=flat-square\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommercetools%2Fsphere-product-type-export","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommercetools%2Fsphere-product-type-export","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommercetools%2Fsphere-product-type-export/lists"}