From 9d111523964a044cbd4f375f2ba28b1681546144 Mon Sep 17 00:00:00 2001 From: wellwelwel <46850407+wellwelwel@users.noreply.github.com> Date: Thu, 10 Aug 2023 14:35:42 -0300 Subject: [PATCH 01/11] chore: update packages --- package-lock.json | 621 +++++----------------------------------------- package.json | 10 +- 2 files changed, 66 insertions(+), 565 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5486328..aead000 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,14 +16,14 @@ "svps": "bin/index.js" }, "devDependencies": { - "@types/node": "^20.4.5", - "@typescript-eslint/eslint-plugin": "^6.2.0", - "@typescript-eslint/parser": "^6.2.0", + "@types/node": "^20.4.9", + "@typescript-eslint/eslint-plugin": "^6.3.0", + "@typescript-eslint/parser": "^6.3.0", "eslint": "^8.46.0", - "eslint-import-resolver-typescript": "^3.5.5", + "eslint-import-resolver-typescript": "^3.6.0", "eslint-plugin-import": "^2.28.0", "packages-update": "^1.2.1", - "prettier": "^3.0.0", + "prettier": "^3.0.1", "typescript": "^5.1.6" }, "engines": { @@ -164,26 +164,6 @@ "node": ">= 8" } }, - "node_modules/@pkgr/utils": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/@pkgr/utils/-/utils-2.4.2.tgz", - "integrity": "sha512-POgTXhjrTfbTV63DiFXav4lBHiICLKKwDeaKn9Nphwj7WH6m0hMMCaJkMyRWjgtPFyRKRVoMXXjczsTQRDEhYw==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.3", - "fast-glob": "^3.3.0", - "is-glob": "^4.0.3", - "open": "^9.1.0", - "picocolors": "^1.0.0", - "tslib": "^2.6.0" - }, - "engines": { - "node": "^12.20.0 || ^14.18.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/unts" - } - }, "node_modules/@types/json-schema": { "version": "7.0.12", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.12.tgz", @@ -197,9 +177,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.4.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.5.tgz", - "integrity": "sha512-rt40Nk13II9JwQBdeYqmbn2Q6IVTA5uPhvSO+JVqdXw/6/4glI6oR9ezty/A9Hg5u7JH4OmYmuQ+XvjKm0Datg==", + "version": "20.4.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.9.tgz", + "integrity": "sha512-8e2HYcg7ohnTUbHk8focoklEQYvemQmu9M/f43DZVx43kHn0tE3BY/6gSDxS7k0SprtS0NHvj+L80cGLnoOUcQ==", "dev": true }, "node_modules/@types/semver": { @@ -222,16 +202,16 @@ "integrity": "sha512-xlR1jahfizdplZYRU59JlUx9uzF1ARa8jbhM11ccpCJya8kvos5jwdm2ZAgxSCwOl0fq21svP18EVwPBXMQudw==" }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.2.0.tgz", - "integrity": "sha512-rClGrMuyS/3j0ETa1Ui7s6GkLhfZGKZL3ZrChLeAiACBE/tRc1wq8SNZESUuluxhLj9FkUefRs2l6bCIArWBiQ==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.3.0.tgz", + "integrity": "sha512-IZYjYZ0ifGSLZbwMqIip/nOamFiWJ9AH+T/GYNZBWkVcyNQOFGtSMoWV7RvY4poYCMZ/4lHzNl796WOSNxmk8A==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.2.0", - "@typescript-eslint/type-utils": "6.2.0", - "@typescript-eslint/utils": "6.2.0", - "@typescript-eslint/visitor-keys": "6.2.0", + "@typescript-eslint/scope-manager": "6.3.0", + "@typescript-eslint/type-utils": "6.3.0", + "@typescript-eslint/utils": "6.3.0", + "@typescript-eslint/visitor-keys": "6.3.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -258,15 +238,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.2.0.tgz", - "integrity": "sha512-igVYOqtiK/UsvKAmmloQAruAdUHihsOCvplJpplPZ+3h4aDkC/UKZZNKgB6h93ayuYLuEymU3h8nF1xMRbh37g==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.3.0.tgz", + "integrity": "sha512-ibP+y2Gr6p0qsUkhs7InMdXrwldjxZw66wpcQq9/PzAroM45wdwyu81T+7RibNCh8oc0AgrsyCwJByncY0Ongg==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.2.0", - "@typescript-eslint/types": "6.2.0", - "@typescript-eslint/typescript-estree": "6.2.0", - "@typescript-eslint/visitor-keys": "6.2.0", + "@typescript-eslint/scope-manager": "6.3.0", + "@typescript-eslint/types": "6.3.0", + "@typescript-eslint/typescript-estree": "6.3.0", + "@typescript-eslint/visitor-keys": "6.3.0", "debug": "^4.3.4" }, "engines": { @@ -286,13 +266,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.2.0.tgz", - "integrity": "sha512-1ZMNVgm5nnHURU8ZSJ3snsHzpFeNK84rdZjluEVBGNu7jDymfqceB3kdIZ6A4xCfEFFhRIB6rF8q/JIqJd2R0Q==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.3.0.tgz", + "integrity": "sha512-WlNFgBEuGu74ahrXzgefiz/QlVb+qg8KDTpknKwR7hMH+lQygWyx0CQFoUmMn1zDkQjTBBIn75IxtWss77iBIQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.2.0", - "@typescript-eslint/visitor-keys": "6.2.0" + "@typescript-eslint/types": "6.3.0", + "@typescript-eslint/visitor-keys": "6.3.0" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -303,13 +283,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.2.0.tgz", - "integrity": "sha512-DnGZuNU2JN3AYwddYIqrVkYW0uUQdv0AY+kz2M25euVNlujcN2u+rJgfJsBFlUEzBB6OQkUqSZPyuTLf2bP5mw==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.3.0.tgz", + "integrity": "sha512-7Oj+1ox1T2Yc8PKpBvOKWhoI/4rWFd1j7FA/rPE0lbBPXTKjdbtC+7Ev0SeBjEKkIhKWVeZSP+mR7y1Db1CdfQ==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.2.0", - "@typescript-eslint/utils": "6.2.0", + "@typescript-eslint/typescript-estree": "6.3.0", + "@typescript-eslint/utils": "6.3.0", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -330,9 +310,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.2.0.tgz", - "integrity": "sha512-1nRRaDlp/XYJQLvkQJG5F3uBTno5SHPT7XVcJ5n1/k2WfNI28nJsvLakxwZRNY5spuatEKO7d5nZWsQpkqXwBA==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.3.0.tgz", + "integrity": "sha512-K6TZOvfVyc7MO9j60MkRNWyFSf86IbOatTKGrpTQnzarDZPYPVy0oe3myTMq7VjhfsUAbNUW8I5s+2lZvtx1gg==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -343,13 +323,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.2.0.tgz", - "integrity": "sha512-Mts6+3HQMSM+LZCglsc2yMIny37IhUgp1Qe8yJUYVyO6rHP7/vN0vajKu3JvHCBIy8TSiKddJ/Zwu80jhnGj1w==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.3.0.tgz", + "integrity": "sha512-Xh4NVDaC4eYKY4O3QGPuQNp5NxBAlEvNQYOqJquR2MePNxO11E5K3t5x4M4Mx53IZvtpW+mBxIT0s274fLUocg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.2.0", - "@typescript-eslint/visitor-keys": "6.2.0", + "@typescript-eslint/types": "6.3.0", + "@typescript-eslint/visitor-keys": "6.3.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -370,17 +350,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.2.0.tgz", - "integrity": "sha512-RCFrC1lXiX1qEZN8LmLrxYRhOkElEsPKTVSNout8DMzf8PeWoQG7Rxz2SadpJa3VSh5oYKGwt7j7X/VRg+Y3OQ==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.3.0.tgz", + "integrity": "sha512-hLLg3BZE07XHnpzglNBG8P/IXq/ZVXraEbgY7FM0Cnc1ehM8RMdn9mat3LubJ3KBeYXXPxV1nugWbQPjGeJk6Q==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.2.0", - "@typescript-eslint/types": "6.2.0", - "@typescript-eslint/typescript-estree": "6.2.0", + "@typescript-eslint/scope-manager": "6.3.0", + "@typescript-eslint/types": "6.3.0", + "@typescript-eslint/typescript-estree": "6.3.0", "semver": "^7.5.4" }, "engines": { @@ -395,12 +375,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.2.0.tgz", - "integrity": "sha512-QbaYUQVKKo9bgCzpjz45llCfwakyoxHetIy8CAvYCtd16Zu1KrpzNHofwF8kGkpPOxZB2o6kz+0nqH8ZkIzuoQ==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.3.0.tgz", + "integrity": "sha512-kEhRRj7HnvaSjux1J9+7dBen15CdWmDnwrpyiHsFX6Qx2iW5LOBUgNefOFeh2PjWPlNwN8TOn6+4eBU3J/gupw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.2.0", + "@typescript-eslint/types": "6.3.0", "eslint-visitor-keys": "^3.4.1" }, "engines": { @@ -608,27 +588,6 @@ "tweetnacl": "^0.14.3" } }, - "node_modules/big-integer": { - "version": "1.6.51", - "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz", - "integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==", - "dev": true, - "engines": { - "node": ">=0.6" - } - }, - "node_modules/bplist-parser": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz", - "integrity": "sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==", - "dev": true, - "dependencies": { - "big-integer": "^1.6.44" - }, - "engines": { - "node": ">= 5.10.0" - } - }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -660,21 +619,6 @@ "node": ">=10.0.0" } }, - "node_modules/bundle-name": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-3.0.0.tgz", - "integrity": "sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw==", - "dev": true, - "dependencies": { - "run-applescript": "^5.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -788,52 +732,6 @@ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, - "node_modules/default-browser": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-4.0.0.tgz", - "integrity": "sha512-wX5pXO1+BrhMkSbROFsyxUm0i/cJEScyNhA4PPxc41ICuv05ZZB/MX28s8aZx6xjmatvebIapF6hLEKEcpneUA==", - "dev": true, - "dependencies": { - "bundle-name": "^3.0.0", - "default-browser-id": "^3.0.0", - "execa": "^7.1.1", - "titleize": "^3.0.0" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/default-browser-id": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-3.0.0.tgz", - "integrity": "sha512-OZ1y3y0SqSICtE8DE4S8YOE9UZOJ8wO16fKWVP5J1Qz42kV9jcnMVFrEE/noXb/ss3Q4pZIH79kxofzyNNtUNA==", - "dev": true, - "dependencies": { - "bplist-parser": "^0.2.0", - "untildify": "^4.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/define-lazy-prop": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", - "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/define-properties": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz", @@ -1063,19 +961,18 @@ } }, "node_modules/eslint-import-resolver-typescript": { - "version": "3.5.5", - "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.5.5.tgz", - "integrity": "sha512-TdJqPHs2lW5J9Zpe17DZNQuDnox4xo2o+0tE7Pggain9Rbc19ik8kFtXdxZ250FVx2kF4vlt2RSf4qlUpG7bhw==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.6.0.tgz", + "integrity": "sha512-QTHR9ddNnn35RTxlaEnx2gCxqFlF2SEN0SE2d17SqwyM7YOSI2GHWRYp5BiRkObTUNYPupC/3Fq2a0PpT+EKpg==", "dev": true, "dependencies": { "debug": "^4.3.4", "enhanced-resolve": "^5.12.0", "eslint-module-utils": "^2.7.4", + "fast-glob": "^3.3.1", "get-tsconfig": "^4.5.0", - "globby": "^13.1.3", "is-core-module": "^2.11.0", - "is-glob": "^4.0.3", - "synckit": "^0.8.5" + "is-glob": "^4.0.3" }, "engines": { "node": "^14.18.0 || >=16.0.0" @@ -1088,37 +985,6 @@ "eslint-plugin-import": "*" } }, - "node_modules/eslint-import-resolver-typescript/node_modules/globby": { - "version": "13.2.2", - "resolved": "https://registry.npmjs.org/globby/-/globby-13.2.2.tgz", - "integrity": "sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==", - "dev": true, - "dependencies": { - "dir-glob": "^3.0.1", - "fast-glob": "^3.3.0", - "ignore": "^5.2.4", - "merge2": "^1.4.1", - "slash": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint-import-resolver-typescript/node_modules/slash": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", - "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/eslint-module-utils": { "version": "2.8.0", "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz", @@ -1294,29 +1160,6 @@ "node": ">=0.10.0" } }, - "node_modules/execa": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-7.1.1.tgz", - "integrity": "sha512-wH0eMf/UXckdUYnO21+HDztteVv05rq2GXksxT4fCGeHkBhw1DROXh40wcjMcRqDOWE7iPJ4n3M7e2+YFP+76Q==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.1", - "human-signals": "^4.3.0", - "is-stream": "^3.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^5.1.0", - "onetime": "^6.0.0", - "signal-exit": "^3.0.7", - "strip-final-newline": "^3.0.0" - }, - "engines": { - "node": "^14.18.0 || ^16.14.0 || >=18.0.0" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -1324,9 +1167,9 @@ "dev": true }, "node_modules/fast-glob": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.0.tgz", - "integrity": "sha512-ChDuvbOypPuNjO8yIDf36x7BlZX1smcUMTTcyoIjycexOxd6DFsKsg21qVBzEmr3G7fUKIRy2/psii+CIUt7FA==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", + "integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==", "dev": true, "dependencies": { "@nodelib/fs.stat": "^2.0.2", @@ -1494,18 +1337,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/get-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/get-symbol-description": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", @@ -1721,15 +1552,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/human-signals": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", - "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", - "dev": true, - "engines": { - "node": ">=14.18.0" - } - }, "node_modules/ignore": { "version": "5.2.4", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", @@ -1875,21 +1697,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-docker": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", - "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", - "dev": true, - "bin": { - "is-docker": "cli.js" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -1911,24 +1718,6 @@ "node": ">=0.10.0" } }, - "node_modules/is-inside-container": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", - "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", - "dev": true, - "dependencies": { - "is-docker": "^3.0.0" - }, - "bin": { - "is-inside-container": "cli.js" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/is-negative-zero": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", @@ -2002,18 +1791,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", - "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/is-string": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", @@ -2075,33 +1852,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-wsl": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", - "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", - "dev": true, - "dependencies": { - "is-docker": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-wsl/node_modules/is-docker": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", - "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", - "dev": true, - "bin": { - "is-docker": "cli.js" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -2190,12 +1940,6 @@ "node": ">=10" } }, - "node_modules/merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true - }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -2218,18 +1962,6 @@ "node": ">=8.6" } }, - "node_modules/mimic-fn": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", - "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -2275,33 +2007,6 @@ "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", "dev": true }, - "node_modules/npm-run-path": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", - "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==", - "dev": true, - "dependencies": { - "path-key": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/npm-run-path/node_modules/path-key": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", - "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/object-inspect": { "version": "1.12.3", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", @@ -2393,39 +2098,6 @@ "wrappy": "1" } }, - "node_modules/onetime": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", - "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", - "dev": true, - "dependencies": { - "mimic-fn": "^4.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/open": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/open/-/open-9.1.0.tgz", - "integrity": "sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg==", - "dev": true, - "dependencies": { - "default-browser": "^4.0.0", - "define-lazy-prop": "^3.0.0", - "is-inside-container": "^1.0.0", - "is-wsl": "^2.2.0" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/optionator": { "version": "0.9.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", @@ -2543,12 +2215,6 @@ "node": ">=8" } }, - "node_modules/picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", - "dev": true - }, "node_modules/picomatch": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", @@ -2571,9 +2237,9 @@ } }, "node_modules/prettier": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.0.tgz", - "integrity": "sha512-zBf5eHpwHOGPC47h0zrPyNn+eAEIdEzfywMoYn2XPi0P44Zp0tSq64rq0xAREh4auw2cJZHo9QUob+NqCQky4g==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.1.tgz", + "integrity": "sha512-fcOWSnnpCrovBsmFZIGIy9UqK2FaI7Hqax+DIO0A9UxeVoY4iweyaFjS5TavZN97Hfehph0nhsZnjlVKzEQSrQ==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" @@ -2691,110 +2357,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/run-applescript": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-5.0.0.tgz", - "integrity": "sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg==", - "dev": true, - "dependencies": { - "execa": "^5.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/run-applescript/node_modules/execa": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", - "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/run-applescript/node_modules/human-signals": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", - "dev": true, - "engines": { - "node": ">=10.17.0" - } - }, - "node_modules/run-applescript/node_modules/is-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/run-applescript/node_modules/mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/run-applescript/node_modules/npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", - "dev": true, - "dependencies": { - "path-key": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/run-applescript/node_modules/onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, - "dependencies": { - "mimic-fn": "^2.1.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/run-applescript/node_modules/strip-final-newline": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -2887,12 +2449,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true - }, "node_modules/slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -2985,18 +2541,6 @@ "node": ">=4" } }, - "node_modules/strip-final-newline": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", - "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", @@ -3033,22 +2577,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/synckit": { - "version": "0.8.5", - "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.5.tgz", - "integrity": "sha512-L1dapNV6vu2s/4Sputv8xGsCdAVlb5nRDMFU/E27D44l5U6cw1g0dGd45uLc+OXjNMmF4ntiMdCimzcjFKQI8Q==", - "dev": true, - "dependencies": { - "@pkgr/utils": "^2.3.1", - "tslib": "^2.5.0" - }, - "engines": { - "node": "^14.18.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/unts" - } - }, "node_modules/tapable": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", @@ -3064,18 +2592,6 @@ "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", "dev": true }, - "node_modules/titleize": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/titleize/-/titleize-3.0.0.tgz", - "integrity": "sha512-KxVu8EYHDPBdUYdKZdKtU2aj2XfEx9AfjXxE/Aj0vT06w2icA09Vus1rh6eSu1y01akYg6BjIK/hxyLJINoMLQ==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -3112,12 +2628,6 @@ "strip-bom": "^3.0.0" } }, - "node_modules/tslib": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.0.tgz", - "integrity": "sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==", - "dev": true - }, "node_modules/tweetnacl": { "version": "0.14.5", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", @@ -3208,15 +2718,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/untildify": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", - "integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", diff --git a/package.json b/package.json index 6319e09..18e0ca1 100644 --- a/package.json +++ b/package.json @@ -11,14 +11,14 @@ "ssh2": "^1.14.0" }, "devDependencies": { - "@types/node": "^20.4.5", - "@typescript-eslint/eslint-plugin": "^6.2.0", - "@typescript-eslint/parser": "^6.2.0", + "@types/node": "^20.4.9", + "@typescript-eslint/eslint-plugin": "^6.3.0", + "@typescript-eslint/parser": "^6.3.0", "eslint": "^8.46.0", - "eslint-import-resolver-typescript": "^3.5.5", + "eslint-import-resolver-typescript": "^3.6.0", "eslint-plugin-import": "^2.28.0", "packages-update": "^1.2.1", - "prettier": "^3.0.0", + "prettier": "^3.0.1", "typescript": "^5.1.6" }, "scripts": { From a0d7110853fae2d1e59e17019bd7233baef318f5 Mon Sep 17 00:00:00 2001 From: wellwelwel <46850407+wellwelwel@users.noreply.github.com> Date: Thu, 10 Aug 2023 14:37:51 -0300 Subject: [PATCH 02/11] chore: remove blank issue template --- ".github/ISSUE_TEMPLATE/blank-\360\237\223\204.md" | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 ".github/ISSUE_TEMPLATE/blank-\360\237\223\204.md" diff --git "a/.github/ISSUE_TEMPLATE/blank-\360\237\223\204.md" "b/.github/ISSUE_TEMPLATE/blank-\360\237\223\204.md" deleted file mode 100644 index b7e1565..0000000 --- "a/.github/ISSUE_TEMPLATE/blank-\360\237\223\204.md" +++ /dev/null @@ -1,7 +0,0 @@ ---- -name: "Blank \U0001F4C4" -about: Describe your issue -title: '' -labels: '' -assignees: '' ---- From 65f47f5d1d5a80d0b30afb8ccad2a1545756b4f0 Mon Sep 17 00:00:00 2001 From: wellwelwel <46850407+wellwelwel@users.noreply.github.com> Date: Tue, 10 Oct 2023 03:07:44 -0300 Subject: [PATCH 03/11] ci: exit on `1` when the return isn't `true` --- src/tests/basic-connection.ts | 4 +++- src/tests/commands.ts | 4 +++- src/tests/mount.ts | 4 +++- src/tests/upload.ts | 4 +++- src/tests/virtual-hosts.ts | 4 +++- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/tests/basic-connection.ts b/src/tests/basic-connection.ts index 83c2d2c..7d6d646 100644 --- a/src/tests/basic-connection.ts +++ b/src/tests/basic-connection.ts @@ -11,9 +11,11 @@ import { SVPS } from '../lib/index.js'; }, }); - await svps.mount(); + const mount = await svps.mount(); await svps.end(); + + if (mount !== true) process.exit(1); } catch (error) { console.log(error); process.exit(1); diff --git a/src/tests/commands.ts b/src/tests/commands.ts index b1e84ea..4991068 100644 --- a/src/tests/commands.ts +++ b/src/tests/commands.ts @@ -11,8 +11,10 @@ import { SVPS } from '../lib/index.js'; }, }); - await svps.commands(['crontab -l']); + const commands = await svps.commands(['crontab -l']); await svps.end(); + + if (commands !== true) process.exit(1); } catch (error) { console.log(error); process.exit(1); diff --git a/src/tests/mount.ts b/src/tests/mount.ts index fe5df66..04b2c91 100644 --- a/src/tests/mount.ts +++ b/src/tests/mount.ts @@ -12,7 +12,7 @@ import { SVPS } from '../lib/index.js'; }, }); - await svps.mount({ + const mount = await svps.mount({ // Testing users users: [ { @@ -108,6 +108,8 @@ import { SVPS } from '../lib/index.js'; // Closing connection await svps.end(); + + if (mount !== true) process.exit(1); } catch (error) { console.log(error); process.exit(1); diff --git a/src/tests/upload.ts b/src/tests/upload.ts index caadb77..311f0cf 100644 --- a/src/tests/upload.ts +++ b/src/tests/upload.ts @@ -11,7 +11,7 @@ import { SVPS } from '../lib/index.js'; }, }); - await svps.upload([ + const upload = await svps.upload([ { local: '../resources', remote: '/root/svps/resources', @@ -22,6 +22,8 @@ import { SVPS } from '../lib/index.js'; ]); await svps.end(); + + if (upload !== true) process.exit(1); } catch (error) { console.log(error); process.exit(1); diff --git a/src/tests/virtual-hosts.ts b/src/tests/virtual-hosts.ts index 7482138..61ac99a 100644 --- a/src/tests/virtual-hosts.ts +++ b/src/tests/virtual-hosts.ts @@ -51,9 +51,11 @@ import { SVPS, VirtualHost } from '../lib/index.js'; }, ]; - await svps.createVirtualHosts(virtualHosts); + const createVirtualHosts = await svps.createVirtualHosts(virtualHosts); await svps.end(); + + if (createVirtualHosts !== true) process.exit(1); } catch (error) { console.log(error); process.exit(1); From 2a2c405e031065ddc63662703f69fcbe1c6cc9ef Mon Sep 17 00:00:00 2001 From: wellwelwel <46850407+wellwelwel@users.noreply.github.com> Date: Tue, 10 Oct 2023 03:26:02 -0300 Subject: [PATCH 04/11] feat: arm64 architecture support --- .../{18.04.list => 18.04-amd.list} | 0 resources/sources-list/18.04-arm.list | 4 ++++ .../{20.04.list => 20.04-amd.list} | 0 resources/sources-list/20.04-arm.list | 4 ++++ .../{22.04.list => 22.04-amd.list} | 0 resources/sources-list/22.04-arm.list | 4 ++++ .../{23.04.list => 23.04-amd.list} | 0 resources/sources-list/23.04-arm.list | 4 ++++ src/lib/tasks/steps/repair.ts | 19 ++++++++++++------- 9 files changed, 28 insertions(+), 7 deletions(-) rename resources/sources-list/{18.04.list => 18.04-amd.list} (100%) create mode 100644 resources/sources-list/18.04-arm.list rename resources/sources-list/{20.04.list => 20.04-amd.list} (100%) create mode 100644 resources/sources-list/20.04-arm.list rename resources/sources-list/{22.04.list => 22.04-amd.list} (100%) create mode 100644 resources/sources-list/22.04-arm.list rename resources/sources-list/{23.04.list => 23.04-amd.list} (100%) create mode 100644 resources/sources-list/23.04-arm.list diff --git a/resources/sources-list/18.04.list b/resources/sources-list/18.04-amd.list similarity index 100% rename from resources/sources-list/18.04.list rename to resources/sources-list/18.04-amd.list diff --git a/resources/sources-list/18.04-arm.list b/resources/sources-list/18.04-arm.list new file mode 100644 index 0000000..75a1e76 --- /dev/null +++ b/resources/sources-list/18.04-arm.list @@ -0,0 +1,4 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe multiverse +deb http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe multiverse +deb http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted universe multiverse +deb http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse diff --git a/resources/sources-list/20.04.list b/resources/sources-list/20.04-amd.list similarity index 100% rename from resources/sources-list/20.04.list rename to resources/sources-list/20.04-amd.list diff --git a/resources/sources-list/20.04-arm.list b/resources/sources-list/20.04-arm.list new file mode 100644 index 0000000..f57ce81 --- /dev/null +++ b/resources/sources-list/20.04-arm.list @@ -0,0 +1,4 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ focal main restricted universe multiverse +deb http://ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted universe multiverse +deb http://ports.ubuntu.com/ubuntu-ports/ focal-backports main restricted universe multiverse +deb http://ports.ubuntu.com/ubuntu-ports/ focal-security main restricted universe multiverse diff --git a/resources/sources-list/22.04.list b/resources/sources-list/22.04-amd.list similarity index 100% rename from resources/sources-list/22.04.list rename to resources/sources-list/22.04-amd.list diff --git a/resources/sources-list/22.04-arm.list b/resources/sources-list/22.04-arm.list new file mode 100644 index 0000000..416f742 --- /dev/null +++ b/resources/sources-list/22.04-arm.list @@ -0,0 +1,4 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted universe multiverse +deb http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted universe multiverse +deb http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted universe multiverse +deb http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse diff --git a/resources/sources-list/23.04.list b/resources/sources-list/23.04-amd.list similarity index 100% rename from resources/sources-list/23.04.list rename to resources/sources-list/23.04-amd.list diff --git a/resources/sources-list/23.04-arm.list b/resources/sources-list/23.04-arm.list new file mode 100644 index 0000000..0dc12ae --- /dev/null +++ b/resources/sources-list/23.04-arm.list @@ -0,0 +1,4 @@ +deb http://ports.ubuntu.com/ubuntu-ports/ lunar main restricted universe multiverse +deb http://ports.ubuntu.com/ubuntu-ports/ lunar-updates main restricted universe multiverse +deb http://ports.ubuntu.com/ubuntu-ports/ lunar-backports main restricted universe multiverse +deb http://ports.ubuntu.com/ubuntu-ports/ lunar-security main restricted universe multiverse diff --git a/src/lib/tasks/steps/repair.ts b/src/lib/tasks/steps/repair.ts index c7bcf45..a7d2a47 100644 --- a/src/lib/tasks/steps/repair.ts +++ b/src/lib/tasks/steps/repair.ts @@ -3,10 +3,10 @@ import { importFile } from '../../modules/prepare-files.js'; import { rootSVPS } from '../../modules/root.js'; import sh from '../../modules/sh.js'; -const getList = (version: string) => { - const header = `if [ "$(grep -E '^VERSION_ID="${version}"' /etc/os-release)" ]; then echo`; +const getList = (version: string, arch: 'amd' | 'arm') => { + const header = `if [[ "$(grep -E '^VERSION_ID="${version}"' /etc/os-release)" ]] && [[ $(dpkg --print-architecture) =~ ^${arch} ]]; then echo`; const main = escapeQuotes( - importFile(`${rootSVPS}/resources/sources-list/${version}.list`) + importFile(`${rootSVPS}/resources/sources-list/${version}-${arch}.list`) ); const footer = `| cat > /etc/apt/sources.list; fi`; @@ -20,10 +20,15 @@ export default () => [ 'chmod 1777 /tmp', /** Restoring default sources list */ - getList('18.04'), - getList('20.04'), - getList('22.04'), - getList('23.04'), + getList('18.04', 'amd'), + getList('20.04', 'amd'), + getList('22.04', 'amd'), + getList('23.04', 'amd'), + + getList('18.04', 'arm'), + getList('20.04', 'arm'), + getList('22.04', 'arm'), + getList('23.04', 'arm'), /** Installing missing packages */ 'apt-get clean', From a80dde0653adb164076bdd7e6e75a375d153f28f Mon Sep 17 00:00:00 2001 From: wellwelwel <46850407+wellwelwel@users.noreply.github.com> Date: Tue, 10 Oct 2023 12:16:41 -0300 Subject: [PATCH 05/11] feat: AWS support --- README.md | 9 + package-lock.json | 221 ++++++++++++----------- package.json | 18 +- src/lib/modules/basic-permissions.ts | 12 +- src/lib/modules/commands.ts | 12 +- src/lib/modules/configs/node.ts | 13 +- src/lib/modules/configs/php.ts | 66 ++++--- src/lib/modules/configs/users.ts | 2 +- src/lib/tasks/index.ts | 22 +-- src/lib/tasks/steps/apache.ts | 24 +-- src/lib/tasks/steps/apt.ts | 10 +- src/lib/tasks/steps/certificate.ts | 2 +- src/lib/tasks/steps/crontab.ts | 11 +- src/lib/tasks/steps/deskop.ts | 32 ++-- src/lib/tasks/steps/docker.ts | 22 +-- src/lib/tasks/steps/firewall.ts | 38 ++-- src/lib/tasks/steps/mysql.ts | 38 ++-- src/lib/tasks/steps/node.ts | 21 ++- src/lib/tasks/steps/php.ts | 30 +-- src/lib/tasks/steps/reboot.ts | 2 +- src/lib/tasks/steps/repair.ts | 26 +-- src/lib/tasks/steps/users/ftp.ts | 4 +- src/lib/tasks/steps/users/index.ts | 51 +++--- src/lib/tasks/steps/users/restart-ssh.ts | 2 +- src/lib/tasks/steps/users/sftp.ts | 14 +- src/lib/tasks/virtual-host/apache.ts | 6 +- src/lib/tasks/virtual-host/docker.ts | 70 +++---- src/lib/types/mount.ts | 10 +- src/lib/types/virtual-hosts.ts | 7 + 29 files changed, 424 insertions(+), 371 deletions(-) diff --git a/README.md b/README.md index 07d71bb..5ca602e 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,15 @@ const svps = new SVPS({ }, }); +/** For AWS */ +const svps = new SVPS({ + access: { + host: '***.amazonaws.com', + username: 'ubuntu', + privateKey: fs.readFileSync('./your_rsa.pem'), + }, +}); + /** Available methods * svps.mount * svps.commands diff --git a/package-lock.json b/package-lock.json index aead000..a8ce4a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,22 +9,22 @@ "version": "2.1.0", "license": "MIT", "dependencies": { - "@types/ssh2": "^1.11.13", + "@types/ssh2": "^1.11.14", "ssh2": "^1.14.0" }, "bin": { "svps": "bin/index.js" }, "devDependencies": { - "@types/node": "^20.4.9", - "@typescript-eslint/eslint-plugin": "^6.3.0", - "@typescript-eslint/parser": "^6.3.0", - "eslint": "^8.46.0", - "eslint-import-resolver-typescript": "^3.6.0", - "eslint-plugin-import": "^2.28.0", + "@types/node": "^20.8.4", + "@typescript-eslint/eslint-plugin": "^6.7.5", + "@typescript-eslint/parser": "^6.7.5", + "eslint": "^8.51.0", + "eslint-import-resolver-typescript": "^3.6.1", + "eslint-plugin-import": "^2.28.1", "packages-update": "^1.2.1", - "prettier": "^3.0.1", - "typescript": "^5.1.6" + "prettier": "^3.0.3", + "typescript": "^5.2.2" }, "engines": { "node": ">=14.5.0", @@ -65,9 +65,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.1.tgz", - "integrity": "sha512-9t7ZA7NGGK8ckelF0PQCfcxIUzs1Md5rrO6U/c+FIQNanea5UZC0wqKXH4vHBccmu4ZJgZ2idtPeW7+Q2npOEA==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.2.tgz", + "integrity": "sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==", "dev": true, "dependencies": { "ajv": "^6.12.4", @@ -88,18 +88,18 @@ } }, "node_modules/@eslint/js": { - "version": "8.46.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.46.0.tgz", - "integrity": "sha512-a8TLtmPi8xzPkCbp/OGFUo5yhRkHM2Ko9kOWP4znJr0WAhWyThaw3PnwX4vOTWOAMsV2uRt32PPDcEz63esSaA==", + "version": "8.51.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.51.0.tgz", + "integrity": "sha512-HxjQ8Qn+4SI3/AFv6sOrDB+g6PpUTDwSJiQqOrnneEk8L71161srI9gjzzZvYVbzHiVg/BvcH95+cK/zfIt4pg==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz", - "integrity": "sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==", + "version": "0.11.11", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz", + "integrity": "sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA==", "dev": true, "dependencies": { "@humanwhocodes/object-schema": "^1.2.1", @@ -165,9 +165,9 @@ } }, "node_modules/@types/json-schema": { - "version": "7.0.12", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.12.tgz", - "integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==", + "version": "7.0.13", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.13.tgz", + "integrity": "sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ==", "dev": true }, "node_modules/@types/json5": { @@ -177,21 +177,24 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.4.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.9.tgz", - "integrity": "sha512-8e2HYcg7ohnTUbHk8focoklEQYvemQmu9M/f43DZVx43kHn0tE3BY/6gSDxS7k0SprtS0NHvj+L80cGLnoOUcQ==", - "dev": true + "version": "20.8.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.4.tgz", + "integrity": "sha512-ZVPnqU58giiCjSxjVUESDtdPk4QR5WQhhINbc9UBrKLU68MX5BF6kbQzTrkwbolyr0X8ChBpXfavr5mZFKZQ5A==", + "dev": true, + "dependencies": { + "undici-types": "~5.25.1" + } }, "node_modules/@types/semver": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.0.tgz", - "integrity": "sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==", + "version": "7.5.3", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.3.tgz", + "integrity": "sha512-OxepLK9EuNEIPxWNME+C6WwbRAOOI2o2BaQEGzz5Lu2e4Z5eDnEo+/aVEDMIXywoJitJ7xWd641wrGLZdtwRyw==", "dev": true }, "node_modules/@types/ssh2": { - "version": "1.11.13", - "resolved": "https://registry.npmjs.org/@types/ssh2/-/ssh2-1.11.13.tgz", - "integrity": "sha512-08WbG68HvQ2YVi74n2iSUnYHYpUdFc/s2IsI0BHBdJwaqYJpWlVv9elL0tYShTv60yr0ObdxJR5NrCRiGJ/0CQ==", + "version": "1.11.14", + "resolved": "https://registry.npmjs.org/@types/ssh2/-/ssh2-1.11.14.tgz", + "integrity": "sha512-O/U38mvV4jVVrdtZz8KpmitkmeD/PUDeDNNueQhm34166dmaqb1iZ3sfarSxBArM2/iX4PZVJY3EOta0Zks9hw==", "dependencies": { "@types/node": "^18.11.18" } @@ -202,21 +205,20 @@ "integrity": "sha512-xlR1jahfizdplZYRU59JlUx9uzF1ARa8jbhM11ccpCJya8kvos5jwdm2ZAgxSCwOl0fq21svP18EVwPBXMQudw==" }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.3.0.tgz", - "integrity": "sha512-IZYjYZ0ifGSLZbwMqIip/nOamFiWJ9AH+T/GYNZBWkVcyNQOFGtSMoWV7RvY4poYCMZ/4lHzNl796WOSNxmk8A==", + "version": "6.7.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.7.5.tgz", + "integrity": "sha512-JhtAwTRhOUcP96D0Y6KYnwig/MRQbOoLGXTON2+LlyB/N35SP9j1boai2zzwXb7ypKELXMx3DVk9UTaEq1vHEw==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.3.0", - "@typescript-eslint/type-utils": "6.3.0", - "@typescript-eslint/utils": "6.3.0", - "@typescript-eslint/visitor-keys": "6.3.0", + "@typescript-eslint/scope-manager": "6.7.5", + "@typescript-eslint/type-utils": "6.7.5", + "@typescript-eslint/utils": "6.7.5", + "@typescript-eslint/visitor-keys": "6.7.5", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", "natural-compare": "^1.4.0", - "natural-compare-lite": "^1.4.0", "semver": "^7.5.4", "ts-api-utils": "^1.0.1" }, @@ -238,15 +240,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.3.0.tgz", - "integrity": "sha512-ibP+y2Gr6p0qsUkhs7InMdXrwldjxZw66wpcQq9/PzAroM45wdwyu81T+7RibNCh8oc0AgrsyCwJByncY0Ongg==", + "version": "6.7.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.7.5.tgz", + "integrity": "sha512-bIZVSGx2UME/lmhLcjdVc7ePBwn7CLqKarUBL4me1C5feOd663liTGjMBGVcGr+BhnSLeP4SgwdvNnnkbIdkCw==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.3.0", - "@typescript-eslint/types": "6.3.0", - "@typescript-eslint/typescript-estree": "6.3.0", - "@typescript-eslint/visitor-keys": "6.3.0", + "@typescript-eslint/scope-manager": "6.7.5", + "@typescript-eslint/types": "6.7.5", + "@typescript-eslint/typescript-estree": "6.7.5", + "@typescript-eslint/visitor-keys": "6.7.5", "debug": "^4.3.4" }, "engines": { @@ -266,13 +268,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.3.0.tgz", - "integrity": "sha512-WlNFgBEuGu74ahrXzgefiz/QlVb+qg8KDTpknKwR7hMH+lQygWyx0CQFoUmMn1zDkQjTBBIn75IxtWss77iBIQ==", + "version": "6.7.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.7.5.tgz", + "integrity": "sha512-GAlk3eQIwWOJeb9F7MKQ6Jbah/vx1zETSDw8likab/eFcqkjSD7BI75SDAeC5N2L0MmConMoPvTsmkrg71+B1A==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.3.0", - "@typescript-eslint/visitor-keys": "6.3.0" + "@typescript-eslint/types": "6.7.5", + "@typescript-eslint/visitor-keys": "6.7.5" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -283,13 +285,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.3.0.tgz", - "integrity": "sha512-7Oj+1ox1T2Yc8PKpBvOKWhoI/4rWFd1j7FA/rPE0lbBPXTKjdbtC+7Ev0SeBjEKkIhKWVeZSP+mR7y1Db1CdfQ==", + "version": "6.7.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.7.5.tgz", + "integrity": "sha512-Gs0qos5wqxnQrvpYv+pf3XfcRXW6jiAn9zE/K+DlmYf6FcpxeNYN0AIETaPR7rHO4K2UY+D0CIbDP9Ut0U4m1g==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.3.0", - "@typescript-eslint/utils": "6.3.0", + "@typescript-eslint/typescript-estree": "6.7.5", + "@typescript-eslint/utils": "6.7.5", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -310,9 +312,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.3.0.tgz", - "integrity": "sha512-K6TZOvfVyc7MO9j60MkRNWyFSf86IbOatTKGrpTQnzarDZPYPVy0oe3myTMq7VjhfsUAbNUW8I5s+2lZvtx1gg==", + "version": "6.7.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.7.5.tgz", + "integrity": "sha512-WboQBlOXtdj1tDFPyIthpKrUb+kZf2VroLZhxKa/VlwLlLyqv/PwUNgL30BlTVZV1Wu4Asu2mMYPqarSO4L5ZQ==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -323,13 +325,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.3.0.tgz", - "integrity": "sha512-Xh4NVDaC4eYKY4O3QGPuQNp5NxBAlEvNQYOqJquR2MePNxO11E5K3t5x4M4Mx53IZvtpW+mBxIT0s274fLUocg==", + "version": "6.7.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.7.5.tgz", + "integrity": "sha512-NhJiJ4KdtwBIxrKl0BqG1Ur+uw7FiOnOThcYx9DpOGJ/Abc9z2xNzLeirCG02Ig3vkvrc2qFLmYSSsaITbKjlg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.3.0", - "@typescript-eslint/visitor-keys": "6.3.0", + "@typescript-eslint/types": "6.7.5", + "@typescript-eslint/visitor-keys": "6.7.5", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -350,17 +352,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.3.0.tgz", - "integrity": "sha512-hLLg3BZE07XHnpzglNBG8P/IXq/ZVXraEbgY7FM0Cnc1ehM8RMdn9mat3LubJ3KBeYXXPxV1nugWbQPjGeJk6Q==", + "version": "6.7.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.7.5.tgz", + "integrity": "sha512-pfRRrH20thJbzPPlPc4j0UNGvH1PjPlhlCMq4Yx7EGjV7lvEeGX0U6MJYe8+SyFutWgSHsdbJ3BXzZccYggezA==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.3.0", - "@typescript-eslint/types": "6.3.0", - "@typescript-eslint/typescript-estree": "6.3.0", + "@typescript-eslint/scope-manager": "6.7.5", + "@typescript-eslint/types": "6.7.5", + "@typescript-eslint/typescript-estree": "6.7.5", "semver": "^7.5.4" }, "engines": { @@ -375,12 +377,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.3.0.tgz", - "integrity": "sha512-kEhRRj7HnvaSjux1J9+7dBen15CdWmDnwrpyiHsFX6Qx2iW5LOBUgNefOFeh2PjWPlNwN8TOn6+4eBU3J/gupw==", + "version": "6.7.5", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.7.5.tgz", + "integrity": "sha512-3MaWdDZtLlsexZzDSdQWsFQ9l9nL8B80Z4fImSpyllFC/KLqWQRdEcB+gGGO+N3Q2uL40EsG66wZLsohPxNXvg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.3.0", + "@typescript-eslint/types": "6.7.5", "eslint-visitor-keys": "^3.4.1" }, "engines": { @@ -887,16 +889,16 @@ } }, "node_modules/eslint": { - "version": "8.46.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.46.0.tgz", - "integrity": "sha512-cIO74PvbW0qU8e0mIvk5IV3ToWdCq5FYG6gWPHHkx6gNdjlbAYvtfHmlCMXxjcoVaIdwy/IAt3+mDkZkfvb2Dg==", + "version": "8.51.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.51.0.tgz", + "integrity": "sha512-2WuxRZBrlwnXi+/vFSJyjMqrNjtJqiasMzehF0shoLaW7DzS3/9Yvrmq5JiT66+pNjiX4UBnLDiKHcWAr/OInA==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.1", - "@eslint/js": "^8.46.0", - "@humanwhocodes/config-array": "^0.11.10", + "@eslint/eslintrc": "^2.1.2", + "@eslint/js": "8.51.0", + "@humanwhocodes/config-array": "^0.11.11", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", "ajv": "^6.12.4", @@ -906,7 +908,7 @@ "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", "eslint-scope": "^7.2.2", - "eslint-visitor-keys": "^3.4.2", + "eslint-visitor-keys": "^3.4.3", "espree": "^9.6.1", "esquery": "^1.4.2", "esutils": "^2.0.2", @@ -961,9 +963,9 @@ } }, "node_modules/eslint-import-resolver-typescript": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.6.0.tgz", - "integrity": "sha512-QTHR9ddNnn35RTxlaEnx2gCxqFlF2SEN0SE2d17SqwyM7YOSI2GHWRYp5BiRkObTUNYPupC/3Fq2a0PpT+EKpg==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.6.1.tgz", + "integrity": "sha512-xgdptdoi5W3niYeuQxKmzVDTATvLYqhpwmykwsh7f6HIOStGWEIL9iqZgQDF9u9OEzrRwR8no5q2VT+bjAujTg==", "dev": true, "dependencies": { "debug": "^4.3.4", @@ -1012,9 +1014,9 @@ } }, "node_modules/eslint-plugin-import": { - "version": "2.28.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.28.0.tgz", - "integrity": "sha512-B8s/n+ZluN7sxj9eUf7/pRFERX0r5bnFA2dCaLHy2ZeaQEAz0k+ZZkFWRFHJAqxfxQDx6KLv9LeIki7cFdwW+Q==", + "version": "2.28.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.28.1.tgz", + "integrity": "sha512-9I9hFlITvOV55alzoKBI+K9q74kv0iKMeY6av5+umsNwayt59fz692daGyjR+oStBQgx6nwR9rXldDev3Clw+A==", "dev": true, "dependencies": { "array-includes": "^3.1.6", @@ -1026,13 +1028,12 @@ "eslint-import-resolver-node": "^0.3.7", "eslint-module-utils": "^2.8.0", "has": "^1.0.3", - "is-core-module": "^2.12.1", + "is-core-module": "^2.13.0", "is-glob": "^4.0.3", "minimatch": "^3.1.2", "object.fromentries": "^2.0.6", "object.groupby": "^1.0.0", "object.values": "^1.1.6", - "resolve": "^1.22.3", "semver": "^6.3.1", "tsconfig-paths": "^3.14.2" }, @@ -1090,9 +1091,9 @@ } }, "node_modules/eslint-visitor-keys": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.2.tgz", - "integrity": "sha512-8drBzUEyZ2llkpCA67iYrgEssKDUu68V8ChqqOfFupIaG/LCVPUT+CoGJpT77zJprs4T/W7p07LP7zAIMuweVw==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1398,9 +1399,9 @@ } }, "node_modules/globals": { - "version": "13.20.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", - "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", + "version": "13.23.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.23.0.tgz", + "integrity": "sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA==", "dev": true, "dependencies": { "type-fest": "^0.20.2" @@ -1671,9 +1672,9 @@ } }, "node_modules/is-core-module": { - "version": "2.12.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz", - "integrity": "sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==", + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.0.tgz", + "integrity": "sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==", "dev": true, "dependencies": { "has": "^1.0.3" @@ -2001,12 +2002,6 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, - "node_modules/natural-compare-lite": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", - "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", - "dev": true - }, "node_modules/object-inspect": { "version": "1.12.3", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", @@ -2237,9 +2232,9 @@ } }, "node_modules/prettier": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.1.tgz", - "integrity": "sha512-fcOWSnnpCrovBsmFZIGIy9UqK2FaI7Hqax+DIO0A9UxeVoY4iweyaFjS5TavZN97Hfehph0nhsZnjlVKzEQSrQ==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", + "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" @@ -2691,9 +2686,9 @@ } }, "node_modules/typescript": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", - "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -2718,6 +2713,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/undici-types": { + "version": "5.25.3", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.25.3.tgz", + "integrity": "sha512-Ga1jfYwRn7+cP9v8auvEXN1rX3sWqlayd4HP7OKk4mZWylEmu3KzXDUGrQUN6Ol7qo1gPvB2e5gX6udnyEPgdA==", + "dev": true + }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", diff --git a/package.json b/package.json index 18e0ca1..7efe786 100644 --- a/package.json +++ b/package.json @@ -7,19 +7,19 @@ "svps": "bin/index.js" }, "dependencies": { - "@types/ssh2": "^1.11.13", + "@types/ssh2": "^1.11.14", "ssh2": "^1.14.0" }, "devDependencies": { - "@types/node": "^20.4.9", - "@typescript-eslint/eslint-plugin": "^6.3.0", - "@typescript-eslint/parser": "^6.3.0", - "eslint": "^8.46.0", - "eslint-import-resolver-typescript": "^3.6.0", - "eslint-plugin-import": "^2.28.0", + "@types/node": "^20.8.4", + "@typescript-eslint/eslint-plugin": "^6.7.5", + "@typescript-eslint/parser": "^6.7.5", + "eslint": "^8.51.0", + "eslint-import-resolver-typescript": "^3.6.1", + "eslint-plugin-import": "^2.28.1", "packages-update": "^1.2.1", - "prettier": "^3.0.1", - "typescript": "^5.1.6" + "prettier": "^3.0.3", + "typescript": "^5.2.2" }, "scripts": { "build": "rm -rf ./bin ./lib ./tests && npx tsc", diff --git a/src/lib/modules/basic-permissions.ts b/src/lib/modules/basic-permissions.ts index 5a89407..4c1e2ea 100644 --- a/src/lib/modules/basic-permissions.ts +++ b/src/lib/modules/basic-permissions.ts @@ -8,13 +8,13 @@ export const basicPermissions = async (options: { const { remote, user, group } = options; if (user && group) { - await catchExec(`chown -R ${user}:${group} "${remote}"`); - await catchExec(`chmod -R 0775 "${remote}"`); + await catchExec(`sudo chown -R ${user}:${group} "${remote}"`); + await catchExec(`sudo chmod -R 0775 "${remote}"`); } else if (user) { - await catchExec(`chown -R ${user}: "${remote}"`); - await catchExec(`chmod -R 0755 "${remote}"`); + await catchExec(`sudo chown -R ${user}: "${remote}"`); + await catchExec(`sudo chmod -R 0755 "${remote}"`); } else if (group) { - await catchExec(`chown -R :${group} "${remote}"`); - await catchExec(`chmod -R 0775 "${remote}"`); + await catchExec(`sudo chown -R :${group} "${remote}"`); + await catchExec(`sudo chmod -R 0775 "${remote}"`); } }; diff --git a/src/lib/modules/commands.ts b/src/lib/modules/commands.ts index 87b6c67..1148082 100644 --- a/src/lib/modules/commands.ts +++ b/src/lib/modules/commands.ts @@ -61,12 +61,12 @@ export const setCommands = async (options: { const initialCommands = [ /** Resolving `dpkg` and `apt` */ - 'rm -rf /var/lib/apt/lists/lock', - 'rm -rf /var/lib/dpkg/lock', - 'rm -rf /var/lib/dpkg/lock-frontend', - 'rm -rf /var/cache/apt/archives/lock', - 'echo "Y" | dpkg --configure -a', - 'echo "debconf debconf/frontend select Noninteractive" | debconf-set-selections', + 'sudo rm -rf /var/lib/apt/lists/lock', + 'sudo rm -rf /var/lib/dpkg/lock', + 'sudo rm -rf /var/lib/dpkg/lock-frontend', + 'sudo rm -rf /var/cache/apt/archives/lock', + 'echo "Y" | sudo dpkg --configure -a', + 'echo "debconf debconf/frontend select Noninteractive" | sudo debconf-set-selections', ]; if (verbose) console.log('# Initial Commands', '\n', initialCommands); diff --git a/src/lib/modules/configs/node.ts b/src/lib/modules/configs/node.ts index 8e7828c..cb62adc 100644 --- a/src/lib/modules/configs/node.ts +++ b/src/lib/modules/configs/node.ts @@ -2,16 +2,23 @@ import { NODE } from '../../types/node.js'; import { MOUNT } from '../../types/mount.js'; export const setNode = (configs: MOUNT): Required | null => { - if (!configs?.node || typeof configs?.node !== 'object') return null; + if (!configs?.node) return null; + + const defaults: Required = { + version: 18, + packages: [], + }; + + if (configs.node === true) return defaults; return { version: configs?.node && typeof configs.node.version === 'number' ? configs.node.version - : 18, + : defaults.version, packages: configs?.node && Array.isArray(configs.node.packages) ? configs.node.packages - : [], + : defaults.packages, }; }; diff --git a/src/lib/modules/configs/php.ts b/src/lib/modules/configs/php.ts index c89aba8..ca83ac7 100644 --- a/src/lib/modules/configs/php.ts +++ b/src/lib/modules/configs/php.ts @@ -2,43 +2,53 @@ import { PHP } from '../../types/php.js'; import { MOUNT } from '../../types/mount.js'; export const setPHP = (configs: MOUNT): Required | null => { - if (!configs?.php || typeof configs?.php !== 'object') return null; + if (!configs?.php) return null; - return { + const defaults: Required = { + version: 8.2, + modules: [ + 'cli', + 'common', + 'bz2', + 'curl', + 'gmp', + 'readline', + 'sqlite3', + 'xml', + 'bcmath', + 'gd', + 'imagick', + 'imap', + 'intl', + 'json', + 'mbstring', + 'mysql', + 'opcache', + 'soap', + 'tidy', + 'xmlrpc', + 'xsl', + 'zip', + ], + composer: true, + }; + + if (configs.php === true) return defaults; + + const php: Required = { version: configs?.php && typeof configs.php?.version === 'number' ? configs.php.version - : 8.2, + : defaults.version, modules: configs?.php && Array.isArray(configs.php?.modules) ? configs.php.modules - : [ - 'cli', - 'common', - 'bz2', - 'curl', - 'gmp', - 'readline', - 'sqlite3', - 'xml', - 'bcmath', - 'gd', - 'imagick', - 'imap', - 'intl', - 'json', - 'mbstring', - 'mysql', - 'opcache', - 'soap', - 'tidy', - 'xmlrpc', - 'xsl', - 'zip', - ], + : defaults.modules, composer: configs?.php && typeof configs.php?.composer === 'boolean' ? configs.php.composer - : true, + : defaults.composer, }; + + return php; }; diff --git a/src/lib/modules/configs/users.ts b/src/lib/modules/configs/users.ts index 44e4c6c..6e3e35c 100644 --- a/src/lib/modules/configs/users.ts +++ b/src/lib/modules/configs/users.ts @@ -2,7 +2,7 @@ import { MOUNT } from '../../types/mount.js'; import { REQUIRED_USER } from '../../types/users.js'; import { forceArray } from '../force-array.js'; -export const setUsers = (configs: MOUNT) => { +export const setUsers = (configs: MOUNT): REQUIRED_USER[] | null => { if (!configs?.users) return null; const mapUsers = forceArray(configs.users) as REQUIRED_USER[]; diff --git a/src/lib/tasks/index.ts b/src/lib/tasks/index.ts index 7ecebe3..5b9f57c 100644 --- a/src/lib/tasks/index.ts +++ b/src/lib/tasks/index.ts @@ -29,7 +29,7 @@ const createSVPS = () => { return class SVPS { constructor(options: { - /** Set the SSH access for one or more VPS */ + /** Set the SSH access */ access: ACCESS; }) { access = options.access; @@ -93,13 +93,13 @@ const createSVPS = () => { const invalidVirtualHosts: VIRTUAL_HOST[] = []; const deployedVirtualHosts: VIRTUAL_HOST[] = []; const commands = [ - 'echo "debconf debconf/frontend select Noninteractive" | debconf-set-selections', - 'mkdir -p /var/containers/images /var/containers/compositions /var/containers/domains /var/containers/databases', - 'chmod 0755 /var/containers', - 'chmod 0700 /var/containers/images', - 'chmod 0700 /var/containers/compositions', - 'chmod 0750 /var/containers/databases', - 'chmod 0755 /var/containers/domains', + 'echo "debconf debconf/frontend select Noninteractive" | sudo debconf-set-selections', + 'sudo mkdir -p /var/containers/images /var/containers/compositions /var/containers/domains /var/containers/databases', + 'sudo chmod 0755 /var/containers', + 'sudo chmod 0700 /var/containers/images', + 'sudo chmod 0700 /var/containers/compositions', + 'sudo chmod 0750 /var/containers/databases', + 'sudo chmod 0755 /var/containers/domains', ]; if (!virtualHosts) { @@ -146,11 +146,11 @@ const createSVPS = () => { ...commands, `echo "${sh.startTitle}Proxy Port: ${virtualHost.domain} on port ${virtualHost.port}${sh.endTitle}"`, ...createProxy(virtualHost), - 'systemctl reload apache2', + 'sudo systemctl reload apache2', sh.done, ]); }); - commands.push('systemctl restart apache2'); + commands.push('sudo systemctl restart apache2'); } /** Basic Virtual Hosts Servers */ @@ -165,7 +165,7 @@ const createSVPS = () => { ...createBasicVirtualHost(virtualHost), ]); }); - commands.push('systemctl restart apache2'); + commands.push('sudo systemctl restart apache2'); } if (deployedVirtualHosts.length === 0) diff --git a/src/lib/tasks/steps/apache.ts b/src/lib/tasks/steps/apache.ts index db367a8..db89e2f 100644 --- a/src/lib/tasks/steps/apache.ts +++ b/src/lib/tasks/steps/apache.ts @@ -15,16 +15,16 @@ export default (configs: MOUNT) => { const commands = [ `echo "${sh.startTitle}Setting up Apache2${sh.endTitle}"`, - 'apt-get update', - 'apt-get install apache2 -y', - 'mkdir -p /var/www', - 'rm -rf /var/www/html', - 'mkdir -p /var/www/host', + 'sudo apt-get update', + 'sudo apt-get install apache2 -y', + 'sudo mkdir -p /var/www', + 'sudo rm -rf /var/www/html', + 'sudo mkdir -p /var/www/host', `echo "${sh.startTitle}Setting up Rewrite Virtual Hosts${sh.endTitle}"`, `echo ${escapeQuotes( fs.readFileSync(normalize(default_000), 'utf-8') - )} | cat > /etc/apache2/sites-available/000-default.conf`, - 'a2enmod proxy proxy_http rewrite headers expires', + )} | sudo tee /etc/apache2/sites-available/000-default.conf`, + 'sudo a2enmod proxy proxy_http rewrite headers expires', ]; if (!apache.accessFromIP) { @@ -36,19 +36,19 @@ export default (configs: MOUNT) => { ...[ `echo ${escapeQuotes( fs.readFileSync(normalize(htaccess), 'utf-8') - )} | cat > /var/www/host/.htaccess`, + )} | sudo tee /var/www/host/.htaccess`, `echo ${escapeQuotes( fs.readFileSync(normalize(_403), 'utf-8') - )} | cat > /var/www/host/403.html`, - 'chmod 0755 /var/www/host', + )} | sudo tee /var/www/host/403.html`, + 'sudo chmod 0755 /var/www/host', ], ]); } Object.assign(commands, [ ...commands, - 'systemctl restart apache2', - 'systemctl reload apache2', + 'sudo systemctl restart apache2', + 'sudo systemctl reload apache2', sh.done, ]); diff --git a/src/lib/tasks/steps/apt.ts b/src/lib/tasks/steps/apt.ts index b5bf93b..b1c9534 100644 --- a/src/lib/tasks/steps/apt.ts +++ b/src/lib/tasks/steps/apt.ts @@ -2,10 +2,10 @@ import sh from '../../modules/sh.js'; export default () => [ `echo "${sh.startTitle}Preparing the Environment${sh.endTitle}"`, - 'apt-get update', - 'DEBIAN_FRONTEND="noninteractive" apt -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade 2>/dev/null', - 'apt-get autoremove -y --purge', - 'apt-get clean -y', - 'apt-get autoclean -y', + 'sudo apt-get update', + 'DEBIAN_FRONTEND="noninteractive" sudo apt -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade 2>/dev/null', + 'sudo apt-get autoremove -y --purge', + 'sudo apt-get clean -y', + 'sudo apt-get autoclean -y', sh.done, ]; diff --git a/src/lib/tasks/steps/certificate.ts b/src/lib/tasks/steps/certificate.ts index e8efc25..9b1c423 100644 --- a/src/lib/tasks/steps/certificate.ts +++ b/src/lib/tasks/steps/certificate.ts @@ -18,7 +18,7 @@ export default (configs: MOUNT) => { const commands = [ 'echo "Generating Open SSL RSA Certificate..."', - `--catch openssl req -x509 -nodes -days ${certificate.days} -new -newkey rsa:${certificate.rsa} -keyout /etc/ssl/private/cert.pem -out /etc/ssl/private/cert.pem -subj "/C=${country}/ST=${state}/L=${location}/O=${organization}/OU=${organizationUnit}/CN=${commonName}"`, + `--catch sudo openssl req -x509 -nodes -days ${certificate.days} -new -newkey rsa:${certificate.rsa} -keyout /etc/ssl/private/cert.pem -out /etc/ssl/private/cert.pem -subj "/C=${country}/ST=${state}/L=${location}/O=${organization}/OU=${organizationUnit}/CN=${commonName}"`, sh.done, ]; diff --git a/src/lib/tasks/steps/crontab.ts b/src/lib/tasks/steps/crontab.ts index 8d13850..2421f88 100644 --- a/src/lib/tasks/steps/crontab.ts +++ b/src/lib/tasks/steps/crontab.ts @@ -15,16 +15,15 @@ export default (configs: MOUNT, VPS: ACCESS) => { const crons = escapeQuotes(fs.readFileSync(normalize(crontab.path), 'utf-8')); const commands = [ `echo "${sh.startTitle}Setting up cron jobs for '${VPS.username}'${sh.endTitle}"`, - 'mkdir -p /var/spool/cron/crontabs/', - 'apt-get update', - 'apt-get install -y cron', - `echo ${crons} | ${append ? 'tee -a' : 'cat >'} /var/spool/cron/crontabs/${ + 'sudo mkdir -p /var/spool/cron/crontabs/', + 'sudo apt-get update', + 'sudo apt-get install -y cron', + `echo ${crons} | sudo tee${append ? ' -a' : ''} /var/spool/cron/crontabs/${ VPS.username }`, ]; - if (!append) commands.push(`echo ${crons}`); - + commands.push(`echo ${crons}`); commands.push(sh.done); return commands; diff --git a/src/lib/tasks/steps/deskop.ts b/src/lib/tasks/steps/deskop.ts index 7bd9de2..ce5c414 100644 --- a/src/lib/tasks/steps/deskop.ts +++ b/src/lib/tasks/steps/deskop.ts @@ -4,13 +4,13 @@ import { MOUNT } from '../../types/mount.js'; const desktop: string[] = [ `echo "${sh.startTitle}Setting up Xubuntu Desktop (It may take a while)${sh.endTitle}"`, `echo "Waiting 3 seconds to continue..."; sleep 3`, - 'apt-get update', - 'apt-get install software-properties-common -y', - 'echo | add-apt-repository ppa:xubuntu-dev/staging', - 'apt-get install -y tasksel xfce4 xfce4-terminal ubuntu-drivers-common gnome-software xfce4-goodies snapd', - '--catch tasksel install xubuntu-desktop || apt-get install xubuntu-desktop -y', - '--catch update-alternatives --install /usr/bin/x-session-manager x-session-manager /usr/bin/startxfce4 60', - '--catch update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator /usr/bin/xfce4-terminal 60', + 'sudo apt-get update', + 'sudo apt-get install software-properties-common -y', + 'echo | sudo add-apt-repository ppa:xubuntu-dev/staging', + 'sudo apt-get install -y tasksel xfce4 xfce4-terminal ubuntu-drivers-common gnome-software xfce4-goodies snapd', + '--catch sudo tasksel install xubuntu-desktop || apt-get install xubuntu-desktop -y', + '--catch sudo update-alternatives --install /usr/bin/x-session-manager x-session-manager /usr/bin/startxfce4 60', + '--catch sudo update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator /usr/bin/xfce4-terminal 60', ]; const rdp: string[] = [ @@ -18,15 +18,15 @@ const rdp: string[] = [ `echo "Waiting 3 seconds to continue..."; sleep 3`, /* Activate graphical display */ - '--catch systemctl set-default graphical.target', + '--catch sudo systemctl set-default graphical.target', /* Install RDP Remote */ - 'apt-get install xrdp xauth xserver-xorg-core xserver-xorg xorg openbox -y', + 'sudo apt-get install xrdp xauth xserver-xorg-core xserver-xorg xorg openbox -y', `echo "${sh.startTitle}Setting up Remote Desktop (It may take a while)${sh.endTitle}"`, - '--catch systemctl enable xrdp', - 'usermod -a -G ssl-cert xrdp', - 'systemctl restart xrdp', + '--catch sudo systemctl enable xrdp', + 'sudo usermod -a -G ssl-cert xrdp', + 'sudo systemctl restart xrdp', '--reboot', ]; @@ -57,13 +57,13 @@ const xfce: string[] = [ `--catch xfconf-query -c xfce4-panel -np '/panels/dark-mode' -t 'bool' -s 'true'`, `--catch xfconf-query -c xfce4-panel -np '/plugins/plugin-1/show-tooltips' -t 'bool' -s 'true'`, `--catch xfconf-query -c xfce4-panel -np '/plugins/plugin-2/grouping' -t int -s 1`, - `--catch apt-get remove colord -y`, + `--catch sudo apt-get remove colord -y`, ]; const browser: string[] = [ - 'apt-get update', - 'apt-get update --fix-missing', - '--catch apt-get install firefox -y || true', + 'sudo apt-get update', + 'sudo apt-get update --fix-missing', + '--catch sudo apt-get install firefox -y || true', ]; export default (configs: MOUNT) => { diff --git a/src/lib/tasks/steps/docker.ts b/src/lib/tasks/steps/docker.ts index f57f2b0..4a7cfff 100644 --- a/src/lib/tasks/steps/docker.ts +++ b/src/lib/tasks/steps/docker.ts @@ -6,17 +6,17 @@ export default (configs: MOUNT) => { return [ `echo "${sh.startTitle}Installing Docker${sh.endTitle}"`, - 'apt-get update', - 'apt-get remove docker docker-engine docker.io containerd runc -y &> /dev/null || true', - 'rm -f /etc/apt/keyrings/docker.gpg', - 'apt-get install ca-certificates curl gnupg lsb-release -y', - 'mkdir -m 0755 -p /etc/apt/keyrings', - 'curl -k -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --no-tty --dearmor -o /etc/apt/keyrings/docker.gpg', - 'echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null', - 'apt-get update', - 'apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y', - 'systemctl start docker', - 'systemctl restart docker', + 'sudo apt-get update', + 'sudo apt-get remove docker docker-engine docker.io containerd runc -y &> /dev/null || true', + 'sudo rm -f /etc/apt/keyrings/docker.gpg', + 'sudo apt-get install ca-certificates curl gnupg lsb-release -y', + 'sudo mkdir -m 0755 -p /etc/apt/keyrings', + 'curl -k -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --no-tty --dearmor -o /etc/apt/keyrings/docker.gpg', + 'echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null', + 'sudo apt-get update', + 'sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y', + 'sudo systemctl start docker', + 'sudo systemctl restart docker', sh.done, ]; }; diff --git a/src/lib/tasks/steps/firewall.ts b/src/lib/tasks/steps/firewall.ts index 55f100d..c7e8cf9 100644 --- a/src/lib/tasks/steps/firewall.ts +++ b/src/lib/tasks/steps/firewall.ts @@ -8,24 +8,24 @@ export default (configs: MOUNT, VPS: ACCESS) => { const commands = [ `echo "${sh.startTitle}Setting up Firewall${sh.endTitle}"`, - 'apt-get update', - `if [ "$(grep -E '^VERSION_ID="18.04"' /etc/os-release)" ]; then apt-get install nftables -y; fi`, - 'apt-get install ufw -y', - 'ufw default deny incoming', - 'ufw default allow outgoing', - `if [ "$(grep -E '^VERSION_ID="18.04"' /etc/os-release)" ]; then ufw allow OpenSSH; else ufw allow ssh; fi`, - `ufw allow ${VPS?.port || 22}`, - 'ufw allow 80', - 'ufw allow 443', - 'ufw allow 20/tcp', - 'ufw allow 21/tcp', - 'ufw allow 990/tcp', - 'ufw allow 40000:50000/tcp', - "sed -i '/ufw-before-input.*icmp/s/ACCEPT/DROP/g' /etc/ufw/before.rules", + 'sudo apt-get update', + `if [ "$(sudo grep -E '^VERSION_ID="18.04"' /etc/os-release)" ]; then sudo apt-get install nftables -y; fi`, + 'sudo apt-get install ufw -y', + 'sudo ufw default deny incoming', + 'sudo ufw default allow outgoing', + `if [ "$(sudo grep -E '^VERSION_ID="18.04"' /etc/os-release)" ]; then sudo ufw allow OpenSSH; else sudo ufw allow ssh; fi`, + `sudo ufw allow ${VPS?.port || 22}`, + 'sudo ufw allow 80', + 'sudo ufw allow 443', + 'sudo ufw allow 20/tcp', + 'sudo ufw allow 21/tcp', + 'sudo ufw allow 990/tcp', + 'sudo ufw allow 40000:50000/tcp', + "sudo sed -i '/ufw-before-input.*icmp/s/ACCEPT/DROP/g' /etc/ufw/before.rules", ]; if (mysql) { - commands.push(`ufw allow from 127.0.0.1 to any port 3306`); + commands.push(`sudo ufw allow from 127.0.0.1 to any port 3306`); if (mysql.users.length > 0) { for (const user of mysql.users) { @@ -33,7 +33,7 @@ export default (configs: MOUNT, VPS: ACCESS) => { if (localhost.includes(user.host)) continue; - commands.push(`ufw allow from ${user.host} to any port 3306`); + commands.push(`sudo ufw allow from ${user.host} to any port 3306`); } } } @@ -42,12 +42,12 @@ export default (configs: MOUNT, VPS: ACCESS) => { /* Open port to RDP */ Object.assign(commands, [ ...commands, - 'ufw allow from any to any port 3389 proto tcp', - 'ufw reload', + 'sudo ufw allow from any to any port 3389 proto tcp', + 'sudo ufw reload', ]); } - commands.push('echo "y" | ufw enable'); + commands.push('echo "y" | sudo ufw enable'); commands.push(sh.done); return commands; diff --git a/src/lib/tasks/steps/mysql.ts b/src/lib/tasks/steps/mysql.ts index 5045024..9388127 100644 --- a/src/lib/tasks/steps/mysql.ts +++ b/src/lib/tasks/steps/mysql.ts @@ -19,27 +19,27 @@ export default (configs: MOUNT) => { .replace(/{!PASS}/gm, mysql.root.pass); const commands = [ `echo "${sh.startTitle}Setting up MySQL${sh.endTitle}"`, - 'apt-get update', - 'apt-get install mysql-server -y', + 'sudo apt-get update', + 'sudo apt-get install mysql-server -y', `echo ${escapeQuotes( fs.readFileSync(normalize(mysqld_cnf), 'utf-8') - )} | cat > /etc/mysql/mysql.conf.d/mysqld.cnf`, - `echo ${escapeQuotes(temp_access)} | cat > ~/.my.cnf`, - 'chmod 0600 ~/.my.cnf', - 'service mysql restart', - `mysql -e "ALTER USER '${mysql.root.name}'@'localhost' IDENTIFIED WITH mysql_native_password BY '${mysql.root.pass}';"`, - 'mysql -e "DELETE FROM mysql.user WHERE User=\'\';"', - `mysql -e "DELETE FROM mysql.user WHERE User='${mysql.root.name}' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"`, - 'mysql -e "DROP DATABASE IF EXISTS test;"', - "mysql -e \"DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%';\"", + )} | sudo tee /etc/mysql/mysql.conf.d/mysqld.cnf`, + `echo ${escapeQuotes(temp_access)} | sudo tee ~/.my.cnf > /dev/null`, + 'sudo chmod 0600 ~/.my.cnf', + 'sudo service mysql restart', + `sudo mysql -e "ALTER USER '${mysql.root.name}'@'localhost' IDENTIFIED WITH mysql_native_password BY '${mysql.root.pass}';"`, + 'sudo mysql -e "DELETE FROM mysql.user WHERE User=\'\';"', + `sudo mysql -e "DELETE FROM mysql.user WHERE User='${mysql.root.name}' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"`, + 'sudo mysql -e "DROP DATABASE IF EXISTS test;"', + "sudo mysql -e \"DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%';\"", ]; /* Creates users */ for (const user of mysql.users) { Object.assign(commands, [ ...commands, - `mysql -e "CREATE USER '${user.name}'@'${user.host}' IDENTIFIED WITH mysql_native_password BY '${user.pass}';" || echo "> No changes to ${user.name}@${user.host}"`, - `mysql -e "GRANT ALL PRIVILEGES ON *.* TO '${user.name}'@'${user.host}' WITH GRANT OPTION;"`, + `sudo mysql -e "CREATE USER '${user.name}'@'${user.host}' IDENTIFIED WITH mysql_native_password BY '${user.pass}';" || echo "> No changes to ${user.name}@${user.host}"`, + `sudo mysql -e "GRANT ALL PRIVILEGES ON *.* TO '${user.name}'@'${user.host}' WITH GRANT OPTION;"`, ]); } @@ -48,20 +48,20 @@ export default (configs: MOUNT) => { for (const db of mysql.databases) Object.assign(commands, [ ...commands, - `mysql -e "CREATE DATABASE IF NOT EXISTS ${db};"`, + `sudo mysql -e "CREATE DATABASE IF NOT EXISTS ${db};"`, ]); } Object.assign(commands, [ ...commands, - 'mysql -e "FLUSH PRIVILEGES;"', + 'sudo mysql -e "FLUSH PRIVILEGES;"', 'echo "\x1b[36m"', - 'mysql -e "SHOW DATABASES;"', + 'sudo mysql -e "SHOW DATABASES;"', 'echo ""', - 'mysql -e "SELECT user, host FROM mysql.user ORDER BY host ASC;" | sed "s/[[:space:]]/@/g"', + 'sudo mysql -e "SELECT user, host FROM mysql.user ORDER BY host ASC;" | sed "s/[[:space:]]/@/g"', 'echo "\x1b[0m"', - 'rm -rf ~/.my.cnf', - 'service mysql restart', + 'sudo rm -rf ~/.my.cnf', + 'sudo service mysql restart', sh.done, ]); diff --git a/src/lib/tasks/steps/node.ts b/src/lib/tasks/steps/node.ts index b89028f..407a641 100644 --- a/src/lib/tasks/steps/node.ts +++ b/src/lib/tasks/steps/node.ts @@ -7,16 +7,23 @@ export default (configs: MOUNT) => { if (!node) return [] as string[]; + // source: https://github.com/nodesource/distributions const commands = [ `echo "${sh.startTitle}Setting up Node.js${sh.endTitle}"`, - 'apt-get update', - 'apt-get remove nodejs npm -y', - `curl -fsSL https://deb.nodesource.com/setup_${node.version}.x | bash -`, - 'apt-get install nodejs', + 'sudo apt-get update', + 'sudo apt-get purge nodejs npm -y', + 'sudo rm -rf /etc/apt/sources.list.d/nodesource.list', + 'sudo rm -rf /etc/apt/keyrings/nodesource.gpg', + 'sudo apt-get install -y ca-certificates curl gnupg', + 'sudo mkdir -p /etc/apt/keyrings', + 'curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg', + `echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${node.version}.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list`, + 'sudo apt-get update', + 'sudo apt-get install nodejs -y', 'node -v', - 'echo "{}" | cat > package.json', + 'echo "{}" | sudo tee package.json', 'npm install --package-lock-only', - 'npm i npm@latest -g 2>/dev/null', + 'sudo npm i npm@latest -g 2>/dev/null', ]; if (node.packages.length > 0) @@ -24,7 +31,7 @@ export default (configs: MOUNT) => { Object.assign(commands, [ ...commands, `echo "\n\x1b[0m\x1b[1m\x1b[36m‣ Global Module:\x1b[0m \x1b[22m\x1b[1m${module}\x1b[0m"`, - `--catch npm i ${module} -g`, + `--catch sudo npm i ${module} -g`, ]); } diff --git a/src/lib/tasks/steps/php.ts b/src/lib/tasks/steps/php.ts index 058fc73..a6e241a 100644 --- a/src/lib/tasks/steps/php.ts +++ b/src/lib/tasks/steps/php.ts @@ -29,21 +29,23 @@ export default (configs: MOUNT) => { const commands: string[] = [ `echo "${sh.startTitle}Setting up PHP${sh.endTitle}"`, - 'apt-get update', - 'apt-get -y install acl software-properties-common', - 'add-apt-repository ppa:ondrej/php', - `apt-get install -y php${version}`, + 'sudo apt-get update', + 'sudo apt-get -y install acl software-properties-common', + 'sudo add-apt-repository ppa:ondrej/php', + `sudo apt-get install -y php${version}`, ]; if (php.modules.length > 0) - commands.push(`apt-get install -y php${version}-{${modules.join(',')}}`); + commands.push( + `sudo apt-get install -y php${version}-{${modules.join(',')}}` + ); if (php.composer) { Object.assign(commands, [ ...commands, ...[ 'curl -sS https://getcomposer.org/installer -o composer-setup.php', - 'php composer-setup.php --install-dir=/usr/local/bin --filename=composer || true', + 'sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer || true', ], ]); } @@ -53,14 +55,14 @@ export default (configs: MOUNT) => { ...[ `echo ${escapeQuotes( fs.readFileSync(normalize(php_ini), 'utf-8') - )} | cat > /etc/php/${version}/cli/php.ini`, - 'find /var/www/ -type d -exec chmod 775 {} \\;', - 'find /var/www/ -type f -exec chmod 664 {} \\;', - 'setfacl -dR -m u:"www-data":rwx /var/www/ /tmp/', - 'chown root:www-data /var/www', - 'chmod 0755 /var/www', - 'systemctl reload apache2', - 'systemctl restart apache2', + )} | sudo tee /etc/php/${version}/cli/php.ini`, + 'find /var/www/ -type d -exec sudo chmod 775 {} \\;', + 'find /var/www/ -type f -exec sudo chmod 664 {} \\;', + 'sudo setfacl -dR -m u:"www-data":rwx /var/www/ /tmp/', + 'sudo chown root:www-data /var/www', + 'sudo chmod 0755 /var/www', + 'sudo systemctl reload apache2', + 'sudo systemctl restart apache2', sh.done, ], ]); diff --git a/src/lib/tasks/steps/reboot.ts b/src/lib/tasks/steps/reboot.ts index eb5cc64..42f343a 100644 --- a/src/lib/tasks/steps/reboot.ts +++ b/src/lib/tasks/steps/reboot.ts @@ -4,7 +4,7 @@ import { ACCESS } from '../../types/acess.js'; export default async (VPS: ACCESS): Promise => { try { await catchExec( - "shutdown -r +0 \"`date '+%H:%M:%S' -d '+2 seconds'`\" & disown" + "sudo shutdown -r +0 \"`date '+%H:%M:%S' -d '+2 seconds'`\" & disown" ); } catch (quiet) {} diff --git a/src/lib/tasks/steps/repair.ts b/src/lib/tasks/steps/repair.ts index a7d2a47..5d3fcbe 100644 --- a/src/lib/tasks/steps/repair.ts +++ b/src/lib/tasks/steps/repair.ts @@ -4,11 +4,11 @@ import { rootSVPS } from '../../modules/root.js'; import sh from '../../modules/sh.js'; const getList = (version: string, arch: 'amd' | 'arm') => { - const header = `if [[ "$(grep -E '^VERSION_ID="${version}"' /etc/os-release)" ]] && [[ $(dpkg --print-architecture) =~ ^${arch} ]]; then echo`; + const header = `if [[ "$(sudo grep -E '^VERSION_ID="${version}"' /etc/os-release)" ]] && [[ $(sudo dpkg --print-architecture) =~ ^${arch} ]]; then echo`; const main = escapeQuotes( importFile(`${rootSVPS}/resources/sources-list/${version}-${arch}.list`) ); - const footer = `| cat > /etc/apt/sources.list; fi`; + const footer = `| sudo tee /etc/apt/sources.list; fi`; return `${header} ${main} ${footer}`; }; @@ -17,7 +17,7 @@ export default () => [ `echo "${sh.startTitle}Repairing common Ubuntu errors${sh.endTitle}"`, /** Resolving `/tmp` permissions */ - 'chmod 1777 /tmp', + 'sudo chmod 1777 /tmp', /** Restoring default sources list */ getList('18.04', 'amd'), @@ -31,30 +31,30 @@ export default () => [ getList('23.04', 'arm'), /** Installing missing packages */ - 'apt-get clean', - 'apt-get update --fix-missing', - 'apt-get install -f -y', + 'sudo apt-get clean', + 'sudo apt-get update --fix-missing', + 'sudo apt-get install -f -y', /** Installing essential packages */ - 'apt-get install -y apt-utils coreutils sysvinit-utils systemd systemd-sysv software-properties-common build-essential gcc g++ make dialog zip gzip tar unzip acl curl cron wget --no-install-recommends --no-install-suggests ssh', + 'sudo apt-get install -y apt-utils coreutils sysvinit-utils systemd systemd-sysv software-properties-common build-essential gcc g++ make dialog zip gzip tar unzip acl curl cron wget --no-install-recommends --no-install-suggests ssh', /** Installing essential libs */ - 'apt-get install -y zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev', + 'sudo apt-get install -y zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev', /** Fixing CVE-2022-39227 vulnerability */ - 'if dpkg -s python3-jwt >/dev/null 2>&1; then apt-get purge --autoremove -y python3-jwt; fi', + 'if sudo dpkg -s python3-jwt >/dev/null 2>&1; then sudo apt-get purge --autoremove -y python3-jwt; fi', /** Fixing CVE-2021-33503 vulnerability */ - 'if dpkg -s python3-urllib3 >/dev/null 2>&1; then apt-get purge --autoremove -y python3-urllib3; fi', + 'if sudo dpkg -s python3-urllib3 >/dev/null 2>&1; then sudo apt-get purge --autoremove -y python3-urllib3; fi', /** Fixing CVE-2018-18074 vulnerability */ - 'if dpkg -s requests >/dev/null 2>&1; then apt-get purge --autoremove -y requests; fi', + 'if sudo dpkg -s requests >/dev/null 2>&1; then sudo apt-get purge --autoremove -y requests; fi', /** Fixing CVE-2022-23491 vulnerability */ - 'if dpkg -s certifi >/dev/null 2>&1; then apt-get purge --autoremove -y certifi; fi', + 'if sudo dpkg -s certifi >/dev/null 2>&1; then sudo apt-get purge --autoremove -y certifi; fi', /** Releasing the `dpkg` and `apt` */ - 'echo "Y" | dpkg --configure -a', + 'echo "Y" | sudo dpkg --configure -a', sh.done, ]; diff --git a/src/lib/tasks/steps/users/ftp.ts b/src/lib/tasks/steps/users/ftp.ts index 9145f52..a542183 100644 --- a/src/lib/tasks/steps/users/ftp.ts +++ b/src/lib/tasks/steps/users/ftp.ts @@ -13,12 +13,12 @@ export const setFTP = (user: REQUIRED_USER) => { .replace(/{!MASK}/gm, user.ftp.mask); const commands: string[] = [ - `echo ${escapeQuotes(user_conf)} | cat > /etc/vsftpd/user_config_dir/${ + `echo ${escapeQuotes(user_conf)} | sudo tee /etc/vsftpd/user_config_dir/${ user.name }`, ]; - commands.push(`echo "${user.name}" | tee -a /etc/vsftpd.userlist`); + commands.push(`sudo echo "${user.name}" | tee -a /etc/vsftpd.userlist`); return commands; }; diff --git a/src/lib/tasks/steps/users/index.ts b/src/lib/tasks/steps/users/index.ts index b862914..9683b82 100644 --- a/src/lib/tasks/steps/users/index.ts +++ b/src/lib/tasks/steps/users/index.ts @@ -17,8 +17,8 @@ export default (configs: MOUNT) => { const commands: string[] = [ `echo "${sh.startTitle}Setting up Users${sh.endTitle}"`, - 'apt-get update', - 'apt-get install acl -y', + 'sudo apt-get update', + 'sudo apt-get install acl -y', ]; const hasFTP = users?.some((user) => typeof user.ftp === 'object') || false; const hasSFTP = users?.some((user) => typeof user.sftp === 'object') || false; @@ -32,42 +32,42 @@ export default (configs: MOUNT) => { if (hasFTP) { Object.assign(commands, [ ...commands, - 'apt-get update', - 'apt-get purge vsftpd -y 2>/dev/null', - 'rm -rf /etc/vsftpd.userlist', - 'apt-get install vsftpd -y', - 'mkdir -p /etc/vsftpd/user_config_dir', - `echo ${vsftpd_conf} | cat > /etc/vsftpd.conf`, + 'sudo apt-get update', + 'sudo apt-get purge vsftpd -y 2>/dev/null', + 'sudo rm -rf /etc/vsftpd.userlist', + 'sudo apt-get install vsftpd -y', + 'sudo mkdir -p /etc/vsftpd/user_config_dir', + `sudo echo ${vsftpd_conf} | tee /etc/vsftpd.conf`, ]); } if (hasSFTP) { Object.assign(commands, [ ...commands, - `sed -i 's/Subsystem\\ssftp\\s\\/usr\\/lib\\/openssh\\/sftp-server/Subsystem\\tsftp\\tinternal-sftp/g' ${sshdConfigPath}`, - `sed -i '/#svps-start/,/#svps-end/d' ${sshdConfigPath}`, - `rm -f ${sftpConfigPath}`, + `sudo sed -i 's/Subsystem\\ssftp\\s\\/usr\\/lib\\/openssh\\/sftp-server/Subsystem\\tsftp\\tinternal-sftp/g' ${sshdConfigPath}`, + `sudo sed -i '/#svps-start/,/#svps-end/d' ${sshdConfigPath}`, + `sudo rm -f ${sftpConfigPath}`, ]); } for (const user of users) { Object.assign(commands, [ ...commands, - `id -u ${user.name} &>/dev/null || adduser --disabled-password --gecos "" ${user.name}`, - `mkdir -p ${user.directory}`, - `echo "${user.name}:${user.password}" | chpasswd`, + `sudo id -u ${user.name} &>/dev/null || sudo adduser --disabled-password --gecos "" ${user.name}`, + `sudo mkdir -p ${user.directory}`, + `sudo echo "${user.name}:${user.password}" | sudo chpasswd`, `echo "${user.name}"`, ]); - if (user.sudo) commands.push(`gpasswd -a "${user.name}" sudo`); + if (user.sudo) commands.push(`sudo gpasswd -a "${user.name}" sudo`); if (user.ftp) Object.assign(commands, [...commands, ...setFTP(user)]); if (user.sftp) Object.assign(commands, [...commands, ...setSFTP(user)]); if (user.groups.length > 0) { user.groups.forEach((group) => Object.assign(commands, [ ...commands, - `groupadd -f ${group}`, - `usermod -a -G ${group} ${user.name}`, + `sudo groupadd -f ${group}`, + `sudo usermod -a -G ${group} ${user.name}`, ]) ); @@ -75,21 +75,22 @@ export default (configs: MOUNT) => { Object.assign(commands, [ ...commands, - `usermod -g ${primary} ${user.name}`, - `--catch chown -R ${user.name}:${primary} ${user.directory}`, + `sudo usermod -g ${primary} ${user.name}`, + `--catch sudo chown -R ${user.name}:${primary} ${user.directory}`, ]); - } else commands.push(`--catch chown -R ${user.name} ${user.directory}`); + } else + commands.push(`--catch sudo chown -R ${user.name} ${user.directory}`); Object.assign(commands, [ ...commands, - `--catch setfacl -Rb ${user.directory}`, - `--catch chown -R ${user.name} ${user.directory}`, - `--catch chmod -R 0755 ${user.directory}`, - `chmod 0700 ${user.directory}`, + `--catch sudo setfacl -Rb ${user.directory}`, + `--catch sudo chown -R ${user.name} ${user.directory}`, + `--catch sudo chmod -R 0755 ${user.directory}`, + `sudo chmod 0700 ${user.directory}`, ]); } - if (hasFTP) commands.push('systemctl restart vsftpd'); + if (hasFTP) commands.push('sudo systemctl restart vsftpd'); if (hasSFTP) commands.push('--restart-ssh'); commands.push(sh.done); diff --git a/src/lib/tasks/steps/users/restart-ssh.ts b/src/lib/tasks/steps/users/restart-ssh.ts index a94ffeb..d511ec6 100644 --- a/src/lib/tasks/steps/users/restart-ssh.ts +++ b/src/lib/tasks/steps/users/restart-ssh.ts @@ -3,7 +3,7 @@ import { ACCESS } from '../../../types/acess.js'; export default async (VPS: ACCESS): Promise => { try { - await catchExec('systemctl restart sshd'); + await catchExec('sudo systemctl restart sshd'); } catch (quiet) {} try { diff --git a/src/lib/tasks/steps/users/sftp.ts b/src/lib/tasks/steps/users/sftp.ts index f2bb106..b9a4d51 100644 --- a/src/lib/tasks/steps/users/sftp.ts +++ b/src/lib/tasks/steps/users/sftp.ts @@ -17,13 +17,13 @@ export const setSFTP = (user: REQUIRED_USER) => { .replace(/{!MASK}/gm, user.sftp.mask); const commands: string[] = [ - `echo ${escapeQuotes(user_conf)} | tee -a ${sshdConfigPath}`, - `mkdir -p ${user.sftp.chRoot} ${user.sftp.chUser}`, - `chown root:root ${user.sftp.chRoot}`, - `chmod 0755 ${user.sftp.chRoot}`, - `groupadd -f ${user.name}`, - `chown -R ${user.name}:${user.name} ${user.sftp.chUser}`, - `chmod -R 0755 ${user.sftp.chUser}`, + `echo ${escapeQuotes(user_conf)} | sudo tee -a ${sshdConfigPath}`, + `sudo mkdir -p ${user.sftp.chRoot} ${user.sftp.chUser}`, + `sudo chown root:root ${user.sftp.chRoot}`, + `sudo chmod 0755 ${user.sftp.chRoot}`, + `sudo groupadd -f ${user.name}`, + `sudo chown -R ${user.name}:${user.name} ${user.sftp.chUser}`, + `sudo chmod -R 0755 ${user.sftp.chUser}`, ]; return commands; diff --git a/src/lib/tasks/virtual-host/apache.ts b/src/lib/tasks/virtual-host/apache.ts index e8dec2b..bc0b62b 100644 --- a/src/lib/tasks/virtual-host/apache.ts +++ b/src/lib/tasks/virtual-host/apache.ts @@ -19,9 +19,9 @@ export const createProxy = (virtualHost: VIRTUAL_HOST): string[] => { ...commands, `echo ${escapeQuotes( proxy - )} | cat > /etc/apache2/sites-available/${domain}.conf`, - `if a2ensite -q ${domain}; then echo 'Virtual Host for "${domain}" enabled'; fi`, - 'systemctl reload apache2', + )} | sudo tee /etc/apache2/sites-available/${domain}.conf`, + `if sudo a2ensite -q ${domain}; then echo 'Virtual Host for "${domain}" enabled'; fi`, + 'sudo systemctl reload apache2', ]); return commands; diff --git a/src/lib/tasks/virtual-host/docker.ts b/src/lib/tasks/virtual-host/docker.ts index 93174fb..8f720bf 100644 --- a/src/lib/tasks/virtual-host/docker.ts +++ b/src/lib/tasks/virtual-host/docker.ts @@ -14,7 +14,9 @@ export const createBasicContainer = ( const domain = virtualHost.domain.trim(); const port = String(virtualHost.port); - const commands = [`mkdir -p /var/containers/domains/${domain}/public_html`]; + const commands = [ + `sudo mkdir -p /var/containers/domains/${domain}/public_html`, + ]; const { language } = virtualHost.server; const buildFromScratch: boolean = virtualHost.server?.buildFromScratch || false; @@ -61,12 +63,12 @@ export const createBasicContainer = ( ...commands, `echo ${escapeQuotes( composeSource - )} | cat > /var/containers/compositions/${composeFile}`, - `chmod 0600 /var/containers/compositions/${composeFile}`, - `docker compose -p ${composeName} -f /var/containers/compositions/${composeFile} down 2>&1 || true`, - `rm -rf /var/containers/domains/${domain}`, - `rm -rf /var/containers/images/${domain}`, - `rm -rf /var/containers/databases/${domain}`, + )} | sudo tee /var/containers/compositions/${composeFile}`, + `sudo chmod 0600 /var/containers/compositions/${composeFile}`, + `sudo docker compose -p ${composeName} -f /var/containers/compositions/${composeFile} down 2>&1 || true`, + `sudo rm -rf /var/containers/domains/${domain}`, + `sudo rm -rf /var/containers/images/${domain}`, + `sudo rm -rf /var/containers/databases/${domain}`, ]); if (useDB) { @@ -76,13 +78,13 @@ export const createBasicContainer = ( Object.assign(commands, [ ...commands, - `mkdir -p /var/containers/databases/${domain}/conf.d`, + `sudo mkdir -p /var/containers/databases/${domain}/conf.d`, `echo ${escapeQuotes( dbCNF - )} | cat > /var/containers/databases/${domain}/conf.d/my.cnf`, - `echo "${virtualHost.server.mysql?.password}" | cat > /var/containers/databases/${domain}/conf.d/secret`, - `chmod 0400 /var/containers/databases/${domain}/conf.d/my.cnf`, - `chmod 0400 /var/containers/databases/${domain}/conf.d/secret`, + )} | sudo tee /var/containers/databases/${domain}/conf.d/my.cnf`, + `echo "${virtualHost.server.mysql?.password}" | sudo tee /var/containers/databases/${domain}/conf.d/secret > /dev/null`, + `sudo chmod 0400 /var/containers/databases/${domain}/conf.d/my.cnf`, + `sudo chmod 0400 /var/containers/databases/${domain}/conf.d/secret`, ]); } @@ -107,10 +109,10 @@ export const createBasicContainer = ( Object.assign(commands, [ ...commands, - `mkdir -p /var/containers/domains/${domain}/public_html`, - `chmod -R 0755 /var/containers/domains/${domain}`, - `echo ${defaultPage} | cat > /var/containers/domains/${domain}/public_html/index.html`, - `docker compose -p ${composeName} -f /var/containers/compositions/${composeFile} up -d`, + `sudo mkdir -p /var/containers/domains/${domain}/public_html`, + `sudo chmod -R 0755 /var/containers/domains/${domain}`, + `echo ${defaultPage} | sudo tee /var/containers/domains/${domain}/public_html/index.html`, + `sudo docker compose -p ${composeName} -f /var/containers/compositions/${composeFile} up -d`, ]); /** Composing NODE server */ @@ -127,14 +129,14 @@ export const createBasicContainer = ( ...commands, `echo ${escapeQuotes( dockerfile - )} | cat > /var/containers/images/Dockerfile-node-lts-alpine`, - `chmod 0600 /var/containers/images/Dockerfile-node-lts-alpine`, + )} | sudo tee /var/containers/images/Dockerfile-node-lts-alpine`, + `sudo chmod 0600 /var/containers/images/Dockerfile-node-lts-alpine`, `echo ${escapeQuotes( createNodeServer(virtualHost.port) - )} | cat > /var/containers/domains/${domain}/app.js`, + )} | sudo tee /var/containers/domains/${domain}/app.js`, `echo ${escapeQuotes( pm2 - )} | cat > /var/containers/domains/${domain}/pm2.json`, + )} | sudo tee /var/containers/domains/${domain}/pm2.json`, ]); } else if (virtualHost.server.language === 'php') { /** Composing PHP server */ @@ -154,23 +156,23 @@ export const createBasicContainer = ( Object.assign(commands, [ ...commands, - 'mkdir -p /var/containers/images/resources', + 'sudo mkdir -p /var/containers/images/resources', `echo ${escapeQuotes( dockerfile - )} | cat > /var/containers/images/Dockerfile-php-8${ + )} | sudo tee /var/containers/images/Dockerfile-php-8${ buildFromScratch ? '-scratch' : '' }`, - `chmod 0600 /var/containers/images/Dockerfile-php-8${ + `sudo chmod 0600 /var/containers/images/Dockerfile-php-8${ buildFromScratch ? '-scratch' : '' }`, `echo ${escapeQuotes( default000 - )} | cat > /var/containers/images/resources/000-default.conf`, - `chmod 0600 /var/containers/images/resources/000-default.conf`, + )} | sudo tee /var/containers/images/resources/000-default.conf`, + `sudo chmod 0600 /var/containers/images/resources/000-default.conf`, `echo ${escapeQuotes( phpINI - )} | cat > /var/containers/images/resources/php.ini`, - `chmod 0600 /var/containers/images/resources/php.ini`, + )} | sudo tee /var/containers/images/resources/php.ini`, + `sudo chmod 0600 /var/containers/images/resources/php.ini`, ]); } @@ -182,27 +184,27 @@ export const createBasicContainer = ( if (user && group) { Object.assign(commands, [ ...commands, - `chown -R ${user}:${user} "${remote}"`, - `chmod -R 0775 "${remote}"`, + `sudo chown -R ${user}:${user} "${remote}"`, + `sudo chmod -R 0775 "${remote}"`, ]); } else if (user) { Object.assign(commands, [ ...commands, - `chown -R ${user}: "${remote}"`, - `chmod -R 0755 "${remote}"`, + `sudo chown -R ${user}: "${remote}"`, + `sudo chmod -R 0755 "${remote}"`, ]); } else if (group) { Object.assign(commands, [ ...commands, - `chown -R :${group} "${remote}"`, - `chmod -R 0775 "${remote}"`, + `sudo chown -R :${group} "${remote}"`, + `sudo chmod -R 0775 "${remote}"`, ]); } } /** Composing container */ commands.push( - `docker compose -p ${composeName} -f /var/containers/compositions/${composeFile} up -d --build` + `sudo docker compose -p ${composeName} -f /var/containers/compositions/${composeFile} up -d --build` ); return commands; diff --git a/src/lib/types/mount.ts b/src/lib/types/mount.ts index 380538f..1c5c6e3 100644 --- a/src/lib/types/mount.ts +++ b/src/lib/types/mount.ts @@ -8,7 +8,15 @@ import { USER } from './users.js'; import { VERBOSE } from './verbose.js'; export interface MOUNT { - /** Set the accesses you want to be created */ + /** + * Set the accesses you want to be created + * + * --- + * + * ⚠️ **AWS** environments: + * + * If you intend to access via **SSH** using a password, ensure that `PasswordAuthentication` is set to `yes` in `/etc/ssh/sshd_config` server file. + */ users?: USER | USER[]; /** Open SSL RSA Certificate * diff --git a/src/lib/types/virtual-hosts.ts b/src/lib/types/virtual-hosts.ts index 1e90bf8..e1e0121 100644 --- a/src/lib/types/virtual-hosts.ts +++ b/src/lib/types/virtual-hosts.ts @@ -61,6 +61,13 @@ interface BasicVirtualHost { */ group?: string; }; + /** + * Installs a **MySQL** database exclusively for this VIrtual Host. + * + * --- + * + * ⚠️ If you are using it on an **AWS EC2**, prefer to use **RDS** or similar instead. + */ mysql?: { /** database name */ database: string; From 645c1d0156374018e30c93b5b2bbdcfa1f162fae Mon Sep 17 00:00:00 2001 From: wellwelwel <46850407+wellwelwel@users.noreply.github.com> Date: Tue, 10 Oct 2023 12:38:02 -0300 Subject: [PATCH 06/11] ci: fix bad finish --- src/tests/virtual-hosts.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/tests/virtual-hosts.ts b/src/tests/virtual-hosts.ts index 61ac99a..7482138 100644 --- a/src/tests/virtual-hosts.ts +++ b/src/tests/virtual-hosts.ts @@ -51,11 +51,9 @@ import { SVPS, VirtualHost } from '../lib/index.js'; }, ]; - const createVirtualHosts = await svps.createVirtualHosts(virtualHosts); + await svps.createVirtualHosts(virtualHosts); await svps.end(); - - if (createVirtualHosts !== true) process.exit(1); } catch (error) { console.log(error); process.exit(1); From a469132950fa90592b29eca6086b43f43eb2eabc Mon Sep 17 00:00:00 2001 From: wellwelwel <46850407+wellwelwel@users.noreply.github.com> Date: Tue, 10 Oct 2023 12:59:18 -0300 Subject: [PATCH 07/11] ci: fix bad finish --- src/lib/tasks/steps/apache.ts | 6 +++--- src/lib/tasks/steps/crontab.ts | 2 +- src/lib/tasks/steps/mysql.ts | 2 +- src/lib/tasks/steps/node.ts | 4 ++-- src/lib/tasks/steps/php.ts | 2 +- src/lib/tasks/steps/repair.ts | 2 +- src/lib/tasks/steps/users/ftp.ts | 2 +- src/lib/tasks/steps/users/sftp.ts | 4 +++- src/lib/tasks/virtual-host/apache.ts | 2 +- src/lib/tasks/virtual-host/docker.ts | 16 ++++++++-------- src/tests/virtual-hosts.ts | 4 +++- 11 files changed, 25 insertions(+), 21 deletions(-) diff --git a/src/lib/tasks/steps/apache.ts b/src/lib/tasks/steps/apache.ts index db89e2f..e21fef6 100644 --- a/src/lib/tasks/steps/apache.ts +++ b/src/lib/tasks/steps/apache.ts @@ -23,7 +23,7 @@ export default (configs: MOUNT) => { `echo "${sh.startTitle}Setting up Rewrite Virtual Hosts${sh.endTitle}"`, `echo ${escapeQuotes( fs.readFileSync(normalize(default_000), 'utf-8') - )} | sudo tee /etc/apache2/sites-available/000-default.conf`, + )} | sudo tee /etc/apache2/sites-available/000-default.conf > /dev/null`, 'sudo a2enmod proxy proxy_http rewrite headers expires', ]; @@ -36,10 +36,10 @@ export default (configs: MOUNT) => { ...[ `echo ${escapeQuotes( fs.readFileSync(normalize(htaccess), 'utf-8') - )} | sudo tee /var/www/host/.htaccess`, + )} | sudo tee /var/www/host/.htaccess > /dev/null`, `echo ${escapeQuotes( fs.readFileSync(normalize(_403), 'utf-8') - )} | sudo tee /var/www/host/403.html`, + )} | sudo tee /var/www/host/403.html > /dev/null`, 'sudo chmod 0755 /var/www/host', ], ]); diff --git a/src/lib/tasks/steps/crontab.ts b/src/lib/tasks/steps/crontab.ts index 2421f88..c45d278 100644 --- a/src/lib/tasks/steps/crontab.ts +++ b/src/lib/tasks/steps/crontab.ts @@ -20,7 +20,7 @@ export default (configs: MOUNT, VPS: ACCESS) => { 'sudo apt-get install -y cron', `echo ${crons} | sudo tee${append ? ' -a' : ''} /var/spool/cron/crontabs/${ VPS.username - }`, + } > /dev/null`, ]; commands.push(`echo ${crons}`); diff --git a/src/lib/tasks/steps/mysql.ts b/src/lib/tasks/steps/mysql.ts index 9388127..11faee1 100644 --- a/src/lib/tasks/steps/mysql.ts +++ b/src/lib/tasks/steps/mysql.ts @@ -23,7 +23,7 @@ export default (configs: MOUNT) => { 'sudo apt-get install mysql-server -y', `echo ${escapeQuotes( fs.readFileSync(normalize(mysqld_cnf), 'utf-8') - )} | sudo tee /etc/mysql/mysql.conf.d/mysqld.cnf`, + )} | sudo tee /etc/mysql/mysql.conf.d/mysqld.cnf > /dev/null`, `echo ${escapeQuotes(temp_access)} | sudo tee ~/.my.cnf > /dev/null`, 'sudo chmod 0600 ~/.my.cnf', 'sudo service mysql restart', diff --git a/src/lib/tasks/steps/node.ts b/src/lib/tasks/steps/node.ts index 407a641..d012a6d 100644 --- a/src/lib/tasks/steps/node.ts +++ b/src/lib/tasks/steps/node.ts @@ -17,11 +17,11 @@ export default (configs: MOUNT) => { 'sudo apt-get install -y ca-certificates curl gnupg', 'sudo mkdir -p /etc/apt/keyrings', 'curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg', - `echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${node.version}.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list`, + `echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${node.version}.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list > /dev/null`, 'sudo apt-get update', 'sudo apt-get install nodejs -y', 'node -v', - 'echo "{}" | sudo tee package.json', + 'echo "{}" | sudo tee package.json > /dev/null', 'npm install --package-lock-only', 'sudo npm i npm@latest -g 2>/dev/null', ]; diff --git a/src/lib/tasks/steps/php.ts b/src/lib/tasks/steps/php.ts index a6e241a..b4a9062 100644 --- a/src/lib/tasks/steps/php.ts +++ b/src/lib/tasks/steps/php.ts @@ -55,7 +55,7 @@ export default (configs: MOUNT) => { ...[ `echo ${escapeQuotes( fs.readFileSync(normalize(php_ini), 'utf-8') - )} | sudo tee /etc/php/${version}/cli/php.ini`, + )} | sudo tee /etc/php/${version}/cli/php.ini > /dev/null`, 'find /var/www/ -type d -exec sudo chmod 775 {} \\;', 'find /var/www/ -type f -exec sudo chmod 664 {} \\;', 'sudo setfacl -dR -m u:"www-data":rwx /var/www/ /tmp/', diff --git a/src/lib/tasks/steps/repair.ts b/src/lib/tasks/steps/repair.ts index 5d3fcbe..b2711cb 100644 --- a/src/lib/tasks/steps/repair.ts +++ b/src/lib/tasks/steps/repair.ts @@ -8,7 +8,7 @@ const getList = (version: string, arch: 'amd' | 'arm') => { const main = escapeQuotes( importFile(`${rootSVPS}/resources/sources-list/${version}-${arch}.list`) ); - const footer = `| sudo tee /etc/apt/sources.list; fi`; + const footer = `| sudo tee /etc/apt/sources.list > /dev/null; fi`; return `${header} ${main} ${footer}`; }; diff --git a/src/lib/tasks/steps/users/ftp.ts b/src/lib/tasks/steps/users/ftp.ts index a542183..fcadf79 100644 --- a/src/lib/tasks/steps/users/ftp.ts +++ b/src/lib/tasks/steps/users/ftp.ts @@ -15,7 +15,7 @@ export const setFTP = (user: REQUIRED_USER) => { const commands: string[] = [ `echo ${escapeQuotes(user_conf)} | sudo tee /etc/vsftpd/user_config_dir/${ user.name - }`, + } > /dev/null`, ]; commands.push(`sudo echo "${user.name}" | tee -a /etc/vsftpd.userlist`); diff --git a/src/lib/tasks/steps/users/sftp.ts b/src/lib/tasks/steps/users/sftp.ts index b9a4d51..d9f70fd 100644 --- a/src/lib/tasks/steps/users/sftp.ts +++ b/src/lib/tasks/steps/users/sftp.ts @@ -17,7 +17,9 @@ export const setSFTP = (user: REQUIRED_USER) => { .replace(/{!MASK}/gm, user.sftp.mask); const commands: string[] = [ - `echo ${escapeQuotes(user_conf)} | sudo tee -a ${sshdConfigPath}`, + `echo ${escapeQuotes( + user_conf + )} | sudo tee -a ${sshdConfigPath} > /dev/null`, `sudo mkdir -p ${user.sftp.chRoot} ${user.sftp.chUser}`, `sudo chown root:root ${user.sftp.chRoot}`, `sudo chmod 0755 ${user.sftp.chRoot}`, diff --git a/src/lib/tasks/virtual-host/apache.ts b/src/lib/tasks/virtual-host/apache.ts index bc0b62b..c659406 100644 --- a/src/lib/tasks/virtual-host/apache.ts +++ b/src/lib/tasks/virtual-host/apache.ts @@ -19,7 +19,7 @@ export const createProxy = (virtualHost: VIRTUAL_HOST): string[] => { ...commands, `echo ${escapeQuotes( proxy - )} | sudo tee /etc/apache2/sites-available/${domain}.conf`, + )} | sudo tee /etc/apache2/sites-available/${domain}.conf > /dev/null`, `if sudo a2ensite -q ${domain}; then echo 'Virtual Host for "${domain}" enabled'; fi`, 'sudo systemctl reload apache2', ]); diff --git a/src/lib/tasks/virtual-host/docker.ts b/src/lib/tasks/virtual-host/docker.ts index 8f720bf..96d898e 100644 --- a/src/lib/tasks/virtual-host/docker.ts +++ b/src/lib/tasks/virtual-host/docker.ts @@ -63,7 +63,7 @@ export const createBasicContainer = ( ...commands, `echo ${escapeQuotes( composeSource - )} | sudo tee /var/containers/compositions/${composeFile}`, + )} | sudo tee /var/containers/compositions/${composeFile} > /dev/null`, `sudo chmod 0600 /var/containers/compositions/${composeFile}`, `sudo docker compose -p ${composeName} -f /var/containers/compositions/${composeFile} down 2>&1 || true`, `sudo rm -rf /var/containers/domains/${domain}`, @@ -81,7 +81,7 @@ export const createBasicContainer = ( `sudo mkdir -p /var/containers/databases/${domain}/conf.d`, `echo ${escapeQuotes( dbCNF - )} | sudo tee /var/containers/databases/${domain}/conf.d/my.cnf`, + )} | sudo tee /var/containers/databases/${domain}/conf.d/my.cnf > /dev/null`, `echo "${virtualHost.server.mysql?.password}" | sudo tee /var/containers/databases/${domain}/conf.d/secret > /dev/null`, `sudo chmod 0400 /var/containers/databases/${domain}/conf.d/my.cnf`, `sudo chmod 0400 /var/containers/databases/${domain}/conf.d/secret`, @@ -111,7 +111,7 @@ export const createBasicContainer = ( ...commands, `sudo mkdir -p /var/containers/domains/${domain}/public_html`, `sudo chmod -R 0755 /var/containers/domains/${domain}`, - `echo ${defaultPage} | sudo tee /var/containers/domains/${domain}/public_html/index.html`, + `echo ${defaultPage} | sudo tee /var/containers/domains/${domain}/public_html/index.html > /dev/null`, `sudo docker compose -p ${composeName} -f /var/containers/compositions/${composeFile} up -d`, ]); @@ -129,14 +129,14 @@ export const createBasicContainer = ( ...commands, `echo ${escapeQuotes( dockerfile - )} | sudo tee /var/containers/images/Dockerfile-node-lts-alpine`, + )} | sudo tee /var/containers/images/Dockerfile-node-lts-alpine > /dev/null`, `sudo chmod 0600 /var/containers/images/Dockerfile-node-lts-alpine`, `echo ${escapeQuotes( createNodeServer(virtualHost.port) )} | sudo tee /var/containers/domains/${domain}/app.js`, `echo ${escapeQuotes( pm2 - )} | sudo tee /var/containers/domains/${domain}/pm2.json`, + )} | sudo tee /var/containers/domains/${domain}/pm2.json > /dev/null`, ]); } else if (virtualHost.server.language === 'php') { /** Composing PHP server */ @@ -161,17 +161,17 @@ export const createBasicContainer = ( dockerfile )} | sudo tee /var/containers/images/Dockerfile-php-8${ buildFromScratch ? '-scratch' : '' - }`, + } > /dev/null`, `sudo chmod 0600 /var/containers/images/Dockerfile-php-8${ buildFromScratch ? '-scratch' : '' }`, `echo ${escapeQuotes( default000 - )} | sudo tee /var/containers/images/resources/000-default.conf`, + )} | sudo tee /var/containers/images/resources/000-default.conf > /dev/null`, `sudo chmod 0600 /var/containers/images/resources/000-default.conf`, `echo ${escapeQuotes( phpINI - )} | sudo tee /var/containers/images/resources/php.ini`, + )} | sudo tee /var/containers/images/resources/php.ini > /dev/null`, `sudo chmod 0600 /var/containers/images/resources/php.ini`, ]); } diff --git a/src/tests/virtual-hosts.ts b/src/tests/virtual-hosts.ts index 7482138..61ac99a 100644 --- a/src/tests/virtual-hosts.ts +++ b/src/tests/virtual-hosts.ts @@ -51,9 +51,11 @@ import { SVPS, VirtualHost } from '../lib/index.js'; }, ]; - await svps.createVirtualHosts(virtualHosts); + const createVirtualHosts = await svps.createVirtualHosts(virtualHosts); await svps.end(); + + if (createVirtualHosts !== true) process.exit(1); } catch (error) { console.log(error); process.exit(1); From e0576399654b570aa41aa6f8cd284d4651d1a029 Mon Sep 17 00:00:00 2001 From: wellwelwel <46850407+wellwelwel@users.noreply.github.com> Date: Tue, 10 Oct 2023 13:27:39 -0300 Subject: [PATCH 08/11] ci: fix bad finish --- src/tests/mount.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/tests/mount.ts b/src/tests/mount.ts index 04b2c91..94e133b 100644 --- a/src/tests/mount.ts +++ b/src/tests/mount.ts @@ -106,6 +106,14 @@ import { SVPS } from '../lib/index.js'; desktop: false, }); + // Clearing storage + await svps.commands([ + '--catch sudo apt-get purge mysql-* nodejs-* php-* nodejs php -y', + '--catch sudo apt-get autoremove -y --purge', + '--catch sudo apt-get clean -y', + '--catch sudo apt-get autoclean -y', + ]); + // Closing connection await svps.end(); From 9dd1c8e97891a2397ce08d08b75d8e97cb11504e Mon Sep 17 00:00:00 2001 From: wellwelwel <46850407+wellwelwel@users.noreply.github.com> Date: Tue, 10 Oct 2023 13:52:56 -0300 Subject: [PATCH 09/11] ci: fix bad finish --- src/tests/mount.ts | 2 ++ src/tests/virtual-hosts.ts | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/src/tests/mount.ts b/src/tests/mount.ts index 94e133b..c919ce3 100644 --- a/src/tests/mount.ts +++ b/src/tests/mount.ts @@ -112,6 +112,8 @@ import { SVPS } from '../lib/index.js'; '--catch sudo apt-get autoremove -y --purge', '--catch sudo apt-get clean -y', '--catch sudo apt-get autoclean -y', + '--catch sudo dpkg --list | grep "^rc" | cut -d " " -f 3 | xargs sudo dpkg --purge', + '--catch sudo find /var/log -type f -delete', ]); // Closing connection diff --git a/src/tests/virtual-hosts.ts b/src/tests/virtual-hosts.ts index 61ac99a..5b3e099 100644 --- a/src/tests/virtual-hosts.ts +++ b/src/tests/virtual-hosts.ts @@ -53,6 +53,14 @@ import { SVPS, VirtualHost } from '../lib/index.js'; const createVirtualHosts = await svps.createVirtualHosts(virtualHosts); + await svps.commands([ + '--catch sudo docker compose -p basic_node_com -f /var/containers/compositions/basic_node_com.yml down', + '--catch sudo docker compose -p basic_php_com -f /var/containers/compositions/basic_php_com.yml down', + '--catch sudo docker rmi mysql:8-debian', + '--catch sudo docker rmi node:lts-alpine', + '--catch sudo docker rmi wellwelwel/php:8-shared-based', + ]); + await svps.end(); if (createVirtualHosts !== true) process.exit(1); From 0d711f91463a73f1194c4cbe50c9ab36e8215ab1 Mon Sep 17 00:00:00 2001 From: wellwelwel <46850407+wellwelwel@users.noreply.github.com> Date: Tue, 10 Oct 2023 14:06:51 -0300 Subject: [PATCH 10/11] ci: fix bad finish --- .github/workflows/ci.yml | 5 +++-- src/tests/mount.ts | 10 ---------- src/tests/virtual-hosts.ts | 8 -------- 3 files changed, 3 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6219829..1d58c1f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,8 +66,9 @@ jobs: - name: 🧪 Testing Service - Upload run: npm run tests:upload - - name: 🧪 Testing Service - Virtual Hosts - run: npm run tests:virtual-hosts + # Temporarily removing due to limited storage space for GuThub Actions. + # - name: 🧪 Testing Service - Virtual Hosts + # run: npm run tests:virtual-hosts - name: ✅ Finishing run: npm run tests:reset >/dev/null 2>&1 || true diff --git a/src/tests/mount.ts b/src/tests/mount.ts index c919ce3..04b2c91 100644 --- a/src/tests/mount.ts +++ b/src/tests/mount.ts @@ -106,16 +106,6 @@ import { SVPS } from '../lib/index.js'; desktop: false, }); - // Clearing storage - await svps.commands([ - '--catch sudo apt-get purge mysql-* nodejs-* php-* nodejs php -y', - '--catch sudo apt-get autoremove -y --purge', - '--catch sudo apt-get clean -y', - '--catch sudo apt-get autoclean -y', - '--catch sudo dpkg --list | grep "^rc" | cut -d " " -f 3 | xargs sudo dpkg --purge', - '--catch sudo find /var/log -type f -delete', - ]); - // Closing connection await svps.end(); diff --git a/src/tests/virtual-hosts.ts b/src/tests/virtual-hosts.ts index 5b3e099..61ac99a 100644 --- a/src/tests/virtual-hosts.ts +++ b/src/tests/virtual-hosts.ts @@ -53,14 +53,6 @@ import { SVPS, VirtualHost } from '../lib/index.js'; const createVirtualHosts = await svps.createVirtualHosts(virtualHosts); - await svps.commands([ - '--catch sudo docker compose -p basic_node_com -f /var/containers/compositions/basic_node_com.yml down', - '--catch sudo docker compose -p basic_php_com -f /var/containers/compositions/basic_php_com.yml down', - '--catch sudo docker rmi mysql:8-debian', - '--catch sudo docker rmi node:lts-alpine', - '--catch sudo docker rmi wellwelwel/php:8-shared-based', - ]); - await svps.end(); if (createVirtualHosts !== true) process.exit(1); From 82ca89c01c32a5c4030fbc1b0bbb297ebdb92a08 Mon Sep 17 00:00:00 2001 From: wellwelwel <46850407+wellwelwel@users.noreply.github.com> Date: Tue, 10 Oct 2023 14:27:59 -0300 Subject: [PATCH 11/11] ci: fix bad finish --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d58c1f..b0d5e26 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,7 +66,7 @@ jobs: - name: 🧪 Testing Service - Upload run: npm run tests:upload - # Temporarily removing due to limited storage space for GuThub Actions. + # Temporarily removing due to limited storage space for GitHub Actions. # - name: 🧪 Testing Service - Virtual Hosts # run: npm run tests:virtual-hosts