Spinner added

This commit is contained in:
ful1e5 2020-09-02 09:03:02 +05:30
parent 53e759f699
commit b0611d8e78

View file

@ -1,4 +1,6 @@
import fs from "fs"; import fs from "fs";
import ora from "ora";
import chalk from "chalk";
import path from "path"; import path from "path";
import { ColorSchemes, Config, PathConfig } from "./types"; import { ColorSchemes, Config, PathConfig } from "./types";
@ -39,11 +41,15 @@ const generateConfigs = ({
for (let [schema] of Object.entries(colorSchemes)) { for (let [schema] of Object.entries(colorSchemes)) {
const schemaName = `${themeName}-${schema}`; const schemaName = `${themeName}-${schema}`;
const spinner = ora();
spinner.text = ` Generating ${chalk.blueBright(schemaName)} Color Schema`;
const schemaSvgsPath = path.resolve(schemesPath, schemaName); const schemaSvgsPath = path.resolve(schemesPath, schemaName);
fs.mkdirSync(schemaSvgsPath, { recursive: true }); fs.mkdirSync(schemaSvgsPath, { recursive: true });
const { base, outline, watch } = colorSchemes[schema]; const { base, outline, watch } = colorSchemes[schema];
try {
const sCursors = staticCursors.map((cursor: string) => { const sCursors = staticCursors.map((cursor: string) => {
// Read file // Read file
let content = fs.readFileSync(cursor, "utf-8").toString(); let content = fs.readFileSync(cursor, "utf-8").toString();
@ -108,6 +114,11 @@ const generateConfigs = ({
animatedCursors: aCursors, animatedCursors: aCursors,
staticCursors: sCursors staticCursors: sCursors
}; };
spinner.succeed();
} catch (error) {
console.log(error);
spinner.fail();
}
} }
return configs; return configs;