@pgpmjs/core 4.5.1 → 4.5.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.
@@ -6,6 +6,7 @@ import { getPgPool } from 'pg-cache';
6
6
  import { PgpmPackage } from '../core/class/pgpm';
7
7
  import { writePgpmFiles, writePgpmPlan } from '../files';
8
8
  import { getMissingInstallableModules } from '../modules/modules';
9
+ import { parseAuthor } from '../utils/author';
9
10
  import { exportMeta } from './export-meta';
10
11
  /**
11
12
  * Required extensions for database schema exports.
@@ -244,6 +245,7 @@ const preparePackage = async ({ project, author, outdir, name, description, exte
244
245
  process.chdir(pgpmDir);
245
246
  const plan = glob(path.join(pgpmDir, 'pgpm.plan'));
246
247
  if (!plan.length) {
248
+ const { fullName, email } = parseAuthor(author);
247
249
  await project.initModule({
248
250
  name,
249
251
  description,
@@ -253,7 +255,9 @@ const preparePackage = async ({ project, author, outdir, name, description, exte
253
255
  moduleName: name,
254
256
  moduleDesc: description,
255
257
  access: 'restricted',
256
- license: 'CLOSED'
258
+ license: 'CLOSED',
259
+ fullName,
260
+ ...(email && { email })
257
261
  }
258
262
  });
259
263
  }
@@ -1,5 +1,6 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
+ import { parseAuthor } from '../../utils/author';
3
4
  /**
4
5
  * Write a PGPM plan file based on the provided rows
5
6
  */
@@ -7,22 +8,9 @@ export function writePgpmPlan(rows, opts) {
7
8
  const dir = path.resolve(path.join(opts.outdir, opts.name));
8
9
  fs.mkdirSync(dir, { recursive: true });
9
10
  const date = () => '2017-08-11T08:11:51Z'; // stubbed timestamp
10
- // Parse author string - it might contain email in format "Name <email>"
11
- const authorInput = (opts.author || 'constructive').trim();
12
- let authorName = authorInput;
13
- let authorEmail = '';
14
- // Check if author already contains email in <...> format
15
- const emailMatch = authorInput.match(/^(.+?)\s*<([^>]+)>\s*$/);
16
- if (emailMatch) {
17
- // Author already has email format: "Name <email>"
18
- authorName = emailMatch[1].trim();
19
- authorEmail = emailMatch[2].trim();
20
- }
21
- else {
22
- // No email in author, use default format
23
- authorName = authorInput;
24
- authorEmail = `${authorName}@5b0c196eeb62`;
25
- }
11
+ const { fullName, email } = parseAuthor(opts.author || 'constructive');
12
+ const authorName = fullName;
13
+ const authorEmail = email || `${fullName}@5b0c196eeb62`;
26
14
  const duplicates = {};
27
15
  const plan = opts.replacer(`%syntax-version=1.0.0
28
16
  %project=constructive-extension-name
@@ -0,0 +1,11 @@
1
+ export function parseAuthor(author) {
2
+ const trimmed = (author || '').trim();
3
+ const match = trimmed.match(/^(.+?)\s*<([^>]+)>$/);
4
+ if (match) {
5
+ return {
6
+ fullName: match[1].trim(),
7
+ email: match[2].trim()
8
+ };
9
+ }
10
+ return { fullName: trimmed };
11
+ }
@@ -12,6 +12,7 @@ const pg_cache_1 = require("pg-cache");
12
12
  const pgpm_1 = require("../core/class/pgpm");
13
13
  const files_1 = require("../files");
14
14
  const modules_1 = require("../modules/modules");
15
+ const author_1 = require("../utils/author");
15
16
  const export_meta_1 = require("./export-meta");
16
17
  /**
17
18
  * Required extensions for database schema exports.
@@ -251,6 +252,7 @@ const preparePackage = async ({ project, author, outdir, name, description, exte
251
252
  process.chdir(pgpmDir);
252
253
  const plan = (0, glob_1.sync)(path_1.default.join(pgpmDir, 'pgpm.plan'));
253
254
  if (!plan.length) {
255
+ const { fullName, email } = (0, author_1.parseAuthor)(author);
254
256
  await project.initModule({
255
257
  name,
256
258
  description,
@@ -260,7 +262,9 @@ const preparePackage = async ({ project, author, outdir, name, description, exte
260
262
  moduleName: name,
261
263
  moduleDesc: description,
262
264
  access: 'restricted',
263
- license: 'CLOSED'
265
+ license: 'CLOSED',
266
+ fullName,
267
+ ...(email && { email })
264
268
  }
265
269
  });
266
270
  }
@@ -11,6 +11,7 @@ exports.generateChangeLineContent = generateChangeLineContent;
11
11
  exports.generateTagLineContent = generateTagLineContent;
12
12
  const fs_1 = __importDefault(require("fs"));
13
13
  const path_1 = __importDefault(require("path"));
14
+ const author_1 = require("../../utils/author");
14
15
  /**
15
16
  * Write a PGPM plan file based on the provided rows
16
17
  */
@@ -18,22 +19,9 @@ function writePgpmPlan(rows, opts) {
18
19
  const dir = path_1.default.resolve(path_1.default.join(opts.outdir, opts.name));
19
20
  fs_1.default.mkdirSync(dir, { recursive: true });
20
21
  const date = () => '2017-08-11T08:11:51Z'; // stubbed timestamp
21
- // Parse author string - it might contain email in format "Name <email>"
22
- const authorInput = (opts.author || 'constructive').trim();
23
- let authorName = authorInput;
24
- let authorEmail = '';
25
- // Check if author already contains email in <...> format
26
- const emailMatch = authorInput.match(/^(.+?)\s*<([^>]+)>\s*$/);
27
- if (emailMatch) {
28
- // Author already has email format: "Name <email>"
29
- authorName = emailMatch[1].trim();
30
- authorEmail = emailMatch[2].trim();
31
- }
32
- else {
33
- // No email in author, use default format
34
- authorName = authorInput;
35
- authorEmail = `${authorName}@5b0c196eeb62`;
36
- }
22
+ const { fullName, email } = (0, author_1.parseAuthor)(opts.author || 'constructive');
23
+ const authorName = fullName;
24
+ const authorEmail = email || `${fullName}@5b0c196eeb62`;
37
25
  const duplicates = {};
38
26
  const plan = opts.replacer(`%syntax-version=1.0.0
39
27
  %project=constructive-extension-name
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pgpmjs/core",
3
- "version": "4.5.1",
3
+ "version": "4.5.2",
4
4
  "author": "Constructive <developers@constructive.io>",
5
5
  "description": "PGPM Package and Migration Tools",
6
6
  "main": "index.js",
@@ -64,5 +64,5 @@
64
64
  "pgsql-parser": "^17.9.5",
65
65
  "yanse": "^0.1.8"
66
66
  },
67
- "gitHead": "6883e3b93da28078483bc6aa25862613ef4405b2"
67
+ "gitHead": "3768b497b5b65410a23bcf7e01ed4192a5f1dd95"
68
68
  }
@@ -0,0 +1,5 @@
1
+ export interface ParsedAuthor {
2
+ fullName: string;
3
+ email?: string;
4
+ }
5
+ export declare function parseAuthor(author: string): ParsedAuthor;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseAuthor = parseAuthor;
4
+ function parseAuthor(author) {
5
+ const trimmed = (author || '').trim();
6
+ const match = trimmed.match(/^(.+?)\s*<([^>]+)>$/);
7
+ if (match) {
8
+ return {
9
+ fullName: match[1].trim(),
10
+ email: match[2].trim()
11
+ };
12
+ }
13
+ return { fullName: trimmed };
14
+ }