Skip to content

Commit

Permalink
feat(cli): add success feedback to generate command + add generated f…
Browse files Browse the repository at this point in the history
…ilepaths with verbose
  • Loading branch information
yassinedoghri committed Aug 21, 2022
1 parent ee90afb commit 9e3d4f5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/cli/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const generate = (
defaultLanguage: string,
supportedLanguages: string[],
outputPath: string = inputPath
) => {
): FileToGenerate[] => {
const files = crawlInputDirectory(inputPath);

const filesToGenerate: FileToGenerate[] = [];
Expand Down Expand Up @@ -64,4 +64,6 @@ export const generate = (
});

createFiles(filesToGenerate);

return filesToGenerate;
};
12 changes: 11 additions & 1 deletion src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,22 @@ yargs(hideBin(process.argv))

const pagesPath = argv.path + "src/pages";

generate(
const filesToGenerate = generate(
pagesPath,
argv.config.defaultLanguage,
argv.config.supportedLanguages,
argv.output
);

// All good! Show success feedback
console.log(`🧪 Localized .astro pages were generated successfully!`);

if (argv.verbose) {
const filepaths = filesToGenerate.map(
(fileToGenerate) => fileToGenerate.path
);
console.log(`\n✨ ${filepaths.join("\n✨ ")}`);
}
}
)
.middleware([normalizePath, loadConfig], true)
Expand Down

0 comments on commit 9e3d4f5

Please sign in to comment.