From 30c3ab553058edfc9eb2df18ed98ef8aa270241a Mon Sep 17 00:00:00 2001 From: Oscar Dominguez Date: Fri, 2 Jul 2021 23:59:35 +0200 Subject: [PATCH 01/21] docs(README): remove WIP note --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 402d335..abe652a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -# 🚧 WORK IN PROGRESS. See [#1](https://github.com/oscard0m/octoherd-script-add-cache-to-node-github-action/pull/1) | [Preview](https://github.com/oscard0m/octoherd-script-add-cache-to-node-github-action/tree/initial-version) - # octoherd-script-add-cache-to-node-github-action > Add cache parameter to GitHub Actions using setup-node From 410d48c3d8827a34f774c245445a6f64ad6be421 Mon Sep 17 00:00:00 2001 From: Oscar Dominguez Date: Fri, 2 Jul 2021 23:59:56 +0200 Subject: [PATCH 02/21] build(package): initial version --- package.json | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 package.json diff --git a/package.json b/package.json new file mode 100644 index 0000000..4b72c6b --- /dev/null +++ b/package.json @@ -0,0 +1,29 @@ +{ + "name": "octoherd-script-add-cache-to-node-github-action", + "version": "0.0.0-development", + "type": "module", + "exports": "./script.js", + "bin": { + "octoherd-script-add-cache-to-node-github-action": "./cli.js" + }, + "description": "Add cache parameter to GitHub Actions using setup-node", + "scripts": { + "start": "node cli.js", + "test": "node script.js" + }, + "repository": "https://github.com/oscard0m/octoherd-script-add-cache-to-node-github-action", + "keywords": [ + "octoherd-script" + ], + "author": "Oscar Dominguez (https://www.oscardom.dev)", + "license": "ISC", + "dependencies": { + "@octoherd/cli": "^3.3.4" + }, + "devDependencies": {}, + "release": { + "branches": [ + "main" + ] + } +} From 0465b43873bd54a6c5b46a3389d6dd85ba6e5a83 Mon Sep 17 00:00:00 2001 From: Oscar Dominguez Date: Fri, 2 Jul 2021 23:59:56 +0200 Subject: [PATCH 03/21] build(package): lock file --- package-lock.json | 879 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 879 insertions(+) create mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..bc0fecd --- /dev/null +++ b/package-lock.json @@ -0,0 +1,879 @@ +{ + "name": "octoherd-script-add-cache-to-node-github-action", + "version": "0.0.0-development", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "requires": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==" + }, + "@nodelib/fs.walk": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.7.tgz", + "integrity": "sha512-BTIhocbPBSrRmHxOAJFtR18oLhxTtAFDAvL8hY1S3iU8k+E60W/YFs4jrixGzQjMpF4qPXxIQHcjVD9dz1C2QA==", + "requires": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + } + }, + "@octoherd/cli": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/@octoherd/cli/-/cli-3.3.4.tgz", + "integrity": "sha512-emJ6cItyK1syFqJ6d/APMGTnQ09nhaQYxBC4aKAN3Kh15D7STkc70pGnj6oH7ry/g/JZChddsCkmkvNMtXgNfQ==", + "requires": { + "@octoherd/octokit": "^2.3.0", + "@octokit/auth-oauth-device": "^3.1.1", + "@octokit/openapi-types": "^8.0.0", + "chalk": "^4.1.0", + "clipboardy": "^2.3.0", + "enquirer": "^2.3.6", + "jsonfile": "^6.0.1", + "mkdirp": "^1.0.4", + "tempy": "^1.0.0", + "yargs": "^17.0.0-candidate.10" + } + }, + "@octoherd/octokit": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@octoherd/octokit/-/octokit-2.3.1.tgz", + "integrity": "sha512-r4ebOpHfFNNQ11quOiEnzCpebLEmQUMNqIeE8JmfQ5s9pqeNnYqBFR0HK0cto5g7ptR6Gl02TtChb94HetBmEQ==", + "requires": { + "@octokit/core": "^3.2.5", + "@octokit/plugin-paginate-rest": "^2.9.1", + "@octokit/plugin-retry": "^3.0.7", + "@octokit/plugin-throttling": "^3.4.1", + "quick-format-unescaped": "^4.0.1" + } + }, + "@octokit/auth-oauth-device": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@octokit/auth-oauth-device/-/auth-oauth-device-3.1.2.tgz", + "integrity": "sha512-w7Po4Ck6N2aAn2VQyKLuojruiyKROTBv4qs6IwE5rbwF7HhBXXp4A/NKmkpoFIZkiXQtM+N8QtkSck4ApYWdGg==", + "requires": { + "@octokit/oauth-methods": "^1.1.0", + "@octokit/request": "^5.4.14", + "@octokit/types": "^6.10.0", + "universal-user-agent": "^6.0.0" + } + }, + "@octokit/auth-token": { + "version": "2.4.5", + "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.5.tgz", + "integrity": "sha512-BpGYsPgJt05M7/L/5FoE1PiAbdxXFZkX/3kDYcsvd1v6UhlnE5e96dTDr0ezX/EFwciQxf3cNV0loipsURU+WA==", + "requires": { + "@octokit/types": "^6.0.3" + } + }, + "@octokit/core": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.5.1.tgz", + "integrity": "sha512-omncwpLVxMP+GLpLPgeGJBF6IWJFjXDS5flY5VbppePYX9XehevbDykRH9PdCdvqt9TS5AOTiDide7h0qrkHjw==", + "requires": { + "@octokit/auth-token": "^2.4.4", + "@octokit/graphql": "^4.5.8", + "@octokit/request": "^5.6.0", + "@octokit/request-error": "^2.0.5", + "@octokit/types": "^6.0.3", + "before-after-hook": "^2.2.0", + "universal-user-agent": "^6.0.0" + } + }, + "@octokit/endpoint": { + "version": "6.0.12", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.12.tgz", + "integrity": "sha512-lF3puPwkQWGfkMClXb4k/eUT/nZKQfxinRWJrdZaJO85Dqwo/G0yOC434Jr2ojwafWJMYqFGFa5ms4jJUgujdA==", + "requires": { + "@octokit/types": "^6.0.3", + "is-plain-object": "^5.0.0", + "universal-user-agent": "^6.0.0" + } + }, + "@octokit/graphql": { + "version": "4.6.4", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.6.4.tgz", + "integrity": "sha512-SWTdXsVheRmlotWNjKzPOb6Js6tjSqA2a8z9+glDJng0Aqjzti8MEWOtuT8ZSu6wHnci7LZNuarE87+WJBG4vg==", + "requires": { + "@octokit/request": "^5.6.0", + "@octokit/types": "^6.0.3", + "universal-user-agent": "^6.0.0" + } + }, + "@octokit/oauth-authorization-url": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/@octokit/oauth-authorization-url/-/oauth-authorization-url-4.3.2.tgz", + "integrity": "sha512-CkKc5+clTSd8nNAtwQWzBewASIpgxO8tEtU75AbVsjDuwDIDj9F0uJ5fjGvsa2rwkc8kP4CxTk5dvEe38SfbLA==" + }, + "@octokit/oauth-methods": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@octokit/oauth-methods/-/oauth-methods-1.2.4.tgz", + "integrity": "sha512-85hen2Dkpnmy2PGfVFe7Ke9rUo//nlqUcHE4GiQBHJ7D95rAm19GcRO49LlH6NOXOMdEFj7i/Ay5GVDRrAk38w==", + "requires": { + "@octokit/oauth-authorization-url": "^4.3.1", + "@octokit/request": "^5.4.14", + "@octokit/request-error": "^2.0.5", + "@octokit/types": "^6.12.2", + "btoa-lite": "^1.0.0" + } + }, + "@octokit/openapi-types": { + "version": "8.1.4", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-8.1.4.tgz", + "integrity": "sha512-NnGr4NNDqO5wjSDJo5nxrGtzZUwoT23YasqK2H4Pav/6vSgeVTxuqCL9Aeh+cWfTxDomj1M4Os5BrXFsvl7qiQ==" + }, + "@octokit/plugin-paginate-rest": { + "version": "2.13.6", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.13.6.tgz", + "integrity": "sha512-ai7TNKLi8tGkDvLM7fm0X1fbIP9u1nfXnN49ZAw2PgSoQou9yixKn5c3m0awuLacbuX2aXEvJpv1gKm3jboabg==", + "requires": { + "@octokit/types": "^6.17.3" + } + }, + "@octokit/plugin-retry": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-3.0.9.tgz", + "integrity": "sha512-r+fArdP5+TG6l1Rv/C9hVoty6tldw6cE2pRHNGmFPdyfrc696R6JjrQ3d7HdVqGwuzfyrcaLAKD7K8TX8aehUQ==", + "requires": { + "@octokit/types": "^6.0.3", + "bottleneck": "^2.15.3" + } + }, + "@octokit/plugin-throttling": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-throttling/-/plugin-throttling-3.5.1.tgz", + "integrity": "sha512-d2jh3/RZo98DRw2J0jFxhKz7nrTGalGdkfRtxM+pI5k1wRb4BKBjiuE9cuZnhZyj+zLC1EcIptj7K+28LJZ3eA==", + "requires": { + "@octokit/types": "^6.0.1", + "bottleneck": "^2.15.3" + } + }, + "@octokit/request": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.6.0.tgz", + "integrity": "sha512-4cPp/N+NqmaGQwbh3vUsYqokQIzt7VjsgTYVXiwpUP2pxd5YiZB2XuTedbb0SPtv9XS7nzAKjAuQxmY8/aZkiA==", + "requires": { + "@octokit/endpoint": "^6.0.1", + "@octokit/request-error": "^2.1.0", + "@octokit/types": "^6.16.1", + "is-plain-object": "^5.0.0", + "node-fetch": "^2.6.1", + "universal-user-agent": "^6.0.0" + } + }, + "@octokit/request-error": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.1.0.tgz", + "integrity": "sha512-1VIvgXxs9WHSjicsRwq8PlR2LR2x6DwsJAaFgzdi0JfJoGSO8mYI/cHJQ+9FbN21aa+DrgNLnwObmyeSC8Rmpg==", + "requires": { + "@octokit/types": "^6.0.3", + "deprecation": "^2.0.0", + "once": "^1.4.0" + } + }, + "@octokit/types": { + "version": "6.17.4", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.17.4.tgz", + "integrity": "sha512-Ghk/JC4zC/1al1GwH6p8jVX6pLdypSWmbnx6h79C/yo3DeaDd6MsNsBFlHu22KbkFh+CdcAzFqdP7UdPaPPmmA==", + "requires": { + "@octokit/openapi-types": "^8.1.4" + } + }, + "aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "requires": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + } + }, + "ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==" + }, + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "arch": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/arch/-/arch-2.2.0.tgz", + "integrity": "sha512-Of/R0wqp83cgHozfIYLbBMnej79U/SVGOOyuB3VVFv1NRM/PSFMK12x9KVtiYzJqmnU5WR2qp0Z5rHb7sWGnFQ==" + }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==" + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "before-after-hook": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.2.tgz", + "integrity": "sha512-3pZEU3NT5BFUo/AD5ERPWOgQOCZITni6iavr5AUw5AUwQjMlI0kzu5btnyD39AF0gUEsDPwJT+oY1ORBJijPjQ==" + }, + "bottleneck": { + "version": "2.19.5", + "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", + "integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw==" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "requires": { + "fill-range": "^7.0.1" + } + }, + "btoa-lite": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/btoa-lite/-/btoa-lite-1.0.0.tgz", + "integrity": "sha1-M3dm2hWAEhD92VbCLpxokaudAzc=" + }, + "chalk": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", + "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==" + }, + "clipboardy": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/clipboardy/-/clipboardy-2.3.0.tgz", + "integrity": "sha512-mKhiIL2DrQIsuXMgBgnfEHOZOryC7kY7YO//TN6c63wlEm3NG5tz+YgY5rVi29KCmq/QQjKYvM7a19+MDOTHOQ==", + "requires": { + "arch": "^2.1.1", + "execa": "^1.0.0", + "is-wsl": "^2.1.1" + } + }, + "cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "crypto-random-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", + "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==" + }, + "del": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/del/-/del-6.0.0.tgz", + "integrity": "sha512-1shh9DQ23L16oXSZKB2JxpL7iMy2E0S9d517ptA1P8iw0alkPtQcrKH7ru31rYtKwF499HkTu+DRzq3TCKDFRQ==", + "requires": { + "globby": "^11.0.1", + "graceful-fs": "^4.2.4", + "is-glob": "^4.0.1", + "is-path-cwd": "^2.2.0", + "is-path-inside": "^3.0.2", + "p-map": "^4.0.0", + "rimraf": "^3.0.2", + "slash": "^3.0.0" + } + }, + "deprecation": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", + "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==" + }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "requires": { + "path-type": "^4.0.0" + } + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "requires": { + "once": "^1.4.0" + } + }, + "enquirer": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", + "requires": { + "ansi-colors": "^4.1.1" + } + }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==" + }, + "execa": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "fast-glob": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.6.tgz", + "integrity": "sha512-GnLuqj/pvQ7pX8/L4J84nijv6sAnlwvSDpMkJi9i7nPmPxGtRPkBSStfvDW5l6nMdX9VWe+pkKWFTgD+vF2QSQ==", + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + } + }, + "fastq": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.0.tgz", + "integrity": "sha512-7Eczs8gIPDrVzT+EksYBcupqMyxSHXXrHOLRRxU2/DicV8789MRBRR8+Hc2uWzUupOs4YS4JzBmBxjjCVBxD/g==", + "requires": { + "reusify": "^1.0.4" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "requires": { + "pump": "^3.0.0" + } + }, + "glob": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "requires": { + "is-glob": "^4.0.1" + } + }, + "globby": { + "version": "11.0.4", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz", + "integrity": "sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==", + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.1.1", + "ignore": "^5.1.4", + "merge2": "^1.3.0", + "slash": "^3.0.0" + } + }, + "graceful-fs": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", + "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==" + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, + "ignore": { + "version": "5.1.8", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", + "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==" + }, + "indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==" + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==" + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + }, + "is-path-cwd": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz", + "integrity": "sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ==" + }, + "is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==" + }, + "is-plain-object": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", + "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==" + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" + }, + "is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "requires": { + "is-docker": "^2.0.0" + } + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + } + }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==" + }, + "micromatch": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", + "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.2.3" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==" + }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" + }, + "node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "requires": { + "path-key": "^2.0.0" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" + }, + "p-map": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", + "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", + "requires": { + "aggregate-error": "^3.0.0" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=" + }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==" + }, + "picomatch": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", + "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==" + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==" + }, + "quick-format-unescaped": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.3.tgz", + "integrity": "sha512-MaL/oqh02mhEo5m5J2rwsVL23Iw2PEaGVHgT2vFt8AAsr0lfvQA5dpXo9TPu0rz7tSBdUPgkbam0j/fj5ZM8yg==" + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" + }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==" + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "requires": { + "glob": "^7.1.3" + } + }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "requires": { + "queue-microtask": "^1.2.2" + } + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" + }, + "signal-exit": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==" + }, + "string-width": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", + "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=" + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "requires": { + "has-flag": "^4.0.0" + } + }, + "temp-dir": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-2.0.0.tgz", + "integrity": "sha512-aoBAniQmmwtcKp/7BzsH8Cxzv8OL736p7v1ihGb5e9DJ9kTwGWHrQrVB5+lfVDzfGrdRzXch+ig7LHaY1JTOrg==" + }, + "tempy": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/tempy/-/tempy-1.0.1.tgz", + "integrity": "sha512-biM9brNqxSc04Ee71hzFbryD11nX7VPhQQY32AdDmjFvodsRFz/3ufeoTZ6uYkRFfGo188tENcASNs3vTdsM0w==", + "requires": { + "del": "^6.0.0", + "is-stream": "^2.0.0", + "temp-dir": "^2.0.0", + "type-fest": "^0.16.0", + "unique-string": "^2.0.0" + }, + "dependencies": { + "is-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==" + } + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "requires": { + "is-number": "^7.0.0" + } + }, + "type-fest": { + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.16.0.tgz", + "integrity": "sha512-eaBzG6MxNzEn9kiwvtre90cXaNLkmadMWa1zQMs3XORCXNbsH/OewwbxC5ia9dCxIxnTAsSxXJaa/p5y8DlvJg==" + }, + "unique-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", + "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", + "requires": { + "crypto-random-string": "^2.0.0" + } + }, + "universal-user-agent": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz", + "integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==" + }, + "universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==" + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "requires": { + "isexe": "^2.0.0" + } + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==" + }, + "yargs": { + "version": "17.0.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.0.1.tgz", + "integrity": "sha512-xBBulfCc8Y6gLFcrPvtqKz9hz8SO0l1Ni8GgDekvBX2ro0HRQImDGnikfc33cgzcYUSncapnNcZDjVFIH3f6KQ==", + "requires": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + } + }, + "yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==" + } + } +} From ebe67e720b27f16564878e22f73144e9cba12b69 Mon Sep 17 00:00:00 2001 From: Oscar Dominguez Date: Fri, 2 Jul 2021 23:59:57 +0200 Subject: [PATCH 04/21] build(gitignore): node_modules --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules From f58830098dd23e5f5bbe19915ffa5c6ef7f31427 Mon Sep 17 00:00:00 2001 From: Oscar Dominguez Date: Fri, 2 Jul 2021 23:59:57 +0200 Subject: [PATCH 05/21] feat: initial version --- cli.js | 6 ++++++ script.js | 11 +++++++++++ 2 files changed, 17 insertions(+) create mode 100644 cli.js create mode 100644 script.js diff --git a/cli.js b/cli.js new file mode 100644 index 0000000..a0fe3c1 --- /dev/null +++ b/cli.js @@ -0,0 +1,6 @@ +#!/usr/bin/env node + +import { script } from "./script.js"; +import { run } from "@octoherd/cli/run"; + +run(script); diff --git a/script.js b/script.js new file mode 100644 index 0000000..20a47bd --- /dev/null +++ b/script.js @@ -0,0 +1,11 @@ +// @ts-check + +/** + * Add cache parameter to GitHub Actions using setup-node + * + * @param {import('@octoherd/cli').Octokit} octokit + * @param {import('@octoherd/cli').Repository} repository + * @param {object} options + * @param {string} [options.cache] Select which package manager you want to use for caching + */ +export async function script(octokit, repository, { cache }) {} From 9f44f3b1b296b3beafe8fa4beaef2e80f9f372c4 Mon Sep 17 00:00:00 2001 From: Oscar Dominguez Date: Fri, 2 Jul 2021 23:59:57 +0200 Subject: [PATCH 06/21] docs(README): badges --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index abe652a..0c19bc9 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,9 @@ > Add cache parameter to GitHub Actions using setup-node +[![@latest](https://img.shields.io/npm/v/octoherd-script-add-cache-to-node-github-action.svg)](https://www.npmjs.com/package/octoherd-script-add-cache-to-node-github-action) +[![Build Status](https://github.com/oscard0m/octoherd-script-add-cache-to-node-github-action/workflows/Test/badge.svg)](https://github.com/oscard0m/octoherd-script-add-cache-to-node-github-action/actions?query=workflow%3ATest+branch%3Amain) + ## Contributing See [CONTRIBUTING.md](CONTRIBUTING.md) From f9749ff4fb6f56e1abea1de31834639c68cda618 Mon Sep 17 00:00:00 2001 From: Oscar Dominguez Date: Fri, 2 Jul 2021 23:59:57 +0200 Subject: [PATCH 07/21] docs(README): usage --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index 0c19bc9..518e502 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,32 @@ [![@latest](https://img.shields.io/npm/v/octoherd-script-add-cache-to-node-github-action.svg)](https://www.npmjs.com/package/octoherd-script-add-cache-to-node-github-action) [![Build Status](https://github.com/oscard0m/octoherd-script-add-cache-to-node-github-action/workflows/Test/badge.svg)](https://github.com/oscard0m/octoherd-script-add-cache-to-node-github-action/actions?query=workflow%3ATest+branch%3Amain) +## Usage + +Minimal usage + +```js +npx octoherd-script-add-cache-to-node-github-action +``` + +Pass all options as CLI flags to avoid user prompts + +```js +npx octoherd-script-add-cache-to-node-github-action \ + -T ghp_0123456789abcdefghjklmnopqrstuvwxyzA \ + -R "oscard0m/*" \ + --cache "npm" | "yarn" +``` + +## Options + +| option | type | description | +| ---------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `--cache` | string | Select which package manager you want to use for caching. Defaults to "npm" | +| `--octoherd-token`, `-T` | string | A personal access token ([create](https://github.com/settings/tokens/new?scopes=repo)). Script will create one if option is not set | +| `--octoherd-repos`, `-R` | array of strings | One or multiple space-separated repositories in the form of `repo-owner/repo-name`. `repo-owner/*` will find all repositories for one owner. `*` will find all repositories the user has access to. Will prompt for repositories if not set | +| `--octoherd-bypass-confirms` | boolean | Bypass prompts to confirm mutating requests | + ## Contributing See [CONTRIBUTING.md](CONTRIBUTING.md) From 59a61761bb39a018cab9c4255c28ff189cce2a02 Mon Sep 17 00:00:00 2001 From: Oscar Dominguez Date: Fri, 2 Jul 2021 23:59:57 +0200 Subject: [PATCH 08/21] ci(release): initial version --- .github/workflows/release.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7831d18 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,26 @@ +name: Release +on: + push: + branches: + - main + +jobs: + release: + name: release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 12 + - uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - run: npm ci + - run: npx semantic-release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} From 838327f02ce8a529245c224ddb51f0b211dcef0e Mon Sep 17 00:00:00 2001 From: Oscar Dominguez Date: Fri, 2 Jul 2021 23:59:57 +0200 Subject: [PATCH 09/21] ci(test): initial version --- .github/workflows/test.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..ff0d34a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,37 @@ +name: Test +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize] + +jobs: + test_matrix: + runs-on: ubuntu-latest + strategy: + matrix: + node_version: ["12", "14"] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node_version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node_version }} + - uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - run: npm ci + - run: npm test + + # The "test" step can be required in branch protection and does not + # change each time the test matrix changes. + test: + runs-on: ubuntu-latest + needs: test_matrix + steps: + - run: echo ok From c1348048acbe6c1aab86c68e8b1e3840a40aee6b Mon Sep 17 00:00:00 2001 From: Oscar Dominguez Date: Sat, 3 Jul 2021 22:59:00 +0200 Subject: [PATCH 10/21] feat(script): implement logic to modify workflows with setup-node action --- package-lock.json | 19 ++++++ package.json | 5 +- script.js | 151 +++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 173 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index bc0fecd..3629709 100644 --- a/package-lock.json +++ b/package-lock.json @@ -131,6 +131,15 @@ "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-8.1.4.tgz", "integrity": "sha512-NnGr4NNDqO5wjSDJo5nxrGtzZUwoT23YasqK2H4Pav/6vSgeVTxuqCL9Aeh+cWfTxDomj1M4Os5BrXFsvl7qiQ==" }, + "@octokit/plugin-create-or-update-text-file": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@octokit/plugin-create-or-update-text-file/-/plugin-create-or-update-text-file-1.0.3.tgz", + "integrity": "sha512-GNqgIrBpoMiX03Sd8PwjPNP/ze/EiJhSc8Bd1sLeakSbTYmVpMeCVcz7DYqRanbfnc+gM7RhEPM4GbefEPxb9Q==", + "requires": { + "@octokit/request-error": "^2.0.5", + "@octokit/types": "^6.16.1" + } + }, "@octokit/plugin-paginate-rest": { "version": "2.13.6", "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.13.6.tgz", @@ -669,6 +678,11 @@ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==" }, + "prettier": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.3.2.tgz", + "integrity": "sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==" + }, "pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", @@ -856,6 +870,11 @@ "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==" }, + "yaml": { + "version": "2.0.0-6", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.0.0-6.tgz", + "integrity": "sha512-YPUm0Z0sei53zauT7HWkkxyIBJhb9Gnf5jv4w4ahw5/v3PjFGhZOt4paXH6g9hzcMJqmNxZwoGfF1JzE2jvSgg==" + }, "yargs": { "version": "17.0.1", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.0.1.tgz", diff --git a/package.json b/package.json index 4b72c6b..1c6b63b 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,10 @@ "author": "Oscar Dominguez (https://www.oscardom.dev)", "license": "ISC", "dependencies": { - "@octoherd/cli": "^3.3.4" + "@octoherd/cli": "^3.3.4", + "@octokit/plugin-create-or-update-text-file": "^1.0.3", + "prettier": "^2.3.2", + "yaml": "^2.0.0-6" }, "devDependencies": {}, "release": { diff --git a/script.js b/script.js index 20a47bd..846e576 100644 --- a/script.js +++ b/script.js @@ -1,5 +1,16 @@ // @ts-check +import { composeCreateOrUpdateTextFile } from "@octokit/plugin-create-or-update-text-file"; +import prettier from "prettier"; +import YAML from 'yaml' + +const { parseDocument, parse, stringify, Document } = YAML + +const isYamlFile = (fileName) => { + const yamlFilePattern = /^.*\.ya?ml$/; + return yamlFilePattern.test(fileName); +}; + /** * Add cache parameter to GitHub Actions using setup-node * @@ -8,4 +19,142 @@ * @param {object} options * @param {string} [options.cache] Select which package manager you want to use for caching */ -export async function script(octokit, repository, { cache }) {} +export async function script(octokit, repository, { cache = "npm" }) { + // Global variables used throughout the code + const owner = repository.owner.login; + const repo = repository.name; + const defaultBranch = repository.default_branch; + const branchName = "add-cache-to-node-workflows"; + const path = ".github/workflows"; + + // Get info on repository branches + const { data: branches } = await octokit.request( + "GET /repos/{owner}/{repo}/branches", + { + owner, + repo, + branch: defaultBranch, + } + ); + + // Get SHA of repository's default branch + const sha = branches + .filter((branch) => branch.name === defaultBranch) + .map((branch) => branch.commit.sha)[0]; + const branchExists = branches.some((branch) => branch.name === branchName); + + // Create branch if not present + if (!branchExists) { + const ref = await octokit + .request("POST /repos/{owner}/{repo}/git/refs", { + owner, + repo, + ref: `refs/heads/${branchName}`, + sha, + }) + .then((response) => response.data.ref); + + if (!ref) { + octokit.log.warn(`Error creating branch in ${repository.html_url}`); + + return; + } + } + + // Get all files from .github/workflows folder + const { data: files } = await octokit.request( + "GET /repos/{owner}/{repo}/contents/{path}", + { + owner, + repo, + path, + } + ); + + if (!Array.isArray(files)) { + throw new Error("The path is not a folder"); //TODO + } + + const workflowFiles = files.filter((file) => isYamlFile(file.name)); + let workflowsUpdated = false; + + for (const workflowFile of workflowFiles) { + const { data, updated } = await composeCreateOrUpdateTextFile(octokit, { + owner, + repo, + path: workflowFile.path, + branch: branchName, + message: `ci(workflow): add '${cache}' cache for actions/setup-node in ${workflowFile.name}`, + content: ({ exists, content }) => { + const yamlDocument = parseDocument(content); + const jobs = yamlDocument.get('jobs') + + for(let i = 0; i < jobs.items.length; i++) { + const job = jobs.items[i].value + const steps = job.get('steps') + for(let j = 0; j Date: Sun, 4 Jul 2021 22:09:26 +0200 Subject: [PATCH 11/21] docs(readme): remove --cache command from example to avoid issues pasting the command with a pipe --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 518e502..cc95735 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,7 @@ Pass all options as CLI flags to avoid user prompts ```js npx octoherd-script-add-cache-to-node-github-action \ -T ghp_0123456789abcdefghjklmnopqrstuvwxyzA \ - -R "oscard0m/*" \ - --cache "npm" | "yarn" + -R "oscard0m/*" ``` ## Options From 699ea6a90add968cef8de9b1c6c97a7b727ec68e Mon Sep 17 00:00:00 2001 From: Oscar Dominguez Date: Sun, 4 Jul 2021 22:11:00 +0200 Subject: [PATCH 12/21] refactor(script): remove and rename global variables and add missing jsdoc --- script.js | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/script.js b/script.js index 846e576..4924231 100644 --- a/script.js +++ b/script.js @@ -2,14 +2,21 @@ import { composeCreateOrUpdateTextFile } from "@octokit/plugin-create-or-update-text-file"; import prettier from "prettier"; -import YAML from 'yaml' +import YAML from "yaml"; -const { parseDocument, parse, stringify, Document } = YAML +const { parseDocument } = YAML; -const isYamlFile = (fileName) => { - const yamlFilePattern = /^.*\.ya?ml$/; - return yamlFilePattern.test(fileName); -}; +const BRANCH_NAME = "add-cache-to-node-workflows"; +const PATH = ".github/workflows"; + +/** + * Check if a filename is a YAML file + * + * @param {string} fileName FileName to be tested + * + * @return {boolean} + */ +const isYamlFile = (fileName) => /\.ya?ml$/.test(fileName); /** * Add cache parameter to GitHub Actions using setup-node @@ -24,8 +31,6 @@ export async function script(octokit, repository, { cache = "npm" }) { const owner = repository.owner.login; const repo = repository.name; const defaultBranch = repository.default_branch; - const branchName = "add-cache-to-node-workflows"; - const path = ".github/workflows"; // Get info on repository branches const { data: branches } = await octokit.request( @@ -41,7 +46,7 @@ export async function script(octokit, repository, { cache = "npm" }) { const sha = branches .filter((branch) => branch.name === defaultBranch) .map((branch) => branch.commit.sha)[0]; - const branchExists = branches.some((branch) => branch.name === branchName); + const branchExists = branches.some((branch) => branch.name === BRANCH_NAME); // Create branch if not present if (!branchExists) { @@ -49,7 +54,7 @@ export async function script(octokit, repository, { cache = "npm" }) { .request("POST /repos/{owner}/{repo}/git/refs", { owner, repo, - ref: `refs/heads/${branchName}`, + ref: `refs/heads/${BRANCH_NAME}`, sha, }) .then((response) => response.data.ref); @@ -67,12 +72,12 @@ export async function script(octokit, repository, { cache = "npm" }) { { owner, repo, - path, + path: PATH, } ); if (!Array.isArray(files)) { - throw new Error("The path is not a folder"); //TODO + throw new Error(`"${PATH}" is not a folder in ${repository.full_name}`); } const workflowFiles = files.filter((file) => isYamlFile(file.name)); @@ -83,7 +88,7 @@ export async function script(octokit, repository, { cache = "npm" }) { owner, repo, path: workflowFile.path, - branch: branchName, + branch: BRANCH_NAME, message: `ci(workflow): add '${cache}' cache for actions/setup-node in ${workflowFile.name}`, content: ({ exists, content }) => { const yamlDocument = parseDocument(content); @@ -105,20 +110,17 @@ export async function script(octokit, repository, { cache = "npm" }) { stepWith.set('cache', cache); } } - }; + } - return prettier.format( - yamlDocument.toString(), - { - parser: "yaml", - } - ); + return prettier.format(yamlDocument.toString(), { + parser: "yaml", + }); }, }); if (updated) { octokit.log.info( - `${path} updated in ${repository.html_url} via ${data.commit.html_url}` + `${PATH} updated in ${repository.html_url} via ${data.commit.html_url}` ); workflowsUpdated = true; @@ -136,7 +138,7 @@ export async function script(octokit, repository, { cache = "npm" }) { { owner, repo, - head: branchName, + head: BRANCH_NAME, base: defaultBranch, title: "ci(workflow): add cache to workflows using actions/setup-node", } From 8c93edf9a668f0fee060ce2a135422ab59818a18 Mon Sep 17 00:00:00 2001 From: Oscar Dominguez Date: Sun, 4 Jul 2021 22:27:47 +0200 Subject: [PATCH 13/21] fix(script): if 'with' statement does not exist, create it --- script.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/script.js b/script.js index 4924231..9b67939 100644 --- a/script.js +++ b/script.js @@ -105,9 +105,13 @@ export async function script(octokit, repository, { cache = "npm" }) { if ( stepUses && stepUses.includes("actions/setup-node") && - !stepWith.get('cache') + (!stepWith || !stepWith.get("cache")) ) { - stepWith.set('cache', cache); + if (!stepWith) { + step.set("with", { cache }); + } else { + stepWith.set("cache", cache); + } } } } From e6fbc3ca71b1f56fca657dc279889b9f0264f2b7 Mon Sep 17 00:00:00 2001 From: Oscar Dominguez Date: Sun, 4 Jul 2021 22:28:17 +0200 Subject: [PATCH 14/21] refactor(script): remove label creation when opening a PR --- script.js | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/script.js b/script.js index 9b67939..0df675d 100644 --- a/script.js +++ b/script.js @@ -148,18 +148,7 @@ export async function script(octokit, repository, { cache = "npm" }) { } ); - octokit.log.info(`Create Pull Request at ${pr.html_url}`); - - // Add the "maintenance" label to the pull request - await octokit.request( - "POST /repos/{owner}/{repo}/issues/{issue_number}/labels", - { - owner, - repo, - issue_number: pr.number, - labels: ["maintenance"], - } - ); + octokit.log.info(`Pull Request created at ${pr.html_url}`); } else { octokit.log.info("There were no workflows to update"); } From 15b446bf0836894599f87f51bedd149eb12b0030 Mon Sep 17 00:00:00 2001 From: Oscar Dominguez Date: Sun, 4 Jul 2021 22:32:48 +0200 Subject: [PATCH 15/21] refactor(script): use for...of instead of for when iterating yaml file --- script.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/script.js b/script.js index 0df675d..716ef65 100644 --- a/script.js +++ b/script.js @@ -92,16 +92,14 @@ export async function script(octokit, repository, { cache = "npm" }) { message: `ci(workflow): add '${cache}' cache for actions/setup-node in ${workflowFile.name}`, content: ({ exists, content }) => { const yamlDocument = parseDocument(content); - const jobs = yamlDocument.get('jobs') - - for(let i = 0; i < jobs.items.length; i++) { - const job = jobs.items[i].value - const steps = job.get('steps') - for(let j = 0; j Date: Sun, 4 Jul 2021 22:47:46 +0200 Subject: [PATCH 16/21] fix(script): branch has to be created before adding a new git reference to that branch --- script.js | 46 +++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/script.js b/script.js index 716ef65..2d96a1e 100644 --- a/script.js +++ b/script.js @@ -32,6 +32,35 @@ export async function script(octokit, repository, { cache = "npm" }) { const repo = repository.name; const defaultBranch = repository.default_branch; + // Get all files from .github/workflows folder + let files; + try { + const { data } = await octokit.request( + "GET /repos/{owner}/{repo}/contents/{path}", + { + owner, + repo, + path: PATH, + } + ); + + files = data; + } catch (e) { + if (e.status === 404) { + octokit.log.warn(`"${PATH}" path not found in ${repository.full_name}`); + return; + } else { + throw e; + } + } + + if (!Array.isArray(files)) { + throw new Error(`"${PATH}" is not a folder in ${repository.full_name}`); + } + + const workflowFiles = files.filter((file) => isYamlFile(file.name)); + let workflowsUpdated = false; + // Get info on repository branches const { data: branches } = await octokit.request( "GET /repos/{owner}/{repo}/branches", @@ -66,23 +95,6 @@ export async function script(octokit, repository, { cache = "npm" }) { } } - // Get all files from .github/workflows folder - const { data: files } = await octokit.request( - "GET /repos/{owner}/{repo}/contents/{path}", - { - owner, - repo, - path: PATH, - } - ); - - if (!Array.isArray(files)) { - throw new Error(`"${PATH}" is not a folder in ${repository.full_name}`); - } - - const workflowFiles = files.filter((file) => isYamlFile(file.name)); - let workflowsUpdated = false; - for (const workflowFile of workflowFiles) { const { data, updated } = await composeCreateOrUpdateTextFile(octokit, { owner, From 1ab0437048371e5da4b5db13718dbbb783dda2d3 Mon Sep 17 00:00:00 2001 From: Oscar Dominguez Date: Sun, 4 Jul 2021 23:45:36 +0200 Subject: [PATCH 17/21] refactor(script): remove unused if(!ref) statement --- script.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/script.js b/script.js index 2d96a1e..0ffc4ee 100644 --- a/script.js +++ b/script.js @@ -87,12 +87,6 @@ export async function script(octokit, repository, { cache = "npm" }) { sha, }) .then((response) => response.data.ref); - - if (!ref) { - octokit.log.warn(`Error creating branch in ${repository.html_url}`); - - return; - } } for (const workflowFile of workflowFiles) { From 667332b80e85b26427032d4aac1157f45401c711 Mon Sep 17 00:00:00 2001 From: Oscar Dominguez Date: Mon, 5 Jul 2021 00:32:30 +0200 Subject: [PATCH 18/21] build(deps): add octokit-plugin-create-pull-request --- package-lock.json | 17 ++++++++--------- package.json | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3629709..ce1a420 100644 --- a/package-lock.json +++ b/package-lock.json @@ -131,15 +131,6 @@ "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-8.1.4.tgz", "integrity": "sha512-NnGr4NNDqO5wjSDJo5nxrGtzZUwoT23YasqK2H4Pav/6vSgeVTxuqCL9Aeh+cWfTxDomj1M4Os5BrXFsvl7qiQ==" }, - "@octokit/plugin-create-or-update-text-file": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@octokit/plugin-create-or-update-text-file/-/plugin-create-or-update-text-file-1.0.3.tgz", - "integrity": "sha512-GNqgIrBpoMiX03Sd8PwjPNP/ze/EiJhSc8Bd1sLeakSbTYmVpMeCVcz7DYqRanbfnc+gM7RhEPM4GbefEPxb9Q==", - "requires": { - "@octokit/request-error": "^2.0.5", - "@octokit/types": "^6.16.1" - } - }, "@octokit/plugin-paginate-rest": { "version": "2.13.6", "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.13.6.tgz", @@ -637,6 +628,14 @@ "path-key": "^2.0.0" } }, + "octokit-plugin-create-pull-request": { + "version": "3.9.3", + "resolved": "https://registry.npmjs.org/octokit-plugin-create-pull-request/-/octokit-plugin-create-pull-request-3.9.3.tgz", + "integrity": "sha512-lTyNnCRoT4IvCQx2Cb4eFMqg8aIpsaDd59MNwf4OPnWAJM7hT6g7RW/icImvAzZLR4t5ENSLNzWarv2XqLL+Lg==", + "requires": { + "@octokit/types": "^6.8.2" + } + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", diff --git a/package.json b/package.json index 1c6b63b..723699c 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "license": "ISC", "dependencies": { "@octoherd/cli": "^3.3.4", - "@octokit/plugin-create-or-update-text-file": "^1.0.3", + "octokit-plugin-create-pull-request": "^3.9.3", "prettier": "^2.3.2", "yaml": "^2.0.0-6" }, From dd06aeeb307b1b3154f6a48f3f36f9a3a95e516a Mon Sep 17 00:00:00 2001 From: Oscar Dominguez Date: Mon, 5 Jul 2021 00:34:53 +0200 Subject: [PATCH 19/21] feat(script): integrate logic with octokit-plugin-create-pull-request --- script.js | 136 ++++++++++++++++++------------------------------------ 1 file changed, 45 insertions(+), 91 deletions(-) diff --git a/script.js b/script.js index 0ffc4ee..a144d76 100644 --- a/script.js +++ b/script.js @@ -1,6 +1,6 @@ // @ts-check -import { composeCreateOrUpdateTextFile } from "@octokit/plugin-create-or-update-text-file"; +import { composeCreatePullRequest } from "octokit-plugin-create-pull-request"; import prettier from "prettier"; import YAML from "yaml"; @@ -59,101 +59,55 @@ export async function script(octokit, repository, { cache = "npm" }) { } const workflowFiles = files.filter((file) => isYamlFile(file.name)); - let workflowsUpdated = false; + const filesToEdit = {}; - // Get info on repository branches - const { data: branches } = await octokit.request( - "GET /repos/{owner}/{repo}/branches", - { - owner, - repo, - branch: defaultBranch, - } - ); - - // Get SHA of repository's default branch - const sha = branches - .filter((branch) => branch.name === defaultBranch) - .map((branch) => branch.commit.sha)[0]; - const branchExists = branches.some((branch) => branch.name === BRANCH_NAME); - - // Create branch if not present - if (!branchExists) { - const ref = await octokit - .request("POST /repos/{owner}/{repo}/git/refs", { - owner, - repo, - ref: `refs/heads/${BRANCH_NAME}`, - sha, - }) - .then((response) => response.data.ref); - } - - for (const workflowFile of workflowFiles) { - const { data, updated } = await composeCreateOrUpdateTextFile(octokit, { - owner, - repo, - path: workflowFile.path, - branch: BRANCH_NAME, - message: `ci(workflow): add '${cache}' cache for actions/setup-node in ${workflowFile.name}`, - content: ({ exists, content }) => { - const yamlDocument = parseDocument(content); - const jobs = yamlDocument.get("jobs"); - - for (const { value: job } of jobs.items) { - const steps = job.get("steps"); - for (const step of steps.items) { - const stepUses = step.get("uses"); - const stepWith = step.get("with"); - - if ( - stepUses && - stepUses.includes("actions/setup-node") && - (!stepWith || !stepWith.get("cache")) - ) { - if (!stepWith) { - step.set("with", { cache }); - } else { - stepWith.set("cache", cache); - } + workflowFiles.forEach((element) => { + filesToEdit[element.path] = ({ content, encoding }) => { + const yamlDocument = parseDocument( + Buffer.from(content, encoding).toString("utf-8") + ); + const jobs = yamlDocument.get("jobs"); + + for (const { value: job } of jobs.items) { + const steps = job.get("steps"); + for (const step of steps.items) { + const stepUses = step.get("uses"); + const stepWith = step.get("with"); + + if ( + stepUses && + stepUses.includes("actions/setup-node") && + (!stepWith || !stepWith.get("cache")) + ) { + if (!stepWith) { + step.set("with", { cache }); + } else { + stepWith.set("cache", cache); } } } + } - return prettier.format(yamlDocument.toString(), { - parser: "yaml", - }); - }, - }); - - if (updated) { - octokit.log.info( - `${PATH} updated in ${repository.html_url} via ${data.commit.html_url}` - ); - - workflowsUpdated = true; - } - } - - if (workflowsUpdated) { - // - // Pull Request - // - - // Create pull request - const { data: pr } = await octokit.request( - "POST /repos/{owner}/{repo}/pulls", + return prettier.format(yamlDocument.toString(), { + parser: "yaml", + }); + }; + }); + + const { data: pr } = await composeCreatePullRequest(octokit, { + owner, + repo, + title: "ci(workflow): add cache to workflows using actions/setup-node", + body: "Add cache to workflows using actions/setup-node", + base: defaultBranch, + head: BRANCH_NAME, + changes: [ { - owner, - repo, - head: BRANCH_NAME, - base: defaultBranch, - title: "ci(workflow): add cache to workflows using actions/setup-node", - } - ); + files: filesToEdit, + commit: `ci(workflow): add '${cache}' cache for actions/setup-node in ${PATH}`, + }, + ], + }); - octokit.log.info(`Pull Request created at ${pr.html_url}`); - } else { - octokit.log.info("There were no workflows to update"); - } + octokit.log.info(`Pull Request created at ${pr.html_url}`); } From 142cf159812db3264c82e8c470e0268796099a44 Mon Sep 17 00:00:00 2001 From: Oscar Dominguez Date: Mon, 5 Jul 2021 00:56:10 +0200 Subject: [PATCH 20/21] fix(script): do not open PR if no cache statement added to any workflow --- script.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/script.js b/script.js index a144d76..f0ce60e 100644 --- a/script.js +++ b/script.js @@ -67,6 +67,7 @@ export async function script(octokit, repository, { cache = "npm" }) { Buffer.from(content, encoding).toString("utf-8") ); const jobs = yamlDocument.get("jobs"); + let cacheAdded = false; for (const { value: job } of jobs.items) { const steps = job.get("steps"); @@ -84,30 +85,41 @@ export async function script(octokit, repository, { cache = "npm" }) { } else { stepWith.set("cache", cache); } + + cacheAdded = true; } } } - return prettier.format(yamlDocument.toString(), { - parser: "yaml", - }); + return cacheAdded + ? prettier.format(yamlDocument.toString(), { + parser: "yaml", + }) + : null; }; }); - const { data: pr } = await composeCreatePullRequest(octokit, { + const prCreated = await composeCreatePullRequest(octokit, { owner, repo, title: "ci(workflow): add cache to workflows using actions/setup-node", body: "Add cache to workflows using actions/setup-node", base: defaultBranch, head: BRANCH_NAME, + createWhenEmpty: false, changes: [ { files: filesToEdit, commit: `ci(workflow): add '${cache}' cache for actions/setup-node in ${PATH}`, + emptyCommit: false, }, ], }); - octokit.log.info(`Pull Request created at ${pr.html_url}`); + if (!prCreated) { + octokit.log.warn(`No Pull Request created for ${repository.full_name}`); + return; + } + + octokit.log.info(`Pull Request created at ${prCreated.data.html_url}`); } From 69b6a9b0fe0853e286f37be54d586be304620915 Mon Sep 17 00:00:00 2001 From: Oscar Dominguez Date: Mon, 5 Jul 2021 01:19:15 +0200 Subject: [PATCH 21/21] feat(script): improve PR body opened by this script --- script.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/script.js b/script.js index f0ce60e..70e024b 100644 --- a/script.js +++ b/script.js @@ -103,7 +103,20 @@ export async function script(octokit, repository, { cache = "npm" }) { owner, repo, title: "ci(workflow): add cache to workflows using actions/setup-node", - body: "Add cache to workflows using actions/setup-node", + body: `## Description + +Add \`cache\` to workflows using \`actions/setup-node\` + +## Context + +\`setup-node\` GitHub Action just released a new option to add cache to steps using it. + +You can find the details here: https://github.blog/changelog/2021-07-02-github-actions-setup-node-now-supports-dependency-caching/ + +--- + +🤖 This PR has been generated automatically by [this octoherd script](https://github.com/oscard0m/octoherd-script-add-cache-to-node-github-action), feel free to run it in your GitHub user/org repositories! 💪🏾 +`, base: defaultBranch, head: BRANCH_NAME, createWhenEmpty: false,