@postxl/generator 0.33.0 → 0.33.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,6 +32,7 @@ function generateEnumSelect({ enumerator, meta }) {
32
32
  */`;
33
33
  }
34
34
  return `
35
+ /* eslint-disable @typescript-eslint/no-unused-vars */
35
36
  import { useField } from 'formik'
36
37
  import React from 'react'
37
38
 
@@ -5,31 +5,34 @@ exports.generateEnumType = void 0;
5
5
  * Generator that generates type definitions for all enumerators.
6
6
  */
7
7
  function generateEnumType({ enumerator, meta, prismaClientPath, }) {
8
- return `
9
- import * as Prisma from '${prismaClientPath}'
10
-
11
- export type ${enumerator.tsTypeName} = Prisma.${enumerator.sourceName}
12
- export const ${enumerator.tsTypeName} = Prisma.${enumerator.sourceName}
13
- ${enumerator.description
14
- ? `/**
15
- * ${enumerator.description.split('\n').join('\n * ')}
16
- */
17
- `
18
- : ''}
19
- export const ${meta.types.membersList}: ${enumerator.tsTypeName}[] = [
20
- ${enumerator.values
21
- .map((v) => {
8
+ let description = '';
9
+ if (enumerator.description) {
10
+ description = `
11
+ /**
12
+ * ${enumerator.description.split('\n').join('\n * ')}
13
+ */`;
14
+ }
15
+ const cases = enumerator.values.map((v) => {
22
16
  var _a;
23
17
  const description = (_a = enumerator.attributes.valueDescription) === null || _a === void 0 ? void 0 : _a[v];
24
18
  if (description) {
25
19
  return `
26
- /** ${description} */
27
- '${v}'
28
- `;
20
+ /** ${description} */
21
+ '${v}'
22
+ `;
29
23
  }
30
24
  return `'${v}'`;
31
- })
32
- .join(', ')}
25
+ });
26
+ return `
27
+ /* eslint-disable @typescript-eslint/no-unused-vars */
28
+ import * as Prisma from '${prismaClientPath}'
29
+
30
+ export type ${enumerator.tsTypeName} = Prisma.${enumerator.sourceName}
31
+ export const ${enumerator.tsTypeName} = Prisma.${enumerator.sourceName}
32
+
33
+ ${description}
34
+ export const ${meta.types.membersList}: ${enumerator.tsTypeName}[] = [
35
+ ${cases.join(', ')}
33
36
  ]
34
37
  `;
35
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@postxl/generator",
3
- "version": "0.33.0",
3
+ "version": "0.33.2",
4
4
  "main": "./dist/generator.js",
5
5
  "typings": "./dist/generator.d.ts",
6
6
  "bin": {