Skip to content

Commit

Permalink
Use constant for API URL
Browse files Browse the repository at this point in the history
  • Loading branch information
lukestanley committed Oct 24, 2023
1 parent f4635d5 commit 3a9a1a4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/extract-example-block-usage-from-flows.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@

let inputFilePath = 'flow-analysis/flows.json';
let outputFilePath = 'flow-analysis/flow-block-config-analysis.json';

let blockType = 'form'; // Replace with the block type you're interested in
let propertyOfInterest = null; // E.g: 'uiSchema' - replace with the property you're interested in or leave as null

let KENDRAIO_APP_URL = 'https://app.kendra.io/';

const fs = require('fs');
const https = require('https');
Expand Down Expand Up @@ -51,7 +52,7 @@ const generateGroupedJson = (inputFilePath, outputFilePath, blockType, propertyO
adapterName: flow.adapterName,
id: flow.id,
title: flow.title,
url: `https://app.kendra.io/${flow.adapterName}/${flow.id}`
url: `${KENDRAIO_APP_URL}${flow.adapterName}/${flow.id}`
};

// Add the blocks and metadata to the enhanced list
Expand All @@ -78,7 +79,7 @@ const generateGroupedJson = (inputFilePath, outputFilePath, blockType, propertyO
// Check if 'flows.json' exists in the current directory
if (!fs.existsSync(inputFilePath)) {
// Download the JSON file using Node.js built-in https
const url = new URL('https://app.kendra.io/flows');
const url = new URL(`${KENDRAIO_APP_URL}flows`);
const file = fs.createWriteStream(inputFilePath);
https.get(url, (response) => {
response.pipe(file);
Expand Down

0 comments on commit 3a9a1a4

Please sign in to comment.