0.8.0-0 • Published 3 years ago

@getcircuit/ffd v0.8.0-0

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

(f)irebase-(f)unctions-(d)eployer

Stop deploying everything. Detect what functions to deploy with ffd.

Under active development. Not ready for usage.

Have you ever needed a tool to automate deployments without pushing all the functions, all the time? ffd allows you to deploy only functions that changed since your last deploy.

ffd works by scanning the file where your function is declared. If the file content changes, even if the change is within the dependency tree (via import or require) the script spots the difference and generates a new hash for the file.

File hashes are stored in a file called functions-lock.json created by ffd:

{
  "warning": "DO NOT EDIT. THIS FILE IS AUTO-GENERATED.",
  "functions": {
    "moduleA": "3bc37d786d96117935bb",
    "moduleB": "3d029baae420526b36ca"
  }
}

To generate a functions-lock.json file, ffd needs a config file. The config file includes information about your functions and their path location.

Sample config file:

{
  "myFunctionName1": "./myFunctionName1.js",
  "myFunctionName2": "./myFunctionName2.js"
}

Note: In an ideal world, each function you want to deploy would be stored in their own file. If you are not there yet, and ffd spots a file with more than one function, any changes within that file would trigger an update on every function. That is due to how ffd works, and the best you can do to avoid this scenario is splitting functions into their own files.

{
  // `myFunctionName1` has same path as `myFunctionName3`. Changes within `./myFunctionName1.js` scope
  // updates both `myFunctionName1` and `myFunctionName3`. Split functions into files to prevent this.
  "myFunctionName1": "./myFunctionName__shared.js",
  "myFunctionName2": "./myFunctionName2.js",
  "myFunctionName3": "./myFunctionName__shared.js"
}

Install

# works via npm too. volta too.
yarn add firebase-functions-deployer

Usage

Package comes with an alias ffd. Acronym means (f)irebase-(f)unctions-(d)eployer. As a CLI tool, you should run it via npx. The CLI expects a --config parameter to work.

npx ffd --config <path_to_config_file> <options>

Options

Options:
  -V, --version                                   output the version number
  -c, --config <path_to_config_file>              set config file path
  -d, --debug <none|errors-only|errors-warnings>  output debug info (default: "none")
  -h, --help                                      display help for command

License

MIT