-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerateConfig.js
More file actions
37 lines (28 loc) · 1.12 KB
/
generateConfig.js
File metadata and controls
37 lines (28 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import fs from "fs";
const animateLoadingMessage =(message, duration) =>{
let index = 0;
const frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
const intervalId = setInterval(() => {
process.stdout.write(`\r${frames[index % frames.length]} ${message}`);
index += 1;
}, 100); // Change the interval duration based on your preference
setTimeout(() => {
clearInterval(intervalId);
console.log('\n'); // Move to the next line after the loading message is complete
}, duration);
}
try {
// Read the configuration data from sniply.json
const configFileContent = fs.readFileSync("sniply.json", "utf-8");
const appConfig = JSON.parse(configFileContent);
const config = {
// Your configuration data here
};
const configString = JSON.stringify(config, null, 2);
const configFilePath = "sniply.config.json";
fs.writeFileSync(configFilePath, configString);
animateLoadingMessage(`Generating svelteflow Config for ${appConfig?.appName}`, 6000);
} catch(err) {
console.error(
"Error reading or generating the configuration file:",err);
}