{"id":19622140,"url":"https://github.com/commercetools/sphere-node-cli","last_synced_at":"2025-04-28T03:32:23.620Z","repository":{"id":13685071,"uuid":"16378858","full_name":"commercetools/sphere-node-cli","owner":"commercetools","description":"A fast, performant, easy-to-use and stream-based CLI for SPHERE.IO","archived":false,"fork":false,"pushed_at":"2024-11-17T12:10:44.000Z","size":1990,"stargazers_count":4,"open_issues_count":27,"forks_count":5,"subscribers_count":32,"default_branch":"master","last_synced_at":"2025-04-20T15:17:59.566Z","etag":null,"topics":["audit-import-export"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/sphereio/sphere-node-cli/","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":"2014-01-30T14:06:18.000Z","updated_at":"2024-11-17T12:10:47.000Z","dependencies_parsed_at":"2024-11-17T13:18:54.940Z","dependency_job_id":"ba551bc9-2465-47ce-a2b3-74713855aa9e","html_url":"https://github.com/commercetools/sphere-node-cli","commit_stats":null,"previous_names":["sphereio/sphere-node-cli"],"tags_count":46,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercetools%2Fsphere-node-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercetools%2Fsphere-node-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercetools%2Fsphere-node-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercetools%2Fsphere-node-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/commercetools","download_url":"https://codeload.github.com/commercetools/sphere-node-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251246336,"owners_count":21558762,"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:10.708Z","updated_at":"2025-04-28T03:32:23.614Z","avatar_url":"https://github.com/commercetools.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv style=\"background-color: yellow; color: black; padding: 10px; text-align: center; font-weight: bold;\"\u003e\n  \u003ch2\u003e🚨 Non-maintainable 🚨\u003c/h2\u003e\n  \u003cp\u003eStarting January 1, 2025, we will no longer provide maintenance or updates for the CLI ImpEx tools. After this date, this tool will no longer receive bug fixes, security patches, or new features.\u003c/p\u003e\n\u003c/div\u003e\n\n\n\u003cimg src=\"https://impex.europe-west1.gcp.commercetools.com/static/images/ct-logo.svg\" alt=\"commercetools logo\" width=\"200\"\u003e\n\n\n# Node.js CLI\n\n[![npm][npm-icon]][npm]\n[![Travis Build Status][travis-icon]][travis]\n[![Codecov Coverage Status][codecov-icon]][codecov]\n[![David Dependencies Status][david-icon]][david]\n[![David devDependencies Status][david-dev-icon]][david-dev]\n\nThe next generation Command-Line-Interface for SPHERE.IO.\n\nTable of Contents\n=================\n\n* [Features](#features)\n* [Requirements](#requirements)\n* [Usage](#usage)\n* [Credentials](#credentials)\n* [Docker](#docker)\n  * [Examples](#examples)\n* [Commands](#commands)\n    * [sphere-import](#sphere-import)\n* [Contributing](#contributing)\n\n## Features\n- import of `stock`, `product`, `price`, `category`, `discount`, `order`, `customer`, `productType`, `discountCode`, `state`, `customObject`\n- Docker support\n- Custom plugin\n\n## Requirements\nMake sure you have installed all of the following prerequisites on your development machine:\n  * Git - [Download \u0026 Install Git](https://git-scm.com/downloads). MacOS and Linux machines typically have this already installed.\n  * Node.js - [Download \u0026 Install Node.js](https://nodejs.org/en/download/) and the npm package manager. Make sure to get the latest active LTS version. You could also use a Node.js version manager such as [n](https://github.com/tj/n) or [nvm](https://github.com/creationix/nvm).\n\n\u003e If you were using the [old ruby CLI](https://github.com/sphereio/sphere-cli) make sure to uninstall it first.\n\n## Usage\n\n```bash\n$ npm install -g sphere-node-cli\n\n# show general help\n$ sphere -h\n\n# show help for a command (e.g.: import)\n$ sphere help \u003ccmd\u003e\n\n```\nThe CLI is **still under development** but already provides a bunch of commands.\u003cbr/\u003e\nThe idea behind it is to operate as a _proxy_ for the different libraries that are used underneath. For example the `import` command will stream chunks from a given JSON file and pass them to the related library that will handled the rest.\n\n\n## Credentials\n\nThe CLI has a lookup mechanism to load SPHERE.IO project credentials.\u003cbr/\u003e\nIf you specify a `-p, --project` option, the CLI will try to load the credentials for that project from the following locations:\n\n```\n./.sphere-project-credentials\n./.sphere-project-credentials.json\n~/.sphere-project-credentials\n~/.sphere-project-credentials.json\n/etc/sphere-project-credentials\n/etc/sphere-project-credentials.json\n```\n\nThere are 2 supported formats: `csv` and `json`.\n\n- **csv**: `project_key:client_id:client_secret`\n- **json**: `{ \"project_key\": { \"client_id\": \"\", \"client_secret\": \"\" } }`\n\nIf no `-p, --project` option is provided, the CLI tries to read the credentials from ENV variables:\n\n```\nexport SPHERE_PROJECT_KEY=\"\"\nexport SPHERE_CLIENT_ID=\"\"\nexport SPHERE_CLIENT_SECRET=\"\"\n```\n\n## Docker\n\n[![Docker build](http://dockeri.co/image/sphereio/sphere-node-cli)](https://registry.hub.docker.com/u/sphereio/sphere-node-cli/)\n\nYou need to have a working docker client! The [Docker Toolbox](https://www.docker.com/toolbox) is an installer to quickly and easily install and setup a Docker environment on your computer. Available for both Windows and Mac, the Toolbox installs Docker Client, Machine, Compose, Kitematic and VirtualBox.\n\n### Examples\n\nShow help\n```bash\ndocker run \\\nsphereio/sphere-node-cli -h\n```\n\nImport a product (host folder `/sample_dir/` mounted as docker volume)\n```bash\ndocker run \\\n-e SPHERE_PROJECT_KEY=\u003cKEY\u003e\n-e SPHERE_CLIENT_ID=\u003cID\u003e\n-e SPHERE_CLIENT_SECRET=\u003cSECRET\u003e\n-v /sample_dir/:/sample_dir/ \\\nsphereio/sphere-node-cli\nimport -p my-project-key -t product -f /sample_dir/products.json'\n```\n\nYou can also set an alias for repeated calls:\n\n```bash\nalias sphere='docker run \\\n-v /etc/sphere-project-credentials.json:/etc/sphere-project-credentials.json \\\nsphereio/sphere-node-cli'\n```\n\n## Commands\n\nThe CLI has _git-like_ sub-commands which can be invoked as `sphere \u003ccmd\u003e`.\n\nCurrent available commands:\n\n- **import** (`stock`, `product`, `price`, `category`, `discount`, `order`, `customer`, `productType`, `discountCode`, `state`, `customObject`)\n\nCommands expects at least a `-t, --type` option which may vary for each command.\n\n#### `sphere-import`\n\nImports a resource `type` by streaming the input JSON file.\n\n```bash\n$ sphere import -p my-project-key -t product \\\n  -f sample_dir/products.json \\\n  -c '{\"errorDir\": \"./productErrors\"}'\n```\n\nThe input must be a valid JSON following a specific schema (`import-type-key` is the _plural_ form of the `type` option, e.g.: `products`, `stocks`, etc.).\n\n```json\n{\n  \"$schema\": \"http://json-schema.org/draft-04/schema#\",\n  \"title\": \"SPHERE.IO CLI import schema\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"\u003cimport-type-key\u003e\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"$ref\": \"https://github.com/sphereio/sphere-json-schemas/tree/master/schema\"\n      }\n    }\n  },\n  \"additionalProperties\": false,\n  \"required\": [\"\u003cimport-type-key\u003e\"]\n}\n```\n\n\u003e If you don't provide a file to read _from_, the CLI listens from `stdin` so you can i.e. pipe in something.\n\n\nEach import type might have / expect some extra specific configuration. In that case you have to refer to the related documentation.\n\n- [Product import](https://github.com/sphereio/sphere-product-import/blob/master/readme/product-import.md)\n- [Product Type import](https://github.com/sphereio/sphere-product-type-import)\n- [Price import](https://github.com/sphereio/sphere-product-import/blob/master/readme/price-importer.md)\n- [Category import](https://github.com/sphereio/sphere-category-sync#json-format)\n- [Product Discount import](https://github.com/sphereio/sphere-product-import/blob/master/readme/product-discounts-importer.md)\n- [Customer import](https://github.com/sphereio/customer-import)\n- [Stock import](https://github.com/sphereio/sphere-stock-import)\n- [Order import](https://github.com/commercetools/orders-update)\n- [Discount Code import](https://commercetools.github.io/nodejs/cli/discount-code-importer.html)\n- [State import](https://commercetools.github.io/nodejs/cli/state-importer.html)\n- [Custom Object import](https://commercetools.github.io/nodejs/cli/custom-objects-importer.html)\n\n## Contributing\n\nSee [Contribution guidelines](CONTRIBUTING.md)\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[npm-icon]: https://img.shields.io/npm/v/sphere-node-cli.svg\n[npm]: https://www.npmjs.com/package/sphere-node-cli\n[travis]: https://travis-ci.org/sphereio/sphere-node-cli\n[travis-icon]: https://img.shields.io/travis/sphereio/sphere-node-cli/master.svg?style=flat-square\n[codecov]: https://codecov.io/gh/sphereio/sphere-node-cli\n[codecov-icon]: https://img.shields.io/codecov/c/github/sphereio/sphere-node-cli.svg?style=flat-square\n[david]: https://david-dm.org/sphereio/sphere-node-cli\n[david-icon]: https://img.shields.io/david/sphereio/sphere-node-cli.svg?style=flat-square\n[david-dev]: https://david-dm.org/sphereio/sphere-node-cli?type=dev\n[david-dev-icon]: https://img.shields.io/david/dev/sphereio/sphere-node-cli.svg?style=flat-square\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommercetools%2Fsphere-node-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommercetools%2Fsphere-node-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommercetools%2Fsphere-node-cli/lists"}