@postxl/generator 0.74.1 → 1.0.1

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.
Files changed (189) hide show
  1. package/LICENSE +50 -0
  2. package/README.md +79 -1
  3. package/dist/generator-manager.class.d.ts +59 -0
  4. package/dist/generator-manager.class.js +221 -0
  5. package/dist/generator.class.d.ts +90 -0
  6. package/dist/generator.class.js +32 -0
  7. package/dist/generator.context.d.ts +174 -0
  8. package/dist/generator.context.js +125 -0
  9. package/dist/helpers/branded.types.d.ts +149 -0
  10. package/dist/helpers/branded.types.js +111 -0
  11. package/dist/helpers/config-builder.class.d.ts +27 -0
  12. package/dist/helpers/config-builder.class.js +54 -0
  13. package/dist/helpers/import-generator.class.d.ts +70 -0
  14. package/dist/helpers/import-generator.class.js +166 -0
  15. package/dist/helpers/importable.types.d.ts +52 -0
  16. package/dist/helpers/importable.types.js +15 -0
  17. package/dist/helpers/index-generator.class.d.ts +10 -0
  18. package/dist/helpers/index-generator.class.js +46 -0
  19. package/dist/helpers/index.d.ts +8 -0
  20. package/dist/helpers/index.js +24 -0
  21. package/dist/helpers/package-json.generator.d.ts +56 -0
  22. package/dist/helpers/package-json.generator.js +36 -0
  23. package/dist/helpers/tsconfig.generator.d.ts +1 -0
  24. package/dist/helpers/tsconfig.generator.js +14 -0
  25. package/dist/helpers/verify-context.d.ts +4 -0
  26. package/dist/helpers/verify-context.js +23 -0
  27. package/dist/index.d.ts +5 -0
  28. package/dist/index.js +21 -0
  29. package/dist/utils/checksum.d.ts +10 -0
  30. package/dist/utils/checksum.js +132 -0
  31. package/dist/utils/fs-utils.d.ts +34 -0
  32. package/dist/utils/fs-utils.js +126 -0
  33. package/dist/utils/index.d.ts +10 -0
  34. package/dist/utils/index.js +26 -0
  35. package/dist/utils/jsdoc.d.ts +12 -0
  36. package/dist/utils/jsdoc.js +37 -0
  37. package/dist/utils/lint.d.ts +46 -0
  38. package/dist/utils/lint.js +154 -0
  39. package/dist/utils/lockfile.d.ts +7 -0
  40. package/dist/utils/lockfile.js +80 -0
  41. package/dist/utils/logger.class.d.ts +25 -0
  42. package/dist/utils/logger.class.js +55 -0
  43. package/dist/utils/merge-conflict.d.ts +55 -0
  44. package/dist/utils/merge-conflict.js +264 -0
  45. package/dist/utils/path.d.ts +52 -0
  46. package/dist/utils/path.js +183 -0
  47. package/dist/utils/prettier-config.d.ts +2 -0
  48. package/dist/utils/prettier-config.js +13 -0
  49. package/dist/utils/prettier.d.ts +5 -0
  50. package/dist/utils/prettier.js +67 -0
  51. package/dist/utils/prettier.skiptest.d.ts +1 -0
  52. package/dist/utils/prettier.skiptest.js +22 -0
  53. package/dist/utils/promise.d.ts +2 -0
  54. package/dist/utils/promise.js +10 -0
  55. package/dist/utils/string-functions.d.ts +9 -0
  56. package/dist/utils/string-functions.js +23 -0
  57. package/dist/utils/sync-log-result.d.ts +9 -0
  58. package/dist/utils/sync-log-result.js +90 -0
  59. package/dist/utils/sync.d.ts +143 -0
  60. package/dist/utils/sync.js +325 -0
  61. package/dist/utils/template.d.ts +66 -0
  62. package/dist/utils/template.js +159 -0
  63. package/dist/utils/vfs.class.d.ts +115 -0
  64. package/dist/utils/vfs.class.js +239 -0
  65. package/dist/utils/zip.d.ts +13 -0
  66. package/dist/utils/zip.js +40 -0
  67. package/package.json +57 -34
  68. package/dist/generator.d.ts +0 -13
  69. package/dist/generator.js +0 -455
  70. package/dist/generators/enums/react.generator.d.ts +0 -10
  71. package/dist/generators/enums/react.generator.js +0 -110
  72. package/dist/generators/enums/types.generator.d.ts +0 -10
  73. package/dist/generators/enums/types.generator.js +0 -39
  74. package/dist/generators/indices/data/module.generator.d.ts +0 -9
  75. package/dist/generators/indices/data/module.generator.js +0 -60
  76. package/dist/generators/indices/data/service.generator.d.ts +0 -9
  77. package/dist/generators/indices/data/service.generator.js +0 -249
  78. package/dist/generators/indices/data/types.generator.d.ts +0 -9
  79. package/dist/generators/indices/data/types.generator.js +0 -49
  80. package/dist/generators/indices/dispatcher-service.generator.d.ts +0 -9
  81. package/dist/generators/indices/dispatcher-service.generator.js +0 -107
  82. package/dist/generators/indices/export/class.generator.d.ts +0 -9
  83. package/dist/generators/indices/export/class.generator.js +0 -140
  84. package/dist/generators/indices/export/encoder.generator.d.ts +0 -9
  85. package/dist/generators/indices/export/encoder.generator.js +0 -50
  86. package/dist/generators/indices/import/convert-functions.generator.d.ts +0 -9
  87. package/dist/generators/indices/import/convert-functions.generator.js +0 -509
  88. package/dist/generators/indices/import/decoder.generator.d.ts +0 -9
  89. package/dist/generators/indices/import/decoder.generator.js +0 -40
  90. package/dist/generators/indices/import/service.generator.d.ts +0 -9
  91. package/dist/generators/indices/import/service.generator.js +0 -573
  92. package/dist/generators/indices/import/types.generator.d.ts +0 -9
  93. package/dist/generators/indices/import/types.generator.js +0 -242
  94. package/dist/generators/indices/repositories.generator.d.ts +0 -9
  95. package/dist/generators/indices/repositories.generator.js +0 -25
  96. package/dist/generators/indices/routes.generator.d.ts +0 -9
  97. package/dist/generators/indices/routes.generator.js +0 -29
  98. package/dist/generators/indices/seed-migration.generator.d.ts +0 -9
  99. package/dist/generators/indices/seed-migration.generator.js +0 -36
  100. package/dist/generators/indices/seed-template.generator.d.ts +0 -9
  101. package/dist/generators/indices/seed-template.generator.js +0 -80
  102. package/dist/generators/indices/testids.generator.d.ts +0 -7
  103. package/dist/generators/indices/testids.generator.js +0 -71
  104. package/dist/generators/indices/types.generator.d.ts +0 -10
  105. package/dist/generators/indices/types.generator.js +0 -35
  106. package/dist/generators/indices/update/actiontypes.generator.d.ts +0 -9
  107. package/dist/generators/indices/update/actiontypes.generator.js +0 -49
  108. package/dist/generators/indices/update/module.generator.d.ts +0 -9
  109. package/dist/generators/indices/update/module.generator.js +0 -41
  110. package/dist/generators/indices/update/service.generator.d.ts +0 -9
  111. package/dist/generators/indices/update/service.generator.js +0 -34
  112. package/dist/generators/indices/view/module.generator.d.ts +0 -9
  113. package/dist/generators/indices/view/module.generator.js +0 -39
  114. package/dist/generators/indices/view/service.generator.d.ts +0 -9
  115. package/dist/generators/indices/view/service.generator.js +0 -34
  116. package/dist/generators/models/admin.page.generator.d.ts +0 -7
  117. package/dist/generators/models/admin.page.generator.js +0 -74
  118. package/dist/generators/models/export/encoder.generator.d.ts +0 -9
  119. package/dist/generators/models/export/encoder.generator.js +0 -51
  120. package/dist/generators/models/import/decoder.generator.d.ts +0 -9
  121. package/dist/generators/models/import/decoder.generator.js +0 -148
  122. package/dist/generators/models/react/context.generator.d.ts +0 -9
  123. package/dist/generators/models/react/context.generator.js +0 -71
  124. package/dist/generators/models/react/index.d.ts +0 -10
  125. package/dist/generators/models/react/index.js +0 -31
  126. package/dist/generators/models/react/library.generator.d.ts +0 -10
  127. package/dist/generators/models/react/library.generator.js +0 -94
  128. package/dist/generators/models/react/lookup.generator.d.ts +0 -9
  129. package/dist/generators/models/react/lookup.generator.js +0 -175
  130. package/dist/generators/models/react/modals.generator.d.ts +0 -23
  131. package/dist/generators/models/react/modals.generator.js +0 -710
  132. package/dist/generators/models/repository.generator.d.ts +0 -9
  133. package/dist/generators/models/repository.generator.js +0 -955
  134. package/dist/generators/models/route.generator.d.ts +0 -9
  135. package/dist/generators/models/route.generator.js +0 -92
  136. package/dist/generators/models/seed.generator.d.ts +0 -21
  137. package/dist/generators/models/seed.generator.js +0 -285
  138. package/dist/generators/models/stub.generator.d.ts +0 -9
  139. package/dist/generators/models/stub.generator.js +0 -92
  140. package/dist/generators/models/types.generator.d.ts +0 -9
  141. package/dist/generators/models/types.generator.js +0 -125
  142. package/dist/generators/models/update/service.generator.d.ts +0 -10
  143. package/dist/generators/models/update/service.generator.js +0 -302
  144. package/dist/generators/models/view/service.generator.d.ts +0 -10
  145. package/dist/generators/models/view/service.generator.js +0 -239
  146. package/dist/lib/attributes.d.ts +0 -114
  147. package/dist/lib/attributes.js +0 -2
  148. package/dist/lib/exports.d.ts +0 -45
  149. package/dist/lib/exports.js +0 -90
  150. package/dist/lib/imports.d.ts +0 -65
  151. package/dist/lib/imports.js +0 -114
  152. package/dist/lib/meta.d.ts +0 -1191
  153. package/dist/lib/meta.js +0 -434
  154. package/dist/lib/schema/fields.d.ts +0 -46
  155. package/dist/lib/schema/fields.js +0 -62
  156. package/dist/lib/schema/schema.d.ts +0 -466
  157. package/dist/lib/schema/schema.js +0 -18
  158. package/dist/lib/schema/types.d.ts +0 -201
  159. package/dist/lib/schema/types.js +0 -112
  160. package/dist/lib/serializer.d.ts +0 -15
  161. package/dist/lib/serializer.js +0 -24
  162. package/dist/lib/test-id-collector.d.ts +0 -42
  163. package/dist/lib/test-id-collector.js +0 -53
  164. package/dist/lib/types.d.ts +0 -7
  165. package/dist/lib/types.js +0 -13
  166. package/dist/lib/typescript.d.ts +0 -5
  167. package/dist/lib/typescript.js +0 -22
  168. package/dist/lib/utils/ast.d.ts +0 -29
  169. package/dist/lib/utils/ast.js +0 -23
  170. package/dist/lib/utils/error.d.ts +0 -17
  171. package/dist/lib/utils/error.js +0 -52
  172. package/dist/lib/utils/file.d.ts +0 -10
  173. package/dist/lib/utils/file.js +0 -56
  174. package/dist/lib/utils/jsdoc.d.ts +0 -9
  175. package/dist/lib/utils/jsdoc.js +0 -37
  176. package/dist/lib/utils/logger.d.ts +0 -17
  177. package/dist/lib/utils/logger.js +0 -12
  178. package/dist/lib/utils/string.d.ts +0 -40
  179. package/dist/lib/utils/string.js +0 -187
  180. package/dist/lib/utils/types.d.ts +0 -12
  181. package/dist/lib/utils/types.js +0 -2
  182. package/dist/lib/zod.d.ts +0 -8
  183. package/dist/lib/zod.js +0 -60
  184. package/dist/prisma/attributes.d.ts +0 -21
  185. package/dist/prisma/attributes.js +0 -175
  186. package/dist/prisma/client-path.d.ts +0 -7
  187. package/dist/prisma/client-path.js +0 -29
  188. package/dist/prisma/parse.d.ts +0 -12
  189. package/dist/prisma/parse.js +0 -452
@@ -0,0 +1,239 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.VirtualFileSystem = void 0;
37
+ const fs = __importStar(require("fs/promises"));
38
+ const minimatch_1 = require("minimatch");
39
+ const utils_1 = require("@postxl/utils");
40
+ const fs_utils_1 = require("./fs-utils");
41
+ const Path = __importStar(require("./path"));
42
+ /**
43
+ * The virtual file system (VFS) represents a file system that can be manipulated in memory.
44
+ *
45
+ * It exposes the following methods:
46
+ * - `write(path, content)`: Writes the given content to the given path
47
+ * - `read(path)`: Reads the content of the given path
48
+ * - `insertFromVfs(path, vfs)`: Inserts the content of the given VFS into the current VFS
49
+ * - `insertFromDisk(path, disk)`: Inserts the content of the given disk into the current VFS
50
+ * - `transform(fn, filter?)`: Transforms the content of all files in the VFS using the given function
51
+ *
52
+ * ## Implementation details
53
+ *
54
+ * All paths are relative to the root of the VFS - and are normalized to use the POSIX path separator.
55
+ * For this we use the `path` utils (path.normalize, path.join, path.parse). All paths are represented
56
+ * as branded strings (`Path.PosixPath`).
57
+ *
58
+ * The file content can either be a (UTF8) string or a Buffer.
59
+ *
60
+ * ## File Pattern Filtering
61
+ *
62
+ * The VFS can be configured with an optional file pattern filter during construction.
63
+ * When a pattern is set, only files matching the pattern will be stored in the VFS.
64
+ * This optimization ensures that linting, formatting, and lock file updates only affect
65
+ * the filtered files, significantly improving performance.
66
+ */
67
+ class VirtualFileSystem {
68
+ #files = new Map();
69
+ #filePattern;
70
+ /**
71
+ * Constructs a new VirtualFileSystem.
72
+ *
73
+ * @param options - Optional configuration options for the VFS.
74
+ */
75
+ constructor(options) {
76
+ this.#filePattern = options?.filePattern;
77
+ }
78
+ /**
79
+ * Returns all file names in the VFS.
80
+ */
81
+ get fileNames() {
82
+ return Array.from(this.#files.keys()).toSorted((a, b) => a.localeCompare(b));
83
+ }
84
+ /**
85
+ * Returns all files in the VFS.
86
+ */
87
+ get files() {
88
+ // We return a new Map instance to prevent accidental mutations.
89
+ return new Map(this.#files);
90
+ }
91
+ /**
92
+ * Returns the file pattern filter if one is set.
93
+ */
94
+ get filePattern() {
95
+ return this.#filePattern;
96
+ }
97
+ /**
98
+ * Checks if a file path matches the VFS file pattern (if one is set).
99
+ * Returns true if no pattern is set, or if the path matches the pattern.
100
+ */
101
+ matchesPattern(filePath) {
102
+ if (!this.#filePattern) {
103
+ return true;
104
+ }
105
+ // Remove leading slash from filePath for consistent matching
106
+ const normalizedPath = filePath.startsWith('/') ? filePath.slice(1) : filePath;
107
+ // Remove leading slash from pattern if present
108
+ const normalizedPattern = this.#filePattern.startsWith('/') ? this.#filePattern.slice(1) : this.#filePattern;
109
+ return (0, minimatch_1.minimatch)(normalizedPath, normalizedPattern, { dot: true, matchBase: false });
110
+ }
111
+ /**
112
+ * Writes the given content to the specified path.
113
+ * If a file pattern is set, only files matching the pattern will be stored.
114
+ */
115
+ write(path, content) {
116
+ const posixPath = Path.normalize(path);
117
+ // Skip files that don't match the pattern
118
+ if (!this.matchesPattern(posixPath)) {
119
+ return;
120
+ }
121
+ this.#files.set(posixPath, content);
122
+ }
123
+ /**
124
+ * Reads the content of a file from the specified path.
125
+ */
126
+ get(path) {
127
+ const posixPath = Path.normalize(path);
128
+ return this.#files.get(posixPath);
129
+ }
130
+ /**
131
+ * Reads the content of the specified folder.
132
+ */
133
+ getFolder(path) {
134
+ const posixPath = Path.normalize(path);
135
+ const vfs = new VirtualFileSystem();
136
+ for (const [filePath, content] of this.#files) {
137
+ if (filePath.startsWith(posixPath)) {
138
+ vfs.write(filePath.slice(posixPath.length), content);
139
+ }
140
+ }
141
+ if (vfs.fileNames.length === 0) {
142
+ return undefined;
143
+ }
144
+ return vfs;
145
+ }
146
+ /**
147
+ * Inserts the content of another VFS into this VFS at the specified path.
148
+ */
149
+ insertFromVfs({ vfs, targetPath = '.' }) {
150
+ const basePath = Path.normalize(targetPath);
151
+ for (const [filePath, content] of vfs.files) {
152
+ const combinedPath = Path.join(basePath, filePath);
153
+ // Skip files that don't match the pattern
154
+ if (!this.matchesPattern(combinedPath)) {
155
+ continue;
156
+ }
157
+ this.#files.set(combinedPath, content);
158
+ }
159
+ }
160
+ /**
161
+ * Loads the content from the folder on disk into this VFS at the specified path.
162
+ */
163
+ async loadFolder({ diskPath, targetPath = '.', recursive = true, filter, }) {
164
+ await this.#readDirectory({
165
+ diskPath: Path.normalize(diskPath),
166
+ targetPath: Path.normalize(targetPath),
167
+ filter,
168
+ recursive,
169
+ });
170
+ }
171
+ /**
172
+ * Loads the content from the file on disk into this VFS at the specified path.
173
+ */
174
+ async loadFile({ diskPath, targetPath }) {
175
+ const diskPathNormalized = Path.normalize(diskPath);
176
+ const basePath = Path.normalize(targetPath ?? Path.fileName(diskPathNormalized));
177
+ // Skip files that don't match the pattern
178
+ if (!this.matchesPattern(basePath)) {
179
+ return;
180
+ }
181
+ const content = await (0, fs_utils_1.readFile)(diskPathNormalized);
182
+ if (content.isErr()) {
183
+ console.error(`Error reading file: ${diskPath}`);
184
+ throw content.unwrapErr().error;
185
+ }
186
+ this.#files.set(basePath, content.unwrap());
187
+ }
188
+ async #readDirectory({ diskPath, targetPath, filter, recursive, }) {
189
+ const entries = await utils_1.Result.fromPromise(() => fs.readdir(diskPath, { withFileTypes: true }), () => `Folder "${diskPath}" does not exist`);
190
+ if (entries.isErr()) {
191
+ throw new Error(entries.unwrapErr());
192
+ }
193
+ for (const entry of entries.unwrap()) {
194
+ const entryName = Path.normalize(entry.name);
195
+ const entryPath = Path.join(diskPath, entryName);
196
+ const relativePath = Path.join(targetPath, entryName);
197
+ if (filter && !filter(relativePath)) {
198
+ continue;
199
+ }
200
+ if (recursive && entry.isDirectory()) {
201
+ await this.#readDirectory({ diskPath: entryPath, targetPath: relativePath, filter, recursive });
202
+ }
203
+ else if (entry.isFile()) {
204
+ // Skip files that don't match the pattern
205
+ if (!this.matchesPattern(relativePath)) {
206
+ continue;
207
+ }
208
+ const content = await (0, fs_utils_1.readFile)(entryPath);
209
+ if (content.isErr()) {
210
+ throw content.unwrapErr();
211
+ }
212
+ this.#files.set(relativePath, content.unwrap());
213
+ }
214
+ }
215
+ }
216
+ /**
217
+ * Transforms the content of all files using the provided function.
218
+ * An optional filter function can be provided to select specific files.
219
+ */
220
+ async transform(fn, { filter, onError, } = {}) {
221
+ for (const [path, content] of this.#files) {
222
+ if (!filter || filter(path)) {
223
+ try {
224
+ const newContent = await fn({ content, path });
225
+ this.#files.set(path, newContent);
226
+ }
227
+ catch (error) {
228
+ if (onError) {
229
+ onError({ path, content, error });
230
+ }
231
+ else {
232
+ throw error;
233
+ }
234
+ }
235
+ }
236
+ }
237
+ }
238
+ }
239
+ exports.VirtualFileSystem = VirtualFileSystem;
@@ -0,0 +1,13 @@
1
+ import JSZip from 'jszip';
2
+ type ZipLimits = {
3
+ maxFiles: number;
4
+ maxSize: number;
5
+ };
6
+ /**
7
+ * Loads a zip file from a buffer and validates the number of files and the total size.
8
+ * Throws an error if the number of files or the total size exceeds the limits.
9
+ *
10
+ * This is to prevent malicious "zip bombs" (see Sonar rule S5042)
11
+ */
12
+ export declare function loadZip(content: Buffer, limits?: ZipLimits): Promise<JSZip>;
13
+ export {};
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.loadZip = loadZip;
7
+ const jszip_1 = __importDefault(require("jszip"));
8
+ const defaultLimits = {
9
+ maxFiles: 1000,
10
+ maxSize: 100_000_000, // 100 MB
11
+ };
12
+ /**
13
+ * Loads a zip file from a buffer and validates the number of files and the total size.
14
+ * Throws an error if the number of files or the total size exceeds the limits.
15
+ *
16
+ * This is to prevent malicious "zip bombs" (see Sonar rule S5042)
17
+ */
18
+ async function loadZip(content, limits = defaultLimits) {
19
+ const { maxFiles, maxSize } = limits;
20
+ let fileCount = 0;
21
+ let totalSize = 0;
22
+ const zip = new jszip_1.default();
23
+ await zip.loadAsync(content); // NOSONAR - the below code implements the suggested validation
24
+ const fileNames = Object.keys(zip.files);
25
+ for (const fileName of fileNames) {
26
+ fileCount++;
27
+ if (fileCount > maxFiles) {
28
+ throw new Error('Reached max. number of files');
29
+ }
30
+ const file = zip.file(fileName);
31
+ if (file) {
32
+ const fileContent = await file.async('nodebuffer');
33
+ totalSize += fileContent.length;
34
+ if (totalSize > maxSize) {
35
+ throw new Error('Reached max. size');
36
+ }
37
+ }
38
+ }
39
+ return zip;
40
+ }
package/package.json CHANGED
@@ -1,49 +1,72 @@
1
1
  {
2
2
  "name": "@postxl/generator",
3
- "version": "0.74.1",
4
- "main": "./dist/generator.js",
5
- "typings": "./dist/generator.d.ts",
6
- "bin": {
7
- "@postxl/generator": "./dist/generator.js"
3
+ "version": "1.0.1",
4
+ "description": "Core package that orchestrates the code generation of a PXL project",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ },
13
+ "./package.json": "./package.json"
14
+ },
15
+ "license": "SEE LICENSE IN LICENSE",
16
+ "author": "PostXL GmbH",
17
+ "keywords": [
18
+ "postxl",
19
+ "pxl",
20
+ "generator",
21
+ "code-generation",
22
+ "typescript",
23
+ "nestjs",
24
+ "react"
25
+ ],
26
+ "engines": {
27
+ "node": ">=24"
28
+ },
29
+ "publishConfig": {
30
+ "access": "public"
8
31
  },
9
32
  "files": [
10
33
  "dist"
11
34
  ],
35
+ "scripts": {
36
+ "build": "tsc -b tsconfig.build.json",
37
+ "lint": "eslint .",
38
+ "prettier:check": "prettier --check \"**/*.{ts,tsx}\" --config ../../prettier.config.js --ignore-path ../../.prettierignore",
39
+ "test:jest": "cross-env NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest",
40
+ "test:coverage": "cross-env NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest --coverage",
41
+ "test:watch": "cross-env NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest --watch",
42
+ "test:types": "tsc --noEmit"
43
+ },
12
44
  "repository": {
13
45
  "type": "git",
14
- "url": "https://github.com/postxl/postxl"
46
+ "url": "https://github.com/postxl/pxl",
47
+ "directory": "packages/generator"
15
48
  },
16
49
  "dependencies": {
17
- "@faker-js/faker": "7.6.0",
18
- "@prisma/generator-helper": "5.8.1",
19
- "@prisma/internals": "5.8.1",
20
- "exceljs": "4.3.0",
50
+ "@eslint/js": "9.10.0",
51
+ "@postxl/schema": "workspace:*",
52
+ "diff": "7.0.0",
21
53
  "fast-glob": "3.2.12",
22
- "zod": "3.22.2",
23
- "@postxl/lock": "1.5.0",
24
- "@postxl/prettier": "0.1.0",
25
- "@postxl/runtime": "0.1.5"
54
+ "globals": "15.12.0",
55
+ "isbinaryfile": "5.0.4",
56
+ "jszip": "3.10.1",
57
+ "minimatch": "^10.0.1",
58
+ "p-limit": "3.1.0"
26
59
  },
27
60
  "devDependencies": {
28
- "@jest/globals": "29.7.0",
29
- "@prisma/client": "5.8.1",
30
- "@types/eslint": "8.44.7",
31
- "@types/node": "20.5.0",
32
- "jest": "29.7.0",
33
- "prisma": "5.8.1",
34
- "ts-jest": "29.1.3",
35
- "ts-node": "10.9.2",
36
- "ts-toolbelt": "9.6.0",
37
- "tsconfig-paths": "4.2.0",
38
- "typescript": "5.4.5"
39
- },
40
- "peerDependencies": {
41
- "prisma": "5.8.1"
61
+ "@types/diff": "5.2.2",
62
+ "@types/eslint__js": "8.42.3"
42
63
  },
43
- "scripts": {
44
- "test:setup": "./scripts/test-setup.sh",
45
- "test:jest": "jest",
46
- "test:watch": "jest --watch",
47
- "test:types": "tsc --noEmit"
64
+ "wallaby": {
65
+ "env": {
66
+ "type": "node",
67
+ "params": {
68
+ "runner": "--experimental-vm-modules"
69
+ }
70
+ }
48
71
  }
49
- }
72
+ }
@@ -1,13 +0,0 @@
1
- #! /usr/bin/env node
2
- import * as Schema from './lib/schema/schema';
3
- import { Logger } from './lib/utils/logger';
4
- /**
5
- * Generates PXL files and flushes them to disk.
6
- */
7
- export declare function generate({ models, enums, config, prismaClientPath, logger, }: {
8
- models: Schema.Model[];
9
- enums: Schema.Enum[];
10
- config: Schema.SchemaConfig;
11
- prismaClientPath: string;
12
- logger: Logger;
13
- }): Promise<void>;