From ac62c00958402262cd36200964e638ff046ad743 Mon Sep 17 00:00:00 2001 From: Callum Smale <71267909+Schmale97@users.noreply.github.com> Date: Mon, 3 Jul 2023 10:19:55 +0100 Subject: [PATCH 1/2] build: add necessary dependency/config changes --- package-lock.json | 659 +++++++++++++++++++++++++++++++++++++++------ package.json | 7 +- tsconfig.base.json | 2 + 3 files changed, 581 insertions(+), 87 deletions(-) diff --git a/package-lock.json b/package-lock.json index 819534c..d97f6d0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,8 +9,11 @@ "version": "0.0.0", "license": "MIT", "dependencies": { + "@inquirer/prompts": "^2.3.0", + "parse-help": "^1.0.0", "semver": "^7.3.8", - "tslib": "^2.0.0" + "tslib": "^2.0.0", + "yargs": "^17.7.2" }, "devDependencies": { "@nx/devkit": "16.1.1", @@ -38,7 +41,7 @@ "ts-jest": "29.1.0", "ts-node": "10.9.1", "tslib": "^2.0.0", - "typescript": "4.8.4" + "typescript": "5.1.6" } }, "node_modules/@ampproject/remapping": { @@ -2067,6 +2070,188 @@ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, + "node_modules/@inquirer/checkbox": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@inquirer/checkbox/-/checkbox-1.3.3.tgz", + "integrity": "sha512-iiAQtwEuMJsQy70Ix4poNauWPLDb8bDo9vQGMGmBEVpAKV2wDOwNvgxSsst3sfPB29iMO2+4NkGCf7hxlMJayw==", + "dependencies": { + "@inquirer/core": "^2.3.0", + "@inquirer/type": "^1.1.0", + "ansi-escapes": "^4.3.2", + "chalk": "^4.1.2", + "figures": "^3.2.0" + }, + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/@inquirer/confirm": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@inquirer/confirm/-/confirm-2.0.4.tgz", + "integrity": "sha512-wL8TS2vdrYWUypIw4XiwnNhk8k6T0PRE6nsyva8PtKP3MZxd7bKgmmhdl8OqApAFZgW6SWobPCOQNkiAIIOjjQ==", + "dependencies": { + "@inquirer/core": "^2.3.0", + "@inquirer/type": "^1.1.0", + "chalk": "^4.1.2" + }, + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/@inquirer/core": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@inquirer/core/-/core-2.3.0.tgz", + "integrity": "sha512-JoJtfplpSa0HOzsCaZA5gcUyibTlMb9h/+d9BiP55OHEB5l2jaQZ/hSnIgjVtyox1BhDYmppzUoa5n1BXc3+aQ==", + "dependencies": { + "@inquirer/type": "^1.1.0", + "ansi-escapes": "^4.3.2", + "chalk": "^4.1.2", + "cli-spinners": "^2.8.0", + "cli-width": "^4.0.0", + "figures": "^3.2.0", + "mute-stream": "^1.0.0", + "run-async": "^3.0.0", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^6.0.1" + }, + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/@inquirer/core/node_modules/cli-spinners": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.0.tgz", + "integrity": "sha512-4/aL9X3Wh0yiMQlE+eeRhWP6vclO3QRtw1JHKIT0FFUs5FjpFmESqtMvYZ0+lbzBw900b95mS0hohy+qn2VK/g==", + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@inquirer/core/node_modules/wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@inquirer/editor": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@inquirer/editor/-/editor-1.2.2.tgz", + "integrity": "sha512-jIUC7Wy4LXZU/7/DQ2W/sWsyTr8k00QRBWc2fsUlWg+rgoLWV/Gy60irbuyp/VCu/jQ/AHRnEz4sS2IJnSxDjA==", + "dependencies": { + "@inquirer/core": "^2.3.0", + "@inquirer/type": "^1.1.0", + "chalk": "^4.1.2", + "external-editor": "^3.0.3" + }, + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/@inquirer/expand": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@inquirer/expand/-/expand-1.1.3.tgz", + "integrity": "sha512-rd2IH4Na6/EoSdEBwj3PoXQ9XjisrktAaSh8XWLiZs/RbsJh00KQmgVxfSJmVxQNw97vYLPc79UBYRkhvgrnng==", + "dependencies": { + "@inquirer/core": "^2.3.0", + "@inquirer/type": "^1.1.0", + "chalk": "^4.1.2", + "figures": "^3.2.0" + }, + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/@inquirer/input": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@inquirer/input/-/input-1.2.3.tgz", + "integrity": "sha512-JDe8Lnl++K+yvqHvMObjxO26/YXpOuJY2Eso5XiTA1TAfGHkQGuRFcemfUK5zuUwuLvYr2fOUiSFBJw+6+w59Q==", + "dependencies": { + "@inquirer/core": "^2.3.0", + "@inquirer/type": "^1.1.0", + "chalk": "^4.1.2" + }, + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/@inquirer/password": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@inquirer/password/-/password-1.1.3.tgz", + "integrity": "sha512-bGF0FFCMLyS4144SX3kqnaM9qpRQ5KFv/B3C3Ya/l/aTNu9+tTSP2y4z0AB8po8BfA9LTfDebcrlM0VFVTBxng==", + "dependencies": { + "@inquirer/input": "^1.2.3", + "@inquirer/type": "^1.1.0", + "chalk": "^4.1.2" + }, + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/@inquirer/prompts": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@inquirer/prompts/-/prompts-2.3.0.tgz", + "integrity": "sha512-x79tSDIZAibOl9WaBoOuyaQqNnisOO8Pk0qWyulP/nPaD/WkoRvkzk7hR4WTRmWAyE8CNbjdYgGltvd0qmvCGQ==", + "dependencies": { + "@inquirer/checkbox": "^1.3.3", + "@inquirer/confirm": "^2.0.4", + "@inquirer/core": "^2.3.0", + "@inquirer/editor": "^1.2.2", + "@inquirer/expand": "^1.1.3", + "@inquirer/input": "^1.2.3", + "@inquirer/password": "^1.1.3", + "@inquirer/rawlist": "^1.2.3", + "@inquirer/select": "^1.2.3" + }, + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/@inquirer/rawlist": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@inquirer/rawlist/-/rawlist-1.2.3.tgz", + "integrity": "sha512-Rmb+5Ju7JHN1xTa1H7BwO5vsy3FqQz7kefEAGoZOawfeeB1zenJolb7LKVvv3nrpH16itDLl79sBTixokoe9lg==", + "dependencies": { + "@inquirer/core": "^2.3.0", + "@inquirer/type": "^1.1.0", + "chalk": "^4.1.2" + }, + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/@inquirer/select": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@inquirer/select/-/select-1.2.3.tgz", + "integrity": "sha512-kipYkf5iVok9i22YSLJiwf4m0Ek6S67tJm20jJr/kjuSmbnbpO0mJGFuhgbrGS4uDqkeEOB3tQ81mqb7cVIVbA==", + "dependencies": { + "@inquirer/core": "^2.3.0", + "@inquirer/type": "^1.1.0", + "ansi-escapes": "^4.3.2", + "chalk": "^4.1.2", + "figures": "^3.2.0" + }, + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/@inquirer/type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@inquirer/type/-/type-1.1.0.tgz", + "integrity": "sha512-XMaorygt2o/mXinZg/OOz6d3JKuV3o4jRc/3KDiVPeKLLkjiO4iJErbLKtKn+Od2ZC2lbiFQkrIuloVpEubisA==", + "engines": { + "node": ">=14.18.0" + } + }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -3476,7 +3661,6 @@ "version": "4.3.2", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", - "dev": true, "dependencies": { "type-fest": "^0.21.3" }, @@ -3491,7 +3675,6 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, "engines": { "node": ">=8" } @@ -3500,7 +3683,6 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, "dependencies": { "color-convert": "^2.0.1" }, @@ -3936,10 +4118,9 @@ ] }, "node_modules/chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", - "dev": true, + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -3960,6 +4141,11 @@ "node": ">=10" } }, + "node_modules/chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==" + }, "node_modules/chokidar": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", @@ -4032,11 +4218,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/cli-width": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-4.0.0.tgz", + "integrity": "sha512-ZksGS2xpa/bYkNzN3BAw1wEjsLV/ZKOf/CCrJ/QOBsxx6fOARIkwTutxp1XIOIohi6HKmOFjMoK/XaqDVUpEEw==", + "engines": { + "node": ">= 12" + } + }, "node_modules/cliui": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", - "dev": true, "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.1", @@ -4046,6 +4239,18 @@ "node": ">=12" } }, + "node_modules/clone-regexp": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/clone-regexp/-/clone-regexp-1.0.1.tgz", + "integrity": "sha512-Fcij9IwRW27XedRIJnSOEupS7RVcXtObJXbcUOX93UCLqqOdRpkvzKywOOSizmEK/Is3S/RHX9dLdfo6R1Q1mw==", + "dependencies": { + "is-regexp": "^1.0.0", + "is-supported-regexp-flag": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -4066,7 +4271,6 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, "dependencies": { "color-name": "~1.1.4" }, @@ -4077,8 +4281,7 @@ "node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, "node_modules/combined-stream": { "version": "1.0.8", @@ -4386,8 +4589,7 @@ "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" }, "node_modules/end-of-stream": { "version": "1.4.4", @@ -4423,7 +4625,6 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true, "engines": { "node": ">=6" } @@ -4432,7 +4633,6 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, "engines": { "node": ">=0.8.0" } @@ -4842,6 +5042,17 @@ "url": "https://github.com/sindresorhus/execa?sponsor=1" } }, + "node_modules/execall": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execall/-/execall-1.0.0.tgz", + "integrity": "sha512-/J0Q8CvOvlAdpvhfkD/WnTQ4H1eU0exze2nFGPj/RSC7jpQ0NkKe2r28T5eMkhEEs+fzepMZNy1kVRKNlC04nQ==", + "dependencies": { + "clone-regexp": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/exit": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", @@ -4867,6 +5078,41 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/external-editor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "dependencies": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/external-editor/node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/external-editor/node_modules/tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dependencies": { + "os-tmpdir": "~1.0.2" + }, + "engines": { + "node": ">=0.6.0" + } + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -4929,7 +5175,6 @@ "version": "3.2.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", - "dev": true, "dependencies": { "escape-string-regexp": "^1.0.5" }, @@ -5134,7 +5379,6 @@ "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true, "engines": { "node": "6.* || 8.* || >= 10.*" } @@ -5268,7 +5512,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, "engines": { "node": ">=8" } @@ -5507,7 +5750,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, "engines": { "node": ">=8" } @@ -5548,6 +5790,14 @@ "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", "dev": true }, + "node_modules/is-regexp": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-regexp/-/is-regexp-1.0.0.tgz", + "integrity": "sha512-7zjFAPO4/gwyQAAgRRmqeEeyIICSdmCqa3tsVHMdBzaXXRiqopZL4Cyghg/XulGWrtABTpbnYYzzIRffLkP4oA==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -5560,6 +5810,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-supported-regexp-flag": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-supported-regexp-flag/-/is-supported-regexp-flag-1.0.1.tgz", + "integrity": "sha512-3vcJecUUrpgCqc/ca0aWeNu64UGgxcvO60K/Fkr1N6RSvfGCTU60UKN68JDmKokgba0rFFJs12EnzOQa14ubKQ==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-wsl": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", @@ -6759,6 +7017,14 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, + "node_modules/mute-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-1.0.0.tgz", + "integrity": "sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -7010,6 +7276,14 @@ "node": ">= 0.8.0" } }, + "node_modules/os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -7073,6 +7347,17 @@ "node": ">=6" } }, + "node_modules/parse-help": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/parse-help/-/parse-help-1.0.0.tgz", + "integrity": "sha512-dlOrbBba6Rrw/nrJ+V7/vkGZdiimWJQzMHZZrYsUq03JE8AV3fAv6kOYX7dP/w2h67lIdmRf8ES8mU44xAgE/Q==", + "dependencies": { + "execall": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/parse-json": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", @@ -7441,7 +7726,6 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -7537,6 +7821,14 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/run-async": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-3.0.0.tgz", + "integrity": "sha512-540WwVDOMxA6dN6We19EcT9sc3hkXPw5mzRNGM3FkdN/vtE9NFvj5lFAPNwUDmJjXidm3v7TC1cTE7t17Ulm1Q==", + "engines": { + "node": ">=0.12.0" + } + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -7592,8 +7884,7 @@ "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "node_modules/saxes": { "version": "5.0.1", @@ -7735,7 +8026,6 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -7749,7 +8039,6 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, "dependencies": { "ansi-regex": "^5.0.1" }, @@ -7808,7 +8097,6 @@ "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, "dependencies": { "has-flag": "^4.0.0" }, @@ -8130,7 +8418,6 @@ "version": "0.21.3", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", - "dev": true, "engines": { "node": ">=10" }, @@ -8139,16 +8426,16 @@ } }, "node_modules/typescript": { - "version": "4.8.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz", - "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==", + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", + "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=14.17" } }, "node_modules/unicode-canonical-property-names-ecmascript": { @@ -8389,7 +8676,6 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -8461,7 +8747,6 @@ "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true, "engines": { "node": ">=10" } @@ -8481,10 +8766,9 @@ } }, "node_modules/yargs": { - "version": "17.6.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.6.2.tgz", - "integrity": "sha512-1/9UrdHjDZc0eOU0HxOHoS78C69UD3JRMvzlJ7S79S2nTaWRA/whGCTV8o9e/N/1Va9YIV7Q4sOxD8VV4pCWOw==", - "dev": true, + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", "dependencies": { "cliui": "^8.0.1", "escalade": "^3.1.1", @@ -8502,7 +8786,6 @@ "version": "21.1.1", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", - "dev": true, "engines": { "node": ">=12" } @@ -9972,6 +10255,148 @@ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, + "@inquirer/checkbox": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@inquirer/checkbox/-/checkbox-1.3.3.tgz", + "integrity": "sha512-iiAQtwEuMJsQy70Ix4poNauWPLDb8bDo9vQGMGmBEVpAKV2wDOwNvgxSsst3sfPB29iMO2+4NkGCf7hxlMJayw==", + "requires": { + "@inquirer/core": "^2.3.0", + "@inquirer/type": "^1.1.0", + "ansi-escapes": "^4.3.2", + "chalk": "^4.1.2", + "figures": "^3.2.0" + } + }, + "@inquirer/confirm": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@inquirer/confirm/-/confirm-2.0.4.tgz", + "integrity": "sha512-wL8TS2vdrYWUypIw4XiwnNhk8k6T0PRE6nsyva8PtKP3MZxd7bKgmmhdl8OqApAFZgW6SWobPCOQNkiAIIOjjQ==", + "requires": { + "@inquirer/core": "^2.3.0", + "@inquirer/type": "^1.1.0", + "chalk": "^4.1.2" + } + }, + "@inquirer/core": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@inquirer/core/-/core-2.3.0.tgz", + "integrity": "sha512-JoJtfplpSa0HOzsCaZA5gcUyibTlMb9h/+d9BiP55OHEB5l2jaQZ/hSnIgjVtyox1BhDYmppzUoa5n1BXc3+aQ==", + "requires": { + "@inquirer/type": "^1.1.0", + "ansi-escapes": "^4.3.2", + "chalk": "^4.1.2", + "cli-spinners": "^2.8.0", + "cli-width": "^4.0.0", + "figures": "^3.2.0", + "mute-stream": "^1.0.0", + "run-async": "^3.0.0", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^6.0.1" + }, + "dependencies": { + "cli-spinners": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.0.tgz", + "integrity": "sha512-4/aL9X3Wh0yiMQlE+eeRhWP6vclO3QRtw1JHKIT0FFUs5FjpFmESqtMvYZ0+lbzBw900b95mS0hohy+qn2VK/g==" + }, + "wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + } + } + }, + "@inquirer/editor": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@inquirer/editor/-/editor-1.2.2.tgz", + "integrity": "sha512-jIUC7Wy4LXZU/7/DQ2W/sWsyTr8k00QRBWc2fsUlWg+rgoLWV/Gy60irbuyp/VCu/jQ/AHRnEz4sS2IJnSxDjA==", + "requires": { + "@inquirer/core": "^2.3.0", + "@inquirer/type": "^1.1.0", + "chalk": "^4.1.2", + "external-editor": "^3.0.3" + } + }, + "@inquirer/expand": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@inquirer/expand/-/expand-1.1.3.tgz", + "integrity": "sha512-rd2IH4Na6/EoSdEBwj3PoXQ9XjisrktAaSh8XWLiZs/RbsJh00KQmgVxfSJmVxQNw97vYLPc79UBYRkhvgrnng==", + "requires": { + "@inquirer/core": "^2.3.0", + "@inquirer/type": "^1.1.0", + "chalk": "^4.1.2", + "figures": "^3.2.0" + } + }, + "@inquirer/input": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@inquirer/input/-/input-1.2.3.tgz", + "integrity": "sha512-JDe8Lnl++K+yvqHvMObjxO26/YXpOuJY2Eso5XiTA1TAfGHkQGuRFcemfUK5zuUwuLvYr2fOUiSFBJw+6+w59Q==", + "requires": { + "@inquirer/core": "^2.3.0", + "@inquirer/type": "^1.1.0", + "chalk": "^4.1.2" + } + }, + "@inquirer/password": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@inquirer/password/-/password-1.1.3.tgz", + "integrity": "sha512-bGF0FFCMLyS4144SX3kqnaM9qpRQ5KFv/B3C3Ya/l/aTNu9+tTSP2y4z0AB8po8BfA9LTfDebcrlM0VFVTBxng==", + "requires": { + "@inquirer/input": "^1.2.3", + "@inquirer/type": "^1.1.0", + "chalk": "^4.1.2" + } + }, + "@inquirer/prompts": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@inquirer/prompts/-/prompts-2.3.0.tgz", + "integrity": "sha512-x79tSDIZAibOl9WaBoOuyaQqNnisOO8Pk0qWyulP/nPaD/WkoRvkzk7hR4WTRmWAyE8CNbjdYgGltvd0qmvCGQ==", + "requires": { + "@inquirer/checkbox": "^1.3.3", + "@inquirer/confirm": "^2.0.4", + "@inquirer/core": "^2.3.0", + "@inquirer/editor": "^1.2.2", + "@inquirer/expand": "^1.1.3", + "@inquirer/input": "^1.2.3", + "@inquirer/password": "^1.1.3", + "@inquirer/rawlist": "^1.2.3", + "@inquirer/select": "^1.2.3" + } + }, + "@inquirer/rawlist": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@inquirer/rawlist/-/rawlist-1.2.3.tgz", + "integrity": "sha512-Rmb+5Ju7JHN1xTa1H7BwO5vsy3FqQz7kefEAGoZOawfeeB1zenJolb7LKVvv3nrpH16itDLl79sBTixokoe9lg==", + "requires": { + "@inquirer/core": "^2.3.0", + "@inquirer/type": "^1.1.0", + "chalk": "^4.1.2" + } + }, + "@inquirer/select": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@inquirer/select/-/select-1.2.3.tgz", + "integrity": "sha512-kipYkf5iVok9i22YSLJiwf4m0Ek6S67tJm20jJr/kjuSmbnbpO0mJGFuhgbrGS4uDqkeEOB3tQ81mqb7cVIVbA==", + "requires": { + "@inquirer/core": "^2.3.0", + "@inquirer/type": "^1.1.0", + "ansi-escapes": "^4.3.2", + "chalk": "^4.1.2", + "figures": "^3.2.0" + } + }, + "@inquirer/type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@inquirer/type/-/type-1.1.0.tgz", + "integrity": "sha512-XMaorygt2o/mXinZg/OOz6d3JKuV3o4jRc/3KDiVPeKLLkjiO4iJErbLKtKn+Od2ZC2lbiFQkrIuloVpEubisA==" + }, "@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -11084,7 +11509,6 @@ "version": "4.3.2", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", - "dev": true, "requires": { "type-fest": "^0.21.3" } @@ -11092,14 +11516,12 @@ "ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" }, "ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, "requires": { "color-convert": "^2.0.1" } @@ -11416,10 +11838,9 @@ "dev": true }, "chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", - "dev": true, + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "requires": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -11431,6 +11852,11 @@ "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", "dev": true }, + "chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==" + }, "chokidar": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", @@ -11474,17 +11900,30 @@ "integrity": "sha512-x/5fWmGMnbKQAaNwN+UZlV79qBLM9JFnJuJ03gIi5whrob0xV0ofNVHy9DhwGdsMJQc2OKv0oGmLzvaqvAVv+g==", "dev": true }, + "cli-width": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-4.0.0.tgz", + "integrity": "sha512-ZksGS2xpa/bYkNzN3BAw1wEjsLV/ZKOf/CCrJ/QOBsxx6fOARIkwTutxp1XIOIohi6HKmOFjMoK/XaqDVUpEEw==" + }, "cliui": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", - "dev": true, "requires": { "string-width": "^4.2.0", "strip-ansi": "^6.0.1", "wrap-ansi": "^7.0.0" } }, + "clone-regexp": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/clone-regexp/-/clone-regexp-1.0.1.tgz", + "integrity": "sha512-Fcij9IwRW27XedRIJnSOEupS7RVcXtObJXbcUOX93UCLqqOdRpkvzKywOOSizmEK/Is3S/RHX9dLdfo6R1Q1mw==", + "requires": { + "is-regexp": "^1.0.0", + "is-supported-regexp-flag": "^1.0.0" + } + }, "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -11501,7 +11940,6 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, "requires": { "color-name": "~1.1.4" } @@ -11509,8 +11947,7 @@ "color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, "combined-stream": { "version": "1.0.8", @@ -11750,8 +12187,7 @@ "emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" }, "end-of-stream": { "version": "1.4.4", @@ -11783,14 +12219,12 @@ "escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==" }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==" }, "escodegen": { "version": "2.0.0", @@ -12074,6 +12508,14 @@ "strip-final-newline": "^2.0.0" } }, + "execall": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execall/-/execall-1.0.0.tgz", + "integrity": "sha512-/J0Q8CvOvlAdpvhfkD/WnTQ4H1eU0exze2nFGPj/RSC7jpQ0NkKe2r28T5eMkhEEs+fzepMZNy1kVRKNlC04nQ==", + "requires": { + "clone-regexp": "^1.0.0" + } + }, "exit": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", @@ -12093,6 +12535,34 @@ "jest-util": "^29.5.0" } }, + "external-editor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "requires": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + }, + "dependencies": { + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "requires": { + "os-tmpdir": "~1.0.2" + } + } + } + }, "fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -12152,7 +12622,6 @@ "version": "3.2.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", - "dev": true, "requires": { "escape-string-regexp": "^1.0.5" } @@ -12304,8 +12773,7 @@ "get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" }, "get-package-type": { "version": "0.1.0", @@ -12407,8 +12875,7 @@ "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" }, "html-encoding-sniffer": { "version": "3.0.0", @@ -12571,8 +13038,7 @@ "is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" }, "is-generator-fn": { "version": "2.1.0", @@ -12601,12 +13067,22 @@ "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", "dev": true }, + "is-regexp": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-regexp/-/is-regexp-1.0.0.tgz", + "integrity": "sha512-7zjFAPO4/gwyQAAgRRmqeEeyIICSdmCqa3tsVHMdBzaXXRiqopZL4Cyghg/XulGWrtABTpbnYYzzIRffLkP4oA==" + }, "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 }, + "is-supported-regexp-flag": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-supported-regexp-flag/-/is-supported-regexp-flag-1.0.1.tgz", + "integrity": "sha512-3vcJecUUrpgCqc/ca0aWeNu64UGgxcvO60K/Fkr1N6RSvfGCTU60UKN68JDmKokgba0rFFJs12EnzOQa14ubKQ==" + }, "is-wsl": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", @@ -13548,6 +14024,11 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, + "mute-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-1.0.0.tgz", + "integrity": "sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==" + }, "natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -13745,6 +14226,11 @@ "word-wrap": "~1.2.3" } }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==" + }, "p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -13789,6 +14275,14 @@ "callsites": "^3.0.0" } }, + "parse-help": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/parse-help/-/parse-help-1.0.0.tgz", + "integrity": "sha512-dlOrbBba6Rrw/nrJ+V7/vkGZdiimWJQzMHZZrYsUq03JE8AV3fAv6kOYX7dP/w2h67lIdmRf8ES8mU44xAgE/Q==", + "requires": { + "execall": "^1.0.0" + } + }, "parse-json": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", @@ -14054,8 +14548,7 @@ "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "dev": true + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==" }, "requires-port": { "version": "1.0.0", @@ -14120,6 +14613,11 @@ "glob": "^7.1.3" } }, + "run-async": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-3.0.0.tgz", + "integrity": "sha512-540WwVDOMxA6dN6We19EcT9sc3hkXPw5mzRNGM3FkdN/vtE9NFvj5lFAPNwUDmJjXidm3v7TC1cTE7t17Ulm1Q==" + }, "run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -14147,8 +14645,7 @@ "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "saxes": { "version": "5.0.1", @@ -14262,7 +14759,6 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, "requires": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -14273,7 +14769,6 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, "requires": { "ansi-regex": "^5.0.1" } @@ -14311,7 +14806,6 @@ "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, "requires": { "has-flag": "^4.0.0" } @@ -14534,13 +15028,12 @@ "type-fest": { "version": "0.21.3", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", - "dev": true + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==" }, "typescript": { - "version": "4.8.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz", - "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==", + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", + "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", "dev": true }, "unicode-canonical-property-names-ecmascript": { @@ -14720,7 +15213,6 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, "requires": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -14765,8 +15257,7 @@ "y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==" }, "yallist": { "version": "4.0.0", @@ -14780,10 +15271,9 @@ "dev": true }, "yargs": { - "version": "17.6.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.6.2.tgz", - "integrity": "sha512-1/9UrdHjDZc0eOU0HxOHoS78C69UD3JRMvzlJ7S79S2nTaWRA/whGCTV8o9e/N/1Va9YIV7Q4sOxD8VV4pCWOw==", - "dev": true, + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", "requires": { "cliui": "^8.0.1", "escalade": "^3.1.1", @@ -14797,8 +15287,7 @@ "yargs-parser": { "version": "21.1.1", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", - "dev": true + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==" }, "yn": { "version": "3.1.1", diff --git a/package.json b/package.json index 5ad1c68..fcfa97e 100644 --- a/package.json +++ b/package.json @@ -41,10 +41,13 @@ "ts-jest": "29.1.0", "ts-node": "10.9.1", "tslib": "^2.0.0", - "typescript": "4.8.4" + "typescript": "5.1.6" }, "dependencies": { + "@inquirer/prompts": "^2.3.0", + "parse-help": "^1.0.0", "semver": "^7.3.8", - "tslib": "^2.0.0" + "tslib": "^2.0.0", + "yargs": "^17.7.2" } } diff --git a/tsconfig.base.json b/tsconfig.base.json index 9fedece..09aa5e4 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -5,6 +5,8 @@ "sourceMap": true, "declaration": false, "moduleResolution": "node", + "esModuleInterop": true, + "resolveJsonModule": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "importHelpers": true, From 931ec61ea73f82aec566af4fd2d535525f7a30c7 Mon Sep 17 00:00:00 2001 From: Callum Smale <71267909+Schmale97@users.noreply.github.com> Date: Mon, 3 Jul 2023 10:20:24 +0100 Subject: [PATCH 2/2] feat: new executors cli: runs the firebase cli via exec sync with some input parsing - uses execSync to avoid issues with run-commands interactivity - confirms that active project is desired if not specified - only passes through params defined by firebase-cli kill-emulator: kills processes running on ports in firebase.config.json - accepts a file path and if the port numbers are defined in the expected format (a firebase.config.json) - kills the processes ports if mac/linux - windows unimplemented - there to catch if firebase-cli doesn't shut down ports correctly copy-local-files: copies .env.local and .secret.local to dist folder - the assets property for esbuild does not copy across .gitignore - this executor gets around this by manually copying the local files required for emulators --- .../nx-firebase/src/executors/cli/executor.ts | 57 ++++++ .../nx-firebase/src/executors/cli/schema.d.ts | 6 + .../nx-firebase/src/executors/cli/schema.json | 36 ++++ .../nx-firebase/src/executors/cli/utils.ts | 165 ++++++++++++++++++ .../executors/copy-local-files/executor.ts | 36 ++++ .../executors/copy-local-files/schema.d.ts | 1 + .../executors/copy-local-files/schema.json | 9 + packages/nx-firebase/src/executors/index.ts | 0 .../src/executors/kill-emulator/executor.ts | 47 +++++ .../src/executors/kill-emulator/schema.d.ts | 3 + .../src/executors/kill-emulator/schema.json | 14 ++ 11 files changed, 374 insertions(+) create mode 100644 packages/nx-firebase/src/executors/cli/executor.ts create mode 100644 packages/nx-firebase/src/executors/cli/schema.d.ts create mode 100644 packages/nx-firebase/src/executors/cli/schema.json create mode 100644 packages/nx-firebase/src/executors/cli/utils.ts create mode 100644 packages/nx-firebase/src/executors/copy-local-files/executor.ts create mode 100644 packages/nx-firebase/src/executors/copy-local-files/schema.d.ts create mode 100644 packages/nx-firebase/src/executors/copy-local-files/schema.json create mode 100644 packages/nx-firebase/src/executors/index.ts create mode 100644 packages/nx-firebase/src/executors/kill-emulator/executor.ts create mode 100644 packages/nx-firebase/src/executors/kill-emulator/schema.d.ts create mode 100644 packages/nx-firebase/src/executors/kill-emulator/schema.json diff --git a/packages/nx-firebase/src/executors/cli/executor.ts b/packages/nx-firebase/src/executors/cli/executor.ts new file mode 100644 index 0000000..732b68a --- /dev/null +++ b/packages/nx-firebase/src/executors/cli/executor.ts @@ -0,0 +1,57 @@ +import { ExecutorContext, logger } from '@nx/devkit' +import { CliExecutorSchema } from './schema' +import { + isString, + normalizeOptions, + runCommands, + stringifyFirebaseArgs, +} from './utils' + +/** + * @param options + * @param context + * @returns + */ +export default async function runExecutor( + options: CliExecutorSchema & { [key: string]: unknown }, + context: Pick, +) { + logger.info('Starting Executor...') + const normalizedOptions = await normalizeOptions(options, context) + if (!normalizedOptions.args.project) return { success: false } + + const stringifiedArgs = stringifyFirebaseArgs( + normalizedOptions._[0], + normalizedOptions.args, + ) + + //:TODO remove + if (normalizedOptions._[0].includes('emulators')) { + if (isString(normalizedOptions.args.only)) { + if (normalizedOptions.args.only.includes('auth')) { + process.env.NX_REACT_APP_AUTH_EMULATOR = 'true' + } + if (normalizedOptions.args.only.includes('functions')) { + process.env.NX_REACT_APP_FUNCTIONS_EMULATOR = 'true' + } + if (normalizedOptions.args.only.includes('firestore')) { + process.env.NX_REACT_APP_FIRESTORE_EMULATOR = 'true' + } + if (normalizedOptions.args.only.includes('storage')) { + process.env.NX_REACT_APP_STORAGE_EMULATOR = 'true' + } + } else { + process.env.NX_REACT_APP_AUTH_EMULATOR = 'true' + process.env.NX_REACT_APP_FUNCTIONS_EMULATOR = 'true' + process.env.NX_REACT_APP_FIRESTORE_EMULATOR = 'true' + process.env.NX_REACT_APP_STORAGE_EMULATOR = 'true' + } + } + + const command = ['firebase', ...normalizedOptions._, stringifiedArgs] + .filter(Boolean) + .join(' ') + + runCommands([command]) + return { success: true } +} diff --git a/packages/nx-firebase/src/executors/cli/schema.d.ts b/packages/nx-firebase/src/executors/cli/schema.d.ts new file mode 100644 index 0000000..776b0a1 --- /dev/null +++ b/packages/nx-firebase/src/executors/cli/schema.d.ts @@ -0,0 +1,6 @@ +export interface CliExecutorSchema { + command: string + config: string + project?: string + _: string[] +} diff --git a/packages/nx-firebase/src/executors/cli/schema.json b/packages/nx-firebase/src/executors/cli/schema.json new file mode 100644 index 0000000..6ce79c4 --- /dev/null +++ b/packages/nx-firebase/src/executors/cli/schema.json @@ -0,0 +1,36 @@ +{ + "$schema": "http://json-schema.org/schema", + "version": 2, + "title": "Firebase CLI executor", + "description": "Runs the Firebase CLI for the target project's firebase configuration", + "type": "object", + "properties": { + "config": { + "type": "string", + "description": "Path to the firebase configuration json for this project", + "default": "firebase.json" + }, + "command": { + "description": "Firebase CLI command", + "type": "string", + "format": "html-selector", + "$default": { + "$source": "argv", + "index": 0 + } + }, + "project": { + "type": "string", + "description": "Name or alias from the .firebaserc of the firebase project being used" + }, + "_": { + "type": "array", + "items": { + "anyOf": [{ "type": "string" }] + }, + "description": "Non-hyphenated options for firebase command", + "default": [] + } + }, + "required": ["config", "command"] +} diff --git a/packages/nx-firebase/src/executors/cli/utils.ts b/packages/nx-firebase/src/executors/cli/utils.ts new file mode 100644 index 0000000..3ca4d07 --- /dev/null +++ b/packages/nx-firebase/src/executors/cli/utils.ts @@ -0,0 +1,165 @@ +import { execSync } from 'node:child_process' +import { setTimeout } from 'node:timers/promises' +import { Separator, select } from '@inquirer/prompts' +import { ExecutorContext, joinPathFragments, logger } from '@nx/devkit' +import parseHelp from 'parse-help' +import yargs from 'yargs/yargs' +import { CliExecutorSchema } from './schema' + +export const parseCommand = (command: string): string => { + if (command[0] === '"' && command.at(-1) === '"') { + return command.slice(1, -1) + } + return command +} + +export const runCommand = (command: string): void => { + execSync(parseCommand(command), { + stdio: 'inherit', + }) +} + +export const runCommands = (commands: string[]): void => { + for (const command of commands) { + runCommand(command) + } +} + +export const isString = (u: unknown): u is string => { + if (typeof u === 'string') return true + return false +} + +const getFirebaseProject = async ( + project?: string, +): Promise => { + if (project) return project + let activeFirebaseProject = execSync( + `echo $(echo $(grep "$(pwd)" ~/.config/configstore/firebase-tools.json | cut -d" " -f2)" " | sed -e 's/"//g')`, + ) + .toString() + .trim() + + if (!activeFirebaseProject) { + logger.error( + `No firebase project has been explicitly set and No active project. Please select desired project with 'firebase use' or select project when running command`, + ) + + return undefined + } + + if (activeFirebaseProject.at(-1) === ',') { + activeFirebaseProject = activeFirebaseProject.slice(0, -1) + } + + const useActiveProject = select({ + message: `Use active project (${activeFirebaseProject})?`, + choices: [ + { + name: 'Yes', + value: true, + }, + { + name: 'No', + value: false, + }, + new Separator(), + ], + }) + + const defaultUseActiveProject = setTimeout(10000).then(() => { + useActiveProject.cancel() + return false + }) + + const answer = await Promise.race([defaultUseActiveProject, useActiveProject]) + + if (!answer) { + logger.error( + `Select desired project with 'firebase use' or select project when running command`, + ) + return undefined + } + + return activeFirebaseProject +} + +export const normalizeOptions = async ( + options: CliExecutorSchema & { + [key: string]: unknown + }, + context: Pick, +): Promise<{ _: string[]; args: Record }> => { + const { command, config, _: params, project, ...additionalArgs } = options + + const { $0, _: commandParams, ...commandArgs } = await yargs(command).argv + + const [cCommand, ...cParams] = commandParams.map((value) => { + return value.toString() + }) + + if (cCommand === params[0]) { + params.shift() + } + + if (cParams.length > 0 && params.length > 0) { + logger.warn('Conflicting parameters for firebase command') + logger.warn(`Parameters to ignore [${cParams.toString()}]`) + logger.warn(`Parameters to use [${params.toString()}]`) + } + + const finalParams = [ + cCommand, + ...(params ?? cParams).map((value) => { + if (value[0] !== '"' && value.at(-1) !== '"' && value.includes(' ')) { + return '"' + value + '"' + } + return value + }), + ].filter(Boolean) + + //Set up args + const finalArgs = { + ...commandArgs, + ...additionalArgs, + } + + const finalArgsProject = + typeof finalArgs.project === 'string' ? finalArgs.project : undefined + + const firebaseProject = await getFirebaseProject(project ?? finalArgsProject) + finalArgs.project = firebaseProject + finalArgs.config = joinPathFragments(context.root, config) + + return { + _: finalParams, + args: finalArgs, + } +} + +export const stringifyFirebaseArgs = ( + command: string, + args: Record, +): string => { + const base = parseHelp(execSync('firebase --help')) + const base2 = parseHelp(execSync(`firebase ${command} --help`)) + + const validArgs = Object.keys({ + ...base.flags, + ...base.aliases, + ...base2.flags, + ...base2.aliases, + }) + + const argsToBeUsed = Object.keys(args) + .filter((p) => validArgs.indexOf(p) !== -1) + .reduce((m, c) => ((m[c] = args[c]), m), {}) + + return Object.keys(argsToBeUsed) + .map((a) => + argsToBeUsed[a] === true || argsToBeUsed[a] === 'true' + ? `--${a}` + : `--${a}=${argsToBeUsed[a]}`, + ) + .join(' ') +} diff --git a/packages/nx-firebase/src/executors/copy-local-files/executor.ts b/packages/nx-firebase/src/executors/copy-local-files/executor.ts new file mode 100644 index 0000000..73a2faf --- /dev/null +++ b/packages/nx-firebase/src/executors/copy-local-files/executor.ts @@ -0,0 +1,36 @@ +import { copyFileSync, statSync } from 'fs' +import path from 'path' +import { ExecutorContext, joinPathFragments, logger } from '@nx/devkit' +import { CopyLocalFilesExecutorSchema } from './schema' + +export default async function runExecutor( + options: CopyLocalFilesExecutorSchema, + context: ExecutorContext +) { + const projectName = context.projectName + if (!projectName) return { success: false } + const projectRoot = context.workspace?.projects[projectName].root + const projectRootPath = `${context.root}/${projectRoot}` + const projectDistPath = `${context.root}/dist/${projectRoot}` + + for (const file of ['.env.local', '.secret.local']) { + const fileFullPath = joinPathFragments(projectRootPath, file) + if (fileExists(fileFullPath)) { + copyFileSync(fileFullPath, joinPathFragments(projectDistPath, file)) + } + } + return { + success: true, + } +} + +const fileExists = (path: string): boolean => { + try { + const isFile = statSync(path).isFile() + if (!isFile) logger.warn(`'${path}' is not a file`) + return isFile + } catch (error) { + logger.warn(error.message) + return false + } +} diff --git a/packages/nx-firebase/src/executors/copy-local-files/schema.d.ts b/packages/nx-firebase/src/executors/copy-local-files/schema.d.ts new file mode 100644 index 0000000..9b8ff48 --- /dev/null +++ b/packages/nx-firebase/src/executors/copy-local-files/schema.d.ts @@ -0,0 +1 @@ +export interface CopyLocalFilesExecutorSchema {} // eslint-disable-line diff --git a/packages/nx-firebase/src/executors/copy-local-files/schema.json b/packages/nx-firebase/src/executors/copy-local-files/schema.json new file mode 100644 index 0000000..04d5d1c --- /dev/null +++ b/packages/nx-firebase/src/executors/copy-local-files/schema.json @@ -0,0 +1,9 @@ +{ + "$schema": "http://json-schema.org/schema", + "version": 2, + "title": "CopyLocalFiles executor", + "description": "", + "type": "object", + "properties": {}, + "required": [] +} diff --git a/packages/nx-firebase/src/executors/index.ts b/packages/nx-firebase/src/executors/index.ts new file mode 100644 index 0000000..e69de29 diff --git a/packages/nx-firebase/src/executors/kill-emulator/executor.ts b/packages/nx-firebase/src/executors/kill-emulator/executor.ts new file mode 100644 index 0000000..870226e --- /dev/null +++ b/packages/nx-firebase/src/executors/kill-emulator/executor.ts @@ -0,0 +1,47 @@ +import { execSync } from 'child_process' +import { platform } from 'os' +import { ExecutorContext, joinPathFragments, logger, readJsonFile } from '@nx/devkit' +import { KillEmulatorPortsExecutorSchema } from './schema.js' + +export default async function runExecutor( + options: KillEmulatorPortsExecutorSchema, + context: ExecutorContext +) { + const normalizedPath = joinPathFragments(context.root, options.config) + const emulatorJson = readJsonFile(normalizedPath) + + const emulators = emulatorJson.emulators as Record + + const emulatorPorts: number[] = [] + for (const entry of Object.entries(emulators)) { + const value = entry[1] + if (typeof value === 'object' && value && 'port' in value) { + const port = Number(value.port) + if (!isNaN(port)) emulatorPorts.push(port) + } + } + + const killFunc = platform() === 'win32' ? win32Kill : unixKill + emulatorPorts.map(killFunc) + + return { + success: true, + } +} + +function win32Kill(port: number) { + logger.log( + `${port} not killed... killing emulators through this method is not implemented for windows` + ) +} + +function unixKill(port: number) { + const pid = execSync(`lsof -t -i:${port} || echo ""`).toString().trim() + if (!pid) { + console.log(`no process running at port ${port}`) + return + } + logger.log(`killing process at port ${port}...`) + execSync(`kill -9 ${pid}`) + logger.log(`killed process at port ${port}`) +} diff --git a/packages/nx-firebase/src/executors/kill-emulator/schema.d.ts b/packages/nx-firebase/src/executors/kill-emulator/schema.d.ts new file mode 100644 index 0000000..7f0d24f --- /dev/null +++ b/packages/nx-firebase/src/executors/kill-emulator/schema.d.ts @@ -0,0 +1,3 @@ +export interface KillEmulatorPortsExecutorSchema { + config: string +} diff --git a/packages/nx-firebase/src/executors/kill-emulator/schema.json b/packages/nx-firebase/src/executors/kill-emulator/schema.json new file mode 100644 index 0000000..11d4bae --- /dev/null +++ b/packages/nx-firebase/src/executors/kill-emulator/schema.json @@ -0,0 +1,14 @@ +{ + "$schema": "http://json-schema.org/schema", + "version": 2, + "title": "KillEmulatorPorts executor", + "description": "", + "type": "object", + "properties": { + "config": { + "type": "string", + "description": "Path to project's firebase config (where the emulator ports are defined)" + } + }, + "required": ["config"] +}