Skip to content

Commit

Permalink
Update for Snowtype 0.8.0 (#964)
Browse files Browse the repository at this point in the history
  • Loading branch information
igneel64 authored Jul 24, 2024
1 parent 232375e commit 05120e8
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 4 deletions.
6 changes: 4 additions & 2 deletions docs/collecting-data/code-generation/commands/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ Initialize the setup of Snowtype code generation in a project. Creates the confi
Generates tracking code based on configuration on the configuration file. Can generate/modify the `.snowtype-lock.json` file.

**Options**
- `-is, --instructions` Generate event specification instructions.
- `-va, --validations` Add runtime validation on events. _Currently available for the Browser tracker_.
- `--instructions` Generate event specification instructions.
- `--no-instructions` Generate without instructions.
- `--validations` Add runtime validation on events. _Currently available for the Browser tracker_.
- `--no-validations` Do not add runtime validation on events.
- `--disallowDevSchemas` Disallow generation of code using schemas deployed on DEV environment. _Sending events using schemas deployed on DEV, will result in failed events in production pipelines._ (default: false)

### `snowtype update`
Expand Down
48 changes: 48 additions & 0 deletions docs/collecting-data/code-generation/snowtype-config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,38 @@ The target language to generate the required code for. [See list of available la

The outpath relative to the current working directory when running the script.

### `options`

Options related to Snowtype behavior and are described by the following TypeScript type:

```ts
options?: {
/* Command related options. */
commands: {
generate?: {
/* Generate implementation instructions. */
instructions?: boolean;
/* Add runtime validations. */
validations?: boolean;
/* Disallow generation of code using schemas only deployed on DEV environment. */
disallowDevSchemas?: boolean;
}
update?: {
/* Update your configuration file automatically and regenerate the code of the latest available update. */
regenerateOnUpdate?: boolean
/* The maximum SchemaVer update to show an available update notification for. */
maximumBump?: "major" | "minor" | "patch"
}
patch?: {
/* Automatically regenerate the code after a successful patch operation. */
regenerateOnPatch?: boolean
}
}
}
```

_Keep in mind that CLI flags take precedence over configuration file options._


## Example configuration file

Expand Down Expand Up @@ -110,6 +142,22 @@ type SnowtypeConfig = {
dataStructures?: string[];
eventSpecificationIds?: string[];
dataProductIds?: string[];
options?: {
commands: {
generate?: {
instructions?: boolean;
validations?: boolean;
disallowDevSchemas?: boolean;
}
update?: {
regenerateOnUpdate?: boolean
maximumBump?: "major" | "minor" | "patch"
}
patch?: {
regenerateOnPatch?: boolean
}
}
}
};

const config: SnowtypeConfig = {
Expand Down
5 changes: 3 additions & 2 deletions docs/collecting-data/code-generation/using-the-cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ By using the `--instructions` option on the `snowtype generate` command, you can

This includes:
- Trigger description.
- Implementation rules.
- Images uploaded on your Event Specification triggers.
- App identifiers and URLs this event should be triggered on.
- Direct links to the code for this Event Specification.
Expand Down Expand Up @@ -366,7 +367,7 @@ An example showcasing the flag's behavior:
This Data Structure has other deployed versions such as `1-0-1`, `1-1-0` and `2-0-0`. The `update` command will show available updates as follows:
```sh
```bash
npx @snowplow/snowtype update --maximumBump=major
# Will prompt an update to 2-0-0 or any other available update.
Expand All @@ -382,4 +383,4 @@ npx @snowplow/snowtype update --maximumBump=patch
While developing or testing, it might be useful to use [Snowplow Mini](../../../pipeline-components-and-applications/snowplow-mini/) to validate against your new schemas in your development environment.
In this and any other case you are developing a schema and eventually publishing the tracking to production, you need to make sure all the schemas you are using are deployed to the production environment for the pipeline to use. Failing to do that will result in failed events.
Snowtype by default will print a warning when code is generated using schemas only published to development environment. To make sure that there are no schemas not yet deployed to production, you can use the `--disallowDevSchemas` flag when using the `generate` command. Using this flag will make sure each generation attempt will fail, indicating the schemas that are not yet deployed to the production environment.
Snowtype by default will print a warning when code is generated using schemas only published to development environment. To make sure that there are no schemas not yet deployed to production, you can use the `--disallowDevSchemas` flag or option when using the `generate` command. Using this flag will make sure each generation attempt will fail, indicating the schemas that are not yet deployed to the production environment.

0 comments on commit 05120e8

Please sign in to comment.