Skip to content

gofynd/fdk-cli

Repository files navigation

Fynd Development Kit

Note: Experimental support for Windows is available, it may not be fully stable.

NPM Version NPM Downloads Coverage Status

Fynd development Kit (FDK CLI) is a cli tool developed by Fynd to create and update themes, extensions and various other components of the Fynd Platform.

Quick Links

| Fynd Platform | Fynd Partners | Documentation | Other Projects | Contributing |

Prerequisites

  • Git
  • Nodejs
  • Optional Prerequisites
    • Maven (To use fdk extension init for java extension initialization)
    • pip (To use fdk extension init for python extension initialization)

Installation

npm install -g @gofynd/fdk-cli

Basic Commands

To help you get started, there are some basic commands you can use.

fdk --help

To see the available theme commands, enter:

fdk theme

To see the available extension commands, enter:

fdk extension

See the Command overview for a listing of all available commands, or the Command reference for syntax details and usage examples of the commands.

Commands


Environment Commands

Command Description
env get Shows current environment
env set Set active environment to the value provided by the user. Default environment: fynd

Authentication Commands

Command Description
login Login user
user Shows user details of logged in user
logout Logout user

Theme Commands

Command Description
new Create new theme
init Clone or download the code of the live website onto your local machine to set up a local development environment for testing and modifications.
serve Initiate theme development on your local machine. Your changes will automatically reflect in the browser whenever you save
sync This command will sync your local changes on live store website so you can preview it.
pull Pull latest theme code of your store website
pull-config Retrieve the most recent theme configuration values from the theme editor on your local machine.
open Returns links that provide preview of the current theme.
package Package your local theme files into a ZIP file. This will allow you to upload the theme to the partners panel and list it on the marketplace.
context Add context of a theme
context-list List all available contexts
active-context show currently active context

Partner Commands

Command Description
connect Add partner access token so that you don't need to add it explicitly

Extension Commands

Command Description
init Utilize this command to set up a new extension locally, leveraging existing templates of your choice.
setup Configure your extension locally using the existing API Key and API Secret provided for the extension inside the partners panel.
preview-url Create a ngrok tunnel and provide a link to tryout extension on development company
launch-url Get/set extension's lanuch url

Debug Mode

Add the --verbose flag to the command you want to run in debug mode.

This will create debug.log file at the current working directory. In case you encounter any issues, this log file can be shared with maintainers for effective issue resolution.

Example

fdk login --verbose

Commands Reference


Environment Commands

Before you start using FDK CLI you will have to set an environment

env set

This command sets the active environment to the value provided by the user.

Syntax

fdk env set [options]

Example

fdk env set -u api.fynd.com

Command Options

Option Description Required
--url, -u Platform API domain Yes
--help Show help No
--verbose, -v enable debug mode No

env get

This command displays the active environment set by the user. Default environment: api.fynd.com

Syntax

fdk env get

Authentication Commands

After setting the environment the user has to login to the cli.

login

This command allows user to login via partner panel.

Syntax

fdk login

Command Options

Option Description
--help Show help
--verbose, -v enable debug mode

Example

fdk login

user

This command show user details of the currently logged in user.

Syntax

fdk user

logout

This command will logout the user.

Syntax

fdk logout

Theme Commands

A theme is a VueJS project that developers can scaffold using this cli tool. Themes change the look and feel of websites built using Fynd Platform. Always create a new directory while creating or initializing a theme.

new

This command is used to create a new theme for your application

Syntax

fdk theme new [options]

Command Options

Option Description Required
--name, -n Theme name Yes
--help Show help No
--verbose, -v enable debug mode No

Example

fdk theme new -n [your-theme-name] 

init

This command is used to initialize an exisiting theme on your local system.

Syntax

fdk theme init [options]

Command Options

Option Description
--help Show help
--verbose, -v enable debug mode

Example

fdk theme init

context

Context is a JSON object which holds the configurations related the the application and theme. When you initialize or create a new theme a context is created with the name provided in the commands and assigned as the active context. You can add multiple contexts if you want to use the same theme on multiple applications or envoirnments.

This command is used to add a new context.

Syntax

fdk theme context [options]

Command Options

Option Description Required
--name, -n Context name Yes
--help Show help No
--verbose, -v enable debug mode No

Example

fdk theme context -n [context-name] 

context-list

This command is used to get a list of available context. You can also set active context by selecting one of the options in the list

Syntax

fdk theme context-list

active-context

This command is used to get currently active context.

Syntax

fdk theme active-context

serve

This command is used to run a theme on your local system.

Syntax

fdk theme serve [options]

Command Options

Option Description
--ssr Enable/disable Server-side rendering
--port Pass custom port number to serve theme. Default: 5001
--help Show help
--verbose, -v enable debug mode

By default Server-side rendering is enable. To disable it use --ssr false with the serve command

Example

fdk theme serve
fdk theme serve --port 5002

sync

This command is used to sync your theme to the application.

Syntax

fdk theme sync

Always verify if you have set the correct context before syncing your theme. Refer context commands.


pull

This command is used to pull latest theme code.

Syntax

fdk theme pull

pull-config

This command is used to pull latest theme config.

Syntax

fdk theme pull-config

package

This command is used to create a zip file of theme.

Syntax

fdk theme package

open

This command is used to preview the theme on browser.

Syntax

fdk theme open 

Extension Commands

Extensions are pluggable snippets of code that can be installed in your applications so improve the feature set of your application. To know more visit - Fynd Partners

Set the active environment before running extension commands

fdk env set -u api.fynd.com

init

This command is used to create a extension's initial code with required dependency. It will also register extension for you on your partner account.

Syntax

fdk extension init [options]

Command Options

Option Description
--target-dir Target Directory
--help Show help
--verbose enable debug mode

Example

fdk extension init --target-dir [your-directory]

setup

This command is used to setup extension's development environment in local machine with required dependencies created on Fynd Partners panel.

Syntax

fdk extension setup [options]

Command Options

Option Description
--target-dir Target Directory
--help Show help
--verbose enable debug mode

Example

fdk extension setup --target-dir [your-directory]

preview-url

This command will return the preview URL, which the user can use to launch or install the extension.

Syntax

fdk extension preview-url [options]

Command Options

Option Description
-p, --port Port on which Extension is running
--company-id specify company id
--update-authtoken update Ngrok authtoken
--api-key Extension API key
--help Show help
--verbose enable debug mode
--access-token Partner Access Token

Example

fdk extension preview-url --port 3000
fdk extension preview-url -p 3000 --update-authtoken
fdk extension preview-url -p 3000 --company-id 999 --update-authtoken

launch-url

This command is used to get or set the launch url of your extension

Syntax

fdk extension launch-url get/set [options]

Command Options

Option Description
--url URL to be set
--api-key Extension ID
--help Show help
--verbose enable debug mode

Set Launch URL Example

fdk extension launch-url set --url [url] --api-key [Extension API Key]

Get Launch URL Example

fdk extension launch-url get --api-key [Extension API Key]

Partner Commands

connect

This command is used to add your partner access token to update extension details on partners panel.

Syntax

fdk partner connect [options]

Command Options

Option Description
--help Show help
--verbose, -v enable debug mode

Example

fdk partner connect

Other Fynd projects

Project Link
Nitrozen Vue Know more
Javascript SDK snapshot
Extension SDK snapshot
Extension Bridge snapshot

Contributing

Checkout CONTRIBUTING.md for more information on how to get started contributing to this repository.