@pgpmjs/core 7.2.0 → 7.2.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.
@@ -1,4 +1,5 @@
1
1
  import { parsePlanFile } from '@pgpmjs/ast/files/plan/parser';
2
+ import { generateChangeLineContent, generateTagLineContent } from '@pgpmjs/ast/files/plan/writer';
2
3
  import { minimatch } from 'minimatch';
3
4
  /**
4
5
  * Build a dependency graph from a parsed plan file
@@ -285,41 +286,15 @@ export function generatePlanContent(pkgName, entries, tags = []) {
285
286
  let content = `%syntax-version=1.0.0\n`;
286
287
  content += `%project=${pkgName}\n`;
287
288
  content += `%uri=${pkgName}\n\n`;
289
+ // Dependency brackets keep their original order (empty order map), matching
290
+ // the source plans this content is sliced from.
291
+ const originalOrder = new Map();
288
292
  for (const entry of entries) {
289
- let line = entry.name;
290
- if (entry.dependencies && entry.dependencies.length > 0) {
291
- line += ` [${entry.dependencies.join(' ')}]`;
292
- }
293
- if (entry.timestamp) {
294
- line += ` ${entry.timestamp}`;
295
- if (entry.planner) {
296
- line += ` ${entry.planner}`;
297
- if (entry.email) {
298
- line += ` <${entry.email}>`;
299
- }
300
- }
301
- }
302
- if (entry.comment) {
303
- line += ` # ${entry.comment}`;
304
- }
305
- content += line + '\n';
293
+ content += generateChangeLineContent(entry, originalOrder) + '\n';
306
294
  // Add tags associated with this change
307
295
  const changeTags = tags.filter(t => t.change === entry.name);
308
296
  for (const tag of changeTags) {
309
- let tagLine = `@${tag.name}`;
310
- if (tag.timestamp) {
311
- tagLine += ` ${tag.timestamp}`;
312
- if (tag.planner) {
313
- tagLine += ` ${tag.planner}`;
314
- if (tag.email) {
315
- tagLine += ` <${tag.email}>`;
316
- }
317
- }
318
- }
319
- if (tag.comment) {
320
- tagLine += ` # ${tag.comment}`;
321
- }
322
- content += tagLine + '\n';
297
+ content += generateTagLineContent(tag) + '\n';
323
298
  }
324
299
  }
325
300
  return content;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pgpmjs/core",
3
- "version": "7.2.0",
3
+ "version": "7.2.2",
4
4
  "author": "Constructive <developers@constructive.io>",
5
5
  "description": "PGPM Package and Migration Tools",
6
6
  "main": "index.js",
@@ -48,8 +48,8 @@
48
48
  "makage": "^0.3.0"
49
49
  },
50
50
  "dependencies": {
51
- "@pgpmjs/ast": "^0.1.0",
52
- "@pgpmjs/bundle": "^0.1.0",
51
+ "@pgpmjs/ast": "^0.1.1",
52
+ "@pgpmjs/bundle": "^0.2.0",
53
53
  "@pgpmjs/env": "^2.28.2",
54
54
  "@pgpmjs/logger": "^2.14.0",
55
55
  "@pgpmjs/server-utils": "^3.15.3",
@@ -66,5 +66,5 @@
66
66
  "pgsql-parser": "^18.1.1",
67
67
  "yanse": "^0.2.1"
68
68
  },
69
- "gitHead": "15a831fa029544068ee64e3386e4b08715d2b86d"
69
+ "gitHead": "d48f39ebd4b7dcbab22df7c57438c06efd9e223d"
70
70
  }
package/slice/slice.js CHANGED
@@ -15,6 +15,7 @@ exports.generateControlContent = generateControlContent;
15
15
  exports.generateSinglePackage = generateSinglePackage;
16
16
  exports.slicePlan = slicePlan;
17
17
  const parser_1 = require("@pgpmjs/ast/files/plan/parser");
18
+ const writer_1 = require("@pgpmjs/ast/files/plan/writer");
18
19
  const minimatch_1 = require("minimatch");
19
20
  /**
20
21
  * Build a dependency graph from a parsed plan file
@@ -301,41 +302,15 @@ function generatePlanContent(pkgName, entries, tags = []) {
301
302
  let content = `%syntax-version=1.0.0\n`;
302
303
  content += `%project=${pkgName}\n`;
303
304
  content += `%uri=${pkgName}\n\n`;
305
+ // Dependency brackets keep their original order (empty order map), matching
306
+ // the source plans this content is sliced from.
307
+ const originalOrder = new Map();
304
308
  for (const entry of entries) {
305
- let line = entry.name;
306
- if (entry.dependencies && entry.dependencies.length > 0) {
307
- line += ` [${entry.dependencies.join(' ')}]`;
308
- }
309
- if (entry.timestamp) {
310
- line += ` ${entry.timestamp}`;
311
- if (entry.planner) {
312
- line += ` ${entry.planner}`;
313
- if (entry.email) {
314
- line += ` <${entry.email}>`;
315
- }
316
- }
317
- }
318
- if (entry.comment) {
319
- line += ` # ${entry.comment}`;
320
- }
321
- content += line + '\n';
309
+ content += (0, writer_1.generateChangeLineContent)(entry, originalOrder) + '\n';
322
310
  // Add tags associated with this change
323
311
  const changeTags = tags.filter(t => t.change === entry.name);
324
312
  for (const tag of changeTags) {
325
- let tagLine = `@${tag.name}`;
326
- if (tag.timestamp) {
327
- tagLine += ` ${tag.timestamp}`;
328
- if (tag.planner) {
329
- tagLine += ` ${tag.planner}`;
330
- if (tag.email) {
331
- tagLine += ` <${tag.email}>`;
332
- }
333
- }
334
- }
335
- if (tag.comment) {
336
- tagLine += ` # ${tag.comment}`;
337
- }
338
- content += tagLine + '\n';
313
+ content += (0, writer_1.generateTagLineContent)(tag) + '\n';
339
314
  }
340
315
  }
341
316
  return content;