diff --git a/template/plugins/compile-js/_prompts.js b/template/plugins/compile-js/_prompts.js index 2a3dbc82..965ce61b 100644 --- a/template/plugins/compile-js/_prompts.js +++ b/template/plugins/compile-js/_prompts.js @@ -1,6 +1,6 @@ module.exports = { - type: 'confirm', - color: 'blue', - message: '📘 Using typescript ?', - initial: true, + type: 'confirm', + color: 'blue', + message: '📘 Using typescript ?', + initial: true, }; diff --git a/template/plugins/index.js b/template/plugins/index.js index ea5377b9..e749eec4 100644 --- a/template/plugins/index.js +++ b/template/plugins/index.js @@ -20,25 +20,25 @@ const plugins = [typescriptPlugin, printSuccessPlugin]; * @return {Promise<*>} */ async function applyPlugin(name, plugin, response) { - if (!plugin.promptsOptions) { - await plugin.apply(null, response); - return { [name]: null, ...response }; - } - const { value } = await prompts({ ...plugin.promptsOptions, name: 'value' }); - await plugin.apply(value, response); - return { [name]: value, ...response }; + if (!plugin.promptsOptions) { + await plugin.apply(null, response); + return { [name]: null, ...response }; + } + const { value } = await prompts({ ...plugin.promptsOptions, name: 'value' }); + await plugin.apply(value, response); + return { [name]: value, ...response }; } module.exports = { - /** - * Apply all plugin in the order of plugin - * @return {Promise<{apply: function(*=): Promise, name: string, promptsOptions: {onRender(*): void, initial: boolean, name: string, type: string, message: string}|{type?: string, name?: string, message?: string, msg?: *, initial?: boolean, onRender?: function(*): void}}|{name?: string, promptsOptions?: {onRender(*): void, initial: boolean, name: string, type: string, message: string}|{type?: string, name?: string, message?: string, msg?: *, initial?: boolean, onRender?: function(*): void}, apply?: function(*=): Promise}|{apply: function(*, *): Promise>, name: string, promptsOptions: null}|{name?: string, promptsOptions?: null, apply?: function(*, *): Promise>}>} - */ - async applyPlugins() { - return plugins.reduce( - (acc, { name, ...plugin }) => - acc.then(response => applyPlugin(name, plugin, response)), - Promise.resolve({}) - ); - }, + /** + * Apply all plugin in the order of plugin + * @return {Promise<{apply: function(*=): Promise, name: string, promptsOptions: {onRender(*): void, initial: boolean, name: string, type: string, message: string}|{type?: string, name?: string, message?: string, msg?: *, initial?: boolean, onRender?: function(*): void}}|{name?: string, promptsOptions?: {onRender(*): void, initial: boolean, name: string, type: string, message: string}|{type?: string, name?: string, message?: string, msg?: *, initial?: boolean, onRender?: function(*): void}, apply?: function(*=): Promise}|{apply: function(*, *): Promise>, name: string, promptsOptions: null}|{name?: string, promptsOptions?: null, apply?: function(*, *): Promise>}>} + */ + async applyPlugins() { + return plugins.reduce( + (acc, { name, ...plugin }) => + acc.then((response) => applyPlugin(name, plugin, response)), + Promise.resolve({}), + ); + }, }; diff --git a/template/plugins/printSuccess/index.js b/template/plugins/printSuccess/index.js index cb18376d..19773414 100644 --- a/template/plugins/printSuccess/index.js +++ b/template/plugins/printSuccess/index.js @@ -1,10 +1,8 @@ -// eslint-disable-next-line @typescript-eslint/no-var-requires const promptsOptions = require('./_prompts'); -// eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/unbound-method const { apply } = require('./plugin'); module.exports = { - name: 'printSuccess', - promptsOptions, - apply, + name: 'printSuccess', + promptsOptions, + apply, }; diff --git a/template/plugins/printSuccess/plugin.js b/template/plugins/printSuccess/plugin.js index 1160e161..fb5da7b8 100644 --- a/template/plugins/printSuccess/plugin.js +++ b/template/plugins/printSuccess/plugin.js @@ -1,55 +1,55 @@ const { green, blue, yellow, red } = require('kleur'); module.exports = { - async apply(value, previousValues) { - return new Promise(resolve => { - console.log('\n'); - console.log( - 'TheCodingMachine React-Native Boilerplate initialized with success ! 🚀\n' - ); - console.log( - `${green( - ' .-` `:: \n' + - ' `///////////// `/shhhy+- ://. /sy/ /ss/ :NMN: \n' + - ' `sssssyhhhyhhy:` `yMMMMNNMMMd. osss: `hMMMh- .-` `+ss: +MMm/. \n' + - ' :MMM+----. `mMMm+:-`.oo/` osssyo` `dMMMMh- ohhh- `oyy+- sMMd/. \n' + - ' :MMM+` oMMN/- osssyhs`.mMMMMMh- -hds` .syy+- `hMMh:` \n' + - ' :MMM+` hMMd: oss-ohhhMMMhdMMh- `. +NNm/. .dMMy:` \n' + - ' :MMM+` oMMN/ oss-`shdMMd:dMMh- :-` sMMd/. -NMMo- \n' + - ' :MMM+` `mMMm/` `/+:. oss- `sdMd:.hMMh- hMys- `hMMh:` -hdy-` \n' + - ' :MMM+` `yMMMMdssss+ oss. `oh/- hMMh- -hyo: dMMs:` -ss+` \n' + - ' .oys:` .+yhyo/- -::` `` -syo- ..` +mo- `// \n' + - ' `` ``` `` `. ' - )}` - ); - if (previousValues.typescript) { - console.log(blue(' THE TYPESCRIPT VERSION 📘')); - } else { - console.log(yellow(' THE JAVASCRIPT VERSION 📒')); - } - console.log('\n'); + async apply(value, previousValues) { + return new Promise((resolve) => { + console.log('\n'); + console.log( + 'TheCodingMachine React-Native Boilerplate initialized with success ! 🚀\n', + ); + console.log( + `${green( + ' .-` `:: \n' + + ' `///////////// `/shhhy+- ://. /sy/ /ss/ :NMN: \n' + + ' `sssssyhhhyhhy:` `yMMMMNNMMMd. osss: `hMMMh- .-` `+ss: +MMm/. \n' + + ' :MMM+----. `mMMm+:-`.oo/` osssyo` `dMMMMh- ohhh- `oyy+- sMMd/. \n' + + ' :MMM+` oMMN/- osssyhs`.mMMMMMh- -hds` .syy+- `hMMh:` \n' + + ' :MMM+` hMMd: oss-ohhhMMMhdMMh- `. +NNm/. .dMMy:` \n' + + ' :MMM+` oMMN/ oss-`shdMMd:dMMh- :-` sMMd/. -NMMo- \n' + + ' :MMM+` `mMMm/` `/+:. oss- `sdMd:.hMMh- hMys- `hMMh:` -hdy-` \n' + + ' :MMM+` `yMMMMdssss+ oss. `oh/- hMMh- -hyo: dMMs:` -ss+` \n' + + ' .oys:` .+yhyo/- -::` `` -syo- ..` +mo- `// \n' + + ' `` ``` `` `. ', + )}`, + ); + if (previousValues.typescript) { + console.log(blue(' THE TYPESCRIPT VERSION 📘')); + } else { + console.log(yellow(' THE JAVASCRIPT VERSION 📒')); + } + console.log('\n'); - console.log( - '- 📚 If you need to read more about this boilerplate : https://thecodingmachine.github.io/react-native-boilerplate/' - ); - console.log( - '- 🤕 If you have some troubles : https://github.com/thecodingmachine/react-native-boilerplate/issues' - ); - console.log( - '- ⭐ If you love this boilerplate, give us a star, you will be a ray of sunshine in our lives :) https://github.com/thecodingmachine/react-native-boilerplate' - ); + console.log( + '- 📚 If you need to read more about this boilerplate : https://thecodingmachine.github.io/react-native-boilerplate/', + ); + console.log( + '- 🤕 If you have some troubles : https://github.com/thecodingmachine/react-native-boilerplate/issues', + ); + console.log( + '- ⭐ If you love this boilerplate, give us a star, you will be a ray of sunshine in our lives :) https://github.com/thecodingmachine/react-native-boilerplate', + ); - if (!previousValues.typescript) { - console.log('\n'); - console.log( - red( - '🚨 You choose the javascript version, don\'t forget to run "yarn lint --fix" after the installation 🚨' - ) - ); - console.log('\n'); - } + if (!previousValues.typescript) { + console.log('\n'); + console.log( + red( + '🚨 You choose the javascript version, don\'t forget to run "yarn lint:fix" after the installation 🚨', + ), + ); + console.log('\n'); + } - resolve(); - }); - }, + resolve(); + }); + }, };