-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.js
executable file
·38 lines (32 loc) · 1.19 KB
/
index.js
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
37
38
#!/usr/bin/env node
/*
Copyright © Magento, Inc. All rights reserved.
See COPYING.txt for license details.
*/
const clear = require('clear');
const chalk = require('chalk');
const {textSync} = require('figlet');
const questions = require('./lib/questions');
const files = require('./lib/files');
const placeholders = require('./lib/placeholders');
// Clear terminal and display ASCII art
clear();
console.log(
chalk.greenBright(textSync("PB Modules", {horizontalLayout: "fitted", font: "Standard"}))
);
const start = async () => {
try {
const moduleAnswers = await questions.askModuleQuestions();
const {vendor, templateType, contentType} = moduleAnswers;
placeholders.setupPlaceholders(moduleAnswers, vendor, contentType);
files.copyTemplate(vendor, templateType, contentType);
files.replaceFileNamePlaceholders(moduleAnswers);
files.replaceFileContentPlaceholders(moduleAnswers);
} catch (e) {
console.log(`${chalk.red('Please correct the following errors noted above and try again.')}`);
console.error(`${chalk.red(e)}`);
} finally {
console.log(`${chalk.white('✔ Page Builder module complete!')}`);
}
};
start();