@clickview/ship-it 0.0.43 → 0.0.45

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.
@@ -2,35 +2,53 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Descriptions = void 0;
4
4
  var Headings = {
5
- BeforeRelease: 'Before release',
6
- Dependencies: 'Dependencies',
7
- CodeChanges: 'Code changes',
8
- CustomerChanges: 'Customer changes',
5
+ BeforeRelease: 'Before Release',
6
+ AfterRelease: 'After Release',
7
+ Dependencies: 'Deploy Dependencies',
8
+ CodeChanges: 'Code Changes',
9
+ CustomerChanges: 'Customer Changes',
9
10
  Testing: 'Testing',
10
- Notes: 'Notes'
11
+ Notes: 'Notes',
12
+ MergeRequestChecklist: 'Merge Request Checklist',
13
+ Tasks: 'Tasks',
14
+ SQL: 'SQL',
11
15
  };
12
16
  var BASE_VALID_HEADINGS = [
13
17
  Headings.BeforeRelease,
18
+ Headings.AfterRelease,
14
19
  Headings.Dependencies,
15
20
  Headings.Testing,
16
- Headings.Notes
21
+ Headings.Notes,
22
+ Headings.MergeRequestChecklist
17
23
  ];
18
24
  var PROJECT_VALID_HEADINGS = BASE_VALID_HEADINGS.concat([
19
25
  Headings.CustomerChanges,
20
26
  Headings.CodeChanges
21
27
  ]);
22
28
  var PROJECT_REQUIRED_HEADINGS = [
23
- Headings.Testing
29
+ Headings.Testing,
30
+ Headings.MergeRequestChecklist
24
31
  ];
25
32
  var HEADING_ORDER = [
26
- Headings.BeforeRelease,
27
33
  Headings.Dependencies,
34
+ Headings.BeforeRelease,
35
+ Headings.AfterRelease,
28
36
  Headings.CustomerChanges,
29
37
  Headings.CodeChanges,
30
38
  '*',
31
39
  Headings.Testing,
32
40
  Headings.Notes,
33
41
  ];
42
+ var IGNORED_HEADINGS = [Headings.MergeRequestChecklist];
43
+ var SPECIAL_HEADINGS = [
44
+ Headings.BeforeRelease,
45
+ Headings.AfterRelease,
46
+ ];
47
+ var GROUPED_SUBHEADINGS = [
48
+ Headings.Tasks,
49
+ Headings.SQL,
50
+ ];
51
+ var MERGE_REQUEST_CHECKLIST = "\n# Merge Request Checklist\n- [ ] QA validation is completed.\n- [ ] All dependencies have been addressed.\n- [ ] All before release tasks have been completed.\n- [ ] All after release tasks are ready to be completed.";
34
52
  function headingTransformer(heading) {
35
53
  // Fix casing of known headings
36
54
  var lowerHeading = heading.toLowerCase();
@@ -143,12 +161,24 @@ exports.Descriptions = {
143
161
  // Ensure all the headings are valid
144
162
  for (var _i = 0, headings_1 = headings; _i < headings_1.length; _i++) {
145
163
  var heading = headings_1[_i];
164
+ if (IGNORED_HEADINGS.includes(heading))
165
+ continue;
146
166
  if (options.validSections.indexOf(heading) === -1)
147
167
  errors.push("Invalid section: ".concat(heading));
168
+ if (SPECIAL_HEADINGS.includes(heading)) {
169
+ var subObj = toObject(parsedDescription[heading].split('\n'), '##');
170
+ var subHeadings = Object.keys(subObj);
171
+ for (var _a = 0, subHeadings_1 = subHeadings; _a < subHeadings_1.length; _a++) {
172
+ var subHeading = subHeadings_1[_a];
173
+ if (!GROUPED_SUBHEADINGS.includes(subHeading)) {
174
+ errors.push("Invalid sub-section '".concat(subHeading, "' in '").concat(heading, "'"));
175
+ }
176
+ }
177
+ }
148
178
  }
149
179
  // Ensure we have all required headings
150
- for (var _a = 0, _b = options.requiredSections; _a < _b.length; _a++) {
151
- var requiredSection = _b[_a];
180
+ for (var _b = 0, _c = options.requiredSections; _b < _c.length; _b++) {
181
+ var requiredSection = _c[_b];
152
182
  if (parsedDescription[requiredSection] === undefined)
153
183
  errors.push("Missing section: ".concat(requiredSection));
154
184
  }
@@ -162,9 +192,24 @@ exports.Descriptions = {
162
192
  var obj = {};
163
193
  var _loop_2 = function (descriptionObj) {
164
194
  Object.keys(descriptionObj).forEach(function (key) {
165
- if (!obj[key])
166
- obj[key] = '';
167
- obj[key] += descriptionObj[key] + '\n';
195
+ if (!SPECIAL_HEADINGS.includes(key)) {
196
+ if (!obj[key])
197
+ obj[key] = ''; // Keep as string for regular headings
198
+ obj[key] += String(descriptionObj[key]) + '\n';
199
+ return;
200
+ }
201
+ // For special headings, initialise as an object
202
+ if (!obj[key] || typeof obj[key] === 'string') {
203
+ obj[key] = {};
204
+ }
205
+ var subObj = toObject(descriptionObj[key].split('\n'), headingPrefix + '#');
206
+ Object.keys(subObj).forEach(function (subKey) {
207
+ if (!obj[key][subKey])
208
+ obj[key][subKey] = '';
209
+ obj[key][subKey] += subObj[subKey];
210
+ if (GROUPED_SUBHEADINGS.includes(subKey))
211
+ obj[key][subKey] += '\n';
212
+ });
168
213
  });
169
214
  };
170
215
  for (var _i = 0, descriptionObjs_1 = descriptionObjs; _i < descriptionObjs_1.length; _i++) {
@@ -172,15 +217,24 @@ exports.Descriptions = {
172
217
  _loop_2(descriptionObj);
173
218
  }
174
219
  var description = '';
175
- var orderedHeadings = orderDescriptionHeadings(Object.keys(obj));
220
+ var orderedHeadings = orderDescriptionHeadings(Object.keys(obj).filter(function (h) { return !IGNORED_HEADINGS.includes(h); }));
176
221
  orderedHeadings.forEach(function (key) {
177
222
  if (key === Headings.Notes)
178
223
  return;
179
224
  if (!obj[key])
180
225
  return;
181
226
  description += '\n' + headingPrefix + ' ' + key + '\n';
182
- description += obj[key];
227
+ if (!SPECIAL_HEADINGS.includes(key)) {
228
+ description += obj[key];
229
+ return;
230
+ }
231
+ // Process subheadings within "Before Release" and "After Release"
232
+ Object.keys(obj[key]).forEach(function (subKey) {
233
+ description += '\n' + headingPrefix + '#' + ' ' + subKey + '\n';
234
+ description += obj[key][subKey];
235
+ });
183
236
  });
237
+ description += MERGE_REQUEST_CHECKLIST;
184
238
  return description;
185
239
  },
186
240
  getDescriptionSection: function (heading, mergeRequest) {
@@ -206,10 +260,22 @@ exports.Descriptions = {
206
260
  combinedObj[key] = {};
207
261
  var combinedSubObj = toObject(descriptionObj[key].split('\n'), '##');
208
262
  var orderedHeadings = orderDescriptionHeadings(Object.keys(combinedSubObj));
263
+ if (!SPECIAL_HEADINGS.includes(key)) {
264
+ // Regular headings (not BeforeRelease or AfterRelease)
265
+ orderedHeadings.forEach(function (subKey) {
266
+ if (!combinedObj[key][subKey]) {
267
+ combinedObj[key][subKey] = '';
268
+ }
269
+ combinedObj[key][subKey] += combinedSubObj[subKey];
270
+ });
271
+ return;
272
+ }
209
273
  orderedHeadings.forEach(function (subKey) {
210
274
  if (!combinedObj[key][subKey])
211
275
  combinedObj[key][subKey] = '';
212
276
  combinedObj[key][subKey] += combinedSubObj[subKey];
277
+ if (GROUPED_SUBHEADINGS.includes(subKey))
278
+ combinedObj[key][subKey] += '\n';
213
279
  });
214
280
  });
215
281
  };
@@ -218,7 +284,7 @@ exports.Descriptions = {
218
284
  var descriptionObj = descriptionObjs_2[_i];
219
285
  _loop_3(descriptionObj);
220
286
  }
221
- var orderedHeadings = orderDescriptionHeadings(Object.keys(combinedObj));
287
+ var orderedHeadings = orderDescriptionHeadings(Object.keys(combinedObj).filter(function (h) { return !IGNORED_HEADINGS.includes(h); }));
222
288
  // Build our description
223
289
  var description = '';
224
290
  orderedHeadings.forEach(function (key) {
@@ -226,11 +292,11 @@ exports.Descriptions = {
226
292
  return;
227
293
  description += '\n# ' + key + '\n';
228
294
  Object.keys(combinedObj[key]).forEach(function (subKey) {
229
- if (key !== Headings.Dependencies && key !== Headings.Testing)
230
- description += '\n## ' + subKey + '\n';
295
+ description += '\n## ' + subKey + '\n';
231
296
  description += combinedObj[key][subKey];
232
297
  });
233
298
  });
299
+ description += MERGE_REQUEST_CHECKLIST;
234
300
  return description;
235
301
  },
236
302
  getMonorepoDescriptionSection: function (subHeading, mergeRequest) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clickview/ship-it",
3
- "version": "0.0.43",
3
+ "version": "0.0.45",
4
4
  "description": "Release Manager",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {