@manojkmfsi/monodog 1.2.1 → 1.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.
@@ -15,6 +15,7 @@ const release_readiness_service_1 = require("./release-readiness-service");
15
15
  const secure_token_service_1 = require("./secure-token-service");
16
16
  const fs_1 = __importDefault(require("fs"));
17
17
  const path_1 = __importDefault(require("path"));
18
+ const publish_pipeline_service_1 = require("./publish-pipeline-service");
18
19
  class PublishController {
19
20
  constructor() {
20
21
  this.pipelines = new Map();
@@ -61,6 +62,23 @@ class PublishController {
61
62
  */
62
63
  async publish(request) {
63
64
  const pipelineId = this.generatePipelineId();
65
+ // Create pipeline in DB
66
+ const pipelineRecord = await publish_pipeline_service_1.publishPipelineService.createPipeline({
67
+ id: pipelineId,
68
+ packageNames: JSON.stringify(request.packageNames),
69
+ method: request.method || 'auto',
70
+ status: 'pending',
71
+ triggeredBy: request.userId || 'system',
72
+ triggeredAt: new Date(),
73
+ createdAt: new Date(),
74
+ updatedAt: new Date(),
75
+ releaseVersion: request.versionMap ? Object.values(request.versionMap).join(',') : undefined,
76
+ releaseNotes: undefined, // Could be set if changelog is generated
77
+ conclusion: undefined,
78
+ completedAt: undefined,
79
+ errorMessage: undefined,
80
+ errorDetails: undefined,
81
+ });
64
82
  const status = {
65
83
  pipelineId,
66
84
  status: 'pending',
@@ -72,20 +90,22 @@ class PublishController {
72
90
  try {
73
91
  status.startedAt = new Date().toISOString();
74
92
  status.status = 'validating';
75
- // 1. Validate packages
93
+ await publish_pipeline_service_1.publishPipelineService.updatePipeline(pipelineId, { status: 'validating', updatedAt: new Date() });
94
+ // 1. Get readiness
76
95
  const prep = await this.preparePublish(request);
77
96
  if (!prep.valid && !request.dryRun) {
97
+ await publish_pipeline_service_1.publishPipelineService.updatePipeline(pipelineId, { status: 'failed', updatedAt: new Date() });
78
98
  throw new Error(`Packages not ready for publishing. Fix blockers and try again.`);
79
99
  }
80
100
  status.status = 'ready';
81
101
  status.progress = 20;
102
+ await publish_pipeline_service_1.publishPipelineService.updatePipeline(pipelineId, { status: 'ready', updatedAt: new Date() });
82
103
  // 2. Get credentials
83
104
  const npmToken = await secure_token_service_1.secureTokenService.getToken('npm', 'env');
84
- const githubToken = request.method !== 'node'
85
- ? await secure_token_service_1.secureTokenService.getToken('github', 'env')
86
- : undefined;
105
+ const githubToken = request.method !== 'node' ? await secure_token_service_1.secureTokenService.getToken('github', 'env') : undefined;
87
106
  // 3. Publish each package
88
107
  status.status = 'publishing';
108
+ await publish_pipeline_service_1.publishPipelineService.updatePipeline(pipelineId, { status: 'publishing', updatedAt: new Date() });
89
109
  const publisherCount = request.packageNames.length;
90
110
  for (let i = 0; i < request.packageNames.length; i++) {
91
111
  const packageName = request.packageNames[i];
@@ -94,6 +114,23 @@ class PublishController {
94
114
  const result = await this.publishPackage(packageName, packagePath, request.versionMap?.[packageName], npmToken, githubToken, request);
95
115
  status.results[packageName] = result;
96
116
  status.progress = 20 + ((i + 1) / publisherCount) * 80;
117
+ // Store result in DB
118
+ await publish_pipeline_service_1.publishPipelineService.addPublishResult(pipelineId, {
119
+ packageName,
120
+ currentVersion: result.version,
121
+ newVersion: result.version,
122
+ status: result.success ? 'completed' : 'failed',
123
+ result: result.success ? 'published' : 'error',
124
+ error: result.errors?.join('\n') || undefined,
125
+ errorDetails: result.errors?.join('\n') || undefined,
126
+ npmPackageId: result.packageId,
127
+ publishedAt: result.success ? new Date() : undefined,
128
+ // tarballUrl: result.tarballUrl || undefined, // Not present in result
129
+ gitTagCreated: result.gitTag || undefined,
130
+ // gitCommitSha: result.gitCommitSha || undefined, // Not present in result
131
+ // gitPushCompleted: result.gitPushCompleted || false, // Not present in result
132
+ githubReleaseUrl: result.gitHubReleaseUrl || undefined,
133
+ });
97
134
  }
98
135
  // 4. Generate changelog entries
99
136
  if (!request.dryRun) {
@@ -103,12 +140,28 @@ class PublishController {
103
140
  status.status = 'completed';
104
141
  status.progress = 100;
105
142
  status.completedAt = new Date().toISOString();
143
+ await publish_pipeline_service_1.publishPipelineService.updatePipeline(pipelineId, {
144
+ status: 'completed',
145
+ completedAt: new Date(),
146
+ updatedAt: new Date(),
147
+ conclusion: 'success',
148
+ errorMessage: undefined,
149
+ errorDetails: undefined,
150
+ });
106
151
  console.info(`\n✅ Publish pipeline completed: ${pipelineId}`);
107
152
  }
108
153
  catch (error) {
109
154
  status.status = 'failed';
110
155
  status.error = error instanceof Error ? error.message : String(error);
111
156
  status.completedAt = new Date().toISOString();
157
+ await publish_pipeline_service_1.publishPipelineService.updatePipeline(pipelineId, {
158
+ status: 'failed',
159
+ errorMessage: status.error,
160
+ errorDetails: status.error,
161
+ completedAt: new Date(),
162
+ updatedAt: new Date(),
163
+ conclusion: 'failure',
164
+ });
112
165
  console.error(`\n❌ Publish pipeline failed: ${status.error}`);
113
166
  }
114
167
  return status;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manojkmfsi/monodog",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "App for monodog monorepo",
5
5
  "license": "MIT",
6
6
  "author": "Mindfiredigital",
Binary file