@docupace/pipeline 1.0.1 → 1.0.2-3.tes2

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.
@@ -0,0 +1,107 @@
1
+ import axios from 'axios';
2
+
3
+ /**
4
+ * Fetch secrets from Vault.
5
+ * @param {string} vaultPath - The path in Vault to fetch secrets from.
6
+ * @returns {Promise<Object>} - The secret data as a JSON object.
7
+ */
8
+ export async function getVaultSecrets(vaultPath) {
9
+ if (!vaultPath) {
10
+ console.error("Error: VAULT_PATH is required.");
11
+ throw new Error("VAULT_PATH is required.");
12
+ }
13
+
14
+ const vaultToken = process.env.VAULT_TOKEN;
15
+ const vaultAddr = process.env.VAULT_ADDR;
16
+
17
+ if (!vaultToken || !vaultAddr) {
18
+ console.error("Error: VAULT_TOKEN and VAULT_ADDR must be set.");
19
+ throw new Error("VAULT_TOKEN and VAULT_ADDR must be set.");
20
+ }
21
+
22
+ try {
23
+ // Disable SSL verification globally by setting environment variable
24
+ if (process.env.VAULT_SKIP_VERIFY === 'true') {
25
+ process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
26
+ }
27
+
28
+ // Fetch the secret from Vault
29
+ const response = await axios.get(`${vaultAddr}/v1/${vaultPath}`, {
30
+ headers: {
31
+ 'X-Vault-Token': vaultToken,
32
+ },
33
+ });
34
+
35
+ // Validate the response contains JSON data
36
+ const data = response.data;
37
+ if (data && typeof data === 'object') {
38
+ // console.log(`Secrets fetched successfully from Vault at ${JSON.stringify(data.data.data)})`);
39
+ return data.data.data;
40
+ } else {
41
+ console.error("Error: Invalid JSON received from Vault.");
42
+ throw new Error("Invalid JSON received from Vault.");
43
+ }
44
+ } catch (error) {
45
+ if (error.response) {
46
+ console.error(
47
+ `Error: Failed to connect to Vault server at ${vaultAddr}. Response: ${error.response.status} ${error.response.statusText}`
48
+ );
49
+ } else {
50
+ console.error(`Error: ${error.message}`);
51
+ }
52
+ // throw error;
53
+ }
54
+ }
55
+
56
+ /**
57
+ * Update a secret in Vault.
58
+ * @param {string} vaultPath - The path in Vault where the secret should be updated.
59
+ * @param {Object} secretData - The secret data to be stored (as a JSON object).
60
+ * @returns {Promise<Object>} - The response from Vault as a JSON object.
61
+ */
62
+ export async function updateVaultSecrets(vaultPath, secretData) {
63
+ if (!vaultPath || !secretData) {
64
+ console.error("Usage: updateVaultSecret(vaultPath, secretData)");
65
+ throw new Error("Both vaultPath and secretData are required.");
66
+ }
67
+
68
+ const vaultToken = process.env.VAULT_TOKEN;
69
+ const vaultAddr = process.env.VAULT_ADDR;
70
+
71
+ if (!vaultToken || !vaultAddr) {
72
+ console.error("Error: VAULT_TOKEN and VAULT_ADDR must be set.");
73
+ throw new Error("VAULT_TOKEN and VAULT_ADDR must be set.");
74
+ }
75
+
76
+ try {
77
+ // Disable SSL verification globally if VAULT_SKIP_VERIFY is set
78
+ if (process.env.VAULT_SKIP_VERIFY === 'true') {
79
+ process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
80
+ }
81
+
82
+ // Make the POST request to update the Vault secret
83
+ const response = await axios.post(
84
+ `${vaultAddr}/v1/${vaultPath}`,
85
+ secretData,
86
+ {
87
+ headers: {
88
+ 'X-Vault-Token': vaultToken,
89
+ 'Content-Type': 'application/json',
90
+ },
91
+ }
92
+ );
93
+
94
+ // Return the response from Vault
95
+ console.log(response.data);
96
+ return response.data;
97
+ } catch (error) {
98
+ if (error.response) {
99
+ console.error(
100
+ `Error: Failed to update secret at ${vaultPath}. Response: ${error.response.status} ${error.response.statusText}`
101
+ );
102
+ } else {
103
+ console.error(`Error: ${error.message}`);
104
+ }
105
+ // throw error;
106
+ }
107
+ }
@@ -2,47 +2,71 @@
2
2
  import { Command } from 'commander';
3
3
  import { $ } from 'zx';
4
4
  import path from 'path';
5
- import {validateChangesets} from "./validate.js";
5
+ import { validateChangesets } from './validate.js';
6
6
  import fs from 'fs';
7
- import OpenAI from "openai";
8
- import {zodResponseFormat} from "openai/helpers/zod";
9
- import z from 'zod'
7
+ import OpenAI from 'openai';
8
+ import { zodResponseFormat } from 'openai/helpers/zod';
9
+ import z from 'zod';
10
10
  import dotenv from 'dotenv';
11
- dotenv.config({path : ['.env.pipeline.local', 'config/.env.pipeline.local']});
11
+ dotenv.config({ path: ['.env.pipeline.local', 'config/.env.pipeline.local'] });
12
+ import { exec } from 'child_process';
12
13
 
13
14
  const program = new Command();
14
15
 
15
16
  const args = process.argv;
16
17
 
17
- const DIR = path.resolve(process.cwd());
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.promises.mkdir(targetDir, { recursive: true });
25
+ } catch (error) {
26
+ console.error('Error creating .changeset directory:', error);
27
+ }
28
+ }
29
+
30
+
31
+ function run(command) {
32
+ return new Promise((resolve, reject) => {
33
+ exec(command, { shell: true }, (error, stdout, stderr) => {
34
+ if (error) {
35
+ reject(error);
36
+ } else {
37
+ resolve({ stdout, stderr });
38
+ }
39
+ });
40
+ });
41
+ }
18
42
 
19
43
  async function fileExists(filePath) {
20
- try {
21
- await fs.promises.access(filePath);
22
- return true;
23
- } catch {
24
- return false;
25
- }
44
+ try {
45
+ await fs.promises.access(filePath);
46
+ return true;
47
+ } catch {
48
+ return false;
49
+ }
26
50
  }
27
51
 
28
52
  async function getMainPackage() {
29
- const mainModulePath = process.env.PWD;
30
- if (mainModulePath) {
31
- const packageJsonPath = path.join(mainModulePath, 'package.json');
32
- if (await fileExists(packageJsonPath)) {
33
- const fileContent = await fs.promises.readFile(packageJsonPath, 'utf-8');
34
- const packageJson = JSON.parse(fileContent);
35
- return packageJson;
36
- }
53
+ const mainModulePath = process.cwd();
54
+ if (mainModulePath) {
55
+ const packageJsonPath = path.join(mainModulePath, 'package.json');
56
+ if (await fileExists(packageJsonPath)) {
57
+ const fileContent = await fs.promises.readFile(packageJsonPath, 'utf-8');
58
+ const packageJson = JSON.parse(fileContent);
59
+ return packageJson;
37
60
  }
38
- throw new Error('Main package.json not found');
61
+ }
62
+ throw new Error('Main package.json not found');
39
63
  }
40
64
 
41
65
  // Helper function to set Git info
42
66
  async function setGitInfo() {
43
- await $`git config --global user.email "gitops@docupace.com"`;
44
- await $`git config --global user.name "Gitops"`;
45
- await $`git remote set-url origin https://x-token-auth:${process.env.THIS_REP_TOKEN}@bitbucket.org/${process.env.BITBUCKET_REPO_FULL_NAME}.git`;
67
+ await $`git config --global user.email "gitops@docupace.com"`;
68
+ await $`git config --global user.name "Gitops"`;
69
+ await $`git remote set-url origin https://${process.env.THIS_REP_TOKEN}@bitbucket.org/${process.env.BITBUCKET_REPO_FULL_NAME}.git`;
46
70
  }
47
71
 
48
72
  const changeSetPackage = `{
@@ -60,176 +84,198 @@ const changeSetPackage = `{
60
84
  "@changesets/cli": "^2.27.10"
61
85
  }
62
86
  }
63
- `
87
+ `;
64
88
 
65
89
  async function versionCommand() {
66
- console.log('📦 Running Changeset versioning...');
67
- await setGitInfo();
68
- await $`mv package.json package.json.bak`
69
- await $`mv pnpm-lock.yaml pnpm-lock.yaml.bak`
70
- await fs.promises.writeFile('package.json', changeSetPackage);
71
- await $`pnpm install`;
72
- await $`rm package.json pnpm-lock.yaml`
73
- await $`mv package.json.bak package.json`
74
- await $`mv pnpm-lock.yaml.bak pnpm-lock.yaml`
75
- await $`pnpm changeset version`;
76
- console.log('✅ Changeset versioning complete.');
90
+ console.log('📦 Running Changeset versioning...');
91
+ await setGitInfo();
92
+ await $`mv package.json package.json.bak`;
93
+ await $`mv pnpm-lock.yaml pnpm-lock.yaml.bak`;
94
+ await fs.promises.writeFile('package.json', changeSetPackage);
95
+ await $`pnpm install`;
96
+ await $`rm package.json pnpm-lock.yaml`;
97
+ await $`mv package.json.bak package.json`;
98
+ await $`mv pnpm-lock.yaml.bak pnpm-lock.yaml`;
99
+ await $`pnpm changeset version`;
100
+ console.log('✅ Changeset versioning complete.');
77
101
  }
78
102
 
79
103
  async function commitTagCommand() {
80
- console.log('📌 Committing and tagging the new version...');
81
- await setGitInfo();
82
- await $`git add .`;
83
- const newVersion = (await $`node -p "require('./package.json').version"`).stdout.trim();
84
- await $`git commit -m "Version bump to ${newVersion} and changelog"`;
85
- await $`git push origin`;
86
- await $`git tag v${newVersion}`;
87
- await $`git push origin --tags`;
88
- console.log(`✅ Version ${newVersion} tagged and pushed.`);
104
+ console.log('📌 Checking for updates to commit...');
105
+
106
+ // Check if there are changes to commit
107
+ const status = (await $`git status --porcelain`).stdout.trim();
108
+ if (!status) {
109
+ console.log('✅ No changes to commit. Exiting.');
110
+ return;
111
+ }
112
+
113
+ console.log('📌 Committing and tagging the new version...');
114
+ await setGitInfo();
115
+ await $`git add .`;
116
+ const newVersion = (
117
+ await $`node -p "require('./package.json').version"`
118
+ ).stdout.trim();
119
+ await $`git commit -m "Version bump to ${newVersion} and changelog"`;
120
+ await $`git push origin`;
121
+ await $`git tag v${newVersion}`;
122
+ await $`git push origin --tags`;
123
+ console.log(`✅ Version ${newVersion} tagged and pushed.`);
89
124
  }
90
125
 
91
126
  // Command: validate
92
127
  program
93
- .command('validate <path>')
94
- .description('Validate changesets for the provided PR')
95
- .action(async (path) => {
96
- if(!process.env.BITBUCKET_PR_ID) {
97
- return;
98
- }
99
- console.log('🔍 Validating changesets...');
100
- try {
101
- await validateChangesets(path);
102
- console.log('✅ Changeset validation passed.');
103
- } catch (error) {
104
- console.error(
105
- '❌ No changeset found. Please add a changeset to this PR. Please see more information at https://docupacellc.atlassian.net/wiki/spaces/PM/pages/1350893571/Creating+changesets+for+Docupace+Next'
106
- );
107
- process.exit(1);
108
- }
109
- });
128
+ .command('validate <path>')
129
+ .description('Validate changesets for the provided PR')
130
+ .action(async (path) => {
131
+ if (!process.env.BITBUCKET_PR_ID) {
132
+ return;
133
+ }
134
+ console.log('🔍 Validating changesets...');
135
+ try {
136
+ await validateChangesets(path);
137
+ console.log('✅ Changeset validation passed.');
138
+ } catch (error) {
139
+ console.error(
140
+ '❌ No changeset found. Please add a changeset to this PR. Please see more information at https://docupacellc.atlassian.net/wiki/spaces/PM/pages/1350893571/Creating+changesets+for+Docupace+Next',
141
+ );
142
+ process.exit(1);
143
+ }
144
+ });
110
145
  // Command: version
111
146
  program
112
- .command('version')
113
- .description('Run Changeset versioning')
114
- .action(async () => {
115
- await versionCommand();
116
- });
147
+ .command('version')
148
+ .description('Run Changeset versioning')
149
+ .action(async () => {
150
+ await versionCommand();
151
+ });
117
152
 
118
153
  // Command: commit-and-tag
119
154
  program
120
- .command('commit-tag')
121
- .description('Commit and tag the new version')
122
- .action(async () => {
123
- await commitTagCommand();
124
- });
155
+ .command('commit-tag')
156
+ .description('Commit and tag the new version')
157
+ .action(async () => {
158
+ await commitTagCommand();
159
+ });
125
160
 
126
161
  // Command: all
127
162
  program
128
- .command('version-commit-tag')
129
- .description('Run versioning and commit-and-tag in sequence')
130
- .action(async () => {
131
- console.log('📦 Running all steps...');
132
- await versionCommand();
133
- await commitTagCommand();
134
- });
163
+ .command('version-commit-tag')
164
+ .description('Run versioning and commit-and-tag in sequence')
165
+ .action(async () => {
166
+ console.log('📦 Running all steps...');
167
+ await versionCommand();
168
+ await commitTagCommand();
169
+ });
135
170
 
136
171
  program
137
- .name('create-changeset')
138
- .description('Creates a changeset based on the current branch and Jira ticket information')
139
- .action(async () => {
140
- const mainPackage = await getMainPackage();
141
- const componentName = mainPackage.name;
142
-
143
- try {
144
- // Step 1: Get the current branch name
145
- const branchName = (await $`git branch --show-current`).stdout.trim();
146
- console.log(`Current branch: ${branchName}`);
147
-
148
- // Step 2: Extract Jira ticket number (e.g., matching JIRA-1234 pattern)
149
- const jiraTicketMatch = branchName.match(/([A-Z]+-\d+)/);
150
- if (!jiraTicketMatch) {
151
- throw new Error('No Jira ticket found in the branch name.');
152
- }
153
- const jiraTicketId = jiraTicketMatch[0];
154
-
155
- // Step 3: Fetch Jira ticket information
156
- const jiraBaseUrl = 'https://docupacellc.atlassian.net';
157
- const jiraEmail = process.env.JIRA_API_EMAIL;
158
- const jiraApiKey = process.env.JIRA_API_KEY;
159
- const jiraFullApiKey = `${jiraEmail}:${jiraApiKey}`;
160
- const jiraUrl = `${jiraBaseUrl}/rest/api/2/issue/${jiraTicketId}`;
161
- const jiraResponse = await fetch(jiraUrl, {
162
- headers: {
163
- Authorization: `Basic ${Buffer.from(jiraFullApiKey).toString('base64')}`,
164
- 'Content-Type': 'application/json',
165
- },
166
- });
167
-
168
- if (!jiraResponse.ok) {
169
- throw new Error(`Failed to fetch Jira ticket. Status: ${jiraResponse.status}`);
170
- }
171
- const jiraTicketData = await jiraResponse.json();
172
-
173
- if(jiraTicketData.fields.customfield_10107?.value !== 'Product') {
174
- throw new Error("Issue Type of Work must be Product")
175
- }
176
-
177
- const jiraSummary = jiraTicketData.fields.summary;
178
-
179
- console.log(`Generating release notes for ${jiraTicketId} - ${jiraSummary}`)
180
-
181
- const openaiClient = new OpenAI({
182
- apiKey: process.env['OPENAI_API_KEY'],
183
- });
184
-
185
- const ChangeRequestSchema = z.object({
186
- change_type: z.enum(["patch", "minor"]),
187
- summary: z.string(),
188
- jira_ticket_id: z.string(),
189
- });
190
-
191
- const openAiResponse = await openaiClient.chat.completions.create({
192
- model: "gpt-4o-mini",
193
- messages: [
194
- {
195
- role: "system",
196
- content: `Process JSON from a Jira ticket to generate simple maximum 2 sentence release note for the ticket and determine the change type for bug it should be a patch for new feature it should be a minor change`,
197
- },
198
- {
199
- role: "user",
200
- content: JSON.stringify(jiraTicketData),
201
- },
202
- ],
203
- response_format: zodResponseFormat(ChangeRequestSchema, 'changeset_schema'),
204
- temperature: 0
205
- });
206
-
207
- const assistantResponse = openAiResponse.choices[0].message.content;
208
- const parsedResponse = JSON.parse(assistantResponse);
209
-
210
- const { change_type, summary } = parsedResponse;
211
- console.log(`Change type: ${change_type}`);
212
- console.log(`Release note: ${summary}`);
213
-
214
- // Step 5: Create a changeset using pnpm
215
- const changesetContent = `---
172
+ .name('create-changeset')
173
+ .description(
174
+ 'Creates a changeset based on the current branch and Jira ticket information',
175
+ )
176
+ .action(async () => {
177
+ const mainPackage = await getMainPackage();
178
+ const componentName = mainPackage.name;
179
+
180
+ try {
181
+ // Step 1: Get the current branch name
182
+ const { stdout: branchStdout } = await run(`git branch --show-current`);
183
+ const branchName = branchStdout.trim();
184
+ console.log(`Current branch: ${branchName}`);
185
+
186
+ // Step 2: Extract Jira ticket number (e.g., matching JIRA-1234 pattern)
187
+ const jiraTicketMatch = branchName.match(/([A-Z]+-\d+)/);
188
+ if (!jiraTicketMatch) {
189
+ throw new Error('No Jira ticket found in the branch name.');
190
+ }
191
+ const jiraTicketId = jiraTicketMatch[0];
192
+
193
+ // Step 3: Fetch Jira ticket information
194
+ const jiraBaseUrl = 'https://docupacellc.atlassian.net';
195
+ const jiraEmail = process.env.JIRA_API_EMAIL;
196
+ const jiraApiKey = process.env.JIRA_API_KEY;
197
+ const jiraFullApiKey = `${jiraEmail}:${jiraApiKey}`;
198
+ const jiraUrl = `${jiraBaseUrl}/rest/api/2/issue/${jiraTicketId}`;
199
+ const jiraResponse = await fetch(jiraUrl, {
200
+ headers: {
201
+ Authorization: `Basic ${Buffer.from(jiraFullApiKey).toString('base64')}`,
202
+ 'Content-Type': 'application/json',
203
+ },
204
+ });
205
+
206
+ if (!jiraResponse.ok) {
207
+ throw new Error(
208
+ `Failed to fetch Jira ticket. Status: ${jiraResponse.status}`,
209
+ );
210
+ }
211
+ const jiraTicketData = await jiraResponse.json();
212
+
213
+ if (jiraTicketData.fields.customfield_10107?.value !== 'Product') {
214
+ throw new Error('Issue Type of Work must be Product');
215
+ }
216
+
217
+ const jiraSummary = jiraTicketData.fields.summary;
218
+
219
+ console.log(
220
+ `Generating release notes for ${jiraTicketId} - ${jiraSummary}`,
221
+ );
222
+
223
+ // Step 4: Use OpenAI to generate release notes
224
+ const openaiClient = new OpenAI({
225
+ apiKey: process.env['OPENAI_API_KEY'],
226
+ });
227
+
228
+ const ChangeRequestSchema = z.object({
229
+ change_type: z.enum(['patch', 'minor']),
230
+ summary: z.string(),
231
+ jira_ticket_id: z.string(),
232
+ });
233
+
234
+ const openAiResponse = await openaiClient.chat.completions.create({
235
+ model: 'gpt-4o-mini',
236
+ messages: [
237
+ {
238
+ role: 'system',
239
+ content: `Process JSON from a Jira ticket to generate simple maximum 2 sentence release note for the ticket and determine the change type for bug it should be a patch for new feature it should be a minor change`,
240
+ },
241
+ {
242
+ role: 'user',
243
+ content: JSON.stringify(jiraTicketData),
244
+ },
245
+ ],
246
+ response_format: zodResponseFormat(
247
+ ChangeRequestSchema,
248
+ 'changeset_schema',
249
+ ),
250
+ temperature: 0,
251
+ });
252
+
253
+ const assistantResponse = openAiResponse.choices[0].message.content;
254
+ const parsedResponse = JSON.parse(assistantResponse);
255
+
256
+ const { change_type, summary } = parsedResponse;
257
+ console.log(`Change type: ${change_type}`);
258
+ console.log(`Release note: ${summary}`);
259
+
260
+ // Step 5: Create a changeset .md file
261
+ const changesetContent = `---
216
262
  "${componentName}": ${change_type}
217
263
  ---
218
264
 
219
265
  ${summary} [${jiraTicketId}]
220
- `;
221
- const changesetFile = `./.changeset/${jiraTicketId}.md`;
222
-
223
- await $`mkdir -p ./.changeset`;
224
- await fs.promises.writeFile(changesetFile, changesetContent);
225
- console.log(`Created changeset file at ${changesetFile}`);
266
+ `;
267
+ const changesetFile = `./.changeset/${jiraTicketId}.md`;
226
268
 
227
- console.log('Done!');
228
- } catch (err) {
229
- console.error(`Error: ${err.message}`);
230
- }
231
- });
269
+ await createChangesetDirectory();
270
+ await fs.promises.writeFile(changesetFile, changesetContent);
271
+ console.log(`Created changeset file at ${changesetFile}`);
232
272
 
273
+ console.log('Done!');
274
+ } catch (err) {
275
+ console.error(`Error: ${err.message}`);
276
+ process.exit(1);
277
+ }
278
+ });
233
279
 
234
280
  // Parse arguments
235
281
  program.parse(args);
@@ -2,43 +2,46 @@ import fs from 'fs';
2
2
  import path from 'path';
3
3
 
4
4
  export async function validateChangesets(directoryPath) {
5
- try {
6
- // Step 1: Read the directory for md files excluding README.md
7
- const allFiles = fs.readdirSync(directoryPath);
8
- const mdFiles = allFiles.filter(file => file.endsWith('.md') && file !== 'README.md');
9
-
10
- // Step 2: Check for pre.json and parse it
11
- const preJsonPath = path.join(directoryPath, 'pre.json');
12
- let preJson;
13
-
14
- if (!fs.existsSync(preJsonPath) && mdFiles.length === 0) {
15
- throw new Error("Error: No pre.json and no md files found.")
16
- }
5
+ try {
6
+ // Step 1: Read the directory for md files excluding README.md
7
+ const allFiles = fs.readdirSync(directoryPath);
8
+ const mdFiles = allFiles.filter(
9
+ (file) => file.endsWith('.md') && file !== 'README.md',
10
+ );
11
+
12
+ // Step 2: Check for pre.json and parse it
13
+ const preJsonPath = path.join(directoryPath, 'pre.json');
14
+ let preJson;
15
+
16
+ if (!fs.existsSync(preJsonPath) && mdFiles.length === 0) {
17
+ throw new Error('Error: No pre.json and no md files found.');
18
+ }
17
19
 
18
- if (fs.existsSync(preJsonPath)) {
19
- preJson = JSON.parse(fs.readFileSync(preJsonPath, 'utf-8'));
20
+ if (fs.existsSync(preJsonPath)) {
21
+ preJson = JSON.parse(fs.readFileSync(preJsonPath, 'utf-8'));
20
22
 
21
- if(preJson.mode == 'pre') {
22
- // Step 4a: Get list of changesets from pre.json
23
- const changesets = preJson.changesets || [];
24
- const changesetNames = changesets.map(change => change);
23
+ if (preJson.mode == 'pre') {
24
+ // Step 4a: Get list of changesets from pre.json
25
+ const changesets = preJson.changesets || [];
26
+ const changesetNames = changesets.map((change) => change);
25
27
 
26
- // Step 4b: Match files with the list of changesets
27
- const mdFileNamesWithoutExt = mdFiles.map(file => path.basename(file, '.md'));
28
- const unmatchedFiles = mdFileNamesWithoutExt.filter(fileName => !changesetNames.includes(fileName));
28
+ // Step 4b: Match files with the list of changesets
29
+ const mdFileNamesWithoutExt = mdFiles.map((file) =>
30
+ path.basename(file, '.md'),
31
+ );
32
+ const unmatchedFiles = mdFileNamesWithoutExt.filter(
33
+ (fileName) => !changesetNames.includes(fileName),
34
+ );
29
35
 
30
- if (unmatchedFiles.length == 0) {
31
- throw new Error("Error: No new MD files found:");
32
- }
33
- }
36
+ if (unmatchedFiles.length == 0) {
37
+ throw new Error('Error: No new MD files found:');
34
38
  }
35
-
36
- console.log("Validation successful.");
37
- } catch (error) {
38
- console.log(error.message);
39
- throw(error);
39
+ }
40
40
  }
41
- }
42
-
43
-
44
41
 
42
+ console.log('Validation successful.');
43
+ } catch (error) {
44
+ console.log(error.message);
45
+ throw error;
46
+ }
47
+ }