Funcraft is a command line tool provided by Function Compute. This tool allows you to easily manage 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 one of the following methods to install Funcraft:

  • Use npm: This method is applicable in Windows, macOS, and Linux operating systems that have installed Node package manager (npm).
    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 fun command in the terminal to view the version information:

      $fun --version
  • Download a binary package: This method is applicable in Windows, macOS, and Linux operating systems. The procedure is as follows:
    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 detailed procedures for different operating systems are as follows:

    • Windows
      1. Download the latest released package named fun-*-win.exe.zip, where the asterisk (*) indicates the version number such as v3.6.1.
      2. Extract the fun-*.win.exe file from fun-*-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 Fun is installed and view the version number.
    • Linux

      Open the terminal and run the following commands in sequence in Bash or Z shell (Zsh):

      # Specify the version. Replace v3.6.1 with the latest version displayed on the https://github.com/aliyun/fun/releases page.
      $ FUN_VERSION="v3.6.1"
      
      # Download the package.
      $ curl -o fun-linux.zip https://gosspublic.alicdn.com/fun/fun-$FUN_VERSION-linux.zip
        % 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
      
      # Decompress the ZIP package.
      $ unzip fun-linux.zip
      Archive:  fun-v3.6.1-linux.zip
        inflating: fun-v3.6.1-linux
      
      # Move the extracted file to the PATH directory.
      $ mv fun-*-linux /usr/local/bin/fun
      
      # Check the version.
      $ fun --version
      3.6.1       
    • macOS

      Open the terminal and run the following commands in sequence in Bash or Zsh:

      # Specify the version. Replace v3.6.1 with the latest version displayed on the https://github.com/aliyun/fun/releases page.
      $ FUN_VERSION="v3.6.1"
      
      # Download the package.
      $ curl -o fun-macos.zip https://gosspublic.alicdn.com/fun/fun-$FUN_VERSION-macos.zip
        % 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
      
      # Decompress the ZIP package.
      $ unzip fun-macos.zip
      Archive:  fun-v3.6.1-macos.zip
        inflating: fun-v3.6.1-macos
      
      # Move the extracted file to the PATH directory.
      $ mv fun-*-macos /usr/local/bin/fun
      
      # Check the version.
      $ fun --version
      3.6.1          
  • Use the Homebrew package manager: This method is applicable in macOS and provides developer-friendly operations.

    Run the following commands to install Funcraft:

    brew tap vangie/formula
    brew install fun            

(Optional) Step 2: 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 Fun.

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