ThingWorx Flow > ThingWorx Flow SDK > Connector Project
Connector Project
A Connector project corresponds to a connector of a system that logically groups certain integration functionality together. Multiple versions of the artifacts associated with the functionality group are contained in a single project. There are artifacts for customizing and localizing in addition to the test artifacts in the project.
Connector information is stored and handled in a project in a structure.
To create a new project, execute the following command from your command prompt:
flow init <user project root directory>
It creates a new connector project in the specified directory. If a directory name is not provided, CLI creates a project under the current directory.
The options for the init command are shown in the table that follows:
Options
Description
Data Type
--help
Displays the help.
[boolean]
--parentDir, -d
The parent directory for the project.
[default: “.”]
--logLevel, -1
Sets the log level.
[default: “info”]
The init command creates a folder that contains the following components:
lib folder
test folder
package.json file
index.js file
The properties of the package.json file are described in the table:
package.json
Property
Description
name
Consists of any character that is valid in filenames. Preferably the name should be the name of the service to which connector interacts. The suffix should be –connector to indicate that it is a ThingWorx Flow connector. The name should be in the following format:
<ptc-servicename-connector>
The servicename cannot contain special characters other than an underscore (_).
For example, the name of ThingWorx Flow connector must be ptc-thingworx-connector in the package name.
description
Provide an appropriate description for the package as it is listed in the search results.
scripts
This is a dictionary containing script commands that are run at various times in the connector lifecycle.
To run test scripts, execute the following command:
npm test
To run custom scripts, execute the following command:
npm run <script name>
For more information on scripts, refer npm scripts website
dependencies
Other NPM packages that the connector uses in its code when the artifacts are started at runtime.
ptc-flow-sdk is a required dependency.
Do not remove the ptc-flow-sdk dependency because ThingWorx Flow may not be able to load the connector.
For more information on dependencies, refer to the dependencies section on the npm website.
devDependencies
Used during the development phase. You can map additional npm packages that are only used in testing the connector in the devDependencies.
For more information, refer to the devDependencies section on the npmjs website.
Was this helpful?