@docupace/pipeline 1.0.5-alpha.20 → 1.0.5-alpha.22
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.
- package/package.json +1 -1
- package/src/changeset/cli.js +17 -7
package/package.json
CHANGED
package/src/changeset/cli.js
CHANGED
|
@@ -15,7 +15,19 @@ const program = new Command();
|
|
|
15
15
|
|
|
16
16
|
const args = process.argv;
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
async function createChangesetDirectory() {
|
|
19
|
+
try {
|
|
20
|
+
// Use path.join to build a safe path to `.changeset`
|
|
21
|
+
const targetDir = path.join(process.cwd(), '.changeset');
|
|
22
|
+
|
|
23
|
+
// Create the directory recursively if it doesn't exist
|
|
24
|
+
await fs.mkdir(targetDir, { recursive: true });
|
|
25
|
+
console.log(`Directory created at ${targetDir}`);
|
|
26
|
+
} catch (error) {
|
|
27
|
+
console.error('Error creating .changeset directory:', error);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
19
31
|
|
|
20
32
|
function run(command) {
|
|
21
33
|
return new Promise((resolve, reject) => {
|
|
@@ -172,8 +184,8 @@ program
|
|
|
172
184
|
const branchName = branchStdout.trim();
|
|
173
185
|
console.log(`Current branch: ${branchName}`);
|
|
174
186
|
|
|
175
|
-
// Step 2: Extract Jira ticket number (e.g., JIRA-1234)
|
|
176
|
-
const jiraTicketMatch = branchName.match(/([A-Z]
|
|
187
|
+
// Step 2: Extract Jira ticket number (e.g., matching JIRA-1234 pattern)
|
|
188
|
+
const jiraTicketMatch = branchName.match(/([A-Z]+-\d+)/);
|
|
177
189
|
if (!jiraTicketMatch) {
|
|
178
190
|
throw new Error('No Jira ticket found in the branch name.');
|
|
179
191
|
}
|
|
@@ -187,9 +199,7 @@ program
|
|
|
187
199
|
const jiraUrl = `${jiraBaseUrl}/rest/api/2/issue/${jiraTicketId}`;
|
|
188
200
|
const jiraResponse = await fetch(jiraUrl, {
|
|
189
201
|
headers: {
|
|
190
|
-
Authorization: `Basic ${Buffer.from(jiraFullApiKey).toString(
|
|
191
|
-
'base64',
|
|
192
|
-
)}`,
|
|
202
|
+
Authorization: `Basic ${Buffer.from(jiraFullApiKey).toString('base64')}`,
|
|
193
203
|
'Content-Type': 'application/json',
|
|
194
204
|
},
|
|
195
205
|
});
|
|
@@ -257,7 +267,7 @@ ${summary} [${jiraTicketId}]
|
|
|
257
267
|
`;
|
|
258
268
|
const changesetFile = `./.changeset/${jiraTicketId}.md`;
|
|
259
269
|
|
|
260
|
-
await
|
|
270
|
+
await createChangesetDirectory();
|
|
261
271
|
await fs.promises.writeFile(changesetFile, changesetContent);
|
|
262
272
|
console.log(`Created changeset file at ${changesetFile}`);
|
|
263
273
|
|