diff --git a/internals/helpers/clean-readme-content.js b/internals/helpers/clean-readme-content.js new file mode 100644 index 0000000..3d8a2f4 --- /dev/null +++ b/internals/helpers/clean-readme-content.js @@ -0,0 +1,16 @@ +const util = require('util') +const writeFile = util.promisify(require('fs').writeFile) + +const newReadmeContent = `# My bento-starter project + +## Documentation + +Documentation available :point_right: [here](https://bento-starter.netlify.com/)` + +/** + * Replace README.md content + * + * @returns {Promise} + */ +module.exports = async () => + await writeFile(`${__dirname}/../../README.md`, newReadmeContent) diff --git a/internals/helpers/clean-useless-dependencies.js b/internals/helpers/clean-useless-dependencies.js new file mode 100644 index 0000000..f069ef5 --- /dev/null +++ b/internals/helpers/clean-useless-dependencies.js @@ -0,0 +1,12 @@ +const util = require('util') +const exec = util.promisify(require('child_process').exec) +const shell = require('shelljs') + +/** + * Remove npm dependencies which are only used by this script + * @returns {Promise} + */ +module.exports = async () => + await exec( + 'npm uninstall rimraf compare-versions chalk shelljs read-pkg write-pkg inquirer ora boxen --save-dev' + ) diff --git a/internals/helpers/clean-useless-resources.js b/internals/helpers/clean-useless-resources.js new file mode 100644 index 0000000..abc5f3a --- /dev/null +++ b/internals/helpers/clean-useless-resources.js @@ -0,0 +1,20 @@ +const path = require('path') +const util = require('util') +const rimraf = util.promisify(require('rimraf')) + +const rootDirname = path.resolve(`${__dirname}/../../`) + +const resourcesPathsToDelete = [ + `${rootDirname}/internals`, + `${rootDirname}/docs`, + `${rootDirname}/.github`, + `${rootDirname}/resources`, + `${rootDirname}/.env.example`, + `${rootDirname}/LICENSE` +] + +/** + * Delete useless resources + * */ +module.exports = async () => + await Promise.all(resourcesPathsToDelete.map(path => rimraf(path))) diff --git a/internals/helpers/clean-useless-scripts.js b/internals/helpers/clean-useless-scripts.js new file mode 100644 index 0000000..4e9b0e1 --- /dev/null +++ b/internals/helpers/clean-useless-scripts.js @@ -0,0 +1,19 @@ +const readPkg = require('read-pkg') +const writePkg = require('write-pkg') + +/** + * Remove the "setup" script from package.json + * @returns {Promise} + */ +module.exports = async () => { + const pkg = await readPkg() + + if (!pkg.scripts) { + pkg.scripts = {} + } + + delete pkg.scripts.setup + delete pkg.scripts.presetup + + return writePkg(pkg) +} diff --git a/internals/helpers/git-helper.js b/internals/helpers/git-helper.js index 740abf4..5e25369 100644 --- a/internals/helpers/git-helper.js +++ b/internals/helpers/git-helper.js @@ -31,19 +31,21 @@ async function checkIfRepositoryIsAClone() { return !!isClonedRepo } +/** + * Checks if we are under Git version control and if this is a clone of our repository. + * @returns {Promise} + */ +async function checkIfRepositoryIsCleanable() { + const hasGitRepo = await hasGitRepository() + return hasGitRepo && (await checkIfRepositoryIsAClone()) +} + /** * Remove the current Git repository * @returns {Promise} */ -function removeGitRepository() { - return new Promise((resolve, reject) => { - try { - shell.rm('-rf', '.git/') - resolve() - } catch (err) { - reject(err) - } - }) +async function removeGitRepository() { + return exec('rm -Rf .git') } /** @@ -74,6 +76,7 @@ module.exports = { initGitRepository, hasGitRepository, checkIfRepositoryIsAClone, + checkIfRepositoryIsCleanable, removeGitRepository, doInitalCommit, changeOrigin diff --git a/internals/helpers/set-local-env-file.js b/internals/helpers/set-local-env-file.js new file mode 100644 index 0000000..33d912b --- /dev/null +++ b/internals/helpers/set-local-env-file.js @@ -0,0 +1,13 @@ +const util = require('util') +const copyFile = util.promisify(require('fs').copyFile) + +/** + * Create '.env.local' file by copying '.env.example' file + * + * @returns {Promise} + */ +module.exports = async () => + await copyFile( + `${__dirname}/../../.env.example`, + `${__dirname}/../../.env.local` + ) diff --git a/internals/setup.js b/internals/setup.js index 931ca1a..847ff24 100644 --- a/internals/setup.js +++ b/internals/setup.js @@ -1,19 +1,20 @@ #!/usr/bin/env node /* eslint-disable import/no-extraneous-dependencies */ -const readPkg = require('read-pkg') -const writePkg = require('write-pkg') const inquirer = require('inquirer') const ora = require('ora') const compareVersions = require('compare-versions') const chalk = require('chalk') +const boxen = require('boxen') const util = require('util') const exec = util.promisify(require('child_process').exec) -const rimraf = util.promisify(require('rimraf')) -const copyFile = util.promisify(require('fs').copyFile) -const writeFile = util.promisify(require('fs').writeFile) const npmConfig = require('./helpers/get-npm-config') +const cleanUselessScripts = require('./helpers/clean-useless-scripts') +const cleanUselessResources = require('./helpers/clean-useless-resources') +const cleanUselessDependencies = require('./helpers/clean-useless-dependencies') +const cleanReadmeContent = require('./helpers/clean-readme-content') +const setLocalEnvFile = require('./helpers/set-local-env-file') const gitHelper = require('./helpers/git-helper') process.stdin.resume() @@ -21,67 +22,6 @@ process.stdin.setEncoding('utf8') process.stdout.write('\n') -/** - * Delete useless resources - * - * @returns {Promise} - */ -async function deleteUselessResources(paths) { - const spinner = ora('Removing useless resources').start() - - try { - await Promise.all(paths.map(path => rimraf(path))) - } catch (error) { - if (error) { - spinner.fail(`Remove useless resources failed\n${error}`) - throw new Error(error) - } - } - - spinner.succeed('Useless resources have been deleted') -} - -/** - * Create '.env.local' file by copying '.env.example' file - * - * @returns {Promise} - */ -async function createEnvLocalFile() { - const spinner = ora('Creating env local file').start() - - try { - await copyFile(`${__dirname}/../.env.example`, `${__dirname}/../.env.local`) - } catch (error) { - spinner.fail(`Create env local file failed\n${error}`) - throw new Error(error) - } - - spinner.succeed('Created env local file') -} - -/** - * Replace README.md content - * - * @returns {Promise} - */ -async function replaceReadmeContent() { - const spinner = ora('Replacing README.md content').start() - const newReadmeContent = `# My bento-starter project - -## Documentation - -Documentation available :point_right: [here](https://bento-starter.netlify.com/)` - - try { - await writeFile(`${__dirname}/../README.md`, newReadmeContent) - } catch (error) { - spinner.fail(`Replace README.md content failed\n${error}`) - throw new Error(error) - } - - spinner.succeed('README.md content replaced') -} - /** * Ask user if he wants to start with a new repository * @returns {Promise} @@ -115,60 +55,18 @@ async function askUserForNewRemote() { ]) const origin = answers[NEW_REMOTE] - if (origin) { const spinner = ora('Adding new remote to repository').start() try { await gitHelper.changeOrigin(origin) - spinner.succeed( - 'New remote added, run `git push` to send initial commit to remote repository.' - ) + spinner.succeed(`New remote added ${printOk()}`) return true } catch (error) { - spinner.fail(`Add remote failed\n${error}`) + spinner.fail(`Add remote failed ${printFail()}`) return false } - } else { - process.stdout.write( - 'No remote added, run git remote add origin to add one' - ) - return false } -} - -/** - * Checks if we are under Git version control. - * If we are and this a clone of our repository the user is given a choice to - * either keep it or start with a new repository. - * @returns {Promise} - */ -async function cleanCurrentRepository() { - const hasGitRepo = await gitHelper.hasGitRepository().catch(onError) - - // We are not under Git version control. So, do nothing - if (hasGitRepo === false) { - return await askUserIfWeShouldCreateNewRepo() - } - - const isClone = await gitHelper.checkIfRepositoryIsAClone().catch(onError) - - // Not our clone so do nothing - if (isClone === false) { - return false - } - - const answer = await askUserIfWeShouldCreateNewRepo() - - if (answer === true) { - const spinner = ora('Removing current repository').start() - await gitHelper.removeGitRepository().catch(reason => { - spinner.fail(reason) - onError() - }) - spinner.succeed('Repository removed') - } - - return answer + return false } /** @@ -195,7 +93,7 @@ async function checkNodeVersion(minimalNodeVersion) { throw new Error() } - spinner.succeed(`Node version ${nodeVersion} OK`) + spinner.succeed(`Node version ${nodeVersion} ${printOk()}`) } /** @@ -221,96 +119,76 @@ async function checkNpmVersion(minimalNpmVersion) { throw new Error() } - spinner.succeed(`npm version ${npmVersion} OK`) -} - -/** - * Initialize a new Git repository - * @returns {Promise} - */ -async function initGitRepository() { - const spinner = ora('Creating new repository').start() - - try { - const { stdout } = await gitHelper.initGitRepository() - spinner.succeed('New repository created') - return stdout - } catch (err) { - spinner.fail('Creation of new repository failed') - throw new Error(err) - } + spinner.succeed(`npm version ${npmVersion} ${printOk()}`) } -/** - * Make the initial Git commit - * @returns {Promise} - */ -async function doInitalCommit() { - const spinner = ora('Creating initial commit for new repository').start() - +async function doCommand(command, commandLog, successLog, failLog) { + const spinner = ora(commandLog).start() try { - const { stdout } = await gitHelper.doInitalCommit() - spinner.succeed('Initial commit created') - return stdout + await command() + spinner.succeed(successLog ? successLog : `${commandLog} ${printOk()}`) } catch (err) { - spinner.fail('Initial commit failed') + spinner.fail(failLog ? failLog : `${commandLog} ${printFail()}`) throw new Error(err) } } /** - * Remove npm dependencies which are only used by this script - * @returns {Promise} + * End the setup process */ -async function removeScriptDependencies() { - const spinner = ora('Uninstalling extraneous dependencies').start() - - try { - await exec( - 'npm uninstall rimraf compare-versions chalk shelljs read-pkg write-pkg inquirer ora --save-dev' +function endProcess() { + process.stdout.write( + boxen( + ` +Thank you for using bento-starter ! + +Do not hesitate to share your project with +the community on slack : + +https://tinyurl.com/yxzrc7fq + +You can also contact us on twitter +${chalk.blue('@FranckAbgrall')} or ${chalk.blue('@tbetous')}. + +We hope to hear about your project soon ! +`, + { + padding: 1, + margin: { top: 3, bottom: 3 }, + borderColor: 'cyan', + align: 'center', + borderStyle: 'double' + } ) - spinner.succeed('Extraneous dependencies uninstalled') - } catch (err) { - spinner.fail(err) - throw new Error(err) - } + ) + process.exit(0) } /** - * Remove the "setup" script from package.json - * @returns {Promise} + * End the setup process with an error */ -async function removeSetupScript() { - const pkg = await readPkg() - - if (!pkg.scripts) { - pkg.scripts = {} - } - - delete pkg.scripts.setup - delete pkg.scripts.presetup - - return writePkg(pkg) +function onError(e) { + console.error('\n\nExiting setup script with the following error :\n', e) + process.exit(1) } -/** - * End the setup process - */ -function endProcess() { - process.stdout.write(chalk.blue('\n\nDone!\n')) - process.exit(0) +function printOk() { + return chalk.green('[OK]') } -function onError(e) { - console.error('Exiting setup script with the following error\n', e) - process.exit(1) +function printFail() { + return chalk.green('[FAIL]') } /** * Run */ ;(async () => { - const repoRemoved = await cleanCurrentRepository() + let isNewOrigin + let isNewRepositoryWanted + if (await gitHelper.checkIfRepositoryIsCleanable()) { + isNewRepositoryWanted = await askUserIfWeShouldCreateNewRepo() + } // Take the required Node and NPM version from package.json const { @@ -318,36 +196,71 @@ function onError(e) { } = npmConfig const requiredNodeVersion = node.match(/([0-9.]+)/g)[0] - const resourcesPathsToDelete = [ - __dirname, - `${__dirname}/../docs`, - `${__dirname}/../.github`, - `${__dirname}/../resources`, - `${__dirname}/../.env.example`, - `${__dirname}/../LICENSE` - ] - await checkNodeVersion(requiredNodeVersion).catch(onError) const requiredNpmVersion = npm.match(/([0-9.]+)/g)[0] await checkNpmVersion(requiredNpmVersion).catch(onError) - await createEnvLocalFile().catch(onError) - await removeScriptDependencies().catch(onError) - await removeSetupScript().catch(onError) - await replaceReadmeContent().catch(onError) - await deleteUselessResources(resourcesPathsToDelete).catch(onError) + await doCommand(setLocalEnvFile, 'Creating env local file').catch(onError) - if (repoRemoved) { - process.stdout.write('\nInitialising new repository') + await doCommand( + cleanUselessDependencies, + 'Cleaning extraneous dependencies' + ).catch(onError) - try { - await initGitRepository() - await doInitalCommit() - await askUserForNewRemote() - } catch (err) { - onError() - } + await doCommand( + cleanUselessScripts, + 'Cleaning useless scripts in package.json' + ).catch(onError) + + await doCommand(cleanReadmeContent, 'Cleaning README.md content').catch( + onError + ) + + await doCommand(cleanUselessResources, 'Cleaning useless resources').catch( + onError + ) + + if (isNewRepositoryWanted) { + await doCommand( + gitHelper.removeGitRepository, + 'Removing current repository' + ).catch(onError) + + await doCommand( + gitHelper.initGitRepository, + 'Creating new repository' + ).catch(onError) + + await doCommand( + gitHelper.doInitalCommit, + 'Creating initial commit for new repository' + ).catch(onError) + + isNewOrigin = await askUserForNewRemote() + } + + if (isNewRepositoryWanted && isNewOrigin) { + process.stdout.write('\n') + process.stdout.write( + chalk.blue( + 'ℹ Run `git push` to send initial commit to remote repository.' + ) + ) + } else if (isNewRepositoryWanted && !isNewOrigin) { + process.stdout.write('\n') + process.stdout.write( + chalk.blue( + 'ℹ No remote added, run `git remote add origin ` to add one.' + ) + ) + } else { + process.stdout.write('\n') + process.stdout.write( + chalk.blue( + 'ℹ No remote changed, run `git remote set-url origin ` to change it.' + ) + ) } endProcess() diff --git a/package-lock.json b/package-lock.json index 5f8b712..5c2c458 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2554,18 +2554,18 @@ "dev": true }, "ansi-align": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-2.0.0.tgz", - "integrity": "sha1-w2rsy6VjuJzrVW82kPCx2eNUf38=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.0.tgz", + "integrity": "sha512-ZpClVKqXN3RGBmKibdfWzqCY4lnjEuoNzU5T0oEFpfd/z5qJHVarukridD4juLO2FXMiwUQxr9WqQtaYa8XRYw==", "dev": true, "requires": { - "string-width": "^2.0.0" + "string-width": "^3.0.0" }, "dependencies": { "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", "dev": true }, "is-fullwidth-code-point": { @@ -2575,22 +2575,23 @@ "dev": true }, "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", "dev": true, "requires": { + "emoji-regex": "^7.0.1", "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" + "strip-ansi": "^5.1.0" } }, "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", "dev": true, "requires": { - "ansi-regex": "^3.0.0" + "ansi-regex": "^4.1.0" } } } @@ -3679,30 +3680,31 @@ "dev": true }, "boxen": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/boxen/-/boxen-1.3.0.tgz", - "integrity": "sha512-TNPjfTr432qx7yOjQyaXm3dSR0MH9vXp7eT1BFSl/C51g+EFnOR9hTg1IreahGBmDNCehscshe45f+C1TBZbLw==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-4.0.0.tgz", + "integrity": "sha512-gBklgJ9hxaEG8AvEq6JmHns0qQh7JS0uRQtpk4r0OW9AJFKfvP0PVoltH0xzZt/OIio2Iy48xkiV3OaIun7GUw==", "dev": true, "requires": { - "ansi-align": "^2.0.0", - "camelcase": "^4.0.0", - "chalk": "^2.0.1", - "cli-boxes": "^1.0.0", - "string-width": "^2.0.0", - "term-size": "^1.2.0", - "widest-line": "^2.0.0" + "ansi-align": "^3.0.0", + "camelcase": "^5.3.1", + "chalk": "^2.4.2", + "cli-boxes": "^2.2.0", + "string-width": "^3.1.0", + "term-size": "^2.1.0", + "type-fest": "^0.5.2", + "widest-line": "^3.1.0" }, "dependencies": { "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", "dev": true }, "camelcase": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", - "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", "dev": true }, "is-fullwidth-code-point": { @@ -3712,23 +3714,30 @@ "dev": true }, "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", "dev": true, "requires": { + "emoji-regex": "^7.0.1", "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" + "strip-ansi": "^5.1.0" } }, "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", "dev": true, "requires": { - "ansi-regex": "^3.0.0" + "ansi-regex": "^4.1.0" } + }, + "type-fest": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.5.2.tgz", + "integrity": "sha512-DWkS49EQKVX//Tbupb9TFa19c7+MK1XmzkrZUR8TAktmE/DizXoaoJV6TZ/tSIPXipqNiRI6CyAe7x69Jb6RSw==", + "dev": true } } }, @@ -4413,9 +4422,9 @@ } }, "cli-boxes": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-1.0.0.tgz", - "integrity": "sha1-T6kXw+WclKAEzWH47lCdplFocUM=", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.0.tgz", + "integrity": "sha512-gpaBrMAizVEANOpfZp/EEUixTXDyGt7DFzdK5hU+UbWt/J0lB0w20ncZj59Z9a93xHb9u12zF5BS6i9RKbtg4w==", "dev": true }, "cli-color": { @@ -18356,63 +18365,10 @@ } }, "term-size": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/term-size/-/term-size-1.2.0.tgz", - "integrity": "sha1-RYuDiH8oj8Vtb/+/rSYuJmOO+mk=", - "dev": true, - "requires": { - "execa": "^0.7.0" - }, - "dependencies": { - "cross-spawn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", - "dev": true, - "requires": { - "lru-cache": "^4.0.1", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "execa": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", - "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", - "dev": true, - "requires": { - "cross-spawn": "^5.0.1", - "get-stream": "^3.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "get-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", - "dev": true - }, - "lru-cache": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", - "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", - "dev": true, - "requires": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - }, - "yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", - "dev": true - } - } + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/term-size/-/term-size-2.1.0.tgz", + "integrity": "sha512-I42EWhJ+2aeNQawGx1VtpO0DFI9YcfuvAMNIdKyf/6sRbHJ4P+ZQ/zIT87tE+ln1ymAGcCJds4dolfSAS0AcNg==", + "dev": true }, "terser": { "version": "3.17.0", @@ -19121,6 +19077,48 @@ "xdg-basedir": "^3.0.0" }, "dependencies": { + "ansi-align": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-2.0.0.tgz", + "integrity": "sha1-w2rsy6VjuJzrVW82kPCx2eNUf38=", + "dev": true, + "requires": { + "string-width": "^2.0.0" + } + }, + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "boxen": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-1.3.0.tgz", + "integrity": "sha512-TNPjfTr432qx7yOjQyaXm3dSR0MH9vXp7eT1BFSl/C51g+EFnOR9hTg1IreahGBmDNCehscshe45f+C1TBZbLw==", + "dev": true, + "requires": { + "ansi-align": "^2.0.0", + "camelcase": "^4.0.0", + "chalk": "^2.0.1", + "cli-boxes": "^1.0.0", + "string-width": "^2.0.0", + "term-size": "^1.2.0", + "widest-line": "^2.0.0" + } + }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "cli-boxes": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-1.0.0.tgz", + "integrity": "sha1-T6kXw+WclKAEzWH47lCdplFocUM=", + "dev": true + }, "configstore": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/configstore/-/configstore-3.1.2.tgz", @@ -19135,6 +19133,54 @@ "xdg-basedir": "^3.0.0" } }, + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "execa": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "dev": true, + "requires": { + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "lru-cache": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "dev": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, "make-dir": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", @@ -19150,11 +19196,54 @@ "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", "dev": true }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "term-size": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/term-size/-/term-size-1.2.0.tgz", + "integrity": "sha1-RYuDiH8oj8Vtb/+/rSYuJmOO+mk=", + "dev": true, + "requires": { + "execa": "^0.7.0" + } + }, + "widest-line": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-2.0.1.tgz", + "integrity": "sha512-Ba5m9/Fa4Xt9eb2ELXt77JxVDV8w7qQrH0zS/TWSJdLyAwQjWoOzpzj5lwVftDz6n/EOu3tNACS84v509qwnJA==", + "dev": true, + "requires": { + "string-width": "^2.1.1" + } + }, "xdg-basedir": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-3.0.0.tgz", "integrity": "sha1-SWsswQnsqNus/i3HK2A8F8WHCtQ=", "dev": true + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true } } }, @@ -20262,43 +20351,50 @@ } }, "widest-line": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-2.0.1.tgz", - "integrity": "sha512-Ba5m9/Fa4Xt9eb2ELXt77JxVDV8w7qQrH0zS/TWSJdLyAwQjWoOzpzj5lwVftDz6n/EOu3tNACS84v509qwnJA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", + "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", "dev": true, "requires": { - "string-width": "^2.1.1" + "string-width": "^4.0.0" }, "dependencies": { "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true }, "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.1.0.tgz", + "integrity": "sha512-NrX+1dVVh+6Y9dnQ19pR0pP4FiEIlUvdTGn8pw6CKTNq5sgib2nIhmUNT5TAmhWmvKr3WcxBcP3E8nWezuipuQ==", "dev": true, "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^5.2.0" } }, "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", "dev": true, "requires": { - "ansi-regex": "^3.0.0" + "ansi-regex": "^4.1.0" } } } diff --git a/package.json b/package.json index 98d29fa..0fe6462 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "babel-eslint": "^10.0.1", "babel-jest": "^23.6.0", "babel-plugin-lodash": "^3.3.4", + "boxen": "4.0.0", "bundlesize": "github:kefranabg/bundlesize", "chalk": "^2.4.2", "compare-versions": "^3.4.0",