Funcraft is a command line tool provided by Function Compute. This tool allows you to easily manage the resources of Function Compute, API Gateway, and Log Service. A resource configuration file template.yml is used along with Funcraft to perform development, build, and deployment operations. This topic describes three methods to install Funcraft.

Step 1: Install Funcraft

You can use any of the following methods to install Funcraft:

  • Use npm: This method is applicable to Windows, macOS, and Linux operating systems where Node Package Manager (npm) is installed.
    1. Run the following command to install Funcraft:

      npm install @alicloud/fun -g
      Note
      • If the Error: EACCES: permission denied error message appears on Linux or macOS after the preceding command is run, you can run the sudo npm install @alicloud/fun -g command.
      • If the installation takes a long period of time, you can run npm --registry=https://registry.npm.taobao.org install @alicloud/fun -g to use the Taobao npm source.
    2. After the installation is complete, run the following command to view the version information:

      fun --version
  • Download a binary package: This method is applicable to Windows, macOS, and Linux operating systems. The following section describes the procedure:
    1. On the Releases page, click the corresponding download link to download the package of the latest version that suits your operating system.

    2. After the package has been downloaded, decompress the package. You can then use Funcraft.

    The following section describes the procedure for different operating systems in detail:

    • Windows operating system
      1. On the Releases page, download the latest released package named fun-*-win.exe.zip, where the asterisk (*) indicates the version number such as v3.6.20.
      2. Extract the fun-v3.6.20.win.exe file from fun-v3.6.20-win.exe.zip and rename the file to fun.exe.
      3. Save the fun.exe file under the system PATH directory such as C:\WINDOWS\System32.
      4. Open the terminal and run fun.exe --version to check whether Funcraft is installed and view the version number.
    • Linux operating system
      1. On the Releases page, view the latest released package. For example, Release 3.6.20 indicates that the version number is v3.6.20.
      2. Open a terminal such as Bash or Zsh and run the following command to download Funcraft.
        Notice If a newer version of Funcraft is available, replace v3.6.20 in the http://funcraft-release.oss-accelerate.aliyuncs.com/fun/fun-v3.6.20-linux.zip command with the latest version number.
        curl -o fun-linux.zip http://funcraft-release.oss-accelerate.aliyuncs.com/fun/fun-v3.6.20-linux.zip
        Expected output:
        % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                         Dload  Upload   Total   Spent    Left  Speed
        100 32.2M  100 32.2M    0     0  2606k      0  0:00:12  0:00:12 --:--:-- 2376k
      3. Run the following command to decompress the ZIP package:
        unzip fun-linux.zip
        Expected output:
        Archive:  fun-v3.6.20-linux.zip
          inflating: fun-v3.6.20-linux
      4. Run the following command to move the extracted file to the PATH directory.
        Notice If a newer version of Funcraft is available, replace v3.6.20 in the command with the latest version number.
        mv fun-v3.6.20-linux /usr/local/bin/fun
      5. Run the following command to check whether the latest Funcraft is installed:
        fun --version
        Expected output:
        3.6.20
    • macOS operating system
      1. On the Releases page, view the latest released package. For example, Release 3.6.20 indicates that the version number is v3.6.20.
      2. Open a terminal such as Bash or Zsh and run the following command to download Funcraft.
        Notice If a newer version of Funcraft is available, replace v3.6.20 in the http://funcraft-release.oss-accelerate.aliyuncs.com/fun/fun-v3.6.20-linux.zip command with the latest version number.
        curl -o fun-macos.zip http://funcraft-release.oss-accelerate.aliyuncs.com/fun/fun-v3.6.20-macos.zip
        Expected output:
        % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                         Dload  Upload   Total   Spent    Left  Speed
        100 47.8M  100 47.8M    0     0   724k      0  0:01:07  0:01:07 --:--:-- 3727k
      3. Run the following command to decompress the ZIP package:
        unzip fun-macos.zip
        Expected output:
        Archive:  fun-macos.zip
          inflating: fun-v3.6.20-macos
      4. Run the following command to move the extracted file to the PATH directory.
        Notice If a newer version of Funcraft is available, replace v3.6.20 in the command with the latest version number.
        mv fun-v3.6.20-macos /usr/local/bin/fun
      5. Run the following command to check whether the latest Funcraft is installed:
        fun --version
        Expected output:
        3.6.20
  • Use the Homebrew package manager: This method is applicable to macOS and provides developer-friendly operations.

    Run the following commands to install Funcraft:

    brew tap vangie/formula
    brew install fun            

Step 2: (Optional) Install Docker

You must install Docker in the development environment if you want to compile and install dependencies or debug locally by using the fun install, fun build, or fun local command of Funcraft.

For more information about how to download other editions of Docker, visit dockerhub.

What to do next

Configure Funcraft