We have released v7.0 of the Freshworks CLI (fdk). fdk 7 brings Node.js v12 support (deprecating support for Node.js v10), ES6+ support, and a couple of new manifest.json
fields to track Node.js and fdk versions.
If you build apps on the Freshworks Developer Platform (Platform), you will need to update fdk to v7.0 and make a few small changes to your existing apps to ensure they continue working with the Platform.
Install fdk 7
With Node.js v12.22+ installed, fdk 7 can be installed via npm
with this command:
$ npm install https://dl.freshdev.io/cli/fdk.tgz -g
Continue reading to know more.
A little background
fdk is a developer toolkit to develop and test Freshworks apps locally. It can simulate production events in a dev environment. This makes it important to ensure fdk runs on the same version(s) of Node.js that the Freshworks Developer Platform (Platform) will run published apps on. The Platform used Node.js v10 to run apps so far. This is why our developer docs recommended running fdk locally on Node.js v10 to ensure code compatibility between development and production.
With Node.js v10 reaching its end of life (EOL) in April ‘21, we needed to make sure the Platform allows only currently supported versions of Node.js. As a developer platform, while we want to stay in sync with the Node.js project’s release cadence, we also want to reduce developer effort in maintaining apps.
In the near future, the Platform plans to support multiple Node.js versions simultaneously. As a Node.js LTS version reaches EOL, the Platform will deprecate that in favour of newer LTS versions. Given that Node.js usually supports multiple LTS versions at a given time, apps will need a way to tell the Platform which Node.js version they want to run on.
All of this meant a new major release of fdk was due.
Important changes in fdk 7
- Node.js version: fdk 7 requires Node.js v12.22.
-
ES6+ support: Apps will now be able to use most ES6+ (ES2018) features in both serverless and browser environments. This was disabled in earlier versions of fdk. Apps can now use
async/await
. ES6 experimental features, like theimport
modules syntax (import
andexport
) are not enabled. -
manifest.json
: A newengines
object has been added tomanifest.json
. This will enable the Platform to keep track of the Node.js version and the fdk version used to develop and pack the app. -
Major version mismatch: If there is a major version mismatch for Node.js, e.g., if Node.js v10.x is used while the manifest.json mentions Node.js v12.x in the
engines.node
property, fdk will ask if you want to make the following changes:- Delete the
coverage/
folder - Delete the
node_modules
folder - Change the Node.js version in the
engines.node
property inmanifest.json
to the Node.js version in use
- Delete the
-
Minor version mismatch: Similarly, if there is a minor Node.js version mismatch, e.g., if fdk finds Node.js v12.22.1 available while v12.18.1 is mentioned in
manifest.json
, fdk will update theengines.node
property inmanifest.json
to the available Node.js version -
fdk pack
: fdk will show an[INFO]
message when running$ fdk pack
with the version of Node.js and fdk used to pack the app.- If there is a major version mismatch for the Node.js runtime available, fdk will pack only if changes mentioned in “Major version mismatch” above were applied
Updating to fdk 7
Updating to fdk 7 requires a fresh install with the supported Node.js version installed. If you already have fdk 6 installed, the inbuilt update prompt will not ask you to update to fdk 7. You will need to install Node.js v12.22 and then install fdk 7. Follow the steps below based on how you have installed Node.js:
Using nvm
If you use nvm to manage Node.js versions, start by installing the required version of Node.js using nvm:
$ nvm install 12.22
Use nvm to switch to the required Node.js version, if it doesn’t switch automatically after install:
$ nvm use 12.22
nvm keeps globally installed modules in a separate directory for each Node.js version installed, so you’ll have to install fdk again, even if you had fdk 6 already setup. This will not affect existing app code:
$ npm install https://dl.freshdev.io/cli/fdk.tgz -g
Check the version of fdk available:
$ fdk version
Note for Windows users: nvm works in MacOS, Linux and WSL (Windows Subsystem for Linux). If you do not use WSL in Windows, consider installing nvm-windows instead.
Using Node.js installer or a package manager
If you do not use nvm, then you will have to install Node.js v12.22 from the Node.js releases page.
If you use a package manager (like apt
on Debian-based systems, or dnf
for Fedora-based systems, or brew
on MacOS) to install Node.js, you will have to find the exact version of the Node.js package for that package manager and install it. (Hint: it is easier to use nvm.)
After installing Node.js v12.22, install the latest version of fdk using:
$ npm install https://dl.freshdev.io/cli/fdk.tgz -g
Migrating existing apps
Please follow the wiki article on Migrating existing apps from fdk 6 to fdk 7.
Troubleshooting
Q: I installed fdk 7.0.0. fdk pack
throws parsing errors when using async
functions in frontend apps. How can I fix it?
A: Please update to fdk v7.0.1
. We have released a fix addressing this issue. If you already have fdk v7.0.0
installed, you will get an update prompt when running fdk
. You can also install the latest fdk
using instructions mentioned above.
Q: I use nvm. I updated fdk using the update command. Then, I upgraded my Node.js version to v12.22 using nvm. After upgrading, I get command not found
error when running fdk.
A: nvm stores globally installed modules in separate directories for each Node.js version installed on a system. You will need to install fdk again for the new Node.js version.
Q: I am still facing issues related to fdk 7. Where can I ask for help?
A: You can post a new topic in the “App Development” category.
Changelog
v7.0.1
- Fixed ES2018 support for frontend apps. (Thanks @Konanki_Prakash for reporting this issue)