Skip to content

Commit 6d1fc69

Browse files
authored
Add automatic function discovery (#11)
* add: automatic function discovery * fix: typo * Fix: lint * fix:test * fix: functions disovery test * minor changes
1 parent 5379499 commit 6d1fc69

File tree

12 files changed

+320
-69
lines changed

12 files changed

+320
-69
lines changed

README.md

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ It detects any changes to a function by bundling it into a single minified file,
1111

1212
## Usage
1313

14-
- Create a `.differspec.json` file in the directory containing your Firebase Functions:
14+
- Create a `.differspec.json` file in the directory containing your Firebase Functions:
1515

1616
```shell
1717
my-firebase-project
1818
├── firebase.json
1919
├── functions
2020
├── src
21-
└── .differspec.json
21+
└── .differspec.json
2222
```
2323

24-
- Specify your function names and their paths in `.differspec.json`:
24+
- Specify your function names and their paths in `.differspec.json`:
2525

2626
```json
2727
{
@@ -32,14 +32,14 @@ my-firebase-project
3232
}
3333
```
3434

35-
- Run `functions-differ` in the directory containing `.differspec.json`
35+
- Run `functions-differ` in the directory containing `.differspec.json`
3636

3737
```shell
3838
cd my-firebase-project/functions
3939
functions-differ
4040
```
4141

42-
- `functions-differ` will then output a list of functions that need to be (re)deployed. This includes any functions that were changed or added since its last invocation.
42+
- `functions-differ` will then output a list of functions that need to be (re)deployed. This includes any functions that were changed or added since its last invocation.
4343

4444
```shell
4545
> functions-differ
@@ -52,13 +52,17 @@ The default output is suitable for passing to `firebase deploy --only` command.
5252

5353
`functions-differ` supports the following options:
5454

55-
| Name | Alias | Description | Default |
56-
| ------- | ----- | ------------------------------------------------ | --------------------------- |
57-
| dir | d | The directory containing `.differspec.json` file | (current working directory) |
58-
| write | w | Write output to `.differspec.json` file or not | true |
59-
| verbose | v | Output verbose logs | false |
60-
| prefix | | Prefix for each function name output | `functions:` |
61-
| sep | | Separator for each output function | `,` |
55+
| Name | Alias | Description | Default |
56+
| ------------- | ----- | ------------------------------------------------------------------------------------------------------------ | --------------------------------------- |
57+
| dir | d | The directory containing `.differspec.json` file | (current working directory) |
58+
| write | w | Write output to `.differspec.json` file or not | true |
59+
| verbose | v | Output verbose logs | false |
60+
| prefix | | Prefix for each function name output | `functions:` |
61+
| sep | | Separator for each output function | `,` |
62+
| bundlerConfig | | Path to the bundler config file which would be passed to esbuild | |
63+
| concurrency | | Number to control the concurrency of the bundling process. Useful in CI/CD flows with limited memory | Number of functions in .differspec.json |
64+
| discover | | Flag indicating whether to use automatic function path discovery | false |
65+
| indexFilePath | | Location of the index.ts file which exports all the functions. Optional. Only used if used with `--discover` | `src/index.ts` |
6266

6367
## .differspec.json
6468

@@ -70,14 +74,14 @@ The default output is suitable for passing to `firebase deploy --only` command.
7074
| `hashes` | (**AUTOGENERATED, DO NOT MODIFY**) JSON object containing hashes of all functions in the `functions` property |
7175
| `lastDiff` | (**AUTOGENERATED, DO NOT MODIFY**) JSON object containing the results of the last successful invocation of `functions-differ` |
7276

73-
- The `functions` property serves as an index of all functions present in your repository. `functions-differ` does not support automatic discovery of functions in the project (yet), and therefore this property is required.
74-
- The `hashes` and `lastDiff` properties are autogenerated by `functions-differ`, and should not be created/edited manually.
77+
- The `functions` property serves as an index of all functions present in your repository. `functions-differ` does not support automatic discovery of functions in the project (yet), and therefore this property is required.
78+
- The `hashes` and `lastDiff` properties are autogenerated by `functions-differ`, and should not be created/edited manually.
7579

7680
## Contributions
7781

7882
Please discuss bugs, feature requests, and help in Github Issues. Pull requests are welcome, but please make sure to open an issue for your changes first.
7983

80-
## Installation
84+
## Installation
8185

8286
Install the package with `npm`:
8387

0 commit comments

Comments
 (0)