# NVON-react-toolbox

This is a package intended to collect useful node based scripts and functions.

## Available functions

### NPM

- checkArgumentsForDryRun (Check for --dry-run argument)
- determineVersionChangeFromArguments (check arguments for npm compatible version change)
- buildAndPublish (build and publish an npm package)

### SVG

- SVG component templates (can be passed to other create functions)
  - gatsbySvgComponentTemplate
  - createReactAppSvgComponentTemplate
- createSvgComponents (create a SVG components in a target directory from SVGs within a path)
- createComponentFromSvg (create a SVG component in a target directory from a file path)
- createSvgMap (create a map of components based on created SVG components)

## Development

To work on the publishing scripts, `npm run scripts-compile-watch` can be used. Compiled scripts are accessible in `scripts/dist`.

For passing flags to scripts, you need to use a `--` between the script and your flags. Otherwise, those flags will be consumed before the script is invoked:

```bash
npm run publish-package -- --minor --dry-run
```

### Debugging scripts

For debugging an npm script in vscode, the `launch.json` can be adjusted, so that the `runtimeArgs` reflect the script you want to debug.

## Publishing

- make sure your git repository is clean
- decide on the version change (patch/minor/major)
- run the publish-package command: `npm run publish-package -- --minor`
