pg-codegen 2.13.7 → 2.13.8

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 (4) hide show
  1. package/README.md +2 -1
  2. package/esm/index.js +25 -25
  3. package/index.js +25 -25
  4. package/package.json +14 -13
package/README.md CHANGED
@@ -97,6 +97,8 @@ export class Users implements Users {
97
97
  }
98
98
  ```
99
99
 
100
+ ---
101
+
100
102
  ## Education and Tutorials
101
103
 
102
104
  1. 🚀 [Quickstart: Getting Up and Running](https://launchql.com/learn/quickstart)
@@ -171,4 +173,3 @@ Common issues and solutions for pgpm, PostgreSQL, and testing.
171
173
  AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
172
174
 
173
175
  No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.
174
-
package/esm/index.js CHANGED
@@ -6,6 +6,31 @@ import { getPgEnvOptions } from 'pg-env';
6
6
  import { generateCodeTree } from './codegen/codegen';
7
7
  import getIntrospectionRows from './introspect';
8
8
  const log = new Logger('pg-codegen');
9
+ /**
10
+ * Writes the generated code files to the specified directory.
11
+ *
12
+ * @param outputDir The base directory to write the files.
13
+ * @param fileTree The file tree containing file paths and content.
14
+ */
15
+ const writeGeneratedFiles = async (outputDir, fileTree) => {
16
+ try {
17
+ // Ensure the output directory exists
18
+ await fs.mkdir(outputDir, { recursive: true });
19
+ // Write each file to its corresponding path
20
+ for (const [filePath, content] of Object.entries(fileTree)) {
21
+ const fullPath = path.join(outputDir, filePath);
22
+ // Ensure the directory for the file exists
23
+ const dirName = path.dirname(fullPath);
24
+ await fs.mkdir(dirName, { recursive: true });
25
+ // Write the file content
26
+ await fs.writeFile(fullPath, content, 'utf8');
27
+ }
28
+ }
29
+ catch (error) {
30
+ log.error(`Failed to write files to ${outputDir}:`, error);
31
+ throw error;
32
+ }
33
+ };
9
34
  (async () => {
10
35
  const env = getPgEnvOptions();
11
36
  const pool = getPgPool(env);
@@ -42,28 +67,3 @@ const log = new Logger('pg-codegen');
42
67
  log.error('Failed to fetch introspection rows or generate code:', error);
43
68
  }
44
69
  })();
45
- /**
46
- * Writes the generated code files to the specified directory.
47
- *
48
- * @param outputDir The base directory to write the files.
49
- * @param fileTree The file tree containing file paths and content.
50
- */
51
- const writeGeneratedFiles = async (outputDir, fileTree) => {
52
- try {
53
- // Ensure the output directory exists
54
- await fs.mkdir(outputDir, { recursive: true });
55
- // Write each file to its corresponding path
56
- for (const [filePath, content] of Object.entries(fileTree)) {
57
- const fullPath = path.join(outputDir, filePath);
58
- // Ensure the directory for the file exists
59
- const dirName = path.dirname(fullPath);
60
- await fs.mkdir(dirName, { recursive: true });
61
- // Write the file content
62
- await fs.writeFile(fullPath, content, 'utf8');
63
- }
64
- }
65
- catch (error) {
66
- log.error(`Failed to write files to ${outputDir}:`, error);
67
- throw error;
68
- }
69
- };
package/index.js CHANGED
@@ -11,6 +11,31 @@ const pg_env_1 = require("pg-env");
11
11
  const codegen_1 = require("./codegen/codegen");
12
12
  const introspect_1 = __importDefault(require("./introspect"));
13
13
  const log = new logger_1.Logger('pg-codegen');
14
+ /**
15
+ * Writes the generated code files to the specified directory.
16
+ *
17
+ * @param outputDir The base directory to write the files.
18
+ * @param fileTree The file tree containing file paths and content.
19
+ */
20
+ const writeGeneratedFiles = async (outputDir, fileTree) => {
21
+ try {
22
+ // Ensure the output directory exists
23
+ await fs_1.promises.mkdir(outputDir, { recursive: true });
24
+ // Write each file to its corresponding path
25
+ for (const [filePath, content] of Object.entries(fileTree)) {
26
+ const fullPath = path_1.default.join(outputDir, filePath);
27
+ // Ensure the directory for the file exists
28
+ const dirName = path_1.default.dirname(fullPath);
29
+ await fs_1.promises.mkdir(dirName, { recursive: true });
30
+ // Write the file content
31
+ await fs_1.promises.writeFile(fullPath, content, 'utf8');
32
+ }
33
+ }
34
+ catch (error) {
35
+ log.error(`Failed to write files to ${outputDir}:`, error);
36
+ throw error;
37
+ }
38
+ };
14
39
  (async () => {
15
40
  const env = (0, pg_env_1.getPgEnvOptions)();
16
41
  const pool = (0, pg_cache_1.getPgPool)(env);
@@ -47,28 +72,3 @@ const log = new logger_1.Logger('pg-codegen');
47
72
  log.error('Failed to fetch introspection rows or generate code:', error);
48
73
  }
49
74
  })();
50
- /**
51
- * Writes the generated code files to the specified directory.
52
- *
53
- * @param outputDir The base directory to write the files.
54
- * @param fileTree The file tree containing file paths and content.
55
- */
56
- const writeGeneratedFiles = async (outputDir, fileTree) => {
57
- try {
58
- // Ensure the output directory exists
59
- await fs_1.promises.mkdir(outputDir, { recursive: true });
60
- // Write each file to its corresponding path
61
- for (const [filePath, content] of Object.entries(fileTree)) {
62
- const fullPath = path_1.default.join(outputDir, filePath);
63
- // Ensure the directory for the file exists
64
- const dirName = path_1.default.dirname(fullPath);
65
- await fs_1.promises.mkdir(dirName, { recursive: true });
66
- // Write the file content
67
- await fs_1.promises.writeFile(fullPath, content, 'utf8');
68
- }
69
- }
70
- catch (error) {
71
- log.error(`Failed to write files to ${outputDir}:`, error);
72
- throw error;
73
- }
74
- };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pg-codegen",
3
- "version": "2.13.7",
3
+ "version": "2.13.8",
4
4
  "author": "Dan Lynch <pyramation@gmail.com>",
5
5
  "description": "PostgreSQL Codegen",
6
6
  "main": "index.js",
@@ -20,11 +20,11 @@
20
20
  "url": "https://github.com/launchql/launchql/issues"
21
21
  },
22
22
  "scripts": {
23
- "copy": "copyfiles -f ../../LICENSE README.md package.json dist",
24
- "clean": "rimraf dist/**",
23
+ "clean": "makage clean",
24
+ "copy": "makage assets",
25
25
  "prepack": "npm run build",
26
- "build": "npm run clean; tsc -p tsconfig.json; tsc -p tsconfig.esm.json; npm run copy",
27
- "build:dev": "npm run clean; tsc -p tsconfig.json --declarationMap; tsc -p tsconfig.esm.json; npm run copy",
26
+ "build": "makage build",
27
+ "build:dev": "makage build --dev",
28
28
  "dev": "ts-node ./src/index.ts",
29
29
  "lint": "eslint . --fix",
30
30
  "test": "jest",
@@ -41,17 +41,18 @@
41
41
  "dependencies": {
42
42
  "@babel/generator": "^7.26.3",
43
43
  "@babel/types": "^7.26.3",
44
- "@launchql/logger": "^1.1.9",
45
- "@launchql/server-utils": "^2.6.5",
46
- "@launchql/types": "^2.8.4",
44
+ "@launchql/logger": "^1.1.10",
45
+ "@launchql/server-utils": "^2.6.6",
46
+ "@launchql/types": "^2.8.5",
47
47
  "pg": "^8.16.0",
48
- "pg-cache": "^1.4.5",
49
- "pg-env": "^1.1.5",
50
- "pgsql-test": "^2.14.7"
48
+ "pg-cache": "^1.4.6",
49
+ "pg-env": "^1.1.6",
50
+ "pgsql-test": "^2.14.8"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/babel__generator": "^7.6.8",
54
- "@types/pg": "^8.15.2"
54
+ "@types/pg": "^8.15.2",
55
+ "makage": "^0.1.6"
55
56
  },
56
- "gitHead": "4cd832ebee39d7be9375340e8e3283692d15b464"
57
+ "gitHead": "e4643c07b6a961b964bbb132308366fc549504a1"
57
58
  }