
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
sphere-node-cli
Advanced tools
A fast, performant, easy-to-use and stream-based CLI for SPHERE.IO
The next generation Command-Line-Interface for SPHERE.IO.
stock
, product
, price
, category
, discount
, order
, customer
, productType
, discountCode
, state
, customObject
Make sure you have installed all of the following prerequisites on your development machine:
If you were using the old ruby CLI make sure to uninstall it first.
$ npm install -g sphere-node-cli
# show general help
$ sphere -h
# show help for a command (e.g.: import)
$ sphere help <cmd>
The CLI is still under development but already provides a bunch of commands.
The 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.
The CLI has a lookup mechanism to load SPHERE.IO project credentials.
If you specify a -p, --project
option, the CLI will try to load the credentials for that project from the following locations:
./.sphere-project-credentials
./.sphere-project-credentials.json
~/.sphere-project-credentials
~/.sphere-project-credentials.json
/etc/sphere-project-credentials
/etc/sphere-project-credentials.json
There are 2 supported formats: csv
and json
.
project_key:client_id:client_secret
{ "project_key": { "client_id": "", "client_secret": "" } }
If no -p, --project
option is provided, the CLI tries to read the credentials from ENV variables:
export SPHERE_PROJECT_KEY=""
export SPHERE_CLIENT_ID=""
export SPHERE_CLIENT_SECRET=""
You need to have a working docker client! The Docker 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.
Show help
docker run \
sphereio/sphere-node-cli -h
Import a product (host folder /sample_dir/
mounted as docker volume)
docker run \
-e SPHERE_PROJECT_KEY=<KEY>
-e SPHERE_CLIENT_ID=<ID>
-e SPHERE_CLIENT_SECRET=<SECRET>
-v /sample_dir/:/sample_dir/ \
sphereio/sphere-node-cli
import -p my-project-key -t product -f /sample_dir/products.json'
You can also set an alias for repeated calls:
alias sphere='docker run \
-v /etc/sphere-project-credentials.json:/etc/sphere-project-credentials.json \
sphereio/sphere-node-cli'
The CLI has git-like sub-commands which can be invoked as sphere <cmd>
.
Current available commands:
stock
, product
, price
, category
, discount
, order
, customer
, productType
, discountCode
, state
, customObject
)Commands expects at least a -t, --type
option which may vary for each command.
sphere-import
Imports a resource type
by streaming the input JSON file.
$ sphere import -p my-project-key -t product \
-f sample_dir/products.json \
-c '{"errorDir": "./productErrors"}'
The 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.).
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "SPHERE.IO CLI import schema",
"type": "object",
"properties": {
"<import-type-key>": {
"type": "array",
"items": {
"$ref": "https://github.com/sphereio/sphere-json-schemas/tree/master/schema"
}
}
},
"additionalProperties": false,
"required": ["<import-type-key>"]
}
If you don't provide a file to read from, the CLI listens from
stdin
so you can i.e. pipe in something.
Each import type might have / expect some extra specific configuration. In that case you have to refer to the related documentation.
FAQs
A fast, performant, easy-to-use and stream-based CLI for SPHERE.IO
The npm package sphere-node-cli receives a total of 11 weekly downloads. As such, sphere-node-cli popularity was classified as not popular.
We found that sphere-node-cli demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 13 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.