Workspace Setup
Workspace Initialization
To develop locally for Canvas you must create a workspace
. A workspace is a folder to store and organize all your blocks, workflows and requests. You can use any folder on your local machine.
It's recommended that you create the workspace folder in your local users/user name
folder, and not in your root drive, to avoid possible access rights issues when debugging workflows. You can only have one workspace at a time, but you are free to move it later if you wish.
You create the workspace, open the desired folder in VS Code and call the cma:Init Workspace
command. You will be prompted to confirm.
After initialization, your workspace will contain the following folders:
/blocks
- New blocks that you create./workflows
- Workflows pulled from a Canvas account you have access to./requests
- REST API requests you can make to application connectors./proxy_modules
- Pre-built JavaScript modules that wrap Canvas function calls e.g. api, fx etc, custom functions. This makes local debug possible. You should not modify the contents of any file in this folder.
Node Modules
After you have initialized workspace, you must install the following npm modules required for debugging.
- date-fns
- keytar
- ssh2-sftp-client
- underscore
- utf8
- xml-js
You will see a package.json file in the workspace after running the cma: Init Workspace
command. The package.json file contains references to all the required npm packages. To install them, open a terminal/command line in the root folder of your workspace and run the following command:
npm install
After installation you should see a node_modules
folder in your workspace directory containing the installed packages. While you can install node packages globally, it is recommended to install locally in your workspace. This is to prevent possible interference with other code already on your machine that may be referencing the same packages.