# @philipcatterall99/dataverse-gen

> Early bound types generator for dataverse-ify. This is an early test version which is a fork of Scott Durow's dataverse-gen. It is a work in progress aimed at adding Business Process Flow Metadata and a typings file for attributes. Ultimate goal is to typ

Latest version **1.0.2** (published 2023-05-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @philipcatterall99/dataverse-gen
pnpm add @philipcatterall99/dataverse-gen
yarn add @philipcatterall99/dataverse-gen
bun add @philipcatterall99/dataverse-gen
```

Provides the command `dataverse-gen`.

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; large bundle.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2023-05-23 |
| First published | 2023-05-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 10.1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Scott Durow |
| Maintainers | philipcatterall99 |

## Links

- npm: https://www.npmjs.com/package/@philipcatterall99/dataverse-gen
- Repository: https://github.com/philcatterall/dataverse-gen
- Homepage: https://github.com/philcatterall/dataverse-gen#readme
- Issues: https://github.com/philcatterall/dataverse-gen/issues
- npm.io page: https://npm.io/package/@philipcatterall99/dataverse-gen

## Dependencies (10)

- [ejs](https://npm.io/package/ejs.md) ^3.1.5
- [chalk](https://npm.io/package/chalk.md) ^4.1.0
- [config](https://npm.io/package/config.md) ^3.3.7
- [xml-js](https://npm.io/package/xml-js.md) ^1.6.11
- [enquirer](https://npm.io/package/enquirer.md) ^2.3.6
- [fs-extra](https://npm.io/package/fs-extra.md) ^9.0.1
- [minimist](https://npm.io/package/minimist.md) ^1.2.5
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.1
- [lodash.merge](https://npm.io/package/lodash.merge.md) ^4.6.2
- [dataverse-ify](https://npm.io/package/dataverse-ify.md) ^2.0.6

## Recent versions

- 1.0.2 (latest) — 2023-05-23

## README

# dataverse-gen

Creates early bound TypeScript interfaces to work with `dataverse-ify`.
For more information see the [dataverse-ify project](https://github.com/scottdurow/dataverse-ify/wiki)

## Usage

1.  Add authentication for your Microsoft Dataverse Environment:\
`~$ npx dataverse-auth [environment]`\
E.g.\
`~$ npx dataverse-auth contosoorg.crm.dynamics.com`

1. Initialise dataverse-ify to create .dataverse-gen.json config file:\
`~$ npx dataverse-gen init`

1. At any time, you can re-generate the early bound types using:\
`~$ npx dataverse-gen`

## `.dataverse-gen.json`
The configuration for dataverse-gen is stored in the `.dataverse-gen.json` file. You can edit this manually if you want rather than use `npx dataverse-gen init`.  This is the only file that is needed to run `npx dataverse-gen`.

The standard templates use references to the dataverse-ify types, and so unless you edit the templates (see below) you will need to install these types using:

```shell
npm install --save dataverse-ify
```
## Custom Templates
If you wanted to just generate Attribute `enum` constants and stop there, you can easily customise the scripts to suit your needs by using:

```shell
npx dataverse-gen eject
```

This will create a step of templates ready to customise in the `_templates` folder. Once you have made your updates, just run `npx dataverse-gen` again. The templates use the awesome [ejs](https://ejs.co/) project. E.g.

```typescript
// Attribute constants
export const enum <%- locals.SchemaName %>Attributes {
<%locals.Properties && locals.Properties.forEach(function(property){ _%>
 <%- property.SchemaName %> = "<%- property.Name %>",
<%})_%>
}
```

If you wanted to revert back to the standard templates, just delete the  `_templates` folder
## Installing Globally
If you would rather install dataverse-gen globally you can use:\
`~$ npm install -g dataverse-gen dataverse-auth`

This will then allow you to simply use:\
`~$ dataverse-auth`\
`~$ dataverse-gen`

For more information see the [dataverse-ify project](https://github.com/scottdurow/dataverse-ify/wiki)

Notes:
1. Files differ by case only. If you get an error from the imports in the generated types, it is likely that your file names have the wrong case. dataverse-gen will remember re-use the file name if it exsts when generating - even if the casing is different. The solution is to completely remove all your generated files and regenerated them to get the correct casing.

---
_Source: https://npm.io/package/@philipcatterall99/dataverse-gen · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
