|
| 1 | +# Snooty Transport Module |
| 2 | + |
| 3 | +As part of integrating Snooty Parser with the unified Snooty toolchain, this module holds exclusive responsibility over transporting and persisting AST and metadata output artifacts from the parser into datastores. |
| 4 | + |
| 5 | +Currently, this module supports persistence to Mongodb Atlas instances, and is also responsible for mutation of entries at persist time. |
| 6 | + |
| 7 | +## Installation |
| 8 | + |
| 9 | +By default, this module requires Node v14.17.6 and uses a `.nvmrc` file if using nvm. |
| 10 | +Running `npm ci` to install all dependencies is required for usage. |
| 11 | + |
| 12 | +An example environment file is available at `sample.env`. |
| 13 | +Copy this file to `.env` in order to use a local environment file. |
| 14 | + |
| 15 | +## Building and Running |
| 16 | + |
| 17 | +### `npm run build` |
| 18 | + |
| 19 | +Compiles the module using `tsc`. By default, compiles to the `./dist` directory. |
| 20 | + |
| 21 | +### `npm run start` |
| 22 | + |
| 23 | +Runs the contents of the `./dist` directory. |
| 24 | +Requires usage of `-- -path` argument, eg `npm run start -- --path ./build/artifacts.zip`. |
| 25 | +Recommended command for running this module in higher than local environments. |
| 26 | +Requires parser output artifacts to be present in specified directory and zip file at `--path` value specified. |
| 27 | + |
| 28 | +### `npm run dev` |
| 29 | + |
| 30 | +Cleans dist, compiles, and runs with arguments `-path ./build/artifacts.zip`. |
| 31 | +Requires parser output artifacts to be present in specified directory and zip file at `./build/artifacts.zip`. |
| 32 | + |
| 33 | +## Available Arguments |
| 34 | + |
| 35 | +This module utilizes [minimist](https://www.npmjs.com/package/minimist) for argument parsing. |
| 36 | +For more information on accepted argument formats, please consult [its documentation](https://www.npmjs.com/package/minimist). |
| 37 | + |
| 38 | +### `-path` |
| 39 | + |
| 40 | +| values | any string | |
| 41 | +| ------ | ---------- | |
| 42 | + |
| 43 | +Required string formatted filepath where build artifacts are housed. |
| 44 | + |
| 45 | +### `-strict` |
| 46 | + |
| 47 | +| values | 'y', 'yes', 'true' | |
| 48 | +| ------ | ------------------ | |
| 49 | + |
| 50 | +Optional string formatted argument for whether module should exit with non-zero status on failure. |
| 51 | +Highly recommended for use in production environments. |
| 52 | + |
| 53 | +## Using/Developing This Module |
| 54 | + |
| 55 | +Usage and development of this module requires specifying the following environment variables. Use of a `.env` file is supported, but only recommended for local development. |
| 56 | + |
| 57 | +If adding a new environment variable, please update the `sample.env`. The `sample.env` should be considered the primary documentation for supported environment variables within this module. |
0 commit comments