Skip to content

Commit

Permalink
docs: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
luangjokaj committed Mar 31, 2021
1 parent 986e98c commit edbfd5c
Show file tree
Hide file tree
Showing 8 changed files with 166 additions and 160 deletions.
50 changes: 20 additions & 30 deletions installer/index.js
Original file line number Diff line number Diff line change
@@ -1,66 +1,56 @@
#!/usr/bin/env node
/**
* Main Installer for FuzzyMail
* Check the node version if above 8 then run the app.
*
* Credits:
* Ahmad Awais - https://twitter.com/MrAhmadAwais/
* Luan Gjokaj - https://twitter.com/luangjokaj/
*/

'use strict';
"use strict";

const currentNodeVersion = process.versions.node;
const semver = currentNodeVersion.split('.');
const semver = currentNodeVersion.split(".");
const major = semver[0];

const prompts = require('prompts');
const chalk = require('chalk');
const prompts = require("prompts");
const chalk = require("chalk");

const program = require('commander');
const version = require('../package.json').version;
const program = require("commander");
const version = require("../package.json").version;

program
.version(version, '-v, --vers', 'output the current version')
.version(version, "-v, --vers", "output the current version")
.parse(process.argv);

(async () => {
const response = await prompts({
type: 'confirm',
name: 'value',
type: "confirm",
name: "value",
message: `Do you want to install ${chalk.white.bgGreen(
'πŸ“¨ FuzzyMail',
"πŸ“¨ FuzzyMail",
)} in the current directory?\n${chalk.red(process.cwd())}`,
});

if (response.value) {
// If below Node 8.
// If below Node 8
if (8 > major) {
console.error(
chalk.red(
'You are running Node ' +
"You are running Node " +
currentNodeVersion +
'.\n' +
'Install FuzzyMail requires Node 8 or higher. \n' +
'Kindly, update your version of Node.',
".\n" +
"Install FuzzyMail requires Node 8 or higher. \n" +
"Kindly, update your version of Node.",
),
);
process.exit(1);
}

// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// terminate the Node.js process with a non-zero exit code.
process.on('unhandledRejection', err => {
// terminate the Node.js process with a non-zero exit code
process.on("unhandledRejection", (err) => {
throw err;
});

/**
* Run the entire program.
* Run the entire program
*
* Runs all the functions with async/await.
* Runs all the functions with async/await
*/
const run = require('./modules/run');
const run = require("./modules/run");
run();
}
})();
12 changes: 8 additions & 4 deletions installer/modules/clearConsole.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
/**
* Cross platform clear console.
* Cross platform clear console
*
* Support for win32 and others.
* Support for win32 and others
*/

'use strict';
"use strict";

module.exports = () => {
process.stdout.write('win32' === process.platform ? '\x1B[2J\x1B[0f' : '\x1B[2J\x1B[3J\x1B[H');
process.stdout.write(
"win32" === process.platform
? "\x1B[2J\x1B[0f"
: "\x1B[2J\x1B[3J\x1B[H",
);
};
9 changes: 3 additions & 6 deletions installer/modules/handleError.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
/**
* Error handler
*/
'use strict';
"use strict";

module.exports = err => {
module.exports = (err) => {
if (err) {
console.log('ERROR: ' + err); // eslint-disable-line no-console
console.log("ERROR: " + err);
}
};
96 changes: 53 additions & 43 deletions installer/modules/printNextSteps.js
Original file line number Diff line number Diff line change
@@ -1,58 +1,68 @@
/**
* Prints next steps.
*
* @param {string} blockName The block name.
* @param {string} blockDir The block directory.
*/

const chalk = require('chalk');
const chalk = require("chalk");

module.exports = () => {
console.log('\n\nβœ… ', chalk.black.bgGreen(' All done! Happy coding. \n'));
console.log("\n\nβœ… ", chalk.black.bgGreen(" All done! Happy coding. \n"));
console.log(
'Installer has added πŸ“¨ FuzzyMail files to the current directory. ',
'\nInside this directory, you can run this command:',
"Installer has added πŸ“¨ FuzzyMail files to the current directory. ",
"\nInside this directory, you can run this command:",
);

// Scripts.
// Scripts
console.log(
'\nπŸ‘‰ ',
' Type',
chalk.black.bgWhite(' npm run dev '),
'\n\n',
' Use to compile and run your files.',
'\n',
' Watches for any changes and reports back any errors in your code.',
"\nπŸ‘‰ ",
" Type",
chalk.black.bgWhite(" npm run dev "),
"\n\n",
" Use to compile and run your files.",
"\n",
" Watches for any changes and reports back any errors in your code.",
);

// Support.
console.log('\n✊ ', chalk.black.bgYellow(' Support FuzzyMail \n'));
console.log('Like FuzzyMail? Check out our other free and open source repositories: \n');
// Support
console.log("\n✊ ", chalk.black.bgYellow(" Support FuzzyMail \n"));
console.log(
"Like FuzzyMail? Check out our other free and open source repositories: \n",
);
console.log(
` ${chalk.yellow('WordPressify β†’ ')} https://bit.ly/2KTqyQX`,
'\n',
` ${chalk.gray('Development workflow for WordPress themes.')}`,
'\n',
` ${chalk.yellow('GoPablo β†’ ')} https://bit.ly/2Hgkfpy`,
'\n',
` ${chalk.gray('GoPablo is a static site generator.')}`,
'\n',
` ${chalk.yellow('ReactFondue β†’ ')} https://bit.ly/2OXgStR`,
'\n',
` ${chalk.gray('SEO optimized React applications with SSR.')}`,
'\n',
` ${chalk.green('Powered by Riangle β†’ ')} https://bit.ly/2P5i26I`,
'\n',
'\n',
` ${chalk.red('Thank you for using πŸ“¨ FuzzyMail β†’ ')} https://www.fuzzymail.co`,
` ${chalk.yellow("Cherry β†’ ")} https://bit.ly/3sEr75P`,
"\n",
` ${chalk.gray("β€’ A design system to build the web.")}`,
"\n",
` ${chalk.yellow("GoPablo β†’ ")} http://bit.ly/2Hgkfpy`,
"\n",
` ${chalk.gray("β€’ Create optimized static websites.")}`,
"\n",
` ${chalk.yellow("WordPressify β†’ ")} https://bit.ly/2KTqyQX`,
"\n",
` ${chalk.gray("β€’ Automate your WordPress development workflow.")}`,
"\n",
` ${chalk.yellow("Nextify β†’ ")} https://bit.ly/3m4lVWm`,
"\n",
` ${chalk.gray("β€’ React apps using Next.js and Emotion.")}`,
"\n",
` ${chalk.yellow("FuzzyMail β†’ ")} https://bit.ly/2P3Irlr`,
"\n",
` ${chalk.gray("β€’ Responsive email template generator.")}`,
"\n",
` ${chalk.green("Powered by Riangle β†’ ")} https://bit.ly/2P5i26I`,
"\n",
"\n",
` ${chalk.red(
"Thank you for using πŸ“¨ FuzzyMail β†’ ",
)} https://www.fuzzymail.co`,
);

// Get started.
console.log('\n\n🎯 ', chalk.black.bgGreen(' Get Started β†’ \n'));
console.log(' You can start: \n');
// Get started
console.log("\n\n🎯 ", chalk.black.bgGreen(" Get Started β†’ \n"));
console.log(" You can start: \n");
console.log(
` ${chalk.dim("1.")} Editing your new email template: ${chalk.green(
`${process.cwd()}/src`,
)}`,
);
console.log(
` ${chalk.dim('1.')} Editing your new email template: ${chalk.green(`${process.cwd()}/src`)}`,
` ${chalk.dim("2.")} Running: ${chalk.green("npm")} run dev`,
"\n\n",
);
console.log(` ${chalk.dim('2.')} Running: ${chalk.green('npm')} run dev`, '\n\n');
process.exit();
};
Loading

0 comments on commit edbfd5c

Please sign in to comment.