<commit_before># USAGE

Serverless build uses the `sls deploy` and `sls deploy function` CLI commands, overriding the standard build
functionality.

- [Configure serverless build](./Install%20&%20Config.md)
- [Configure serverless with AWS credentials](https://serverless.com/framework/docs/providers/aws/guide/credentials/)
- `sls deploy` to deploy your resources and all functions at once
- `sls invoke -l -f <fnName>` to invoke a deployed function
- `sls deploy function -f <fnName>` to deploy a single function
- `NODE_ENV=production sls deploy function -f <fnName>` when your build process cares about `process.env.NODE_ENV`

Try adding this to your npm scripts, to both deploy and run at once:
```json
{
    "scripts": {
        "function": "sls deploy function -f $FUNCTION && sls invoke -l -f $FUNCTION"
    }
}
```

And running `FUNCTION=myFn npm run function`

## TEST IT OUT

If you'd like to test out a preconfigured project...

```
git clone git@github.com:nfour/serverless-build-plugin
cd serverless-build-plugin
npm i
npm run build
npm link
cd test/1.0
npm link serverless-build-plugin
<commit_msg>Update script<commit_after># USAGE

Serverless build uses the `sls deploy` and `sls deploy function` CLI commands, overriding the standard build
functionality.

- [Configure serverless build](./Install%20&%20Config.md)
- [Configure serverless with AWS credentials](https://serverless.com/framework/docs/providers/aws/guide/credentials/)
- `sls deploy` to deploy your resources and all functions at once
- `sls invoke -l -f <fnName>` to invoke a deployed function
- `sls deploy function -f <fnName>` to deploy a single function
- `NODE_ENV=production sls deploy function -f <fnName>` when your build process cares about `process.env.NODE_ENV`

Try adding this to your npm scripts, to both deploy and run at once:
```json
{
    "scripts": {
        "function": "sls deploy function -f $FUNCTION && sls invoke -l -f $FUNCTION"
    }
}
```

And running `FUNCTION=myFn npm run function`

## TEST IT OUT

If you'd like to test out a preconfigured project...

```
git clone <EMAIL>:nfour/serverless-build-plugin
cd serverless-build-plugin
npm i
npm run build
npm link
cd test/1.0
npm i
npm link serverless-build-plugin

{'fraction_non_alphanumeric': 0.10337078651685393, 'fraction_numerical': 0.005393258426966292, 'mean_word_length': 4.213114754098361, 'pattern_counts': {'":': 4, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4757895', 'n_tokens_mistral': 704, 'n_tokens_neox': 664, 'n_words': 269}