From 00d485db7f03a0814144f8cd8c595fc30d547099 Mon Sep 17 00:00:00 2001 From: Abhi Date: Fri, 23 Jun 2023 17:21:56 +0100 Subject: [PATCH 01/11] Adding comment for the function runFromCommandLine --- package.json | 2 +- src/command-line.ts | 3 + yarn.lock | 140 ++++++++++++++++++++++---------------------- 3 files changed, 75 insertions(+), 70 deletions(-) diff --git a/package.json b/package.json index 533d087..88d4607 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ }, "devDependencies": { "@continuous-auth/semantic-release-npm": "^3.0.0", - "@microsoft/api-extractor": "^7.19.4", + "@microsoft/api-extractor": "^7.36.0", "@types/debug": "^4.1.5", "@types/fs-extra": "^9.0.13", "@types/getos": "^3.0.1", diff --git a/src/command-line.ts b/src/command-line.ts index a4ff0c9..2102b66 100644 --- a/src/command-line.ts +++ b/src/command-line.ts @@ -5,6 +5,9 @@ import { ElectronVersions } from './versions'; import { Fiddle, FiddleFactory } from './fiddle'; import { Runner } from './runner'; + +/** The runFromCommandLine function handles command-line arguments, creates instances of necessary objects, and executes specific commands (test, bisect) based on the arguments provided. + * It logs debug information and exits the process if invalid parameters are detected. */ export async function runFromCommandLine(argv: string[]): Promise { const d = debug('fiddle-core:runFromCommandLine'); diff --git a/yarn.lock b/yarn.lock index 996f2e9..7aa0ec2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -951,47 +951,47 @@ resolved "https://registry.yarnpkg.com/@kwsites/promise-deferred/-/promise-deferred-1.1.1.tgz#8ace5259254426ccef57f3175bc64ed7095ed919" integrity sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw== -"@microsoft/api-extractor-model@7.15.3": - version "7.15.3" - resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.15.3.tgz#cf76deeeb2733d974da678f530c2dbaceb18a065" - integrity sha512-NkSjolmSI7NGvbdz0Y7kjQfdpD+j9E5CwXTxEyjDqxd10MI7GXV8DnAsQ57GFJcgHKgTjf2aUnYfMJ9w3aMicw== - dependencies: - "@microsoft/tsdoc" "0.13.2" - "@microsoft/tsdoc-config" "~0.15.2" - "@rushstack/node-core-library" "3.45.0" - -"@microsoft/api-extractor@^7.19.4": - version "7.19.4" - resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.19.4.tgz#95d43d410a1dfb28a02062c4693bcb9c52afe9eb" - integrity sha512-iehC6YA3DGJvxTUaK7HUtQmP6hAQU07+Q/OR8TG4dVR6KpqCi9UPEVk8AgCvQkiK+6FbVEFQTx0qLuYk4EeuHg== - dependencies: - "@microsoft/api-extractor-model" "7.15.3" - "@microsoft/tsdoc" "0.13.2" - "@microsoft/tsdoc-config" "~0.15.2" - "@rushstack/node-core-library" "3.45.0" - "@rushstack/rig-package" "0.3.7" - "@rushstack/ts-command-line" "4.10.6" +"@microsoft/api-extractor-model@7.27.3": + version "7.27.3" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.27.3.tgz#a484e0b7e25c4fa85846281aed6b87da0411d96c" + integrity sha512-fSFvw7otYHduOkyshjTbapKKgwF8bgquVHvgF8VgeKtMYvqXkoaj7W6VcM7PNY7E2bbblhUgC4XNdqZLD4SJGw== + dependencies: + "@microsoft/tsdoc" "0.14.2" + "@microsoft/tsdoc-config" "~0.16.1" + "@rushstack/node-core-library" "3.59.4" + +"@microsoft/api-extractor@^7.36.0": + version "7.36.0" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.36.0.tgz#e0a9f449bb1393697691b79045f384dd78fd760e" + integrity sha512-P+kYgJFDXIr+UNzhRMhlpM/dderi6ab4lxn35vdhfAIMPtGCSXIJxrrtpTOQmQW8CZtmoZX06LYoUsKCc1zjow== + dependencies: + "@microsoft/api-extractor-model" "7.27.3" + "@microsoft/tsdoc" "0.14.2" + "@microsoft/tsdoc-config" "~0.16.1" + "@rushstack/node-core-library" "3.59.4" + "@rushstack/rig-package" "0.4.0" + "@rushstack/ts-command-line" "4.15.1" colors "~1.2.1" lodash "~4.17.15" - resolve "~1.17.0" + resolve "~1.22.1" semver "~7.3.0" source-map "~0.6.1" - typescript "~4.5.2" + typescript "~5.0.4" -"@microsoft/tsdoc-config@~0.15.2": - version "0.15.2" - resolved "https://registry.yarnpkg.com/@microsoft/tsdoc-config/-/tsdoc-config-0.15.2.tgz#eb353c93f3b62ab74bdc9ab6f4a82bcf80140f14" - integrity sha512-mK19b2wJHSdNf8znXSMYVShAHktVr/ib0Ck2FA3lsVBSEhSI/TfXT7DJQkAYgcztTuwazGcg58ZjYdk0hTCVrA== +"@microsoft/tsdoc-config@~0.16.1": + version "0.16.2" + resolved "https://registry.yarnpkg.com/@microsoft/tsdoc-config/-/tsdoc-config-0.16.2.tgz#b786bb4ead00d54f53839a458ce626c8548d3adf" + integrity sha512-OGiIzzoBLgWWR0UdRJX98oYO+XKGf7tiK4Zk6tQ/E4IJqGCe7dvkTvgDZV5cFJUzLGDOjeAXrnZoA6QkVySuxw== dependencies: - "@microsoft/tsdoc" "0.13.2" + "@microsoft/tsdoc" "0.14.2" ajv "~6.12.6" jju "~1.4.0" resolve "~1.19.0" -"@microsoft/tsdoc@0.13.2": - version "0.13.2" - resolved "https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.13.2.tgz#3b0efb6d3903bd49edb073696f60e90df08efb26" - integrity sha512-WrHvO8PDL8wd8T2+zBGKrMwVL5IyzR3ryWUsl0PXgEV0QHup4mTLi0QcATefGI6Gx9Anu7vthPyyyLpY0EpiQg== +"@microsoft/tsdoc@0.14.2": + version "0.14.2" + resolved "https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.14.2.tgz#c3ec604a0b54b9a9b87e9735dfc59e1a5da6a5fb" + integrity sha512-9b8mPpKrfeGRuhFH5iO1iwCLeIIsV6+H1sRfxbkoGXIyQE2BTsPd9zqSqQJ+pv5sJ/hT5M1zvOFL02MnEezFug== "@nodelib/fs.scandir@2.1.5": version "2.1.5" @@ -1185,33 +1185,31 @@ read-package-json-fast "^2.0.3" which "^2.0.2" -"@rushstack/node-core-library@3.45.0": - version "3.45.0" - resolved "https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-3.45.0.tgz#8c86b39271b6d84260b1e70db87e1e265b54f620" - integrity sha512-YMuIJl19vQT1+g/OU9mLY6T5ZBT9uDlmeXExDQACpGuxTJW+LHNbk/lRX+eCApQI2eLBlaL4U68r3kZlqwbdmw== +"@rushstack/node-core-library@3.59.4": + version "3.59.4" + resolved "https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-3.59.4.tgz#95f9eb3274627a5e84ee9443e65bb6edec1a5dc8" + integrity sha512-YAKJDC6Mz/KA1D7bvB88WaRX3knt/ZuLzkRu5G9QADGSjLtvTWzCNCytRF2PCSaaHOZaZsWul4F1KQdgFgUDqA== dependencies: - "@types/node" "12.20.24" colors "~1.2.1" fs-extra "~7.0.1" import-lazy "~4.0.0" jju "~1.4.0" - resolve "~1.17.0" + resolve "~1.22.1" semver "~7.3.0" - timsort "~0.3.0" z-schema "~5.0.2" -"@rushstack/rig-package@0.3.7": - version "0.3.7" - resolved "https://registry.yarnpkg.com/@rushstack/rig-package/-/rig-package-0.3.7.tgz#3fa564b1d129d28689dd4309502792b15e84bf81" - integrity sha512-pzMsTSeTC8IiZ6EJLr53gGMvhT4oLWH+hxD7907cHyWuIUlEXFtu/2pK25vUQT13nKp5DJCWxXyYoGRk/h6rtA== +"@rushstack/rig-package@0.4.0": + version "0.4.0" + resolved "https://registry.yarnpkg.com/@rushstack/rig-package/-/rig-package-0.4.0.tgz#1dade94da5cd81321ca9ec630b6ceed2d57cc826" + integrity sha512-FnM1TQLJYwSiurP6aYSnansprK5l8WUK8VG38CmAaZs29ZeL1msjK0AP1VS4ejD33G0kE/2cpsPsS9jDenBMxw== dependencies: - resolve "~1.17.0" + resolve "~1.22.1" strip-json-comments "~3.1.1" -"@rushstack/ts-command-line@4.10.6": - version "4.10.6" - resolved "https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.10.6.tgz#5669e481e4339ceb4e1428183eb0937d3bc3841b" - integrity sha512-Y3GkUag39sTIlukDg9mUp8MCHrrlJ27POrBNRQGc/uF+VVgX8M7zMzHch5zP6O1QVquWgD7Engdpn2piPYaS/g== +"@rushstack/ts-command-line@4.15.1": + version "4.15.1" + resolved "https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.15.1.tgz#8f2ebde6bb19deb2c5b65363854b84aea1bf59f0" + integrity sha512-EL4jxZe5fhb1uVL/P/wQO+Z8Rc8FMiWJ1G7VgnPDvdIt5GVjRfK7vwzder1CZQiX3x0PY6uxENYLNGTFd1InRQ== dependencies: "@types/argparse" "1.0.38" argparse "~1.0.9" @@ -1400,11 +1398,6 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-16.4.2.tgz#0a95d7fd950cb1eaca0ce11031d72e8f680b775a" integrity sha512-vxyhOzFCm+jC/T5KugbVsYy1DbQM0h3NCFUrVbu0+pYa/nr+heeucpqxpa8j4pUmIGLPYzboY9zIdOF0niFAjQ== -"@types/node@12.20.24": - version "12.20.24" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.24.tgz#c37ac69cb2948afb4cef95f424fa0037971a9a5c" - integrity sha512-yxDeaQIAJlMav7fH5AQqPH1u8YIuhYJXYBzxaQ4PifsU0GDO38MSdmEDeRlIxrKbC6NbEaaEHDanWb+y30U8SQ== - "@types/node@^14.14.31": version "14.18.31" resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.31.tgz#4b873dea3122e71af4f77e65ec5841397ff254d3" @@ -3164,6 +3157,13 @@ is-core-module@^2.1.0, is-core-module@^2.2.0: dependencies: has "^1.0.3" +is-core-module@^2.11.0: + version "2.12.1" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.12.1.tgz#0c0b6885b6f80011c71541ce15c8d66cf5a4f9fd" + integrity sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg== + dependencies: + has "^1.0.3" + is-core-module@^2.8.1: version "2.10.0" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.10.0.tgz#9012ede0a91c69587e647514e1d5277019e728ed" @@ -4715,7 +4715,7 @@ path-key@^3.0.0, path-key@^3.1.0: resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== -path-parse@^1.0.6: +path-parse@^1.0.6, path-parse@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== @@ -5032,13 +5032,6 @@ resolve@^1.10.0, resolve@^1.20.0: is-core-module "^2.2.0" path-parse "^1.0.6" -resolve@~1.17.0: - version "1.17.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444" - integrity sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w== - dependencies: - path-parse "^1.0.6" - resolve@~1.19.0: version "1.19.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.19.0.tgz#1af5bf630409734a067cae29318aac7fa29a267c" @@ -5047,6 +5040,15 @@ resolve@~1.19.0: is-core-module "^2.1.0" path-parse "^1.0.6" +resolve@~1.22.1: + version "1.22.2" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.2.tgz#0ed0943d4e301867955766c9f3e1ae6d01c6845f" + integrity sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g== + dependencies: + is-core-module "^2.11.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + responselike@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/responselike/-/responselike-2.0.1.tgz#9a0bc8fdc252f3fb1cca68b016591059ba1422bc" @@ -5431,6 +5433,11 @@ supports-color@^8.0.0: dependencies: has-flag "^4.0.0" +supports-preserve-symlinks-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" + integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== + tar@^6.1.0, tar@^6.1.11, tar@^6.1.2: version "6.1.11" resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.11.tgz#6760a38f003afa1b2ffd0ffe9e9abbd0eab3d621" @@ -5473,11 +5480,6 @@ text-table@^0.2.0, text-table@~0.2.0: resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= -timsort@~0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/timsort/-/timsort-0.3.0.tgz#405411a8e7e6339fe64db9a234de11dc31e02bd4" - integrity sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q= - tiny-relative-date@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/tiny-relative-date/-/tiny-relative-date-1.3.0.tgz#fa08aad501ed730f31cc043181d995c39a935e07" @@ -5583,10 +5585,10 @@ typescript@^4.9.5: resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== -typescript@~4.5.2: - version "4.5.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.4.tgz#a17d3a0263bf5c8723b9c52f43c5084edf13c2e8" - integrity sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg== +typescript@~5.0.4: + version "5.0.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b" + integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw== unbox-primitive@^1.0.1: version "1.0.1" From 49b20f1e52957c20a497a2b892f7808b33009d9a Mon Sep 17 00:00:00 2001 From: Abhi Date: Fri, 23 Jun 2023 22:38:43 +0100 Subject: [PATCH 02/11] Addressed the lint and other issues, rolled back to the original version of api-extractor --- etc/fiddle-core.api.md | 2 +- package.json | 2 +- src/command-line.ts | 7 ++- yarn.lock | 140 ++++++++++++++++++++--------------------- 4 files changed, 76 insertions(+), 75 deletions(-) diff --git a/etc/fiddle-core.api.md b/etc/fiddle-core.api.md index d28462a..57e1fa2 100644 --- a/etc/fiddle-core.api.md +++ b/etc/fiddle-core.api.md @@ -213,7 +213,7 @@ export interface ReleaseInfo { zlib: string; } -// @public (undocumented) +// @public export function runFromCommandLine(argv: string[]): Promise; // @public (undocumented) diff --git a/package.json b/package.json index 88d4607..da2c319 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ }, "devDependencies": { "@continuous-auth/semantic-release-npm": "^3.0.0", - "@microsoft/api-extractor": "^7.36.0", + "@microsoft/api-extractor": "7.19.4", "@types/debug": "^4.1.5", "@types/fs-extra": "^9.0.13", "@types/getos": "^3.0.1", diff --git a/src/command-line.ts b/src/command-line.ts index 2102b66..df53233 100644 --- a/src/command-line.ts +++ b/src/command-line.ts @@ -5,9 +5,12 @@ import { ElectronVersions } from './versions'; import { Fiddle, FiddleFactory } from './fiddle'; import { Runner } from './runner'; +/** + * This function handles command-line arguments, creates instances of necessary objects and + * executes specific commands based on the arguments provided. + * It logs debug information and exits the process if invalid parameters are detected. + */ -/** The runFromCommandLine function handles command-line arguments, creates instances of necessary objects, and executes specific commands (test, bisect) based on the arguments provided. - * It logs debug information and exits the process if invalid parameters are detected. */ export async function runFromCommandLine(argv: string[]): Promise { const d = debug('fiddle-core:runFromCommandLine'); diff --git a/yarn.lock b/yarn.lock index 7aa0ec2..29a6701 100644 --- a/yarn.lock +++ b/yarn.lock @@ -951,47 +951,47 @@ resolved "https://registry.yarnpkg.com/@kwsites/promise-deferred/-/promise-deferred-1.1.1.tgz#8ace5259254426ccef57f3175bc64ed7095ed919" integrity sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw== -"@microsoft/api-extractor-model@7.27.3": - version "7.27.3" - resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.27.3.tgz#a484e0b7e25c4fa85846281aed6b87da0411d96c" - integrity sha512-fSFvw7otYHduOkyshjTbapKKgwF8bgquVHvgF8VgeKtMYvqXkoaj7W6VcM7PNY7E2bbblhUgC4XNdqZLD4SJGw== - dependencies: - "@microsoft/tsdoc" "0.14.2" - "@microsoft/tsdoc-config" "~0.16.1" - "@rushstack/node-core-library" "3.59.4" - -"@microsoft/api-extractor@^7.36.0": - version "7.36.0" - resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.36.0.tgz#e0a9f449bb1393697691b79045f384dd78fd760e" - integrity sha512-P+kYgJFDXIr+UNzhRMhlpM/dderi6ab4lxn35vdhfAIMPtGCSXIJxrrtpTOQmQW8CZtmoZX06LYoUsKCc1zjow== - dependencies: - "@microsoft/api-extractor-model" "7.27.3" - "@microsoft/tsdoc" "0.14.2" - "@microsoft/tsdoc-config" "~0.16.1" - "@rushstack/node-core-library" "3.59.4" - "@rushstack/rig-package" "0.4.0" - "@rushstack/ts-command-line" "4.15.1" +"@microsoft/api-extractor-model@7.15.3": + version "7.15.3" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.15.3.tgz#cf76deeeb2733d974da678f530c2dbaceb18a065" + integrity sha512-NkSjolmSI7NGvbdz0Y7kjQfdpD+j9E5CwXTxEyjDqxd10MI7GXV8DnAsQ57GFJcgHKgTjf2aUnYfMJ9w3aMicw== + dependencies: + "@microsoft/tsdoc" "0.13.2" + "@microsoft/tsdoc-config" "~0.15.2" + "@rushstack/node-core-library" "3.45.0" + +"@microsoft/api-extractor@7.19.4": + version "7.19.4" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.19.4.tgz#95d43d410a1dfb28a02062c4693bcb9c52afe9eb" + integrity sha512-iehC6YA3DGJvxTUaK7HUtQmP6hAQU07+Q/OR8TG4dVR6KpqCi9UPEVk8AgCvQkiK+6FbVEFQTx0qLuYk4EeuHg== + dependencies: + "@microsoft/api-extractor-model" "7.15.3" + "@microsoft/tsdoc" "0.13.2" + "@microsoft/tsdoc-config" "~0.15.2" + "@rushstack/node-core-library" "3.45.0" + "@rushstack/rig-package" "0.3.7" + "@rushstack/ts-command-line" "4.10.6" colors "~1.2.1" lodash "~4.17.15" - resolve "~1.22.1" + resolve "~1.17.0" semver "~7.3.0" source-map "~0.6.1" - typescript "~5.0.4" + typescript "~4.5.2" -"@microsoft/tsdoc-config@~0.16.1": - version "0.16.2" - resolved "https://registry.yarnpkg.com/@microsoft/tsdoc-config/-/tsdoc-config-0.16.2.tgz#b786bb4ead00d54f53839a458ce626c8548d3adf" - integrity sha512-OGiIzzoBLgWWR0UdRJX98oYO+XKGf7tiK4Zk6tQ/E4IJqGCe7dvkTvgDZV5cFJUzLGDOjeAXrnZoA6QkVySuxw== +"@microsoft/tsdoc-config@~0.15.2": + version "0.15.2" + resolved "https://registry.yarnpkg.com/@microsoft/tsdoc-config/-/tsdoc-config-0.15.2.tgz#eb353c93f3b62ab74bdc9ab6f4a82bcf80140f14" + integrity sha512-mK19b2wJHSdNf8znXSMYVShAHktVr/ib0Ck2FA3lsVBSEhSI/TfXT7DJQkAYgcztTuwazGcg58ZjYdk0hTCVrA== dependencies: - "@microsoft/tsdoc" "0.14.2" + "@microsoft/tsdoc" "0.13.2" ajv "~6.12.6" jju "~1.4.0" resolve "~1.19.0" -"@microsoft/tsdoc@0.14.2": - version "0.14.2" - resolved "https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.14.2.tgz#c3ec604a0b54b9a9b87e9735dfc59e1a5da6a5fb" - integrity sha512-9b8mPpKrfeGRuhFH5iO1iwCLeIIsV6+H1sRfxbkoGXIyQE2BTsPd9zqSqQJ+pv5sJ/hT5M1zvOFL02MnEezFug== +"@microsoft/tsdoc@0.13.2": + version "0.13.2" + resolved "https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.13.2.tgz#3b0efb6d3903bd49edb073696f60e90df08efb26" + integrity sha512-WrHvO8PDL8wd8T2+zBGKrMwVL5IyzR3ryWUsl0PXgEV0QHup4mTLi0QcATefGI6Gx9Anu7vthPyyyLpY0EpiQg== "@nodelib/fs.scandir@2.1.5": version "2.1.5" @@ -1185,31 +1185,33 @@ read-package-json-fast "^2.0.3" which "^2.0.2" -"@rushstack/node-core-library@3.59.4": - version "3.59.4" - resolved "https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-3.59.4.tgz#95f9eb3274627a5e84ee9443e65bb6edec1a5dc8" - integrity sha512-YAKJDC6Mz/KA1D7bvB88WaRX3knt/ZuLzkRu5G9QADGSjLtvTWzCNCytRF2PCSaaHOZaZsWul4F1KQdgFgUDqA== +"@rushstack/node-core-library@3.45.0": + version "3.45.0" + resolved "https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-3.45.0.tgz#8c86b39271b6d84260b1e70db87e1e265b54f620" + integrity sha512-YMuIJl19vQT1+g/OU9mLY6T5ZBT9uDlmeXExDQACpGuxTJW+LHNbk/lRX+eCApQI2eLBlaL4U68r3kZlqwbdmw== dependencies: + "@types/node" "12.20.24" colors "~1.2.1" fs-extra "~7.0.1" import-lazy "~4.0.0" jju "~1.4.0" - resolve "~1.22.1" + resolve "~1.17.0" semver "~7.3.0" + timsort "~0.3.0" z-schema "~5.0.2" -"@rushstack/rig-package@0.4.0": - version "0.4.0" - resolved "https://registry.yarnpkg.com/@rushstack/rig-package/-/rig-package-0.4.0.tgz#1dade94da5cd81321ca9ec630b6ceed2d57cc826" - integrity sha512-FnM1TQLJYwSiurP6aYSnansprK5l8WUK8VG38CmAaZs29ZeL1msjK0AP1VS4ejD33G0kE/2cpsPsS9jDenBMxw== +"@rushstack/rig-package@0.3.7": + version "0.3.7" + resolved "https://registry.yarnpkg.com/@rushstack/rig-package/-/rig-package-0.3.7.tgz#3fa564b1d129d28689dd4309502792b15e84bf81" + integrity sha512-pzMsTSeTC8IiZ6EJLr53gGMvhT4oLWH+hxD7907cHyWuIUlEXFtu/2pK25vUQT13nKp5DJCWxXyYoGRk/h6rtA== dependencies: - resolve "~1.22.1" + resolve "~1.17.0" strip-json-comments "~3.1.1" -"@rushstack/ts-command-line@4.15.1": - version "4.15.1" - resolved "https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.15.1.tgz#8f2ebde6bb19deb2c5b65363854b84aea1bf59f0" - integrity sha512-EL4jxZe5fhb1uVL/P/wQO+Z8Rc8FMiWJ1G7VgnPDvdIt5GVjRfK7vwzder1CZQiX3x0PY6uxENYLNGTFd1InRQ== +"@rushstack/ts-command-line@4.10.6": + version "4.10.6" + resolved "https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.10.6.tgz#5669e481e4339ceb4e1428183eb0937d3bc3841b" + integrity sha512-Y3GkUag39sTIlukDg9mUp8MCHrrlJ27POrBNRQGc/uF+VVgX8M7zMzHch5zP6O1QVquWgD7Engdpn2piPYaS/g== dependencies: "@types/argparse" "1.0.38" argparse "~1.0.9" @@ -1398,6 +1400,11 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-16.4.2.tgz#0a95d7fd950cb1eaca0ce11031d72e8f680b775a" integrity sha512-vxyhOzFCm+jC/T5KugbVsYy1DbQM0h3NCFUrVbu0+pYa/nr+heeucpqxpa8j4pUmIGLPYzboY9zIdOF0niFAjQ== +"@types/node@12.20.24": + version "12.20.24" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.24.tgz#c37ac69cb2948afb4cef95f424fa0037971a9a5c" + integrity sha512-yxDeaQIAJlMav7fH5AQqPH1u8YIuhYJXYBzxaQ4PifsU0GDO38MSdmEDeRlIxrKbC6NbEaaEHDanWb+y30U8SQ== + "@types/node@^14.14.31": version "14.18.31" resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.31.tgz#4b873dea3122e71af4f77e65ec5841397ff254d3" @@ -3157,13 +3164,6 @@ is-core-module@^2.1.0, is-core-module@^2.2.0: dependencies: has "^1.0.3" -is-core-module@^2.11.0: - version "2.12.1" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.12.1.tgz#0c0b6885b6f80011c71541ce15c8d66cf5a4f9fd" - integrity sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg== - dependencies: - has "^1.0.3" - is-core-module@^2.8.1: version "2.10.0" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.10.0.tgz#9012ede0a91c69587e647514e1d5277019e728ed" @@ -4715,7 +4715,7 @@ path-key@^3.0.0, path-key@^3.1.0: resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== -path-parse@^1.0.6, path-parse@^1.0.7: +path-parse@^1.0.6: version "1.0.7" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== @@ -5032,6 +5032,13 @@ resolve@^1.10.0, resolve@^1.20.0: is-core-module "^2.2.0" path-parse "^1.0.6" +resolve@~1.17.0: + version "1.17.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444" + integrity sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w== + dependencies: + path-parse "^1.0.6" + resolve@~1.19.0: version "1.19.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.19.0.tgz#1af5bf630409734a067cae29318aac7fa29a267c" @@ -5040,15 +5047,6 @@ resolve@~1.19.0: is-core-module "^2.1.0" path-parse "^1.0.6" -resolve@~1.22.1: - version "1.22.2" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.2.tgz#0ed0943d4e301867955766c9f3e1ae6d01c6845f" - integrity sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g== - dependencies: - is-core-module "^2.11.0" - path-parse "^1.0.7" - supports-preserve-symlinks-flag "^1.0.0" - responselike@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/responselike/-/responselike-2.0.1.tgz#9a0bc8fdc252f3fb1cca68b016591059ba1422bc" @@ -5433,11 +5431,6 @@ supports-color@^8.0.0: dependencies: has-flag "^4.0.0" -supports-preserve-symlinks-flag@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" - integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== - tar@^6.1.0, tar@^6.1.11, tar@^6.1.2: version "6.1.11" resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.11.tgz#6760a38f003afa1b2ffd0ffe9e9abbd0eab3d621" @@ -5480,6 +5473,11 @@ text-table@^0.2.0, text-table@~0.2.0: resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= +timsort@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/timsort/-/timsort-0.3.0.tgz#405411a8e7e6339fe64db9a234de11dc31e02bd4" + integrity sha512-qsdtZH+vMoCARQtyod4imc2nIJwg9Cc7lPRrw9CzF8ZKR0khdr8+2nX80PBhET3tcyTtJDxAffGh2rXH4tyU8A== + tiny-relative-date@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/tiny-relative-date/-/tiny-relative-date-1.3.0.tgz#fa08aad501ed730f31cc043181d995c39a935e07" @@ -5585,10 +5583,10 @@ typescript@^4.9.5: resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== -typescript@~5.0.4: - version "5.0.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b" - integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw== +typescript@~4.5.2: + version "4.5.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.5.tgz#d8c953832d28924a9e3d37c73d729c846c5896f3" + integrity sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA== unbox-primitive@^1.0.1: version "1.0.1" From 5fc3d769af73bb8175a75569a5b44cc37889e0aa Mon Sep 17 00:00:00 2001 From: Abhi Date: Fri, 23 Jun 2023 23:33:14 +0100 Subject: [PATCH 03/11] Added comments in fiddle.ts and added caret prefix for api-extractor --- etc/fiddle-core.api.md | 15 ++--- package.json | 2 +- src/fiddle.ts | 22 +++++++ yarn.lock | 140 +++++++++++++++++++++-------------------- 4 files changed, 98 insertions(+), 81 deletions(-) diff --git a/etc/fiddle-core.api.md b/etc/fiddle-core.api.md index 57e1fa2..461beea 100644 --- a/etc/fiddle-core.api.md +++ b/etc/fiddle-core.api.md @@ -97,30 +97,23 @@ export interface ElectronVersionsCreateOptions { initialVersions?: unknown; } -// @public (undocumented) +// @public export class Fiddle { - constructor(mainPath: string, // /path/to/main.js + constructor( + mainPath: string, // /path/to/main.js source: string); - // (undocumented) readonly mainPath: string; - // (undocumented) remove(): Promise; - // (undocumented) readonly source: string; } -// @public (undocumented) +// @public export class FiddleFactory { constructor(fiddles?: string); - // (undocumented) create(src: FiddleSource): Promise; - // (undocumented) fromEntries(src: Iterable<[string, string]>): Promise; - // (undocumented) fromFolder(source: string): Promise; - // (undocumented) fromGist(gistId: string): Promise; - // (undocumented) fromRepo(url: string, checkout?: string): Promise; } diff --git a/package.json b/package.json index da2c319..533d087 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ }, "devDependencies": { "@continuous-auth/semantic-release-npm": "^3.0.0", - "@microsoft/api-extractor": "7.19.4", + "@microsoft/api-extractor": "^7.19.4", "@types/debug": "^4.1.5", "@types/fs-extra": "^9.0.13", "@types/getos": "^3.0.1", diff --git a/src/fiddle.ts b/src/fiddle.ts index 17b8864..9c44e75 100644 --- a/src/fiddle.ts +++ b/src/fiddle.ts @@ -12,12 +12,16 @@ function hashString(str: string): string { return md5sum.digest('hex'); } +/** This class represents a fiddle */ export class Fiddle { constructor( + /** It serves as the entry point or the primary script file for the fiddle */ public readonly mainPath: string, // /path/to/main.js + /** It represents the code */ public readonly source: string, ) {} + /** This method deletes the fiddle from the system */ public remove(): Promise { return fs.remove(path.dirname(this.mainPath)); } @@ -31,13 +35,19 @@ export class Fiddle { */ export type FiddleSource = Fiddle | string | Iterable<[string, string]>; +/** + * This class is responsible for creating instances of the Fiddle class + * and it has methods to create a fiddle from various source + */ export class FiddleFactory { constructor(private readonly fiddles: string = DefaultPaths.fiddles) {} + /** This method creates a Fiddle instance by fetching a GitHub Gist and cloning it into a temporary directory, */ public async fromGist(gistId: string): Promise { return this.fromRepo(`https://gist.github.com/${gistId}.git`); } + /** This method creates a Fiddle instance by making a temporary copy of the fiddle from a specified source */ public async fromFolder(source: string): Promise { const d = debug('fiddle-core:FiddleFactory:fromFolder'); @@ -55,6 +65,12 @@ export class FiddleFactory { return new Fiddle(path.join(folder, 'main.js'), source); } + /** + * This method creates a Fiddle instance by cloning a Git repository into a temporary directory, + * checking out a specified branch (default: 'master'), + * and setting the main file path based on the cloned files. + */ + public async fromRepo(url: string, checkout = 'master'): Promise { const d = debug('fiddle-core:FiddleFactory:fromRepo'); const folder = path.join(this.fiddles, hashString(url)); @@ -74,6 +90,11 @@ export class FiddleFactory { return new Fiddle(path.join(folder, 'main.js'), url); } + /** + * This method creates a Fiddle instance by saving a collection of filename-content pairs to a temporary directory + * and setting the main file path accordingly. + */ + public async fromEntries(src: Iterable<[string, string]>): Promise { const d = debug('fiddle-core:FiddleFactory:fromEntries'); const map = new Map(src); @@ -95,6 +116,7 @@ export class FiddleFactory { return new Fiddle(path.join(folder, 'main.js'), 'entries'); } + /** This method determines the source type and calls the appropriate method to create the fiddle */ public async create(src: FiddleSource): Promise { if (src instanceof Fiddle) return src; diff --git a/yarn.lock b/yarn.lock index 29a6701..78c145e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -951,47 +951,47 @@ resolved "https://registry.yarnpkg.com/@kwsites/promise-deferred/-/promise-deferred-1.1.1.tgz#8ace5259254426ccef57f3175bc64ed7095ed919" integrity sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw== -"@microsoft/api-extractor-model@7.15.3": - version "7.15.3" - resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.15.3.tgz#cf76deeeb2733d974da678f530c2dbaceb18a065" - integrity sha512-NkSjolmSI7NGvbdz0Y7kjQfdpD+j9E5CwXTxEyjDqxd10MI7GXV8DnAsQ57GFJcgHKgTjf2aUnYfMJ9w3aMicw== - dependencies: - "@microsoft/tsdoc" "0.13.2" - "@microsoft/tsdoc-config" "~0.15.2" - "@rushstack/node-core-library" "3.45.0" - -"@microsoft/api-extractor@7.19.4": - version "7.19.4" - resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.19.4.tgz#95d43d410a1dfb28a02062c4693bcb9c52afe9eb" - integrity sha512-iehC6YA3DGJvxTUaK7HUtQmP6hAQU07+Q/OR8TG4dVR6KpqCi9UPEVk8AgCvQkiK+6FbVEFQTx0qLuYk4EeuHg== - dependencies: - "@microsoft/api-extractor-model" "7.15.3" - "@microsoft/tsdoc" "0.13.2" - "@microsoft/tsdoc-config" "~0.15.2" - "@rushstack/node-core-library" "3.45.0" - "@rushstack/rig-package" "0.3.7" - "@rushstack/ts-command-line" "4.10.6" +"@microsoft/api-extractor-model@7.27.3": + version "7.27.3" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.27.3.tgz#a484e0b7e25c4fa85846281aed6b87da0411d96c" + integrity sha512-fSFvw7otYHduOkyshjTbapKKgwF8bgquVHvgF8VgeKtMYvqXkoaj7W6VcM7PNY7E2bbblhUgC4XNdqZLD4SJGw== + dependencies: + "@microsoft/tsdoc" "0.14.2" + "@microsoft/tsdoc-config" "~0.16.1" + "@rushstack/node-core-library" "3.59.4" + +"@microsoft/api-extractor@^7.19.4": + version "7.36.0" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.36.0.tgz#e0a9f449bb1393697691b79045f384dd78fd760e" + integrity sha512-P+kYgJFDXIr+UNzhRMhlpM/dderi6ab4lxn35vdhfAIMPtGCSXIJxrrtpTOQmQW8CZtmoZX06LYoUsKCc1zjow== + dependencies: + "@microsoft/api-extractor-model" "7.27.3" + "@microsoft/tsdoc" "0.14.2" + "@microsoft/tsdoc-config" "~0.16.1" + "@rushstack/node-core-library" "3.59.4" + "@rushstack/rig-package" "0.4.0" + "@rushstack/ts-command-line" "4.15.1" colors "~1.2.1" lodash "~4.17.15" - resolve "~1.17.0" + resolve "~1.22.1" semver "~7.3.0" source-map "~0.6.1" - typescript "~4.5.2" + typescript "~5.0.4" -"@microsoft/tsdoc-config@~0.15.2": - version "0.15.2" - resolved "https://registry.yarnpkg.com/@microsoft/tsdoc-config/-/tsdoc-config-0.15.2.tgz#eb353c93f3b62ab74bdc9ab6f4a82bcf80140f14" - integrity sha512-mK19b2wJHSdNf8znXSMYVShAHktVr/ib0Ck2FA3lsVBSEhSI/TfXT7DJQkAYgcztTuwazGcg58ZjYdk0hTCVrA== +"@microsoft/tsdoc-config@~0.16.1": + version "0.16.2" + resolved "https://registry.yarnpkg.com/@microsoft/tsdoc-config/-/tsdoc-config-0.16.2.tgz#b786bb4ead00d54f53839a458ce626c8548d3adf" + integrity sha512-OGiIzzoBLgWWR0UdRJX98oYO+XKGf7tiK4Zk6tQ/E4IJqGCe7dvkTvgDZV5cFJUzLGDOjeAXrnZoA6QkVySuxw== dependencies: - "@microsoft/tsdoc" "0.13.2" + "@microsoft/tsdoc" "0.14.2" ajv "~6.12.6" jju "~1.4.0" resolve "~1.19.0" -"@microsoft/tsdoc@0.13.2": - version "0.13.2" - resolved "https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.13.2.tgz#3b0efb6d3903bd49edb073696f60e90df08efb26" - integrity sha512-WrHvO8PDL8wd8T2+zBGKrMwVL5IyzR3ryWUsl0PXgEV0QHup4mTLi0QcATefGI6Gx9Anu7vthPyyyLpY0EpiQg== +"@microsoft/tsdoc@0.14.2": + version "0.14.2" + resolved "https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.14.2.tgz#c3ec604a0b54b9a9b87e9735dfc59e1a5da6a5fb" + integrity sha512-9b8mPpKrfeGRuhFH5iO1iwCLeIIsV6+H1sRfxbkoGXIyQE2BTsPd9zqSqQJ+pv5sJ/hT5M1zvOFL02MnEezFug== "@nodelib/fs.scandir@2.1.5": version "2.1.5" @@ -1185,33 +1185,31 @@ read-package-json-fast "^2.0.3" which "^2.0.2" -"@rushstack/node-core-library@3.45.0": - version "3.45.0" - resolved "https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-3.45.0.tgz#8c86b39271b6d84260b1e70db87e1e265b54f620" - integrity sha512-YMuIJl19vQT1+g/OU9mLY6T5ZBT9uDlmeXExDQACpGuxTJW+LHNbk/lRX+eCApQI2eLBlaL4U68r3kZlqwbdmw== +"@rushstack/node-core-library@3.59.4": + version "3.59.4" + resolved "https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-3.59.4.tgz#95f9eb3274627a5e84ee9443e65bb6edec1a5dc8" + integrity sha512-YAKJDC6Mz/KA1D7bvB88WaRX3knt/ZuLzkRu5G9QADGSjLtvTWzCNCytRF2PCSaaHOZaZsWul4F1KQdgFgUDqA== dependencies: - "@types/node" "12.20.24" colors "~1.2.1" fs-extra "~7.0.1" import-lazy "~4.0.0" jju "~1.4.0" - resolve "~1.17.0" + resolve "~1.22.1" semver "~7.3.0" - timsort "~0.3.0" z-schema "~5.0.2" -"@rushstack/rig-package@0.3.7": - version "0.3.7" - resolved "https://registry.yarnpkg.com/@rushstack/rig-package/-/rig-package-0.3.7.tgz#3fa564b1d129d28689dd4309502792b15e84bf81" - integrity sha512-pzMsTSeTC8IiZ6EJLr53gGMvhT4oLWH+hxD7907cHyWuIUlEXFtu/2pK25vUQT13nKp5DJCWxXyYoGRk/h6rtA== +"@rushstack/rig-package@0.4.0": + version "0.4.0" + resolved "https://registry.yarnpkg.com/@rushstack/rig-package/-/rig-package-0.4.0.tgz#1dade94da5cd81321ca9ec630b6ceed2d57cc826" + integrity sha512-FnM1TQLJYwSiurP6aYSnansprK5l8WUK8VG38CmAaZs29ZeL1msjK0AP1VS4ejD33G0kE/2cpsPsS9jDenBMxw== dependencies: - resolve "~1.17.0" + resolve "~1.22.1" strip-json-comments "~3.1.1" -"@rushstack/ts-command-line@4.10.6": - version "4.10.6" - resolved "https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.10.6.tgz#5669e481e4339ceb4e1428183eb0937d3bc3841b" - integrity sha512-Y3GkUag39sTIlukDg9mUp8MCHrrlJ27POrBNRQGc/uF+VVgX8M7zMzHch5zP6O1QVquWgD7Engdpn2piPYaS/g== +"@rushstack/ts-command-line@4.15.1": + version "4.15.1" + resolved "https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.15.1.tgz#8f2ebde6bb19deb2c5b65363854b84aea1bf59f0" + integrity sha512-EL4jxZe5fhb1uVL/P/wQO+Z8Rc8FMiWJ1G7VgnPDvdIt5GVjRfK7vwzder1CZQiX3x0PY6uxENYLNGTFd1InRQ== dependencies: "@types/argparse" "1.0.38" argparse "~1.0.9" @@ -1400,11 +1398,6 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-16.4.2.tgz#0a95d7fd950cb1eaca0ce11031d72e8f680b775a" integrity sha512-vxyhOzFCm+jC/T5KugbVsYy1DbQM0h3NCFUrVbu0+pYa/nr+heeucpqxpa8j4pUmIGLPYzboY9zIdOF0niFAjQ== -"@types/node@12.20.24": - version "12.20.24" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.24.tgz#c37ac69cb2948afb4cef95f424fa0037971a9a5c" - integrity sha512-yxDeaQIAJlMav7fH5AQqPH1u8YIuhYJXYBzxaQ4PifsU0GDO38MSdmEDeRlIxrKbC6NbEaaEHDanWb+y30U8SQ== - "@types/node@^14.14.31": version "14.18.31" resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.31.tgz#4b873dea3122e71af4f77e65ec5841397ff254d3" @@ -3164,6 +3157,13 @@ is-core-module@^2.1.0, is-core-module@^2.2.0: dependencies: has "^1.0.3" +is-core-module@^2.11.0: + version "2.12.1" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.12.1.tgz#0c0b6885b6f80011c71541ce15c8d66cf5a4f9fd" + integrity sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg== + dependencies: + has "^1.0.3" + is-core-module@^2.8.1: version "2.10.0" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.10.0.tgz#9012ede0a91c69587e647514e1d5277019e728ed" @@ -4715,7 +4715,7 @@ path-key@^3.0.0, path-key@^3.1.0: resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== -path-parse@^1.0.6: +path-parse@^1.0.6, path-parse@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== @@ -5032,13 +5032,6 @@ resolve@^1.10.0, resolve@^1.20.0: is-core-module "^2.2.0" path-parse "^1.0.6" -resolve@~1.17.0: - version "1.17.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444" - integrity sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w== - dependencies: - path-parse "^1.0.6" - resolve@~1.19.0: version "1.19.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.19.0.tgz#1af5bf630409734a067cae29318aac7fa29a267c" @@ -5047,6 +5040,15 @@ resolve@~1.19.0: is-core-module "^2.1.0" path-parse "^1.0.6" +resolve@~1.22.1: + version "1.22.2" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.2.tgz#0ed0943d4e301867955766c9f3e1ae6d01c6845f" + integrity sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g== + dependencies: + is-core-module "^2.11.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + responselike@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/responselike/-/responselike-2.0.1.tgz#9a0bc8fdc252f3fb1cca68b016591059ba1422bc" @@ -5431,6 +5433,11 @@ supports-color@^8.0.0: dependencies: has-flag "^4.0.0" +supports-preserve-symlinks-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" + integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== + tar@^6.1.0, tar@^6.1.11, tar@^6.1.2: version "6.1.11" resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.11.tgz#6760a38f003afa1b2ffd0ffe9e9abbd0eab3d621" @@ -5473,11 +5480,6 @@ text-table@^0.2.0, text-table@~0.2.0: resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= -timsort@~0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/timsort/-/timsort-0.3.0.tgz#405411a8e7e6339fe64db9a234de11dc31e02bd4" - integrity sha512-qsdtZH+vMoCARQtyod4imc2nIJwg9Cc7lPRrw9CzF8ZKR0khdr8+2nX80PBhET3tcyTtJDxAffGh2rXH4tyU8A== - tiny-relative-date@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/tiny-relative-date/-/tiny-relative-date-1.3.0.tgz#fa08aad501ed730f31cc043181d995c39a935e07" @@ -5583,10 +5585,10 @@ typescript@^4.9.5: resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== -typescript@~4.5.2: - version "4.5.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.5.tgz#d8c953832d28924a9e3d37c73d729c846c5896f3" - integrity sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA== +typescript@~5.0.4: + version "5.0.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b" + integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw== unbox-primitive@^1.0.1: version "1.0.1" From 75d986c3cd20c2490d9fae424350b88116cd3be8 Mon Sep 17 00:00:00 2001 From: Abhi Date: Sat, 24 Jun 2023 10:48:20 +0100 Subject: [PATCH 04/11] Added comments in installer.ts --- etc/fiddle-core.api.md | 28 +++++----------------------- src/installer.ts | 27 +++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/etc/fiddle-core.api.md b/etc/fiddle-core.api.md index 461beea..d5be439 100644 --- a/etc/fiddle-core.api.md +++ b/etc/fiddle-core.api.md @@ -55,11 +55,9 @@ export function compareVersions(a: SemVer, b: SemVer): number; // @public (undocumented) export const DefaultPaths: Paths; -// @public (undocumented) +// @public export interface ElectronBinary { - // (undocumented) alreadyExtracted: boolean; - // (undocumented) path: string; } @@ -123,55 +121,39 @@ export type FiddleSource = Fiddle | string | Iterable<[string, string]>; // @public export class Installer extends EventEmitter { constructor(pathsIn?: Partial); - // (undocumented) ensureDownloaded(version: string, opts?: Partial): Promise; - // (undocumented) static execSubpath(platform?: string): string; - // (undocumented) static getExecPath(folder: string): string; - // (undocumented) install(version: string, opts?: Partial): Promise; get installedVersion(): string | undefined; remove(version: string): Promise; - // (undocumented) state(version: string): InstallState; } -// @public (undocumented) +// @public export interface InstallerParams { - // (undocumented) mirror: Mirrors; - // (undocumented) progressCallback: (progress: ProgressObject) => void; } // @public export enum InstallState { - // (undocumented) downloaded = "downloaded", - // (undocumented) downloading = "downloading", - // (undocumented) installed = "installed", - // (undocumented) installing = "installing", - // (undocumented) missing = "missing" } -// @public (undocumented) +// @public export interface InstallStateEvent { - // (undocumented) state: InstallState; - // (undocumented) version: string; } -// @public (undocumented) +// @public export interface Mirrors { - // (undocumented) electronMirror: string; - // (undocumented) electronNightlyMirror: string; } @@ -187,7 +169,7 @@ export interface Paths { readonly versionsCache: string; } -// @public (undocumented) +// @public export type ProgressObject = { percent: number; }; diff --git a/src/installer.ts b/src/installer.ts index 4e8727b..bcbf82e 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -14,6 +14,7 @@ function getZipName(version: string): string { return `electron-v${version}-${process.platform}-${process.arch}.zip`; } +/** This object is used to track progress in percent */ export type ProgressObject = { percent: number }; /** @@ -22,30 +23,49 @@ export type ProgressObject = { percent: number }; * See Installer.on('state-changed') to watch for state changes. */ export enum InstallState { + /** This represent the missing state */ missing = 'missing', + /** This represent the downloading state */ downloading = 'downloading', + /** This represent the downloaded state */ downloaded = 'downloaded', + /** This represent the installing state */ installing = 'installing', + /** This represent the installed state */ installed = 'installed', } +/** + * Represents an event that indicates the installation state of something. + */ export interface InstallStateEvent { + /** The version of the installation */ version: string; + /** The state of the installation */ state: InstallState; } +/** Represents an object that holds information about electron mirrors */ export interface Mirrors { + /** The URL of the electron mirror */ electronMirror: string; + /** The URL of the electron nightly mirror */ electronNightlyMirror: string; } +/** Represents the configuration for an Electron binary */ export interface ElectronBinary { + /** The path to the Electron binary */ path: string; + /** Indicates whether the Electron binary is already extracted or not */ alreadyExtracted: boolean; // to check if it's kept as zipped or not } +/** Represents the parameters for an installer */ export interface InstallerParams { + /** The callback function to receive progress updates */ progressCallback: (progress: ProgressObject) => void; + /** The mirrors to use for the installation */ mirror: Mirrors; } @@ -71,6 +91,7 @@ export class Installer extends EventEmitter { this.rebuildStates(); } + /** Executes the subpath based on the platform */ public static execSubpath(platform: string = process.platform): string { switch (platform) { case 'darwin': @@ -82,10 +103,12 @@ export class Installer extends EventEmitter { } } + /** Gets the executable path for a given folder */ public static getExecPath(folder: string): string { return path.join(folder, Installer.execSubpath()); } + /** Gets the installation state for a specific version */ public state(version: string): InstallState { return this.stateMap.get(version) || InstallState.missing; } @@ -301,6 +324,9 @@ export class Installer extends EventEmitter { /** map of version string to currently-running active Promise */ private downloading = new Map>(); + /** + * Ensures that the specified version of Electron is downloaded and available. + */ public async ensureDownloaded( version: string, opts?: Partial, @@ -319,6 +345,7 @@ export class Installer extends EventEmitter { /** keep a track of all currently installing versions */ private installing = new Set(); + /** Installs the specified version of Electron */ public async install( version: string, opts?: Partial, From d8e46270f31d70ebe3bb40561f98e35b15e1a7d1 Mon Sep 17 00:00:00 2001 From: Abhi Date: Sat, 24 Jun 2023 10:49:54 +0100 Subject: [PATCH 05/11] Fixed lint issues in installer.ts --- src/installer.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/installer.ts b/src/installer.ts index bcbf82e..660c717 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -49,7 +49,7 @@ export interface InstallStateEvent { export interface Mirrors { /** The URL of the electron mirror */ electronMirror: string; - /** The URL of the electron nightly mirror */ + /** The URL of the electron nightly mirror */ electronNightlyMirror: string; } @@ -63,9 +63,9 @@ export interface ElectronBinary { /** Represents the parameters for an installer */ export interface InstallerParams { - /** The callback function to receive progress updates */ + /** The callback function to receive progress updates */ progressCallback: (progress: ProgressObject) => void; - /** The mirrors to use for the installation */ + /** The mirrors to use for the installation */ mirror: Mirrors; } From 14e18f0b7a1745c31f67f4221e313f41eb5df544 Mon Sep 17 00:00:00 2001 From: Abhi Date: Sat, 24 Jun 2023 10:58:25 +0100 Subject: [PATCH 06/11] Added comments on paths.ts --- etc/fiddle-core.api.md | 8 ++------ src/paths.ts | 12 ++++++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/etc/fiddle-core.api.md b/etc/fiddle-core.api.md index d5be439..8706b55 100644 --- a/etc/fiddle-core.api.md +++ b/etc/fiddle-core.api.md @@ -52,7 +52,7 @@ export interface BisectResult { // @public (undocumented) export function compareVersions(a: SemVer, b: SemVer): number; -// @public (undocumented) +// @public export const DefaultPaths: Paths; // @public @@ -157,15 +157,11 @@ export interface Mirrors { electronNightlyMirror: string; } -// @public (undocumented) +// @public export interface Paths { - // (undocumented) readonly electronDownloads: string; - // (undocumented) readonly electronInstall: string; - // (undocumented) readonly fiddles: string; - // (undocumented) readonly versionsCache: string; } diff --git a/src/paths.ts b/src/paths.ts index 17e98d3..6945c6e 100644 --- a/src/paths.ts +++ b/src/paths.ts @@ -1,22 +1,26 @@ import * as path from 'path'; import envPaths from 'env-paths'; +/** + * Represents a set of paths used by an application. + */ export interface Paths { - // folder where electron zipfiles will be cached + /** folder where electron zipfiles will be cached */ readonly electronDownloads: string; - // folder where an electron download will be unzipped to be run + /** folder where an electron download will be unzipped to be run */ readonly electronInstall: string; - // folder where fiddles will be saved + /** folder where fiddles will be saved */ readonly fiddles: string; - // file where electron releases are cached + /** file where electron releases are cached */ readonly versionsCache: string; } const paths = envPaths('fiddle-core', { suffix: '' }); +/** This object contains default paths. */ export const DefaultPaths: Paths = { electronDownloads: path.join(paths.data, 'electron', 'zips'), electronInstall: path.join(paths.data, 'electron', 'current'), From 90ece729b5f8b7e1d80ef98934337dfe777abb41 Mon Sep 17 00:00:00 2001 From: Abhi Date: Sat, 24 Jun 2023 11:17:49 +0100 Subject: [PATCH 07/11] Added comments to runner.ts file --- etc/fiddle-core.api.md | 22 +++++----------------- src/runner.ts | 21 +++++++++++++++++---- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/etc/fiddle-core.api.md b/etc/fiddle-core.api.md index 8706b55..a8d9736 100644 --- a/etc/fiddle-core.api.md +++ b/etc/fiddle-core.api.md @@ -41,11 +41,9 @@ export class BaseVersions implements Versions { get versions(): SemVer[]; } -// @public (undocumented) +// @public export interface BisectResult { - // (undocumented) range?: [string, string]; - // (undocumented) status: 'bisect_succeeded' | 'test_error' | 'system_error'; } @@ -187,38 +185,29 @@ export interface ReleaseInfo { // @public export function runFromCommandLine(argv: string[]): Promise; -// @public (undocumented) +// @public export class Runner { - // (undocumented) bisect(version_a: string | SemVer, version_b: string | SemVer, fiddleIn: FiddleSource, opts?: RunnerSpawnOptions): Promise; - // (undocumented) static create(opts?: { installer?: Installer; fiddleFactory?: FiddleFactory; paths?: Partial; versions?: Versions; }): Promise; - // (undocumented) static displayResult(result: TestResult): string; - // (undocumented) run(version: string | SemVer, fiddle: FiddleSource, opts?: RunnerSpawnOptions): Promise; - // (undocumented) spawn(versionIn: string | SemVer, fiddleIn: FiddleSource, opts?: RunnerSpawnOptions): Promise; } -// @public (undocumented) +// @public export interface RunnerOptions { - // (undocumented) args?: string[]; - // (undocumented) headless?: boolean; - // (undocumented) out?: Writable; - // (undocumented) showConfig?: boolean; } -// @public (undocumented) +// @public export type RunnerSpawnOptions = SpawnOptions & RunnerOptions; // @public (undocumented) @@ -226,9 +215,8 @@ export type SemOrStr = SemVer | string; export { SemVer } -// @public (undocumented) +// @public export interface TestResult { - // (undocumented) status: 'test_passed' | 'test_failed' | 'test_error' | 'system_error'; } diff --git a/src/runner.ts b/src/runner.ts index bf4e5c7..9f8ff88 100644 --- a/src/runner.ts +++ b/src/runner.ts @@ -13,14 +13,15 @@ import { ElectronVersions, Versions } from './versions'; import { Fiddle, FiddleFactory, FiddleSource } from './fiddle'; import { DefaultPaths, Paths } from './paths'; +/** Represents the options for a runner */ export interface RunnerOptions { - // extra arguments to be appended to the electron invocation + /** Extra arguments to be appended to the electron invocation */ args?: string[]; - // if true, use xvfb-run on *nix + /** if true, use xvfb-run on *nix */ headless?: boolean; - // where the test's output should be written + /** where the test's output should be written */ out?: Writable; - // whether to show config info (e.g. platform os & arch) in the log + /** whether to show config info (e.g. platform os & arch) in the log */ showConfig?: boolean; } @@ -31,17 +32,24 @@ const DefaultRunnerOpts: RunnerOptions = { showConfig: true, } as const; +/** Represents the options for spawning a runner */ export type RunnerSpawnOptions = SpawnOptions & RunnerOptions; +/** Represents the result of a test */ export interface TestResult { + /** Status of the test result */ status: 'test_passed' | 'test_failed' | 'test_error' | 'system_error'; } +/** Represents the result of a bisect operation */ export interface BisectResult { + /** The range of values where the bisect operation succeeded */ range?: [string, string]; + /** The status of the bisect operation */ status: 'bisect_succeeded' | 'test_error' | 'system_error'; } +/** Represents a class for executing Electron-related tasks */ export class Runner { private osInfo = ''; @@ -53,6 +61,7 @@ export class Runner { getos((err, result) => (this.osInfo = inspect(result || err))); } + /** Creates a new instance of the Runner class */ public static async create( opts: { installer?: Installer; @@ -132,6 +141,7 @@ export class Runner { return { exec, args }; } + /** This method is used to spawn a child process and run a fiddle with Electron */ public async spawn( versionIn: string | SemVer, fiddleIn: FiddleSource, @@ -179,6 +189,7 @@ export class Runner { } } + /** This method that takes a TestResult object and returns a string representation of the result */ public static displayResult(result: TestResult): string { const text = Runner.displayEmoji(result); switch (result.status) { @@ -193,6 +204,7 @@ export class Runner { } } + /** This method is used to run a fiddle with a specific version of Electron and obtain the test result */ public async run( version: string | SemVer, fiddle: FiddleSource, @@ -213,6 +225,7 @@ export class Runner { }); } + /** This method performs a bisect operation between two versions of Electron to find a regression */ public async bisect( version_a: string | SemVer, version_b: string | SemVer, From 6e3e70112e2f4c11093e13b73df9748525486cd3 Mon Sep 17 00:00:00 2001 From: Abhi Date: Sat, 24 Jun 2023 13:50:49 +0100 Subject: [PATCH 08/11] Added comments to the file versions.ts --- etc/fiddle-core.api.md | 36 ++++--------------------------- src/versions.ts | 48 +++++++++++++++++++++++++++++++++++++----- 2 files changed, 47 insertions(+), 37 deletions(-) diff --git a/etc/fiddle-core.api.md b/etc/fiddle-core.api.md index a8d9736..79f59dd 100644 --- a/etc/fiddle-core.api.md +++ b/etc/fiddle-core.api.md @@ -15,29 +15,17 @@ import { Writable } from 'stream'; // @public export class BaseVersions implements Versions { constructor(versions: unknown); - // (undocumented) getReleaseInfo(ver: SemOrStr): ReleaseInfo | undefined; - // (undocumented) inMajor(major: number): SemVer[]; - // (undocumented) inRange(a: SemOrStr, b: SemOrStr): SemVer[]; - // (undocumented) isVersion(ver: SemOrStr): boolean; - // (undocumented) get latest(): SemVer | undefined; - // (undocumented) get latestStable(): SemVer | undefined; - // (undocumented) get obsoleteMajors(): number[]; - // (undocumented) get prereleaseMajors(): number[]; - // (undocumented) protected setVersions(val: unknown): void; - // (undocumented) get stableMajors(): number[]; - // (undocumented) get supportedMajors(): number[]; - // (undocumented) get versions(): SemVer[]; } @@ -47,7 +35,7 @@ export interface BisectResult { status: 'bisect_succeeded' | 'test_error' | 'system_error'; } -// @public (undocumented) +// @public export function compareVersions(a: SemVer, b: SemVer): number; // @public @@ -61,33 +49,21 @@ export interface ElectronBinary { // @public export class ElectronVersions extends BaseVersions { - // (undocumented) static create(paths?: Partial, options?: ElectronVersionsCreateOptions): Promise; - // (undocumented) fetch(): Promise; - // (undocumented) inMajor(major: number): SemVer[]; - // (undocumented) inRange(a: SemOrStr, b: SemOrStr): SemVer[]; - // (undocumented) isVersion(ver: SemOrStr): boolean; - // (undocumented) get latest(): SemVer | undefined; - // (undocumented) get latestStable(): SemVer | undefined; - // (undocumented) get obsoleteMajors(): number[]; - // (undocumented) get prereleaseMajors(): number[]; - // (undocumented) get stableMajors(): number[]; - // (undocumented) get supportedMajors(): number[]; - // (undocumented) get versions(): SemVer[]; } -// @public (undocumented) +// @public export interface ElectronVersionsCreateOptions { ignoreCache?: boolean; initialVersions?: unknown; @@ -168,7 +144,7 @@ export type ProgressObject = { percent: number; }; -// @public (undocumented) +// @public export interface ReleaseInfo { chrome: string; date: string; @@ -210,7 +186,7 @@ export interface RunnerOptions { // @public export type RunnerSpawnOptions = SpawnOptions & RunnerOptions; -// @public (undocumented) +// @public export type SemOrStr = SemVer | string; export { SemVer } @@ -222,13 +198,9 @@ export interface TestResult { // @public export interface Versions { - // (undocumented) getReleaseInfo(version: SemOrStr): ReleaseInfo | undefined; - // (undocumented) inMajor(major: number): SemVer[]; - // (undocumented) inRange(a: SemOrStr, b: SemOrStr): SemVer[]; - // (undocumented) isVersion(version: SemOrStr): boolean; readonly latest: SemVer | undefined; readonly latestStable: SemVer | undefined; diff --git a/src/versions.ts b/src/versions.ts index 8448fff..d1955ff 100644 --- a/src/versions.ts +++ b/src/versions.ts @@ -7,8 +7,10 @@ export { SemVer }; import { DefaultPaths, Paths } from './paths'; +/** Represents a type that can be either a SemVer object or a string */ export type SemOrStr = SemVer | string; +/** Represents information about a release */ export interface ReleaseInfo { /** Electron version */ version: string; @@ -57,19 +59,22 @@ export interface Versions { /** Full list of all known Electron releases, Sorted in branch order. */ readonly versions: SemVer[]; - /** @returns true iff `version` is a release that this object knows about */ + /** Returns true iff `version` is a release that this object knows about */ isVersion(version: SemOrStr): boolean; - /** @returns all versions matching that major number. Sorted in branch order. */ + /** Returns all versions matching that major number. Sorted in branch order. */ inMajor(major: number): SemVer[]; - /** @returns all versions in a range, inclusive. Sorted in branch order. */ + /** Return all versions in a range, inclusive. Sorted in branch order. */ inRange(a: SemOrStr, b: SemOrStr): SemVer[]; - /** @returns {@link ReleaseInfo} iff `version` is a release that this object knows about */ + /** Retrieves the release info */ getReleaseInfo(version: SemOrStr): ReleaseInfo | undefined; } +/** + * Represents the options for creating Electron versions. + */ export interface ElectronVersionsCreateOptions { /** Initial versions to use if there is no cache. When provided, no initial fetch is done */ initialVersions?: unknown; @@ -78,6 +83,7 @@ export interface ElectronVersionsCreateOptions { ignoreCache?: boolean; } +/** Compares two semantic version numbers */ export function compareVersions(a: SemVer, b: SemVer): number { const l = a.compareMain(b); if (l) return l; @@ -150,6 +156,7 @@ export class BaseVersions implements Versions { private readonly map = new Map(); private readonly releaseInfo = new Map(); + /** Sets the versions and their corresponding release information */ protected setVersions(val: unknown): void { // release info doesn't need to be in sorted order this.releaseInfo.clear(); @@ -193,6 +200,7 @@ export class BaseVersions implements Versions { this.setVersions(versions); } + /** Gets an array of major versions that have prerelease versions */ public get prereleaseMajors(): number[] { const majors = new Set(); for (const ver of this.map.values()) { @@ -206,6 +214,7 @@ export class BaseVersions implements Versions { return [...majors]; } + /** Gets an array of major versions that only have stable versions */ public get stableMajors(): number[] { const majors = new Set(); for (const ver of this.map.values()) { @@ -216,22 +225,27 @@ export class BaseVersions implements Versions { return [...majors]; } + /** Gets an array of the most recently supported major versions */ public get supportedMajors(): number[] { return this.stableMajors.slice(-NUM_SUPPORTED_MAJORS); } + /** Gets an array of major versions that are considered obsolete */ public get obsoleteMajors(): number[] { return this.stableMajors.slice(0, -NUM_SUPPORTED_MAJORS); } + /** Gets an array of all semantic versions */ public get versions(): SemVer[] { return [...this.map.values()]; } + /** Gets the latest semantic version */ public get latest(): SemVer | undefined { return this.versions.pop(); } + /** Gets the latest stable semantic version */ public get latestStable(): SemVer | undefined { let stable: SemVer | undefined = undefined; for (const ver of this.map.values()) { @@ -242,10 +256,12 @@ export class BaseVersions implements Versions { return stable; } + /** Checks if a given value is a valid version */ public isVersion(ver: SemOrStr): boolean { return this.map.has(typeof ver === 'string' ? ver : ver.version); } + /** Gets an array of semantic versions in a specific major version */ public inMajor(major: number): SemVer[] { const versions: SemVer[] = []; for (const ver of this.map.values()) { @@ -256,6 +272,7 @@ export class BaseVersions implements Versions { return versions; } + /** Gets an array of semantic versions within a specified range */ public inRange(a: SemOrStr, b: SemOrStr): SemVer[] { if (typeof a !== 'string') a = a.version; if (typeof b !== 'string') b = b.version; @@ -267,6 +284,7 @@ export class BaseVersions implements Versions { return versions.slice(first, last + 1); } + /** Gets the release information for a given version */ public getReleaseInfo(ver: SemOrStr): ReleaseInfo | undefined { return this.releaseInfo.get(typeof ver === 'string' ? ver : ver.version); } @@ -302,6 +320,7 @@ export class ElectronVersions extends BaseVersions { return now <= cacheTimeMs + VERSION_CACHE_TTL_MS; } + /** Creates an instance of the parent class. */ public static async create( paths: Partial = {}, options: ElectronVersionsCreateOptions = {}, @@ -335,7 +354,7 @@ export class ElectronVersions extends BaseVersions { return new ElectronVersions(versionsCache, now, versions); } - // update the cache + /** update the cache */ public async fetch(): Promise { const d = debug('fiddle-core:ElectronVersions:fetch'); const { mtimeMs, versionsCache } = this; @@ -357,42 +376,61 @@ export class ElectronVersions extends BaseVersions { } } + /** Overrides the `prereleaseMajors` getter to ensure the cache is up to date */ public override get prereleaseMajors(): number[] { void this.keepFresh(); return super.prereleaseMajors; } + + /** Overrides the `stableMajors` getter to ensure the cache is up to date */ public override get stableMajors(): number[] { void this.keepFresh(); return super.stableMajors; } + + /** Overrides the `supportedMajors` getter to ensure the cache is up to date */ public override get supportedMajors(): number[] { void this.keepFresh(); return super.supportedMajors; } + + /** Overrides the `obsoleteMajors` getter to ensure the cache is up to date */ public override get obsoleteMajors(): number[] { void this.keepFresh(); return super.obsoleteMajors; } + + /** Overrides the `versions` getter to ensure the cache is up to date */ public override get versions(): SemVer[] { void this.keepFresh(); return super.versions; } + + /** Overrides the `latest` getter to ensure the cache is up to date */ public override get latest(): SemVer | undefined { void this.keepFresh(); return super.latest; } + + /** Overrides the `latestStable` getter to ensure the cache is up to date. */ public override get latestStable(): SemVer | undefined { void this.keepFresh(); return super.latestStable; } + + /** Overrides the `isVersion` method to ensure the cache is up to date */ public override isVersion(ver: SemOrStr): boolean { void this.keepFresh(); return super.isVersion(ver); } + + /** Overrides the `inMajor` method to ensure the cache is up to date */ public override inMajor(major: number): SemVer[] { void this.keepFresh(); return super.inMajor(major); } + + /** Overrides the `inRange` method to ensure the cache is up to date */ public override inRange(a: SemOrStr, b: SemOrStr): SemVer[] { void this.keepFresh(); return super.inRange(a, b); From b35f672add89ad3e021ac0dbb506ff66b963b8fd Mon Sep 17 00:00:00 2001 From: Abhishek Gite Date: Thu, 29 Jun 2023 20:07:36 +0100 Subject: [PATCH 09/11] Made changes as PR review comments --- etc/fiddle-core.api.md | 4 ++ src/command-line.ts | 1 - src/fiddle.ts | 2 - src/installer.ts | 2 +- src/paths.ts | 4 +- src/versions.ts | 8 +-- yarn.lock | 146 ++++++++++++++++++++--------------------- 7 files changed, 82 insertions(+), 85 deletions(-) diff --git a/etc/fiddle-core.api.md b/etc/fiddle-core.api.md index 79f59dd..c361ca0 100644 --- a/etc/fiddle-core.api.md +++ b/etc/fiddle-core.api.md @@ -198,9 +198,13 @@ export interface TestResult { // @public export interface Versions { + // (undocumented) getReleaseInfo(version: SemOrStr): ReleaseInfo | undefined; + // (undocumented) inMajor(major: number): SemVer[]; + // (undocumented) inRange(a: SemOrStr, b: SemOrStr): SemVer[]; + // (undocumented) isVersion(version: SemOrStr): boolean; readonly latest: SemVer | undefined; readonly latestStable: SemVer | undefined; diff --git a/src/command-line.ts b/src/command-line.ts index df53233..e369030 100644 --- a/src/command-line.ts +++ b/src/command-line.ts @@ -10,7 +10,6 @@ import { Runner } from './runner'; * executes specific commands based on the arguments provided. * It logs debug information and exits the process if invalid parameters are detected. */ - export async function runFromCommandLine(argv: string[]): Promise { const d = debug('fiddle-core:runFromCommandLine'); diff --git a/src/fiddle.ts b/src/fiddle.ts index 9c44e75..6524bf9 100644 --- a/src/fiddle.ts +++ b/src/fiddle.ts @@ -70,7 +70,6 @@ export class FiddleFactory { * checking out a specified branch (default: 'master'), * and setting the main file path based on the cloned files. */ - public async fromRepo(url: string, checkout = 'master'): Promise { const d = debug('fiddle-core:FiddleFactory:fromRepo'); const folder = path.join(this.fiddles, hashString(url)); @@ -94,7 +93,6 @@ export class FiddleFactory { * This method creates a Fiddle instance by saving a collection of filename-content pairs to a temporary directory * and setting the main file path accordingly. */ - public async fromEntries(src: Iterable<[string, string]>): Promise { const d = debug('fiddle-core:FiddleFactory:fromEntries'); const map = new Map(src); diff --git a/src/installer.ts b/src/installer.ts index 660c717..3c61e9e 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -91,7 +91,7 @@ export class Installer extends EventEmitter { this.rebuildStates(); } - /** Executes the subpath based on the platform */ + /** Returns the executable subpath based on the platform */ public static execSubpath(platform: string = process.platform): string { switch (platform) { case 'darwin': diff --git a/src/paths.ts b/src/paths.ts index 6945c6e..71905be 100644 --- a/src/paths.ts +++ b/src/paths.ts @@ -1,9 +1,7 @@ import * as path from 'path'; import envPaths from 'env-paths'; -/** - * Represents a set of paths used by an application. - */ +/** Paths used by fiddle-core */ export interface Paths { /** folder where electron zipfiles will be cached */ readonly electronDownloads: string; diff --git a/src/versions.ts b/src/versions.ts index d1955ff..75d69f0 100644 --- a/src/versions.ts +++ b/src/versions.ts @@ -59,16 +59,16 @@ export interface Versions { /** Full list of all known Electron releases, Sorted in branch order. */ readonly versions: SemVer[]; - /** Returns true iff `version` is a release that this object knows about */ + /** @returns true iff `version` is a release that this object knows about */ isVersion(version: SemOrStr): boolean; - /** Returns all versions matching that major number. Sorted in branch order. */ + /** @returns all versions matching that major number. Sorted in branch order. */ inMajor(major: number): SemVer[]; - /** Return all versions in a range, inclusive. Sorted in branch order. */ + /** @returns all versions in a range, inclusive. Sorted in branch order. */ inRange(a: SemOrStr, b: SemOrStr): SemVer[]; - /** Retrieves the release info */ + /** @returns {@link ReleaseInfo} iff `version` is a release that this object knows about */ getReleaseInfo(version: SemOrStr): ReleaseInfo | undefined; } diff --git a/yarn.lock b/yarn.lock index 78c145e..34c28fd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -951,47 +951,47 @@ resolved "https://registry.yarnpkg.com/@kwsites/promise-deferred/-/promise-deferred-1.1.1.tgz#8ace5259254426ccef57f3175bc64ed7095ed919" integrity sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw== -"@microsoft/api-extractor-model@7.27.3": - version "7.27.3" - resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.27.3.tgz#a484e0b7e25c4fa85846281aed6b87da0411d96c" - integrity sha512-fSFvw7otYHduOkyshjTbapKKgwF8bgquVHvgF8VgeKtMYvqXkoaj7W6VcM7PNY7E2bbblhUgC4XNdqZLD4SJGw== +"@microsoft/api-extractor-model@7.15.3": + version "7.15.3" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.15.3.tgz#cf76deeeb2733d974da678f530c2dbaceb18a065" + integrity sha512-NkSjolmSI7NGvbdz0Y7kjQfdpD+j9E5CwXTxEyjDqxd10MI7GXV8DnAsQ57GFJcgHKgTjf2aUnYfMJ9w3aMicw== dependencies: - "@microsoft/tsdoc" "0.14.2" - "@microsoft/tsdoc-config" "~0.16.1" - "@rushstack/node-core-library" "3.59.4" + "@microsoft/tsdoc" "0.13.2" + "@microsoft/tsdoc-config" "~0.15.2" + "@rushstack/node-core-library" "3.45.0" "@microsoft/api-extractor@^7.19.4": - version "7.36.0" - resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.36.0.tgz#e0a9f449bb1393697691b79045f384dd78fd760e" - integrity sha512-P+kYgJFDXIr+UNzhRMhlpM/dderi6ab4lxn35vdhfAIMPtGCSXIJxrrtpTOQmQW8CZtmoZX06LYoUsKCc1zjow== - dependencies: - "@microsoft/api-extractor-model" "7.27.3" - "@microsoft/tsdoc" "0.14.2" - "@microsoft/tsdoc-config" "~0.16.1" - "@rushstack/node-core-library" "3.59.4" - "@rushstack/rig-package" "0.4.0" - "@rushstack/ts-command-line" "4.15.1" + version "7.19.4" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.19.4.tgz#95d43d410a1dfb28a02062c4693bcb9c52afe9eb" + integrity sha512-iehC6YA3DGJvxTUaK7HUtQmP6hAQU07+Q/OR8TG4dVR6KpqCi9UPEVk8AgCvQkiK+6FbVEFQTx0qLuYk4EeuHg== + dependencies: + "@microsoft/api-extractor-model" "7.15.3" + "@microsoft/tsdoc" "0.13.2" + "@microsoft/tsdoc-config" "~0.15.2" + "@rushstack/node-core-library" "3.45.0" + "@rushstack/rig-package" "0.3.7" + "@rushstack/ts-command-line" "4.10.6" colors "~1.2.1" lodash "~4.17.15" - resolve "~1.22.1" + resolve "~1.17.0" semver "~7.3.0" source-map "~0.6.1" - typescript "~5.0.4" + typescript "~4.5.2" -"@microsoft/tsdoc-config@~0.16.1": - version "0.16.2" - resolved "https://registry.yarnpkg.com/@microsoft/tsdoc-config/-/tsdoc-config-0.16.2.tgz#b786bb4ead00d54f53839a458ce626c8548d3adf" - integrity sha512-OGiIzzoBLgWWR0UdRJX98oYO+XKGf7tiK4Zk6tQ/E4IJqGCe7dvkTvgDZV5cFJUzLGDOjeAXrnZoA6QkVySuxw== +"@microsoft/tsdoc-config@~0.15.2": + version "0.15.2" + resolved "https://registry.yarnpkg.com/@microsoft/tsdoc-config/-/tsdoc-config-0.15.2.tgz#eb353c93f3b62ab74bdc9ab6f4a82bcf80140f14" + integrity sha512-mK19b2wJHSdNf8znXSMYVShAHktVr/ib0Ck2FA3lsVBSEhSI/TfXT7DJQkAYgcztTuwazGcg58ZjYdk0hTCVrA== dependencies: - "@microsoft/tsdoc" "0.14.2" + "@microsoft/tsdoc" "0.13.2" ajv "~6.12.6" jju "~1.4.0" resolve "~1.19.0" -"@microsoft/tsdoc@0.14.2": - version "0.14.2" - resolved "https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.14.2.tgz#c3ec604a0b54b9a9b87e9735dfc59e1a5da6a5fb" - integrity sha512-9b8mPpKrfeGRuhFH5iO1iwCLeIIsV6+H1sRfxbkoGXIyQE2BTsPd9zqSqQJ+pv5sJ/hT5M1zvOFL02MnEezFug== +"@microsoft/tsdoc@0.13.2": + version "0.13.2" + resolved "https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.13.2.tgz#3b0efb6d3903bd49edb073696f60e90df08efb26" + integrity sha512-WrHvO8PDL8wd8T2+zBGKrMwVL5IyzR3ryWUsl0PXgEV0QHup4mTLi0QcATefGI6Gx9Anu7vthPyyyLpY0EpiQg== "@nodelib/fs.scandir@2.1.5": version "2.1.5" @@ -1185,31 +1185,33 @@ read-package-json-fast "^2.0.3" which "^2.0.2" -"@rushstack/node-core-library@3.59.4": - version "3.59.4" - resolved "https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-3.59.4.tgz#95f9eb3274627a5e84ee9443e65bb6edec1a5dc8" - integrity sha512-YAKJDC6Mz/KA1D7bvB88WaRX3knt/ZuLzkRu5G9QADGSjLtvTWzCNCytRF2PCSaaHOZaZsWul4F1KQdgFgUDqA== +"@rushstack/node-core-library@3.45.0": + version "3.45.0" + resolved "https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-3.45.0.tgz#8c86b39271b6d84260b1e70db87e1e265b54f620" + integrity sha512-YMuIJl19vQT1+g/OU9mLY6T5ZBT9uDlmeXExDQACpGuxTJW+LHNbk/lRX+eCApQI2eLBlaL4U68r3kZlqwbdmw== dependencies: + "@types/node" "12.20.24" colors "~1.2.1" fs-extra "~7.0.1" import-lazy "~4.0.0" jju "~1.4.0" - resolve "~1.22.1" + resolve "~1.17.0" semver "~7.3.0" + timsort "~0.3.0" z-schema "~5.0.2" -"@rushstack/rig-package@0.4.0": - version "0.4.0" - resolved "https://registry.yarnpkg.com/@rushstack/rig-package/-/rig-package-0.4.0.tgz#1dade94da5cd81321ca9ec630b6ceed2d57cc826" - integrity sha512-FnM1TQLJYwSiurP6aYSnansprK5l8WUK8VG38CmAaZs29ZeL1msjK0AP1VS4ejD33G0kE/2cpsPsS9jDenBMxw== +"@rushstack/rig-package@0.3.7": + version "0.3.7" + resolved "https://registry.yarnpkg.com/@rushstack/rig-package/-/rig-package-0.3.7.tgz#3fa564b1d129d28689dd4309502792b15e84bf81" + integrity sha512-pzMsTSeTC8IiZ6EJLr53gGMvhT4oLWH+hxD7907cHyWuIUlEXFtu/2pK25vUQT13nKp5DJCWxXyYoGRk/h6rtA== dependencies: - resolve "~1.22.1" + resolve "~1.17.0" strip-json-comments "~3.1.1" -"@rushstack/ts-command-line@4.15.1": - version "4.15.1" - resolved "https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.15.1.tgz#8f2ebde6bb19deb2c5b65363854b84aea1bf59f0" - integrity sha512-EL4jxZe5fhb1uVL/P/wQO+Z8Rc8FMiWJ1G7VgnPDvdIt5GVjRfK7vwzder1CZQiX3x0PY6uxENYLNGTFd1InRQ== +"@rushstack/ts-command-line@4.10.6": + version "4.10.6" + resolved "https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.10.6.tgz#5669e481e4339ceb4e1428183eb0937d3bc3841b" + integrity sha512-Y3GkUag39sTIlukDg9mUp8MCHrrlJ27POrBNRQGc/uF+VVgX8M7zMzHch5zP6O1QVquWgD7Engdpn2piPYaS/g== dependencies: "@types/argparse" "1.0.38" argparse "~1.0.9" @@ -1398,6 +1400,11 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-16.4.2.tgz#0a95d7fd950cb1eaca0ce11031d72e8f680b775a" integrity sha512-vxyhOzFCm+jC/T5KugbVsYy1DbQM0h3NCFUrVbu0+pYa/nr+heeucpqxpa8j4pUmIGLPYzboY9zIdOF0niFAjQ== +"@types/node@12.20.24": + version "12.20.24" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.24.tgz#c37ac69cb2948afb4cef95f424fa0037971a9a5c" + integrity sha512-yxDeaQIAJlMav7fH5AQqPH1u8YIuhYJXYBzxaQ4PifsU0GDO38MSdmEDeRlIxrKbC6NbEaaEHDanWb+y30U8SQ== + "@types/node@^14.14.31": version "14.18.31" resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.31.tgz#4b873dea3122e71af4f77e65ec5841397ff254d3" @@ -3157,13 +3164,6 @@ is-core-module@^2.1.0, is-core-module@^2.2.0: dependencies: has "^1.0.3" -is-core-module@^2.11.0: - version "2.12.1" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.12.1.tgz#0c0b6885b6f80011c71541ce15c8d66cf5a4f9fd" - integrity sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg== - dependencies: - has "^1.0.3" - is-core-module@^2.8.1: version "2.10.0" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.10.0.tgz#9012ede0a91c69587e647514e1d5277019e728ed" @@ -4715,7 +4715,7 @@ path-key@^3.0.0, path-key@^3.1.0: resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== -path-parse@^1.0.6, path-parse@^1.0.7: +path-parse@^1.0.6: version "1.0.7" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== @@ -5032,6 +5032,13 @@ resolve@^1.10.0, resolve@^1.20.0: is-core-module "^2.2.0" path-parse "^1.0.6" +resolve@~1.17.0: + version "1.17.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444" + integrity sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w== + dependencies: + path-parse "^1.0.6" + resolve@~1.19.0: version "1.19.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.19.0.tgz#1af5bf630409734a067cae29318aac7fa29a267c" @@ -5040,15 +5047,6 @@ resolve@~1.19.0: is-core-module "^2.1.0" path-parse "^1.0.6" -resolve@~1.22.1: - version "1.22.2" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.2.tgz#0ed0943d4e301867955766c9f3e1ae6d01c6845f" - integrity sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g== - dependencies: - is-core-module "^2.11.0" - path-parse "^1.0.7" - supports-preserve-symlinks-flag "^1.0.0" - responselike@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/responselike/-/responselike-2.0.1.tgz#9a0bc8fdc252f3fb1cca68b016591059ba1422bc" @@ -5124,10 +5122,10 @@ semver-compare@^1.0.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== -semver@7.x, semver@^7.3.2, semver@^7.3.5, semver@~7.3.0: - version "7.3.5" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" - integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== +semver@7.x, semver@^7.0.0, semver@^7.1.1, semver@^7.1.2, semver@^7.3.2, semver@^7.3.5, semver@^7.3.7: + version "7.5.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.2.tgz#5b851e66d1be07c1cdaf37dfc856f543325a2beb" + integrity sha512-SoftuTROv/cRjCze/scjGyiDtcUyxw1rgYQSZY7XTmtR5hX+dm76iDbTH8TkLPHCQmlbQVSSbNZCPM2hb0knnQ== dependencies: lru-cache "^6.0.0" @@ -5136,7 +5134,7 @@ semver@^6.0.0, semver@^6.2.0, semver@^6.3.0: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== -semver@^7.0.0, semver@^7.1.1, semver@^7.1.2, semver@^7.3.7: +semver@~7.3.0: version "7.3.8" resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798" integrity sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A== @@ -5433,11 +5431,6 @@ supports-color@^8.0.0: dependencies: has-flag "^4.0.0" -supports-preserve-symlinks-flag@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" - integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== - tar@^6.1.0, tar@^6.1.11, tar@^6.1.2: version "6.1.11" resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.11.tgz#6760a38f003afa1b2ffd0ffe9e9abbd0eab3d621" @@ -5480,6 +5473,11 @@ text-table@^0.2.0, text-table@~0.2.0: resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= +timsort@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/timsort/-/timsort-0.3.0.tgz#405411a8e7e6339fe64db9a234de11dc31e02bd4" + integrity sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q= + tiny-relative-date@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/tiny-relative-date/-/tiny-relative-date-1.3.0.tgz#fa08aad501ed730f31cc043181d995c39a935e07" @@ -5585,10 +5583,10 @@ typescript@^4.9.5: resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== -typescript@~5.0.4: - version "5.0.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b" - integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw== +typescript@~4.5.2: + version "4.5.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.4.tgz#a17d3a0263bf5c8723b9c52f43c5084edf13c2e8" + integrity sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg== unbox-primitive@^1.0.1: version "1.0.1" @@ -5821,4 +5819,4 @@ z-schema@~5.0.2: lodash.isequal "^4.5.0" validator "^13.7.0" optionalDependencies: - commander "^2.7.1" + commander "^2.7.1" \ No newline at end of file From d70a7433c9d1fefa5af877aec7f6147d0b24c407 Mon Sep 17 00:00:00 2001 From: Abhishek Gite Date: Thu, 29 Jun 2023 20:21:09 +0100 Subject: [PATCH 10/11] Reverting changes from yarn.lock --- yarn.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/yarn.lock b/yarn.lock index 34c28fd..996f2e9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5122,10 +5122,10 @@ semver-compare@^1.0.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== -semver@7.x, semver@^7.0.0, semver@^7.1.1, semver@^7.1.2, semver@^7.3.2, semver@^7.3.5, semver@^7.3.7: - version "7.5.2" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.2.tgz#5b851e66d1be07c1cdaf37dfc856f543325a2beb" - integrity sha512-SoftuTROv/cRjCze/scjGyiDtcUyxw1rgYQSZY7XTmtR5hX+dm76iDbTH8TkLPHCQmlbQVSSbNZCPM2hb0knnQ== +semver@7.x, semver@^7.3.2, semver@^7.3.5, semver@~7.3.0: + version "7.3.5" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" + integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== dependencies: lru-cache "^6.0.0" @@ -5134,7 +5134,7 @@ semver@^6.0.0, semver@^6.2.0, semver@^6.3.0: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== -semver@~7.3.0: +semver@^7.0.0, semver@^7.1.1, semver@^7.1.2, semver@^7.3.7: version "7.3.8" resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798" integrity sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A== @@ -5819,4 +5819,4 @@ z-schema@~5.0.2: lodash.isequal "^4.5.0" validator "^13.7.0" optionalDependencies: - commander "^2.7.1" \ No newline at end of file + commander "^2.7.1" From a1e71f6a7dfb8c368031e93e21910174145de846 Mon Sep 17 00:00:00 2001 From: Abhishek Gite Date: Wed, 5 Jul 2023 20:29:12 +0100 Subject: [PATCH 11/11] Amended comments based on Review comments --- src/command-line.ts | 2 +- src/fiddle.ts | 4 ++-- src/installer.ts | 36 ++++++++++++++++++------------------ src/paths.ts | 2 +- src/runner.ts | 16 ++++++++-------- src/versions.ts | 40 ++++++++++++++++++++-------------------- 6 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/command-line.ts b/src/command-line.ts index e369030..b982331 100644 --- a/src/command-line.ts +++ b/src/command-line.ts @@ -6,7 +6,7 @@ import { Fiddle, FiddleFactory } from './fiddle'; import { Runner } from './runner'; /** - * This function handles command-line arguments, creates instances of necessary objects and + * Function handles command-line arguments, creates instances of necessary objects and * executes specific commands based on the arguments provided. * It logs debug information and exits the process if invalid parameters are detected. */ diff --git a/src/fiddle.ts b/src/fiddle.ts index 6524bf9..81b8f3e 100644 --- a/src/fiddle.ts +++ b/src/fiddle.ts @@ -17,7 +17,7 @@ export class Fiddle { constructor( /** It serves as the entry point or the primary script file for the fiddle */ public readonly mainPath: string, // /path/to/main.js - /** It represents the code */ + /** Is the cource of the fiddle */ public readonly source: string, ) {} @@ -67,7 +67,7 @@ export class FiddleFactory { /** * This method creates a Fiddle instance by cloning a Git repository into a temporary directory, - * checking out a specified branch (default: 'master'), + * optionally checking out a specified branch, * and setting the main file path based on the cloned files. */ public async fromRepo(url: string, checkout = 'master'): Promise { diff --git a/src/installer.ts b/src/installer.ts index 3c61e9e..96228f5 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -14,7 +14,7 @@ function getZipName(version: string): string { return `electron-v${version}-${process.platform}-${process.arch}.zip`; } -/** This object is used to track progress in percent */ +/** Tracks progress in percent */ export type ProgressObject = { percent: number }; /** @@ -23,20 +23,20 @@ export type ProgressObject = { percent: number }; * See Installer.on('state-changed') to watch for state changes. */ export enum InstallState { - /** This represent the missing state */ + /** Missing state */ missing = 'missing', - /** This represent the downloading state */ + /** Downloading state */ downloading = 'downloading', - /** This represent the downloaded state */ + /** Downloaded state */ downloaded = 'downloaded', - /** This represent the installing state */ + /** Installing state */ installing = 'installing', - /** This represent the installed state */ + /** Installed state */ installed = 'installed', } /** - * Represents an event that indicates the installation state of something. + * An event that indicates a change in the installation state of a version */ export interface InstallStateEvent { /** The version of the installation */ @@ -45,27 +45,27 @@ export interface InstallStateEvent { state: InstallState; } -/** Represents an object that holds information about electron mirrors */ +/** An object that holds information about electron mirrors */ export interface Mirrors { - /** The URL of the electron mirror */ + /** URL of the electron mirror */ electronMirror: string; - /** The URL of the electron nightly mirror */ + /** URL of the electron nightly mirror */ electronNightlyMirror: string; } -/** Represents the configuration for an Electron binary */ +/** Configuration for an Electron binary */ export interface ElectronBinary { - /** The path to the Electron binary */ + /** Path to the Electron binary */ path: string; - /** Indicates whether the Electron binary is already extracted or not */ + /** Checks whether the Electron binary is already extracted or not */ alreadyExtracted: boolean; // to check if it's kept as zipped or not } -/** Represents the parameters for an installer */ +/** Parameters for an installer */ export interface InstallerParams { - /** The callback function to receive progress updates */ + /** Callback function to receive progress updates */ progressCallback: (progress: ProgressObject) => void; - /** The mirrors to use for the installation */ + /** Mirrors to use for the installation */ mirror: Mirrors; } @@ -103,12 +103,12 @@ export class Installer extends EventEmitter { } } - /** Gets the executable path for a given folder */ + /** Executable path for a given folder */ public static getExecPath(folder: string): string { return path.join(folder, Installer.execSubpath()); } - /** Gets the installation state for a specific version */ + /** Installation state for a specific version */ public state(version: string): InstallState { return this.stateMap.get(version) || InstallState.missing; } diff --git a/src/paths.ts b/src/paths.ts index 71905be..dab5d6e 100644 --- a/src/paths.ts +++ b/src/paths.ts @@ -18,7 +18,7 @@ export interface Paths { const paths = envPaths('fiddle-core', { suffix: '' }); -/** This object contains default paths. */ +/** Default paths. */ export const DefaultPaths: Paths = { electronDownloads: path.join(paths.data, 'electron', 'zips'), electronInstall: path.join(paths.data, 'electron', 'current'), diff --git a/src/runner.ts b/src/runner.ts index 9f8ff88..fb5a68a 100644 --- a/src/runner.ts +++ b/src/runner.ts @@ -32,16 +32,16 @@ const DefaultRunnerOpts: RunnerOptions = { showConfig: true, } as const; -/** Represents the options for spawning a runner */ +/** Options for spawning a runner */ export type RunnerSpawnOptions = SpawnOptions & RunnerOptions; -/** Represents the result of a test */ +/** Result of a test */ export interface TestResult { /** Status of the test result */ status: 'test_passed' | 'test_failed' | 'test_error' | 'system_error'; } -/** Represents the result of a bisect operation */ +/** Result of a bisect operation */ export interface BisectResult { /** The range of values where the bisect operation succeeded */ range?: [string, string]; @@ -49,7 +49,7 @@ export interface BisectResult { status: 'bisect_succeeded' | 'test_error' | 'system_error'; } -/** Represents a class for executing Electron-related tasks */ +/** Executing Electron-related tasks */ export class Runner { private osInfo = ''; @@ -141,7 +141,7 @@ export class Runner { return { exec, args }; } - /** This method is used to spawn a child process and run a fiddle with Electron */ + /** Spawns a child process and run a fiddle with Electron */ public async spawn( versionIn: string | SemVer, fiddleIn: FiddleSource, @@ -189,7 +189,7 @@ export class Runner { } } - /** This method that takes a TestResult object and returns a string representation of the result */ + /** Displays result */ public static displayResult(result: TestResult): string { const text = Runner.displayEmoji(result); switch (result.status) { @@ -204,7 +204,7 @@ export class Runner { } } - /** This method is used to run a fiddle with a specific version of Electron and obtain the test result */ + /** Runs a fiddle with a specific version of Electron and obtain the test result */ public async run( version: string | SemVer, fiddle: FiddleSource, @@ -225,7 +225,7 @@ export class Runner { }); } - /** This method performs a bisect operation between two versions of Electron to find a regression */ + /** Bisects operation between two versions of Electron to find a regression */ public async bisect( version_a: string | SemVer, version_b: string | SemVer, diff --git a/src/versions.ts b/src/versions.ts index 75d69f0..8ecfac8 100644 --- a/src/versions.ts +++ b/src/versions.ts @@ -7,10 +7,10 @@ export { SemVer }; import { DefaultPaths, Paths } from './paths'; -/** Represents a type that can be either a SemVer object or a string */ +/** Type that can be either a SemVer object or a string */ export type SemOrStr = SemVer | string; -/** Represents information about a release */ +/** Information about a release */ export interface ReleaseInfo { /** Electron version */ version: string; @@ -200,7 +200,7 @@ export class BaseVersions implements Versions { this.setVersions(versions); } - /** Gets an array of major versions that have prerelease versions */ + /** An array of major versions that have prerelease versions */ public get prereleaseMajors(): number[] { const majors = new Set(); for (const ver of this.map.values()) { @@ -214,7 +214,7 @@ export class BaseVersions implements Versions { return [...majors]; } - /** Gets an array of major versions that only have stable versions */ + /** An array of major versions that only have stable versions */ public get stableMajors(): number[] { const majors = new Set(); for (const ver of this.map.values()) { @@ -225,27 +225,27 @@ export class BaseVersions implements Versions { return [...majors]; } - /** Gets an array of the most recently supported major versions */ + /** An array of the most recently supported major versions */ public get supportedMajors(): number[] { return this.stableMajors.slice(-NUM_SUPPORTED_MAJORS); } - /** Gets an array of major versions that are considered obsolete */ + /** An array of major versions that are considered obsolete */ public get obsoleteMajors(): number[] { return this.stableMajors.slice(0, -NUM_SUPPORTED_MAJORS); } - /** Gets an array of all semantic versions */ + /** An array of all semantic versions */ public get versions(): SemVer[] { return [...this.map.values()]; } - /** Gets the latest semantic version */ + /** Latest semantic version */ public get latest(): SemVer | undefined { return this.versions.pop(); } - /** Gets the latest stable semantic version */ + /** Latest stable semantic version */ public get latestStable(): SemVer | undefined { let stable: SemVer | undefined = undefined; for (const ver of this.map.values()) { @@ -261,7 +261,7 @@ export class BaseVersions implements Versions { return this.map.has(typeof ver === 'string' ? ver : ver.version); } - /** Gets an array of semantic versions in a specific major version */ + /** An array of semantic versions in a specific major version */ public inMajor(major: number): SemVer[] { const versions: SemVer[] = []; for (const ver of this.map.values()) { @@ -376,61 +376,61 @@ export class ElectronVersions extends BaseVersions { } } - /** Overrides the `prereleaseMajors` getter to ensure the cache is up to date */ + /** Getter to ensure the cache is up to date */ public override get prereleaseMajors(): number[] { void this.keepFresh(); return super.prereleaseMajors; } - /** Overrides the `stableMajors` getter to ensure the cache is up to date */ + /** Getter to ensure the cache is up to date */ public override get stableMajors(): number[] { void this.keepFresh(); return super.stableMajors; } - /** Overrides the `supportedMajors` getter to ensure the cache is up to date */ + /** Getter to ensure the cache is up to date */ public override get supportedMajors(): number[] { void this.keepFresh(); return super.supportedMajors; } - /** Overrides the `obsoleteMajors` getter to ensure the cache is up to date */ + /** Getter to ensure the cache is up to date */ public override get obsoleteMajors(): number[] { void this.keepFresh(); return super.obsoleteMajors; } - /** Overrides the `versions` getter to ensure the cache is up to date */ + /** Getter to ensure the cache is up to date */ public override get versions(): SemVer[] { void this.keepFresh(); return super.versions; } - /** Overrides the `latest` getter to ensure the cache is up to date */ + /** Getter to ensure the cache is up to date */ public override get latest(): SemVer | undefined { void this.keepFresh(); return super.latest; } - /** Overrides the `latestStable` getter to ensure the cache is up to date. */ + /** Getter to ensure the cache is up to date. */ public override get latestStable(): SemVer | undefined { void this.keepFresh(); return super.latestStable; } - /** Overrides the `isVersion` method to ensure the cache is up to date */ + /** An method to ensure the cache is up to date */ public override isVersion(ver: SemOrStr): boolean { void this.keepFresh(); return super.isVersion(ver); } - /** Overrides the `inMajor` method to ensure the cache is up to date */ + /** An method to ensure the cache is up to date */ public override inMajor(major: number): SemVer[] { void this.keepFresh(); return super.inMajor(major); } - /** Overrides the `inRange` method to ensure the cache is up to date */ + /** An method to ensure the cache is up to date */ public override inRange(a: SemOrStr, b: SemOrStr): SemVer[] { void this.keepFresh(); return super.inRange(a, b);