├── .github └── workflows │ └── ci.yml ├── .gitignore ├── .prettierrc ├── LICENSE ├── README.md ├── package.json ├── pnpm-lock.yaml ├── renovate.json ├── src ├── cli.ts ├── index.ts └── lib.ts └── tsconfig.json /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: Node.js CI 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | pull_request: 7 | branches: [main] 8 | 9 | jobs: 10 | test: 11 | if: "!contains(github.event.head_commit.message, 'ci skip')" 12 | 13 | strategy: 14 | matrix: 15 | os: [ubuntu-latest] 16 | 17 | runs-on: ${{ matrix.os }} 18 | 19 | # Steps represent a sequence of tasks that will be executed as part of the job 20 | steps: 21 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 22 | - uses: actions/checkout@v2 23 | 24 | - uses: actions/setup-node@v2 25 | with: 26 | node-version: 14.x 27 | 28 | - name: Cache ~/.pnpm-store 29 | uses: actions/cache@v2 30 | env: 31 | cache-name: cache-pnpm-store 32 | with: 33 | path: ~/.pnpm-store 34 | key: ${{ runner.os }}-${{ matrix.node-version }}-build-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }} 35 | restore-keys: | 36 | ${{ runner.os }}-${{ matrix.node-version }}-build-${{ env.cache-name }}- 37 | ${{ runner.os }}-${{ matrix.node-version }}-build- 38 | ${{ runner.os }}- 39 | - name: Install pnpm 40 | run: npm i -g pnpm 41 | 42 | - name: Install deps 43 | run: pnpm i 44 | 45 | # Runs a set of commands using the runners shell 46 | - name: Build and Test 47 | run: npm run test 48 | 49 | - name: Release 50 | run: pnpx -y semantic-release --branches main 51 | env: 52 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 53 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} 54 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | dist 4 | *.log 5 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | "@egoist/prettier-config" 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright © 2021 EGOIST (https://github.com/sponsors/egoist) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **💛 You can help the author become a full-time open-source maintainer by [sponsoring him on GitHub](https://github.com/sponsors/egoist).** 2 | 3 | --- 4 | 5 | # aho 6 | 7 | [![npm version](https://badgen.net/npm/v/aho)](https://npm.im/aho) [![npm downloads](https://badgen.net/npm/dm/aho)](https://npm/im/aho) [![install size](https://packagephobia.com/badge?p=aho)](https://packagephobia.com/result?p=aho) 8 | 9 | > ultra simple project scaffolding 10 | 11 | ## Usage 12 | 13 | ```bash 14 | # NPM 15 | npx aho user/repo [destination] 16 | # PNPM 17 | pnpm dlx aho user/repo [destination] 18 | ``` 19 | 20 | ## Flags 21 | 22 | ### `aho [destination]` 23 | 24 | Generate a project from `` to `[destination]`, destination defaults to current directory. 25 | 26 | `` is in the format of `user/repo#branch_or_tag`, currently only GitHub repositories are supported. `#branch_or_tag` is optional. 27 | 28 | You can also download a sub folder from the repo: `user/repo/sub_folder#dev`. 29 | 30 | ### `--force` 31 | 32 | By default the command would abort if destination is not empty, use `--force` if you want to empty the dir before writing to it. 33 | 34 | ## Sponsors 35 | 36 | [![sponsors](https://sponsors-images.egoist.sh/sponsors.svg)](https://github.com/sponsors/egoist) 37 | 38 | ## License 39 | 40 | MIT © [EGOIST](https://github.com/sponsors/egoist) 41 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aho", 3 | "version": "0.0.0", 4 | "description": "ultra simple project scaffolding", 5 | "publishConfig": { 6 | "access": "public" 7 | }, 8 | "type": "module", 9 | "bin": "./dist/cli.js", 10 | "files": [ 11 | "dist" 12 | ], 13 | "scripts": { 14 | "build": "rm -rf dist && tsup src/cli.ts --format esm --target node14", 15 | "test": "echo lol", 16 | "prepublishOnly": "npm run build" 17 | }, 18 | "license": "MIT", 19 | "devDependencies": { 20 | "@egoist/prettier-config": "1.0.0", 21 | "@types/node": "^16.11.7", 22 | "cac": "^6.7.12", 23 | "fast-glob": "^3.2.7", 24 | "node-fetch": "^3.1.0", 25 | "prettier": "2.5.1", 26 | "tsno": "^1.5.0", 27 | "tsup": "5.11.9", 28 | "typescript": "4.5.4" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /pnpm-lock.yaml: -------------------------------------------------------------------------------- 1 | lockfileVersion: 5.3 2 | 3 | specifiers: 4 | '@egoist/prettier-config': 1.0.0 5 | '@types/node': ^16.11.7 6 | cac: ^6.7.12 7 | fast-glob: ^3.2.7 8 | node-fetch: ^3.1.0 9 | prettier: 2.5.1 10 | tsno: ^1.5.0 11 | tsup: 5.11.9 12 | typescript: 4.5.4 13 | 14 | devDependencies: 15 | '@egoist/prettier-config': 1.0.0 16 | '@types/node': 16.11.7 17 | cac: 6.7.12 18 | fast-glob: 3.2.7 19 | node-fetch: 3.1.0 20 | prettier: 2.5.1 21 | tsno: 1.5.0 22 | tsup: 5.11.9_typescript@4.5.4 23 | typescript: 4.5.4 24 | 25 | packages: 26 | 27 | /@babel/code-frame/7.12.13: 28 | resolution: {integrity: sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==} 29 | dependencies: 30 | '@babel/highlight': 7.13.10 31 | dev: true 32 | 33 | /@babel/helper-validator-identifier/7.12.11: 34 | resolution: {integrity: sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==} 35 | dev: true 36 | 37 | /@babel/highlight/7.13.10: 38 | resolution: {integrity: sha512-5aPpe5XQPzflQrFwL1/QoeHkP2MsA4JCntcXHRhEsdsfPVkvPi2w7Qix4iV7t5S/oC9OodGrggd8aco1g3SZFg==} 39 | dependencies: 40 | '@babel/helper-validator-identifier': 7.12.11 41 | chalk: 2.4.2 42 | js-tokens: 4.0.0 43 | dev: true 44 | 45 | /@egoist/prettier-config/1.0.0: 46 | resolution: {integrity: sha512-D1Tp9Jv4aVoEo3cOAO966gFCI0wx/1lZ6sEHX8uMAfyVxuxD2+knGxhfGlb/FNLxWV3ifSI5hOmB/zFfsi7Rzw==} 47 | dev: true 48 | 49 | /@nodelib/fs.scandir/2.1.4: 50 | resolution: {integrity: sha512-33g3pMJk3bg5nXbL/+CY6I2eJDzZAni49PfJnL5fghPTggPvBd/pFNSgJsdAgWptuFu7qq/ERvOYFlhvsLTCKA==} 51 | engines: {node: '>= 8'} 52 | dependencies: 53 | '@nodelib/fs.stat': 2.0.4 54 | run-parallel: 1.2.0 55 | dev: true 56 | 57 | /@nodelib/fs.stat/2.0.4: 58 | resolution: {integrity: sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q==} 59 | engines: {node: '>= 8'} 60 | dev: true 61 | 62 | /@nodelib/fs.walk/1.2.6: 63 | resolution: {integrity: sha512-8Broas6vTtW4GIXTAHDoE32hnN2M5ykgCpWGbuXHQ15vEMqr23pB76e/GZcYsZCHALv50ktd24qhEyKr6wBtow==} 64 | engines: {node: '>= 8'} 65 | dependencies: 66 | '@nodelib/fs.scandir': 2.1.4 67 | fastq: 1.11.0 68 | dev: true 69 | 70 | /@types/node/16.11.7: 71 | resolution: {integrity: sha512-QB5D2sqfSjCmTuWcBWyJ+/44bcjO7VbjSbOE0ucoVbAsSNQc4Lt6QkgkVXkTDwkL4z/beecZNDvVX15D4P8Jbw==} 72 | dev: true 73 | 74 | /@types/parse-json/4.0.0: 75 | resolution: {integrity: sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==} 76 | dev: true 77 | 78 | /ansi-styles/3.2.1: 79 | resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==} 80 | engines: {node: '>=4'} 81 | dependencies: 82 | color-convert: 1.9.3 83 | dev: true 84 | 85 | /any-promise/1.3.0: 86 | resolution: {integrity: sha1-q8av7tzqUugJzcA3au0845Y10X8=} 87 | dev: true 88 | 89 | /anymatch/3.1.1: 90 | resolution: {integrity: sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==} 91 | engines: {node: '>= 8'} 92 | dependencies: 93 | normalize-path: 3.0.0 94 | picomatch: 2.3.0 95 | dev: true 96 | 97 | /array-union/2.1.0: 98 | resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} 99 | engines: {node: '>=8'} 100 | dev: true 101 | 102 | /balanced-match/1.0.0: 103 | resolution: {integrity: sha1-ibTRmasr7kneFk6gK4nORi1xt2c=} 104 | dev: true 105 | 106 | /binary-extensions/2.2.0: 107 | resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==} 108 | engines: {node: '>=8'} 109 | dev: true 110 | 111 | /brace-expansion/1.1.11: 112 | resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} 113 | dependencies: 114 | balanced-match: 1.0.0 115 | concat-map: 0.0.1 116 | dev: true 117 | 118 | /braces/3.0.2: 119 | resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==} 120 | engines: {node: '>=8'} 121 | dependencies: 122 | fill-range: 7.0.1 123 | dev: true 124 | 125 | /bundle-require/1.4.1_esbuild@0.13.9: 126 | resolution: {integrity: sha512-UUcJPJHas04OW2zJNBK8oh1+baV8sDF6EJvoG39dKtoNBMeXYYF4mjD7LVtxSDPpbtK0cA7r+d30n+32qnx98Q==} 127 | peerDependencies: 128 | esbuild: ^0.13.4 129 | dependencies: 130 | esbuild: 0.13.9 131 | dev: true 132 | 133 | /bundle-require/2.2.0_esbuild@0.14.8: 134 | resolution: {integrity: sha512-JDVxYEAxEX1g8AWtadiIkCkFf42RulEl5AOIvUa4cpuEL/VKpK2lJwogyswHnp+qizNQxM0Ylamw7CjPRaJZuA==} 135 | peerDependencies: 136 | esbuild: '>=0.13' 137 | dependencies: 138 | esbuild: 0.14.8 139 | dev: true 140 | 141 | /cac/6.7.12: 142 | resolution: {integrity: sha512-rM7E2ygtMkJqD9c7WnFU6fruFcN3xe4FM5yUmgxhZzIKJk4uHl9U/fhwdajGFQbQuv43FAUo1Fe8gX/oIKDeSA==} 143 | engines: {node: '>=8'} 144 | dev: true 145 | 146 | /callsites/3.1.0: 147 | resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} 148 | engines: {node: '>=6'} 149 | dev: true 150 | 151 | /chalk/2.4.2: 152 | resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} 153 | engines: {node: '>=4'} 154 | dependencies: 155 | ansi-styles: 3.2.1 156 | escape-string-regexp: 1.0.5 157 | supports-color: 5.5.0 158 | dev: true 159 | 160 | /chokidar/3.5.1: 161 | resolution: {integrity: sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==} 162 | engines: {node: '>= 8.10.0'} 163 | dependencies: 164 | anymatch: 3.1.1 165 | braces: 3.0.2 166 | glob-parent: 5.1.2 167 | is-binary-path: 2.1.0 168 | is-glob: 4.0.1 169 | normalize-path: 3.0.0 170 | readdirp: 3.5.0 171 | optionalDependencies: 172 | fsevents: 2.3.2 173 | dev: true 174 | 175 | /color-convert/1.9.3: 176 | resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} 177 | dependencies: 178 | color-name: 1.1.3 179 | dev: true 180 | 181 | /color-name/1.1.3: 182 | resolution: {integrity: sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=} 183 | dev: true 184 | 185 | /commander/4.1.1: 186 | resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==} 187 | engines: {node: '>= 6'} 188 | dev: true 189 | 190 | /concat-map/0.0.1: 191 | resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=} 192 | dev: true 193 | 194 | /cosmiconfig/7.0.0: 195 | resolution: {integrity: sha512-pondGvTuVYDk++upghXJabWzL6Kxu6f26ljFw64Swq9v6sQPUL3EUlVDV56diOjpCayKihL6hVe8exIACU4XcA==} 196 | engines: {node: '>=10'} 197 | dependencies: 198 | '@types/parse-json': 4.0.0 199 | import-fresh: 3.3.0 200 | parse-json: 5.2.0 201 | path-type: 4.0.0 202 | yaml: 1.10.2 203 | dev: true 204 | 205 | /cross-spawn/7.0.3: 206 | resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} 207 | engines: {node: '>= 8'} 208 | dependencies: 209 | path-key: 3.1.1 210 | shebang-command: 2.0.0 211 | which: 2.0.2 212 | dev: true 213 | 214 | /data-uri-to-buffer/4.0.0: 215 | resolution: {integrity: sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA==} 216 | engines: {node: '>= 12'} 217 | dev: true 218 | 219 | /debug/4.3.1: 220 | resolution: {integrity: sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==} 221 | engines: {node: '>=6.0'} 222 | peerDependencies: 223 | supports-color: '*' 224 | peerDependenciesMeta: 225 | supports-color: 226 | optional: true 227 | dependencies: 228 | ms: 2.1.2 229 | dev: true 230 | 231 | /dir-glob/3.0.1: 232 | resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} 233 | engines: {node: '>=8'} 234 | dependencies: 235 | path-type: 4.0.0 236 | dev: true 237 | 238 | /error-ex/1.3.2: 239 | resolution: {integrity: sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==} 240 | dependencies: 241 | is-arrayish: 0.2.1 242 | dev: true 243 | 244 | /esbuild-android-arm64/0.13.9: 245 | resolution: {integrity: sha512-Ty0hKldtjJVLHwUwbKR4GFPiXBo5iQ3aE1OLBar9lh3myaRkUGEb+Ypl74LEKa0+t/9lS3Ev1N5+5P2Sq6UvNQ==} 246 | cpu: [arm64] 247 | os: [android] 248 | requiresBuild: true 249 | dev: true 250 | optional: true 251 | 252 | /esbuild-android-arm64/0.14.8: 253 | resolution: {integrity: sha512-tAEoSHnPBSH0cCAFa/aYs3LPsoTY4SwsP6wDKi4PaelbQYNJjqNpAeweyJ8l98g1D6ZkLyqsHbkYj+209sezkA==} 254 | cpu: [arm64] 255 | os: [android] 256 | requiresBuild: true 257 | dev: true 258 | optional: true 259 | 260 | /esbuild-darwin-64/0.13.9: 261 | resolution: {integrity: sha512-Ay0/b98v0oYp3ApXNQ7QPbaSkCT9WjBU6h8bMB1SYrQ/PmHgwph91fb9V0pfOLKK1rYWypfrNbI0MyT2tWN+rQ==} 262 | cpu: [x64] 263 | os: [darwin] 264 | requiresBuild: true 265 | dev: true 266 | optional: true 267 | 268 | /esbuild-darwin-64/0.14.8: 269 | resolution: {integrity: sha512-t7p7WzTb+ybiD/irkMt5j/NzB+jY+8yPTsrXk5zCOH1O7DdthRnAUJ7pJPwImdL7jAGRbLtYRxUPgCHs/0qUPw==} 270 | cpu: [x64] 271 | os: [darwin] 272 | requiresBuild: true 273 | dev: true 274 | optional: true 275 | 276 | /esbuild-darwin-arm64/0.13.9: 277 | resolution: {integrity: sha512-nJB8chaJdWathCe6EyIiMIqfyEzbuXPyNsPlL3bYRB1zFCF8feXT874D4IHbJ/w8B6BpY3sM1Clr/I/DK8E4ow==} 278 | cpu: [arm64] 279 | os: [darwin] 280 | requiresBuild: true 281 | dev: true 282 | optional: true 283 | 284 | /esbuild-darwin-arm64/0.14.8: 285 | resolution: {integrity: sha512-5FeaT2zMUajKnBwUMSsjZev5iA38YHrDmXhkOCwZQIFUvhqojinqCrvv/X7dyxb1987bcY9KGwJ+EwDwd922HQ==} 286 | cpu: [arm64] 287 | os: [darwin] 288 | requiresBuild: true 289 | dev: true 290 | optional: true 291 | 292 | /esbuild-freebsd-64/0.13.9: 293 | resolution: {integrity: sha512-ktaBujf12XLkVXLGx7WjFcmh1tt34tm7gP4pHkhvbzbHrq+BbXwcl4EsW+5JT9VNKl7slOGf4Qnua/VW7ZcnIw==} 294 | cpu: [x64] 295 | os: [freebsd] 296 | requiresBuild: true 297 | dev: true 298 | optional: true 299 | 300 | /esbuild-freebsd-64/0.14.8: 301 | resolution: {integrity: sha512-pGHBLSf7ynfyDZXUtbq/GsA2VIwQlWXrUj1AMcE0id47mRdEUM8/1ZuqMGZx63hRnNgtK9zNJ8OIu2c7qq76Qw==} 302 | cpu: [x64] 303 | os: [freebsd] 304 | requiresBuild: true 305 | dev: true 306 | optional: true 307 | 308 | /esbuild-freebsd-arm64/0.13.9: 309 | resolution: {integrity: sha512-vVa5zps4dmwpXwv/amxVpIWvFJuUPWQkpV+PYtZUW9lqjXsQ3LBHP51Q1cXZZBIrqwszLsEyJPa5GuDOY15hzQ==} 310 | cpu: [arm64] 311 | os: [freebsd] 312 | requiresBuild: true 313 | dev: true 314 | optional: true 315 | 316 | /esbuild-freebsd-arm64/0.14.8: 317 | resolution: {integrity: sha512-g4GgAnrx6Gh1BjKJjJWgPnOR4tW2FcAx9wFvyUjRsIjB35gT+aAFR+P/zStu5OG9LnbS8Pvjd4wS68QIXk+2dA==} 318 | cpu: [arm64] 319 | os: [freebsd] 320 | requiresBuild: true 321 | dev: true 322 | optional: true 323 | 324 | /esbuild-linux-32/0.13.9: 325 | resolution: {integrity: sha512-HxoW9QNqhO8VW1l7aBiYQH4lobeHq85+blZ4nlZ7sg5CNhGRRwnMlV6S08VYKz6V0YKnHb5OqJxx2HZuTZ7tgQ==} 326 | cpu: [ia32] 327 | os: [linux] 328 | requiresBuild: true 329 | dev: true 330 | optional: true 331 | 332 | /esbuild-linux-32/0.14.8: 333 | resolution: {integrity: sha512-wPfQJadF5vTzriw/B8Ide74PeAJlZW7czNx3NIUHkHlXb+En1SeIqNzl6jG9DuJUl57xD9Ucl9YJFEkFeX8eLg==} 334 | cpu: [ia32] 335 | os: [linux] 336 | requiresBuild: true 337 | dev: true 338 | optional: true 339 | 340 | /esbuild-linux-64/0.13.9: 341 | resolution: {integrity: sha512-L+eAR8o1lAUr9g64RXnBLuWZjAItAOWSUpvkchpa6QvSnXFA/nG6PgGsOBEqhDXl9qYEpGI0ReDrFkf8ByapvQ==} 342 | cpu: [x64] 343 | os: [linux] 344 | requiresBuild: true 345 | dev: true 346 | optional: true 347 | 348 | /esbuild-linux-64/0.14.8: 349 | resolution: {integrity: sha512-+RNuLk9RhRDL2kG+KTEYl5cIgF6AGLkRnKKWEu9DpCZaickONEqrKyQSVn410Hj105DLdW6qvIXQQHPycJhExg==} 350 | cpu: [x64] 351 | os: [linux] 352 | requiresBuild: true 353 | dev: true 354 | optional: true 355 | 356 | /esbuild-linux-arm/0.13.9: 357 | resolution: {integrity: sha512-DT0S+ufCVXatPZHjkCaBgZSFIV8FzY4GEHz/BlkitTWzUvT1dIUXjPIRPnqBUVa+0AyS1bZSfHzv9hTT4LHz7A==} 358 | cpu: [arm] 359 | os: [linux] 360 | requiresBuild: true 361 | dev: true 362 | optional: true 363 | 364 | /esbuild-linux-arm/0.14.8: 365 | resolution: {integrity: sha512-HIct38SvUAIJbiTwV/PVQroimQo96TGtzRDAEZxTorB4vsAj1r8bd0keXExPU4RH7G0zIqC4loQQpWYL+nH4Vg==} 366 | cpu: [arm] 367 | os: [linux] 368 | requiresBuild: true 369 | dev: true 370 | optional: true 371 | 372 | /esbuild-linux-arm64/0.13.9: 373 | resolution: {integrity: sha512-IjbhZpW5VQYK4nVI4dj/mLvH5oXAIf57OI8BYVkCqrdVXJwR8nVrSqux3zJSY+ElrkOK3DtG9iTPpmqvBXaU0g==} 374 | cpu: [arm64] 375 | os: [linux] 376 | requiresBuild: true 377 | dev: true 378 | optional: true 379 | 380 | /esbuild-linux-arm64/0.14.8: 381 | resolution: {integrity: sha512-BtWoKNYul9UoxUvQUSdSrvSmJyFL1sGnNPTSqWCg1wMe4kmc8UY2yVsXSSkKO8N2jtHxlgFyz/XhvNBzEwGVcw==} 382 | cpu: [arm64] 383 | os: [linux] 384 | requiresBuild: true 385 | dev: true 386 | optional: true 387 | 388 | /esbuild-linux-mips64le/0.13.9: 389 | resolution: {integrity: sha512-ec9RgAM4r+fe1ZmG16qeMwEHdcIvqeW8tpnpkfSQu9T4487KtQF6lg3TQasTarrLLEe7Qpy+E+r4VwC8eeZySQ==} 390 | cpu: [mips64el] 391 | os: [linux] 392 | requiresBuild: true 393 | dev: true 394 | optional: true 395 | 396 | /esbuild-linux-mips64le/0.14.8: 397 | resolution: {integrity: sha512-0DxnCl9XTvaQtsX6Qa+Phr5i9b04INwwSv2RbQ2UWRLoQ/037iaFzbmuhgrcmaGOcRwPkCa+4Qo5EgI01MUgsQ==} 398 | cpu: [mips64el] 399 | os: [linux] 400 | requiresBuild: true 401 | dev: true 402 | optional: true 403 | 404 | /esbuild-linux-ppc64le/0.13.9: 405 | resolution: {integrity: sha512-7b2/wg8T1n/L1BgCWlMSez0aXfGkNjFuOqMBQdnTti3LRuUwzGJcrhRf/FdZGJ5/evML9mqu60vLRuXW1TdXCg==} 406 | cpu: [ppc64] 407 | os: [linux] 408 | requiresBuild: true 409 | dev: true 410 | optional: true 411 | 412 | /esbuild-linux-ppc64le/0.14.8: 413 | resolution: {integrity: sha512-Uzr/OMj97Q0qoWLXCvXCKUY/z1SNI4iSZEuYylM5Nd71HGStL32XWq/MReJ0PYMvUMKKJicKSKw2jWM1uBQ84Q==} 414 | cpu: [ppc64] 415 | os: [linux] 416 | requiresBuild: true 417 | dev: true 418 | optional: true 419 | 420 | /esbuild-linux-s390x/0.14.8: 421 | resolution: {integrity: sha512-vURka7aCA5DrRoOqOn6pXYwFlDSoQ4qnqam8AC0Ikn6tibutuhgar6M3Ek2DCuz9yqd396mngdYr5A8x2TPkww==} 422 | cpu: [s390x] 423 | os: [linux] 424 | requiresBuild: true 425 | dev: true 426 | optional: true 427 | 428 | /esbuild-netbsd-64/0.13.9: 429 | resolution: {integrity: sha512-PiZu3h4+Szj0iZPgvuD2Y0isOXnlNetmF6jMcOwW54BScwynW24/baE+z7PfDyNFgjV04Ga2THdcpbKBDhgWQw==} 430 | cpu: [x64] 431 | os: [netbsd] 432 | requiresBuild: true 433 | dev: true 434 | optional: true 435 | 436 | /esbuild-netbsd-64/0.14.8: 437 | resolution: {integrity: sha512-tjyDak2/pp0VUAhBW6/ueuReMd5qLHNlisXl5pq0Xn0z+kH9urA/t1igm0JassWbdMz123td5ZEQWoD9KbtOAw==} 438 | cpu: [x64] 439 | os: [netbsd] 440 | requiresBuild: true 441 | dev: true 442 | optional: true 443 | 444 | /esbuild-openbsd-64/0.13.9: 445 | resolution: {integrity: sha512-SJKN4Ez+ilY7mu+1gAdGQ9N6dktBfbEkiOAvw+hT7xHrNnTnrTGH0FT4qx9dazB9HX6D04L4PXmVOyynqi+oEQ==} 446 | cpu: [x64] 447 | os: [openbsd] 448 | requiresBuild: true 449 | dev: true 450 | optional: true 451 | 452 | /esbuild-openbsd-64/0.14.8: 453 | resolution: {integrity: sha512-zAKKV15fIyAuDDga5rQv0lW2ufBWj/OCjqjDBb3dJf5SfoAi/DMIHuzmkKQeDQ+oxt9Rp1D7ZOlOBVflutFTqQ==} 454 | cpu: [x64] 455 | os: [openbsd] 456 | requiresBuild: true 457 | dev: true 458 | optional: true 459 | 460 | /esbuild-sunos-64/0.13.9: 461 | resolution: {integrity: sha512-9N0RjZ7cElE8ifrS0nBrLQgBMQNPiIIKO2GzLXy7Ms8AM3KjfLiV2G2+9O0B9paXjRAHchIwazTeOyeWb1vyWA==} 462 | cpu: [x64] 463 | os: [sunos] 464 | requiresBuild: true 465 | dev: true 466 | optional: true 467 | 468 | /esbuild-sunos-64/0.14.8: 469 | resolution: {integrity: sha512-xV41Wa8imziM/2dbWZjLKQbIETRgo5dE0oc/uPsgaecJhsrdA0VkGa/V432LJSUYv967xHDQdoRRl5tr80+NnQ==} 470 | cpu: [x64] 471 | os: [sunos] 472 | requiresBuild: true 473 | dev: true 474 | optional: true 475 | 476 | /esbuild-windows-32/0.13.9: 477 | resolution: {integrity: sha512-awxWs1kns+RfjhqBbTbdlePjqZrAE2XMaAQJNg9dtu+C7ghC3QKsqXbu0C26OuF5YeAdJcq9q+IdG6WPLjvj9w==} 478 | cpu: [ia32] 479 | os: [win32] 480 | requiresBuild: true 481 | dev: true 482 | optional: true 483 | 484 | /esbuild-windows-32/0.14.8: 485 | resolution: {integrity: sha512-AxpdeLKQSyCZo7MzdOyV4OgEbEJcjnrS/2niAjbHESbjuS5P1DN/5vZoJ/JSWDVa/40OkBuHBhAXMx1HK3UDsg==} 486 | cpu: [ia32] 487 | os: [win32] 488 | requiresBuild: true 489 | dev: true 490 | optional: true 491 | 492 | /esbuild-windows-64/0.13.9: 493 | resolution: {integrity: sha512-VmA9GQMCzOr8rFfD72Dum1+AWhJui7ZO6sYwp6rBHYu4vLmWITTSUsd/zgXXmZuHBPkkvxLJLF8XsKFCRKflJA==} 494 | cpu: [x64] 495 | os: [win32] 496 | requiresBuild: true 497 | dev: true 498 | optional: true 499 | 500 | /esbuild-windows-64/0.14.8: 501 | resolution: {integrity: sha512-/3pllNoy8mrz/E1rYalwiwwhzJBrYQhEapwAteHZbFVhGzYuB8F80e8x5eA8dhFHxDiZh1VzK+hREwwSt8UTQA==} 502 | cpu: [x64] 503 | os: [win32] 504 | requiresBuild: true 505 | dev: true 506 | optional: true 507 | 508 | /esbuild-windows-arm64/0.13.9: 509 | resolution: {integrity: sha512-P/jPY2JwmTpgEPh9BkXpCe690tcDSSo0K9BHTniSeEAEz26kPpqldVa4XDm0R+hNnFA7ecEgNskr4QAxE1ry0w==} 510 | cpu: [arm64] 511 | os: [win32] 512 | requiresBuild: true 513 | dev: true 514 | optional: true 515 | 516 | /esbuild-windows-arm64/0.14.8: 517 | resolution: {integrity: sha512-lTm5naoNgaUvzIiax3XYIEebqwr3bIIEEtqUhzQ2UQ+JMBmvhr02w3sJIJqF3axTX6TgWrC1OtM7DYNvFG+aXA==} 518 | cpu: [arm64] 519 | os: [win32] 520 | requiresBuild: true 521 | dev: true 522 | optional: true 523 | 524 | /esbuild/0.13.9: 525 | resolution: {integrity: sha512-8bYcckmisXjGvBMeylp1PRtu21uOoCDFAgXGGF2BR241zYQDN6ZLNvcmQlnQ7olG0p6PRWmJI8WVH3ca8viPuw==} 526 | hasBin: true 527 | requiresBuild: true 528 | optionalDependencies: 529 | esbuild-android-arm64: 0.13.9 530 | esbuild-darwin-64: 0.13.9 531 | esbuild-darwin-arm64: 0.13.9 532 | esbuild-freebsd-64: 0.13.9 533 | esbuild-freebsd-arm64: 0.13.9 534 | esbuild-linux-32: 0.13.9 535 | esbuild-linux-64: 0.13.9 536 | esbuild-linux-arm: 0.13.9 537 | esbuild-linux-arm64: 0.13.9 538 | esbuild-linux-mips64le: 0.13.9 539 | esbuild-linux-ppc64le: 0.13.9 540 | esbuild-netbsd-64: 0.13.9 541 | esbuild-openbsd-64: 0.13.9 542 | esbuild-sunos-64: 0.13.9 543 | esbuild-windows-32: 0.13.9 544 | esbuild-windows-64: 0.13.9 545 | esbuild-windows-arm64: 0.13.9 546 | dev: true 547 | 548 | /esbuild/0.14.8: 549 | resolution: {integrity: sha512-stMsCBmxwaMpeK8GC/49L/cRGIwsHwoEN7Twk5zDTHlm/63c0KXFKzDC8iM2Mi3fyCKwS002TAH6IlAvqR6t3g==} 550 | hasBin: true 551 | requiresBuild: true 552 | optionalDependencies: 553 | esbuild-android-arm64: 0.14.8 554 | esbuild-darwin-64: 0.14.8 555 | esbuild-darwin-arm64: 0.14.8 556 | esbuild-freebsd-64: 0.14.8 557 | esbuild-freebsd-arm64: 0.14.8 558 | esbuild-linux-32: 0.14.8 559 | esbuild-linux-64: 0.14.8 560 | esbuild-linux-arm: 0.14.8 561 | esbuild-linux-arm64: 0.14.8 562 | esbuild-linux-mips64le: 0.14.8 563 | esbuild-linux-ppc64le: 0.14.8 564 | esbuild-linux-s390x: 0.14.8 565 | esbuild-netbsd-64: 0.14.8 566 | esbuild-openbsd-64: 0.14.8 567 | esbuild-sunos-64: 0.14.8 568 | esbuild-windows-32: 0.14.8 569 | esbuild-windows-64: 0.14.8 570 | esbuild-windows-arm64: 0.14.8 571 | dev: true 572 | 573 | /escape-string-regexp/1.0.5: 574 | resolution: {integrity: sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=} 575 | engines: {node: '>=0.8.0'} 576 | dev: true 577 | 578 | /execa/5.0.0: 579 | resolution: {integrity: sha512-ov6w/2LCiuyO4RLYGdpFGjkcs0wMTgGE8PrkTHikeUy5iJekXyPIKUjifk5CsE0pt7sMCrMZ3YNqoCj6idQOnQ==} 580 | engines: {node: '>=10'} 581 | dependencies: 582 | cross-spawn: 7.0.3 583 | get-stream: 6.0.0 584 | human-signals: 2.1.0 585 | is-stream: 2.0.0 586 | merge-stream: 2.0.0 587 | npm-run-path: 4.0.1 588 | onetime: 5.1.2 589 | signal-exit: 3.0.3 590 | strip-final-newline: 2.0.0 591 | dev: true 592 | 593 | /fast-glob/3.2.7: 594 | resolution: {integrity: sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==} 595 | engines: {node: '>=8'} 596 | dependencies: 597 | '@nodelib/fs.stat': 2.0.4 598 | '@nodelib/fs.walk': 1.2.6 599 | glob-parent: 5.1.2 600 | merge2: 1.4.1 601 | micromatch: 4.0.4 602 | dev: true 603 | 604 | /fastq/1.11.0: 605 | resolution: {integrity: sha512-7Eczs8gIPDrVzT+EksYBcupqMyxSHXXrHOLRRxU2/DicV8789MRBRR8+Hc2uWzUupOs4YS4JzBmBxjjCVBxD/g==} 606 | dependencies: 607 | reusify: 1.0.4 608 | dev: true 609 | 610 | /fetch-blob/3.1.3: 611 | resolution: {integrity: sha512-ax1Y5I9w+9+JiM+wdHkhBoxew+zG4AJ2SvAD1v1szpddUIiPERVGBxrMcB2ZqW0Y3PP8bOWYv2zqQq1Jp2kqUQ==} 612 | engines: {node: ^12.20 || >= 14.13} 613 | dependencies: 614 | web-streams-polyfill: 3.2.0 615 | dev: true 616 | 617 | /fill-range/7.0.1: 618 | resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==} 619 | engines: {node: '>=8'} 620 | dependencies: 621 | to-regex-range: 5.0.1 622 | dev: true 623 | 624 | /formdata-polyfill/4.0.10: 625 | resolution: {integrity: sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==} 626 | engines: {node: '>=12.20.0'} 627 | dependencies: 628 | fetch-blob: 3.1.3 629 | dev: true 630 | 631 | /fs.realpath/1.0.0: 632 | resolution: {integrity: sha1-FQStJSMVjKpA20onh8sBQRmU6k8=} 633 | dev: true 634 | 635 | /fsevents/2.3.2: 636 | resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} 637 | engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} 638 | os: [darwin] 639 | requiresBuild: true 640 | dev: true 641 | optional: true 642 | 643 | /get-stream/6.0.0: 644 | resolution: {integrity: sha512-A1B3Bh1UmL0bidM/YX2NsCOTnGJePL9rO/M+Mw3m9f2gUpfokS0hi5Eah0WSUEWZdZhIZtMjkIYS7mDfOqNHbg==} 645 | engines: {node: '>=10'} 646 | dev: true 647 | 648 | /glob-parent/5.1.2: 649 | resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} 650 | engines: {node: '>= 6'} 651 | dependencies: 652 | is-glob: 4.0.1 653 | dev: true 654 | 655 | /glob/7.1.6: 656 | resolution: {integrity: sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==} 657 | dependencies: 658 | fs.realpath: 1.0.0 659 | inflight: 1.0.6 660 | inherits: 2.0.4 661 | minimatch: 3.0.4 662 | once: 1.4.0 663 | path-is-absolute: 1.0.1 664 | dev: true 665 | 666 | /globby/11.0.4: 667 | resolution: {integrity: sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==} 668 | engines: {node: '>=10'} 669 | dependencies: 670 | array-union: 2.1.0 671 | dir-glob: 3.0.1 672 | fast-glob: 3.2.7 673 | ignore: 5.1.8 674 | merge2: 1.4.1 675 | slash: 3.0.0 676 | dev: true 677 | 678 | /has-flag/3.0.0: 679 | resolution: {integrity: sha1-tdRU3CGZriJWmfNGfloH87lVuv0=} 680 | engines: {node: '>=4'} 681 | dev: true 682 | 683 | /human-signals/2.1.0: 684 | resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==} 685 | engines: {node: '>=10.17.0'} 686 | dev: true 687 | 688 | /ignore/5.1.8: 689 | resolution: {integrity: sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==} 690 | engines: {node: '>= 4'} 691 | dev: true 692 | 693 | /import-cwd/3.0.0: 694 | resolution: {integrity: sha512-4pnzH16plW+hgvRECbDWpQl3cqtvSofHWh44met7ESfZ8UZOWWddm8hEyDTqREJ9RbYHY8gi8DqmaelApoOGMg==} 695 | engines: {node: '>=8'} 696 | dependencies: 697 | import-from: 3.0.0 698 | dev: true 699 | 700 | /import-fresh/3.3.0: 701 | resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==} 702 | engines: {node: '>=6'} 703 | dependencies: 704 | parent-module: 1.0.1 705 | resolve-from: 4.0.0 706 | dev: true 707 | 708 | /import-from/3.0.0: 709 | resolution: {integrity: sha512-CiuXOFFSzkU5x/CR0+z7T91Iht4CXgfCxVOFRhh2Zyhg5wOpWvvDLQUsWl+gcN+QscYBjez8hDCt85O7RLDttQ==} 710 | engines: {node: '>=8'} 711 | dependencies: 712 | resolve-from: 5.0.0 713 | dev: true 714 | 715 | /inflight/1.0.6: 716 | resolution: {integrity: sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=} 717 | dependencies: 718 | once: 1.4.0 719 | wrappy: 1.0.2 720 | dev: true 721 | 722 | /inherits/2.0.4: 723 | resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} 724 | dev: true 725 | 726 | /is-arrayish/0.2.1: 727 | resolution: {integrity: sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=} 728 | dev: true 729 | 730 | /is-binary-path/2.1.0: 731 | resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} 732 | engines: {node: '>=8'} 733 | dependencies: 734 | binary-extensions: 2.2.0 735 | dev: true 736 | 737 | /is-extglob/2.1.1: 738 | resolution: {integrity: sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=} 739 | engines: {node: '>=0.10.0'} 740 | dev: true 741 | 742 | /is-glob/4.0.1: 743 | resolution: {integrity: sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==} 744 | engines: {node: '>=0.10.0'} 745 | dependencies: 746 | is-extglob: 2.1.1 747 | dev: true 748 | 749 | /is-number/7.0.0: 750 | resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} 751 | engines: {node: '>=0.12.0'} 752 | dev: true 753 | 754 | /is-stream/2.0.0: 755 | resolution: {integrity: sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==} 756 | engines: {node: '>=8'} 757 | dev: true 758 | 759 | /isexe/2.0.0: 760 | resolution: {integrity: sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=} 761 | dev: true 762 | 763 | /joycon/3.0.1: 764 | resolution: {integrity: sha512-SJcJNBg32dGgxhPtM0wQqxqV0ax9k/9TaUskGDSJkSFSQOEWWvQ3zzWdGQRIUry2j1zA5+ReH13t0Mf3StuVZA==} 765 | engines: {node: '>=10'} 766 | dev: true 767 | 768 | /js-tokens/4.0.0: 769 | resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} 770 | dev: true 771 | 772 | /json-parse-even-better-errors/2.3.1: 773 | resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} 774 | dev: true 775 | 776 | /lines-and-columns/1.1.6: 777 | resolution: {integrity: sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=} 778 | dev: true 779 | 780 | /merge-stream/2.0.0: 781 | resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} 782 | dev: true 783 | 784 | /merge2/1.4.1: 785 | resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} 786 | engines: {node: '>= 8'} 787 | dev: true 788 | 789 | /micromatch/4.0.4: 790 | resolution: {integrity: sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==} 791 | engines: {node: '>=8.6'} 792 | dependencies: 793 | braces: 3.0.2 794 | picomatch: 2.3.0 795 | dev: true 796 | 797 | /mimic-fn/2.1.0: 798 | resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} 799 | engines: {node: '>=6'} 800 | dev: true 801 | 802 | /minimatch/3.0.4: 803 | resolution: {integrity: sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==} 804 | dependencies: 805 | brace-expansion: 1.1.11 806 | dev: true 807 | 808 | /ms/2.1.2: 809 | resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} 810 | dev: true 811 | 812 | /mz/2.7.0: 813 | resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==} 814 | dependencies: 815 | any-promise: 1.3.0 816 | object-assign: 4.1.1 817 | thenify-all: 1.6.0 818 | dev: true 819 | 820 | /node-fetch/3.1.0: 821 | resolution: {integrity: sha512-QU0WbIfMUjd5+MUzQOYhenAazakV7Irh1SGkWCsRzBwvm4fAhzEUaHMJ6QLP7gWT6WO9/oH2zhKMMGMuIrDyKw==} 822 | engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} 823 | dependencies: 824 | data-uri-to-buffer: 4.0.0 825 | fetch-blob: 3.1.3 826 | formdata-polyfill: 4.0.10 827 | dev: true 828 | 829 | /node-modules-regexp/1.0.0: 830 | resolution: {integrity: sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA=} 831 | engines: {node: '>=0.10.0'} 832 | dev: true 833 | 834 | /normalize-path/3.0.0: 835 | resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} 836 | engines: {node: '>=0.10.0'} 837 | dev: true 838 | 839 | /npm-run-path/4.0.1: 840 | resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} 841 | engines: {node: '>=8'} 842 | dependencies: 843 | path-key: 3.1.1 844 | dev: true 845 | 846 | /object-assign/4.1.1: 847 | resolution: {integrity: sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=} 848 | engines: {node: '>=0.10.0'} 849 | dev: true 850 | 851 | /once/1.4.0: 852 | resolution: {integrity: sha1-WDsap3WWHUsROsF9nFC6753Xa9E=} 853 | dependencies: 854 | wrappy: 1.0.2 855 | dev: true 856 | 857 | /onetime/5.1.2: 858 | resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} 859 | engines: {node: '>=6'} 860 | dependencies: 861 | mimic-fn: 2.1.0 862 | dev: true 863 | 864 | /parent-module/1.0.1: 865 | resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} 866 | engines: {node: '>=6'} 867 | dependencies: 868 | callsites: 3.1.0 869 | dev: true 870 | 871 | /parse-json/5.2.0: 872 | resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} 873 | engines: {node: '>=8'} 874 | dependencies: 875 | '@babel/code-frame': 7.12.13 876 | error-ex: 1.3.2 877 | json-parse-even-better-errors: 2.3.1 878 | lines-and-columns: 1.1.6 879 | dev: true 880 | 881 | /path-is-absolute/1.0.1: 882 | resolution: {integrity: sha1-F0uSaHNVNP+8es5r9TpanhtcX18=} 883 | engines: {node: '>=0.10.0'} 884 | dev: true 885 | 886 | /path-key/3.1.1: 887 | resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} 888 | engines: {node: '>=8'} 889 | dev: true 890 | 891 | /path-type/4.0.0: 892 | resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} 893 | engines: {node: '>=8'} 894 | dev: true 895 | 896 | /picomatch/2.3.0: 897 | resolution: {integrity: sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==} 898 | engines: {node: '>=8.6'} 899 | dev: true 900 | 901 | /pirates/4.0.1: 902 | resolution: {integrity: sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA==} 903 | engines: {node: '>= 6'} 904 | dependencies: 905 | node-modules-regexp: 1.0.0 906 | dev: true 907 | 908 | /postcss-load-config/3.0.1: 909 | resolution: {integrity: sha512-/pDHe30UYZUD11IeG8GWx9lNtu1ToyTsZHnyy45B4Mrwr/Kb6NgYl7k753+05CJNKnjbwh4975amoPJ+TEjHNQ==} 910 | engines: {node: '>= 10'} 911 | dependencies: 912 | cosmiconfig: 7.0.0 913 | import-cwd: 3.0.0 914 | dev: true 915 | 916 | /prettier/2.5.1: 917 | resolution: {integrity: sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==} 918 | engines: {node: '>=10.13.0'} 919 | hasBin: true 920 | dev: true 921 | 922 | /queue-microtask/1.2.2: 923 | resolution: {integrity: sha512-dB15eXv3p2jDlbOiNLyMabYg1/sXvppd8DP2J3EOCQ0AkuSXCW2tP7mnVouVLJKgUMY6yP0kcQDVpLCN13h4Xg==} 924 | dev: true 925 | 926 | /readdirp/3.5.0: 927 | resolution: {integrity: sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==} 928 | engines: {node: '>=8.10.0'} 929 | dependencies: 930 | picomatch: 2.3.0 931 | dev: true 932 | 933 | /resolve-from/4.0.0: 934 | resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} 935 | engines: {node: '>=4'} 936 | dev: true 937 | 938 | /resolve-from/5.0.0: 939 | resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} 940 | engines: {node: '>=8'} 941 | dev: true 942 | 943 | /reusify/1.0.4: 944 | resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} 945 | engines: {iojs: '>=1.0.0', node: '>=0.10.0'} 946 | dev: true 947 | 948 | /rollup/2.62.0: 949 | resolution: {integrity: sha512-cJEQq2gwB0GWMD3rYImefQTSjrPYaC6s4J9pYqnstVLJ1CHa/aZNVkD4Epuvg4iLeMA4KRiq7UM7awKK6j7jcw==} 950 | engines: {node: '>=10.0.0'} 951 | hasBin: true 952 | optionalDependencies: 953 | fsevents: 2.3.2 954 | dev: true 955 | 956 | /run-parallel/1.2.0: 957 | resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} 958 | dependencies: 959 | queue-microtask: 1.2.2 960 | dev: true 961 | 962 | /shebang-command/2.0.0: 963 | resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} 964 | engines: {node: '>=8'} 965 | dependencies: 966 | shebang-regex: 3.0.0 967 | dev: true 968 | 969 | /shebang-regex/3.0.0: 970 | resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} 971 | engines: {node: '>=8'} 972 | dev: true 973 | 974 | /signal-exit/3.0.3: 975 | resolution: {integrity: sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==} 976 | dev: true 977 | 978 | /slash/3.0.0: 979 | resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} 980 | engines: {node: '>=8'} 981 | dev: true 982 | 983 | /source-map/0.7.3: 984 | resolution: {integrity: sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==} 985 | engines: {node: '>= 8'} 986 | dev: true 987 | 988 | /strip-final-newline/2.0.0: 989 | resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==} 990 | engines: {node: '>=6'} 991 | dev: true 992 | 993 | /sucrase/3.20.3: 994 | resolution: {integrity: sha512-azqwq0/Bs6RzLAdb4dXxsCgMtAaD2hzmUr4UhSfsxO46JFPAwMnnb441B/qsudZiS6Ylea3JXZe3Q497lsgXzQ==} 995 | engines: {node: '>=8'} 996 | hasBin: true 997 | dependencies: 998 | commander: 4.1.1 999 | glob: 7.1.6 1000 | lines-and-columns: 1.1.6 1001 | mz: 2.7.0 1002 | pirates: 4.0.1 1003 | ts-interface-checker: 0.1.13 1004 | dev: true 1005 | 1006 | /supports-color/5.5.0: 1007 | resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} 1008 | engines: {node: '>=4'} 1009 | dependencies: 1010 | has-flag: 3.0.0 1011 | dev: true 1012 | 1013 | /thenify-all/1.6.0: 1014 | resolution: {integrity: sha1-GhkY1ALY/D+Y+/I02wvMjMEOlyY=} 1015 | engines: {node: '>=0.8'} 1016 | dependencies: 1017 | thenify: 3.3.1 1018 | dev: true 1019 | 1020 | /thenify/3.3.1: 1021 | resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==} 1022 | dependencies: 1023 | any-promise: 1.3.0 1024 | dev: true 1025 | 1026 | /to-regex-range/5.0.1: 1027 | resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} 1028 | engines: {node: '>=8.0'} 1029 | dependencies: 1030 | is-number: 7.0.0 1031 | dev: true 1032 | 1033 | /tree-kill/1.2.2: 1034 | resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==} 1035 | hasBin: true 1036 | dev: true 1037 | 1038 | /ts-interface-checker/0.1.13: 1039 | resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} 1040 | dev: true 1041 | 1042 | /tsno/1.5.0: 1043 | resolution: {integrity: sha512-D2Mn+1zVikY9nQgOuoBovzQBG15f9aPJn+gvdZ1En6MiIHtsnntO/Atkk7OeIYEZ4YntC/PSuzkQhQ0xoOxWnA==} 1044 | hasBin: true 1045 | dependencies: 1046 | bundle-require: 1.4.1_esbuild@0.13.9 1047 | cross-spawn: 7.0.3 1048 | esbuild: 0.13.9 1049 | dev: true 1050 | 1051 | /tsup/5.11.9_typescript@4.5.4: 1052 | resolution: {integrity: sha512-APFcd9qKblMVO35O5OyIcfa4lwBrVNinwtifUojO78I6j0aDhS4fQ06gq6vF1b/+Z83pYDWNb0R2fmO9PX3IVQ==} 1053 | hasBin: true 1054 | peerDependencies: 1055 | typescript: ^4.1.0 1056 | peerDependenciesMeta: 1057 | typescript: 1058 | optional: true 1059 | dependencies: 1060 | bundle-require: 2.2.0_esbuild@0.14.8 1061 | cac: 6.7.12 1062 | chokidar: 3.5.1 1063 | debug: 4.3.1 1064 | esbuild: 0.14.8 1065 | execa: 5.0.0 1066 | globby: 11.0.4 1067 | joycon: 3.0.1 1068 | postcss-load-config: 3.0.1 1069 | resolve-from: 5.0.0 1070 | rollup: 2.62.0 1071 | source-map: 0.7.3 1072 | sucrase: 3.20.3 1073 | tree-kill: 1.2.2 1074 | typescript: 4.5.4 1075 | transitivePeerDependencies: 1076 | - supports-color 1077 | dev: true 1078 | 1079 | /typescript/4.5.4: 1080 | resolution: {integrity: sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==} 1081 | engines: {node: '>=4.2.0'} 1082 | hasBin: true 1083 | dev: true 1084 | 1085 | /web-streams-polyfill/3.2.0: 1086 | resolution: {integrity: sha512-EqPmREeOzttaLRm5HS7io98goBgZ7IVz79aDvqjD0kYXLtFZTc0T/U6wHTPKyIjb+MdN7DFIIX6hgdBEpWmfPA==} 1087 | engines: {node: '>= 8'} 1088 | dev: true 1089 | 1090 | /which/2.0.2: 1091 | resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} 1092 | engines: {node: '>= 8'} 1093 | hasBin: true 1094 | dependencies: 1095 | isexe: 2.0.0 1096 | dev: true 1097 | 1098 | /wrappy/1.0.2: 1099 | resolution: {integrity: sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=} 1100 | dev: true 1101 | 1102 | /yaml/1.10.2: 1103 | resolution: {integrity: sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==} 1104 | engines: {node: '>= 6'} 1105 | dev: true 1106 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "config:base" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /src/cli.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | import { cac } from 'cac' 3 | import { 4 | downloadFile, 5 | existsSync, 6 | args, 7 | exit, 8 | getOwnVersion, 9 | isEmptyDirSync, 10 | resolvePath, 11 | getTempDir, 12 | } from './lib' 13 | import { PrettyError, parseRepo, getDefaultBranchFromApi, extract } from './' 14 | 15 | const start = async () => { 16 | const cli = cac('aho') 17 | 18 | cli 19 | .command('[repo] [desitination]', 'Download a repo') 20 | .option( 21 | '-f, --force', 22 | `Force override desitination directory even if it's not empty`, 23 | ) 24 | .action(async (_repo, desitination, flags) => { 25 | if (!_repo) { 26 | throw new PrettyError('No repo provided') 27 | } 28 | 29 | const { owner, repoName, subpath, tag } = parseRepo(_repo) 30 | const repo = `${owner}/${repoName}` 31 | 32 | desitination = resolvePath(desitination || '.') 33 | 34 | if ( 35 | !flags.force && 36 | existsSync(desitination) && 37 | !isEmptyDirSync(desitination) 38 | ) { 39 | throw new PrettyError( 40 | `Destination directory is not empty, use --force if you are sure about this`, 41 | ) 42 | } 43 | 44 | console.log( 45 | `Downloading ${repo} ${subpath ? `(sub folder: ${subpath})` : ''}`, 46 | ) 47 | 48 | const ref = tag || (await getDefaultBranchFromApi(repo)) 49 | 50 | const tempTarFile = `${getTempDir()}/aho_${Date.now()}.tar.gz` 51 | await downloadFile( 52 | `https://codeload.github.com/${repo}/tar.gz/refs/heads/${ref}`, 53 | tempTarFile, 54 | ) 55 | console.log(`Generating to ${desitination}`) 56 | await extract(tempTarFile, desitination, { path: subpath }) 57 | }) 58 | 59 | cli.version(getOwnVersion()) 60 | cli.help() 61 | cli.parse(args, { run: false }) 62 | 63 | try { 64 | await cli.runMatchedCommand() 65 | } catch (error) { 66 | if (error instanceof PrettyError) { 67 | console.error(error.message) 68 | } else { 69 | console.error(error) 70 | } 71 | exit(1) 72 | } 73 | } 74 | 75 | start() 76 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import { 2 | ensureDirSync, 3 | getTempDir, 4 | runCommand, 5 | fetchJSON, 6 | moveSync, 7 | emptyDirSync, 8 | joinPath, 9 | } from './lib' 10 | 11 | export class PrettyError extends Error { 12 | constructor(message: string) { 13 | super(message) 14 | this.name = this.constructor.name 15 | if (typeof Error.captureStackTrace === 'function') { 16 | Error.captureStackTrace(this, this.constructor) 17 | } else { 18 | this.stack = new Error(message).stack 19 | } 20 | } 21 | } 22 | 23 | export async function extract( 24 | from: string, 25 | to: string, 26 | { path }: { path?: string }, 27 | ) { 28 | const tempDir = getTempDir() + `/aho_temp_${Date.now()}` 29 | ensureDirSync(tempDir) 30 | const cmd = ['tar', 'xvzf', from, '-C', tempDir, '--strip-components', '1'] 31 | await runCommand(cmd) 32 | emptyDirSync(to) 33 | moveSync(path ? joinPath(tempDir, path) : tempDir, to) 34 | } 35 | 36 | export function parseRepo(input: string) { 37 | const [_repo, tag] = input.split('#') 38 | const [, owner, repoName, subpath = ''] = 39 | /^([\w\-\.]+)\/([\w\-\.]+)(\/.+)?$/.exec(_repo)! 40 | return { owner, repoName, subpath: subpath.slice(1), tag } 41 | } 42 | 43 | export async function getDefaultBranchFromApi(repo: string): Promise { 44 | const data = await fetchJSON(`https://api.github.com/repos/${repo}`) 45 | return data.default_branch 46 | } 47 | -------------------------------------------------------------------------------- /src/lib.ts: -------------------------------------------------------------------------------- 1 | import { spawn } from 'child_process' 2 | import { tmpdir } from 'os' 3 | import { resolve, join } from 'path' 4 | import https from 'https' 5 | import fs from 'fs' 6 | import { version } from '../package.json' 7 | 8 | export const fetchJSON = (url: string): Promise => 9 | new Promise((resolve, reject) => { 10 | https.get( 11 | url, 12 | { 13 | headers: { 14 | 'user-agent': USER_AGENT, 15 | }, 16 | }, 17 | (res) => { 18 | let body = '' 19 | 20 | res.on('data', (chunk) => { 21 | body += chunk 22 | }) 23 | 24 | res.on('end', () => { 25 | resolve(JSON.parse(body)) 26 | }) 27 | 28 | res.on('error', reject) 29 | }, 30 | ) 31 | }) 32 | 33 | export const downloadFile = (url: string, outFile: string) => 34 | new Promise((resolve, reject) => { 35 | const stream = fs.createWriteStream(outFile) 36 | 37 | stream.on('finish', () => { 38 | stream.close() 39 | resolve(true) 40 | }) 41 | 42 | https 43 | .get(url) 44 | .on('response', (res) => { 45 | res.pipe(stream, { end: true }) 46 | }) 47 | .on('error', reject) 48 | }) 49 | 50 | export const ensureDirSync = (dir: string) => 51 | fs.mkdirSync(dir, { recursive: true }) 52 | 53 | export const existsSync = fs.existsSync 54 | 55 | export const isEmptyDirSync = (dir: string) => fs.readdirSync(dir).length === 0 56 | 57 | export const getTempDir = () => tmpdir() 58 | 59 | export function runCommand(cmd: string[]) { 60 | return new Promise((resolve, reject) => { 61 | const ps = spawn(cmd[0], cmd.slice(1), { 62 | stdio: 'pipe', 63 | }) 64 | let output = '' 65 | ps.stdout.on('data', (data) => { 66 | output += data.toString() 67 | }) 68 | ps.stderr.on('data', (data) => { 69 | output += data.toString() 70 | }) 71 | ps.on('exit', (code) => { 72 | if (code === 0) { 73 | resolve(true) 74 | } else { 75 | reject(new Error(output)) 76 | } 77 | }) 78 | }) 79 | } 80 | 81 | export const resolvePath = resolve 82 | 83 | export const joinPath = join 84 | 85 | export const args = process.argv 86 | 87 | export const exit = process.exit 88 | 89 | export const getOwnVersion = () => { 90 | return version 91 | } 92 | 93 | export const moveSync = (from: string, to: string) => { 94 | fs.renameSync(from, to) 95 | } 96 | 97 | export const emptyDirSync = (path: string) => { 98 | fs.rmSync(path, { recursive: true, force: true }) 99 | ensureDirSync(path) 100 | } 101 | 102 | export const USER_AGENT = `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36` 103 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2020", 4 | "module": "esnext", 5 | "strict": true, 6 | "esModuleInterop": true, 7 | "moduleResolution": "node", 8 | "skipLibCheck": true, 9 | "noUnusedLocals": true, 10 | "noImplicitAny": true, 11 | "allowJs": true, 12 | "resolveJsonModule": true 13 | } 14 | } 15 | --------------------------------------------------------------------------------