From fa7983299412ed5daadb4007e4c149baad49bf05 Mon Sep 17 00:00:00 2001 From: Luan Gjokaj Date: Sat, 4 Sep 2021 12:35:14 +0200 Subject: [PATCH] chore: update dependencies --- installer/index.js | 23 +++++++++---------- installer/modules/clearConsole.js | 10 ++++----- installer/modules/handleError.js | 8 +++++-- installer/modules/printNextSteps.js | 6 +++-- installer/modules/run.js | 34 +++++++++++++++++++---------- installer/package.json | 21 ++++++++++-------- package-lock.json | 4 ++-- package.json | 10 +++++---- 8 files changed, 70 insertions(+), 46 deletions(-) diff --git a/installer/index.js b/installer/index.js index aec98d3..4a04872 100755 --- a/installer/index.js +++ b/installer/index.js @@ -1,25 +1,27 @@ #!/usr/bin/env node /** * Main Installer for GoPablo - * Check the node version if above 8 then run the app. + * Check the node version if above 12 then run the app. * * Credits: * Ahmad Awais - https://twitter.com/MrAhmadAwais/ * Luan Gjokaj - https://twitter.com/luangjokaj/ */ -'use strict'; +import prompts from 'prompts'; +import chalk from 'chalk'; +import program from 'commander'; +import { createRequire } from 'module'; +import { run } from './modules/run.js'; +const require = createRequire(import.meta.url); +const packageData = require('./package.json'); + +const version = packageData.version; const currentNodeVersion = process.versions.node; const semver = currentNodeVersion.split('.'); const major = semver[0]; -const prompts = require('prompts'); -const chalk = require('chalk'); - -const program = require('commander'); -const version = require('../package.json').version; - program .version(version, '-v, --vers', 'output the current version') .parse(process.argv); @@ -35,13 +37,13 @@ program if (response.value) { // If below Node 8 - if (8 > major) { + if (12 > major) { console.error( chalk.red( 'You are running Node ' + currentNodeVersion + '.\n' + - 'Install GoPablo requires Node 8 or higher. \n' + + 'Install GoPablo requires Node 12 or higher. \n' + 'Kindly, update your version of Node.' ) ); @@ -60,7 +62,6 @@ program * * Runs all the functions with async/await */ - const run = require('./modules/run'); run(); } })(); diff --git a/installer/modules/clearConsole.js b/installer/modules/clearConsole.js index 92df058..6407c8a 100755 --- a/installer/modules/clearConsole.js +++ b/installer/modules/clearConsole.js @@ -1,13 +1,13 @@ /** - * Cross platform clear console + * Cross platform clear console. * - * Support for win32 and others + * Support for win32 and others. */ -'use strict'; - -module.exports = () => { +const clearConsole = () => { process.stdout.write( 'win32' === process.platform ? '\x1B[2J\x1B[0f' : '\x1B[2J\x1B[3J\x1B[H' ); }; + +export { clearConsole }; diff --git a/installer/modules/handleError.js b/installer/modules/handleError.js index f8a9345..28f1fd9 100755 --- a/installer/modules/handleError.js +++ b/installer/modules/handleError.js @@ -1,7 +1,11 @@ -'use strict'; +/** + * Error handler + */ -module.exports = (err) => { +const handleError = (err) => { if (err) { console.log('ERROR: ' + err); } }; + +export { handleError }; diff --git a/installer/modules/printNextSteps.js b/installer/modules/printNextSteps.js index c42e377..b919eff 100755 --- a/installer/modules/printNextSteps.js +++ b/installer/modules/printNextSteps.js @@ -1,6 +1,6 @@ -const chalk = require('chalk'); +import chalk from 'chalk'; -module.exports = () => { +const printNextSteps = () => { console.log('\n\n✅ ', chalk.black.bgGreen(' All done! Happy coding. \n')); console.log( 'Installer has added 🐺 GoPablo files to the current directory. ', @@ -64,3 +64,5 @@ module.exports = () => { ); process.exit(); }; + +export { printNextSteps }; diff --git a/installer/modules/run.js b/installer/modules/run.js index adc02ce..668c435 100755 --- a/installer/modules/run.js +++ b/installer/modules/run.js @@ -1,17 +1,27 @@ -const fs = require('fs'); +/** + * Installation + */ + +import fs from 'fs'; +import ora from 'ora'; +import execa from 'execa'; +import chalk from 'chalk'; +import download from 'download'; +import { createRequire } from 'module'; +import { handleError } from './handleError.js'; +import { clearConsole } from './clearConsole.js'; +import { printNextSteps } from './printNextSteps.js'; + +const require = createRequire(import.meta.url); +const packageData = require('../package.json'); + +const version = packageData.version; + const theCWD = process.cwd(); const theCWDArray = theCWD.split('/'); const theDir = theCWDArray[theCWDArray.length - 1]; -const ora = require('ora'); -const execa = require('execa'); -const chalk = require('chalk'); -const download = require('download'); -const handleError = require('./handleError.js'); -const clearConsole = require('./clearConsole.js'); -const printNextSteps = require('./printNextSteps.js'); -const version = require('../package.json').version; - -module.exports = () => { + +const run = () => { // Init clearConsole(); @@ -140,3 +150,5 @@ module.exports = () => { } ); }; + +export { run }; diff --git a/installer/package.json b/installer/package.json index ba39c93..90c214a 100644 --- a/installer/package.json +++ b/installer/package.json @@ -1,6 +1,6 @@ { "name": "gopablo", - "version": "0.1.5-2", + "version": "0.1.5-3", "description": "Create optimized static websites.", "keywords": [ "babel", @@ -25,6 +25,9 @@ ], "homepage": "https://www.gopablo.co", "repository": "https://github.com/luangjokaj/gopablo", + "exports": "./index.js", + "type": "module", + "node": "^12.20.0 || ^14.13.1 || >=16.0.0", "scripts": { "start": "npm run prod && node server.js", "dev": "gulp dev", @@ -34,14 +37,14 @@ "author": "Luan Gjokaj ", "license": "MIT", "dependencies": { - "@babel/core": "^7.14.6", - "@babel/preset-env": "^7.14.5", + "@babel/core": "^7.15.5", + "@babel/preset-env": "^7.15.4", "aos": "^2.3.4", - "autoprefixer": "^10.2.6", - "browser-sync": "^2.26.14", + "autoprefixer": "^10.3.4", + "browser-sync": "^2.27.5", "cherry-postcss": "^0.0.2-11", "connect-modrewrite": "^0.10.2", - "cssnano": "^5.0.6", + "cssnano": "^5.0.8", "del": "^6.0.0", "express": "^4.17.1", "gulp": "^4.0.2", @@ -49,16 +52,16 @@ "gulp-concat": "^2.6.1", "gulp-file-include": "^2.3.0", "gulp-htmlmin": "^5.0.1", - "gulp-imagemin": "^7.1.0", + "gulp-imagemin": "^8.0.0", "gulp-plumber": "^1.2.1", - "gulp-postcss": "^9.0.0", + "gulp-postcss": "^9.0.1", "gulp-purgecss": "^4.0.3", "gulp-rev-all": "^3.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-uglify": "^3.0.2", "gulp-util": "^3.0.8", "jquery": "^3.6.0", - "postcss": "^8.3.4", + "postcss": "^8.3.6", "postcss-flexbugs-fixes": "^5.0.2", "postcss-import": "^14.0.2", "postcss-mixins": "^8.1.0", diff --git a/package-lock.json b/package-lock.json index 1627ecf..1168a85 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "gopablo", - "version": "0.1.5-2", + "version": "0.1.5-3", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "0.1.5-2", + "version": "0.1.5-3", "license": "MIT", "dependencies": { "chalk": "^4.1.1", diff --git a/package.json b/package.json index 62a92dd..d2d8960 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gopablo", - "version": "0.1.5-2", + "version": "0.1.5-3", "description": "Create optimized static websites.", "keywords": [ "babel", @@ -26,17 +26,19 @@ "homepage": "https://www.gopablo.co", "repository": "https://github.com/luangjokaj/gopablo", "main": "./installer/index.js", + "type": "module", + "node": "^12.20.0 || ^14.13.1 || >=16.0.0", "bin": { "gopablo": "./installer/index.js" }, "author": "Luan Gjokaj ", "license": "MIT", "dependencies": { - "chalk": "^4.1.1", - "commander": "^7.2.0", + "chalk": "^4.1.2", + "commander": "^8.1.0", "download": "^8.0.0", "execa": "^5.1.1", - "ora": "^5.4.1", + "ora": "^6.0.0", "prompts": "^2.4.1" } }