From 2d7c1c761d9578dfb47d8a92bd5a827e6d2a4b0b Mon Sep 17 00:00:00 2001 From: Olivier Lamothe Date: Wed, 10 Mar 2021 17:08:02 -0500 Subject: [PATCH] feat(cli): support for auto update packaging (#72) https://coveord.atlassian.net/browse/CDX-138 --- .github/workflows/build-binaries.yml | 20 +- lerna.json | 4 +- packages/cli/README.md | 27 ++- packages/cli/package-lock.json | 350 ++++++++++++++++++++++++++- packages/cli/package.json | 16 +- scripts/download-release-assets.js | 23 +- scripts/github-client.js | 3 +- 7 files changed, 415 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build-binaries.yml b/.github/workflows/build-binaries.yml index 7c50a3b685..36a4a5e4e6 100644 --- a/.github/workflows/build-binaries.yml +++ b/.github/workflows/build-binaries.yml @@ -3,23 +3,31 @@ name: Build binaries on: release: types: [published] + jobs: package: - name: Package for ${{ matrix.pack-command }} + name: Package for ${{ matrix.for }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: - os: macos-latest - pack-command: macos + pack-command: :macos additional-install: echo "no additional install" + for: 'macos install kit' - os: ubuntu-latest - pack-command: win + pack-command: :win additional-install: sudo apt-get install nsis p7zip-full -y + for: 'windows install kit' + - os: ubuntu-latest + pack-command: :deb + additional-install: echo "no additional install" + for: 'linux install kit' - os: ubuntu-latest - pack-command: deb + pack-command: '' additional-install: echo "no additional install" + for: 'tarball' steps: - uses: actions/checkout@v2 @@ -32,11 +40,11 @@ jobs: run: ${{ matrix.additional-install }} - name: Create package working-directory: ./packages/cli - run: ./node_modules/@oclif/dev-cli/bin/run pack:${{ matrix.pack-command }} + run: ./node_modules/@oclif/dev-cli/bin/run pack${{ matrix.pack-command }} - name: Upload binaries uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ./packages/cli/dist/${{ matrix.pack-command }}/**/* + file: ./packages/cli/dist/**/* file_glob: true tag: ${{ github.ref }} diff --git a/lerna.json b/lerna.json index 5a207b6230..05fa5d9ef4 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,4 @@ { - "packages": [ - "packages/*" - ], + "packages": ["packages/*"], "version": "0.4.0" } diff --git a/packages/cli/README.md b/packages/cli/README.md index 114171296e..e743538cb0 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -7,14 +7,16 @@ [![License](https://img.shields.io/npm/l/@coveo/cli.svg)](https://github.com/coveo/cli/blob/master/package.json) -* [@coveo/cli](#coveocli) -* [Usage](#usage) -* [Commands](#commands) + +- [@coveo/cli](#coveocli) +- [Usage](#usage) +- [Commands](#commands) # Usage + ```sh-session $ npm install -g @coveo/cli $ coveo COMMAND @@ -26,19 +28,22 @@ USAGE $ coveo COMMAND ... ``` + # Commands -* [`coveo auth:login`](#coveo-authlogin) -* [`coveo config:get`](#coveo-configget) -* [`coveo config:set`](#coveo-configset) -* [`coveo help [COMMAND]`](#coveo-help-command) -* [`coveo org:list`](#coveo-orglist) -* [`coveo ui:create:angular NAME`](#coveo-uicreateangular-name) -* [`coveo ui:create:react NAME`](#coveo-uicreatereact-name) -* [`coveo ui:create:vue NAME`](#coveo-uicreatevue-name) + +- [`coveo auth:login`](#coveo-authlogin) +- [`coveo config:get`](#coveo-configget) +- [`coveo config:set`](#coveo-configset) +- [`coveo help [COMMAND]`](#coveo-help-command) +- [`coveo org:list`](#coveo-orglist) +- [`coveo ui:create:angular NAME`](#coveo-uicreateangular-name) +- [`coveo ui:create:react NAME`](#coveo-uicreatereact-name) +- [`coveo ui:create:vue NAME`](#coveo-uicreatevue-name) +- [`coveo update [CHANNEL]`](#coveo-update-channel) ## `coveo auth:login` diff --git a/packages/cli/package-lock.json b/packages/cli/package-lock.json index 376e048ffd..e4f55a1183 100644 --- a/packages/cli/package-lock.json +++ b/packages/cli/package-lock.json @@ -114,6 +114,22 @@ } } }, + "@angular/cdk": { + "version": "11.2.4", + "resolved": "https://registry.npmjs.org/@angular/cdk/-/cdk-11.2.4.tgz", + "integrity": "sha512-BcMHRaKZxkpK+dPwmjqktAzWUnywbyHyrORGlF4OMtbE88IvbI8tQ+0xANfBm0cPaAm+na5AlGKyH2ptzedyRQ==", + "requires": { + "parse5": "^5.0.0", + "tslib": "^2.0.0" + }, + "dependencies": { + "tslib": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz", + "integrity": "sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==" + } + } + }, "@angular/cli": { "version": "11.1.4", "resolved": "https://registry.npmjs.org/@angular/cli/-/cli-11.1.4.tgz", @@ -1307,6 +1323,82 @@ "minimist": "^1.2.0" } }, + "@coveo/angular": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@coveo/angular/-/angular-0.4.0.tgz", + "integrity": "sha512-zAcmiGeUI6v2EQM0Pxn/c9sI+/fWwvktreN6WWk6CBGOb3nEg9py8Zm6OlpqdIYFZoIk1HSvcpZEc5YcJxMMeg==", + "requires": { + "@angular-devkit/core": "^11.1.2", + "@angular-devkit/schematics": "^11.1.2", + "@angular/cdk": "^11.1.1", + "@angular/cli": "^11.1.2", + "@coveo/search-token-server": "^0.4.0", + "@schematics/angular": "^11.1.2", + "typescript": "~4.1.2" + }, + "dependencies": { + "typescript": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.5.tgz", + "integrity": "sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA==" + } + } + }, + "@coveo/cra-template": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@coveo/cra-template/-/cra-template-0.4.0.tgz", + "integrity": "sha512-uShctCqSb/kaalwwcfsXYFs/n9fVgacuCeTPGqfjSeE4geptRgd32BUjKrFFk5g3ZS7mVbhcvQBWfHQigI9+nA==", + "dev": true + }, + "@coveo/search-token-server": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@coveo/search-token-server/-/search-token-server-0.4.0.tgz", + "integrity": "sha512-YdPxDQlcDPhoLU/nwU+zCVmrh+MUP4lltdPXzfMuXIvn/13z4sSwiOSgVh2mDOH0gKntItPgVvbSqdIDUJnEFQ==", + "requires": { + "@coveord/platform-client": "^11.0.0", + "abortcontroller-polyfill": "^1.7.1", + "dotenv": "^8.2.0", + "express": "^4.17.1", + "isomorphic-fetch": "^3.0.0", + "ts-node": "^9.1.1", + "typescript": "^4.1.5" + }, + "dependencies": { + "@coveord/platform-client": { + "version": "11.3.0", + "resolved": "https://registry.npmjs.org/@coveord/platform-client/-/platform-client-11.3.0.tgz", + "integrity": "sha512-BCVXK7KYWLnVADPv6ecyjcPV8vwpRUft+iOZFJa7zCBYQo5UwLX1GP7ihrilNYBuSkPh3Lcqr6aha/8zcvESvA==", + "requires": { + "exponential-backoff": "^3.1.0", + "form-data": "^3.0.0", + "query-string": "^6.13.1" + } + }, + "ts-node": { + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.1.1.tgz", + "integrity": "sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg==", + "requires": { + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "source-map-support": "^0.5.17", + "yn": "3.1.1" + } + }, + "typescript": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.3.tgz", + "integrity": "sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==" + } + } + }, + "@coveo/vue-cli-plugin-typescript": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@coveo/vue-cli-plugin-typescript/-/vue-cli-plugin-typescript-0.4.0.tgz", + "integrity": "sha512-AFA3yKC4cr3a5jKJ3wh8ioRfWcRcOF0vg2w3OQEld9Wzrzu2vBRtcNeOTAJwhXWe0wvXqWiF78ptBgQPY6hBcQ==" + }, "@coveord/platform-client": { "version": "9.29.0", "resolved": "https://registry.npmjs.org/@coveord/platform-client/-/platform-client-9.29.0.tgz", @@ -2419,6 +2511,233 @@ } } }, + "@oclif/plugin-update": { + "version": "1.3.10", + "resolved": "https://registry.npmjs.org/@oclif/plugin-update/-/plugin-update-1.3.10.tgz", + "integrity": "sha512-ONoqF3IkLIuxwvdnZr47TERnVrclVDMLSzOhZjc3ds66vCTrVCnmcVa7WxwxWqpfYNi+QwN16Ull1ipZ904qKQ==", + "requires": { + "@oclif/color": "^0.1.0", + "@oclif/command": "^1.6.0", + "@oclif/config": "^1.9.0", + "@oclif/errors": "^1.2.2", + "@types/semver": "^5.5.0", + "cli-ux": "^4.9.3", + "cross-spawn": "^6.0.5", + "debug": "^4.1.0", + "filesize": "^3.6.1", + "fs-extra": "^7.0.1", + "http-call": "^5.2.2", + "lodash": "^4.17.13", + "log-chopper": "^1.0.2", + "semver": "^5.6.0", + "tar-fs": "^1.16.3" + }, + "dependencies": { + "ansi-escapes": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz", + "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==" + }, + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "bl": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.3.tgz", + "integrity": "sha512-pvcNpa0UU69UT341rO6AYy4FVAIkUHuZXRIWbq+zHnsVcRzDDjIAhGuuYoi0d//cwIwtt4pkpKycWEfjdV+vww==", + "requires": { + "readable-stream": "^2.3.5", + "safe-buffer": "^5.1.1" + } + }, + "clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==" + }, + "cli-ux": { + "version": "4.9.3", + "resolved": "https://registry.npmjs.org/cli-ux/-/cli-ux-4.9.3.tgz", + "integrity": "sha512-/1owvF0SZ5Gn54cgrikJ0QskgTzeg30HGjkmjFoaHDJzAqFpuX1DBpFR8aLvsE1J5s9MgeYRENQK4BFwOag5VA==", + "requires": { + "@oclif/errors": "^1.2.2", + "@oclif/linewrap": "^1.0.0", + "@oclif/screen": "^1.0.3", + "ansi-escapes": "^3.1.0", + "ansi-styles": "^3.2.1", + "cardinal": "^2.1.1", + "chalk": "^2.4.1", + "clean-stack": "^2.0.0", + "extract-stack": "^1.0.0", + "fs-extra": "^7.0.0", + "hyperlinker": "^1.0.0", + "indent-string": "^3.2.0", + "is-wsl": "^1.1.0", + "lodash": "^4.17.11", + "password-prompt": "^1.0.7", + "semver": "^5.6.0", + "strip-ansi": "^5.0.0", + "supports-color": "^5.5.0", + "supports-hyperlinks": "^1.0.1", + "treeify": "^1.1.0", + "tslib": "^1.9.3" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "extract-stack": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/extract-stack/-/extract-stack-1.0.0.tgz", + "integrity": "sha1-uXrK+UQe6iMyUpYktzL8WhyBZfo=" + }, + "fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "has-flag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=" + }, + "indent-string": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", + "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=" + }, + "is-wsl": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz", + "integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=" + }, + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "requires": { + "minimist": "^1.2.5" + } + }, + "pump": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/pump/-/pump-1.0.3.tgz", + "integrity": "sha512-8k0JupWme55+9tCVE+FS5ULT3K6AbgqrGa58lTT49RpyfwwcGedHqaC5LlQNdEAumn/wFsu6aPwkuPMioy8kqw==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "requires": { + "ansi-regex": "^4.1.0" + } + }, + "supports-hyperlinks": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-1.0.1.tgz", + "integrity": "sha512-HHi5kVSefKaJkGYXbDuKbUGRVxqnWGn3J2e39CYcNJEfWciGq2zYtOhXLTlvrOZW1QU7VX67w7fMmWafHX9Pfw==", + "requires": { + "has-flag": "^2.0.0", + "supports-color": "^5.0.0" + } + }, + "tar-fs": { + "version": "1.16.3", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-1.16.3.tgz", + "integrity": "sha512-NvCeXpYx7OsmOh8zIOP/ebG55zZmxLE0etfWRbWok+q2Qo8x/vOR/IJT1taADXPe+jsiu9axDb3X4B+iIgNlKw==", + "requires": { + "chownr": "^1.0.1", + "mkdirp": "^0.5.1", + "pump": "^1.0.0", + "tar-stream": "^1.1.2" + } + }, + "tar-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz", + "integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==", + "requires": { + "bl": "^1.0.0", + "buffer-alloc": "^1.2.0", + "end-of-stream": "^1.0.0", + "fs-constants": "^1.0.0", + "readable-stream": "^2.3.0", + "to-buffer": "^1.1.1", + "xtend": "^4.0.0" + } + } + } + }, "@oclif/plugin-warn-if-update-available": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/@oclif/plugin-warn-if-update-available/-/plugin-warn-if-update-available-1.7.0.tgz", @@ -2966,6 +3285,11 @@ "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.3.tgz", "integrity": "sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA==" }, + "@types/semver": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-5.5.0.tgz", + "integrity": "sha512-41qEJgBH/TWgo5NFSvBCJ1qkoi3Q6ONSF2avrHq1LVEZfYpdHmj0y9SuTK+u9ZhG1sYQKBL1AWXKyLWP4RaUoQ==" + }, "@types/serve-static": { "version": "1.13.9", "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.9.tgz", @@ -6524,6 +6848,11 @@ } } }, + "create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" + }, "cross-spawn": { "version": "6.0.5", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", @@ -6984,6 +7313,11 @@ "streamsearch": "0.1.2" } }, + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==" + }, "diff-sequences": { "version": "26.6.2", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-26.6.2.tgz", @@ -7881,6 +8215,11 @@ "trim-repeated": "^1.0.0" } }, + "filesize": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/filesize/-/filesize-3.6.1.tgz", + "integrity": "sha512-7KjR1vv6qnicaPMi1iiTcI85CyYwRO/PSFCu6SvqL8jN2Wjt/NIYQTFtFs7fSDCYOstUkEWIQGFUg5YZQfjlcg==" + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -11298,6 +11637,14 @@ "resolved": "https://registry.npmjs.org/lodash.xorby/-/lodash.xorby-4.7.0.tgz", "integrity": "sha1-nBmm+fBjputT3QPBtocXmYAUY9c=" }, + "log-chopper": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/log-chopper/-/log-chopper-1.0.2.tgz", + "integrity": "sha512-tEWS6Fb+Xv0yLChJ6saA1DP3H1yPL0PfiIN7SDJ+U/CyP+fD4G/dhKfow+P5UuJWi6BdE4mUcPkJclGXCWxDrg==", + "requires": { + "byline": "5.x" + } + }, "log-symbols": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", @@ -12565,8 +12912,7 @@ "parse5": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.1.tgz", - "integrity": "sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug==", - "dev": true + "integrity": "sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug==" }, "parseurl": { "version": "1.3.3", diff --git a/packages/cli/package.json b/packages/cli/package.json index af89d89733..4a06914923 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -3,6 +3,9 @@ "private": false, "version": "0.4.0", "author": "Coveo", + "engines": { + "node": ">=14.15.1" + }, "dependencies": { "@angular/cli": "^11.1.4", "@coveo/angular": "^0.4.0", @@ -11,6 +14,7 @@ "@oclif/command": "^1", "@oclif/config": "^1", "@oclif/plugin-help": "^3", + "@oclif/plugin-update": "^1.3.10", "@openid/appauth": "^1.3.0", "@vue/cli": "^4.5.11", "abortcontroller-polyfill": "^1.7.1", @@ -49,11 +53,15 @@ ], "license": "Apache-2.0", "main": "lib/index.js", + "bin": { + "coveo": "./bin/run" + }, "oclif": { "commands": "./lib/commands", "bin": "coveo", "plugins": [ - "@oclif/plugin-help" + "@oclif/plugin-help", + "@oclif/plugin-update" ], "topics": { "auth": { @@ -67,6 +75,12 @@ }, "macos": { "identifier": "com.coveo.cli" + }, + "update": { + "s3": { + "host": "https://static.cloud.coveo.com/cli", + "bucket": "https://static.cloud.coveo.com/cli" + } } }, "repository": "coveo/cli", diff --git a/scripts/download-release-assets.js b/scripts/download-release-assets.js index e713e2888c..5ef09b814e 100644 --- a/scripts/download-release-assets.js +++ b/scripts/download-release-assets.js @@ -3,13 +3,28 @@ const fs = require('fs'); async function main() { const tag = await getLatestTag(); - const directory = './artifacts'; + // This folder structure needs to be respected in order for the CLI update plugin to + // be able to do it's job properly. + const topLevelDirectory = './artifacts'; + const subDirectoryForTarball = `${topLevelDirectory}/coveo-${tag}`; - if (!fs.existsSync(directory)) { - fs.mkdirSync(directory); + if (!fs.existsSync(topLevelDirectory)) { + fs.mkdirSync(topLevelDirectory); } - await downloadReleaseAssets(tag, directory); + if (!fs.existsSync(subDirectoryForTarball)) { + fs.mkdirSync(subDirectoryForTarball); + } + + await downloadReleaseAssets(tag, (assetName) => { + if (assetName.match(/\.tar\.gz$/)) { + console.info(assetName, `--> ${subDirectoryForTarball}`); + return subDirectoryForTarball; + } else { + console.info(assetName, `--> ${topLevelDirectory}`); + return topLevelDirectory; + } + }); } main(); diff --git a/scripts/github-client.js b/scripts/github-client.js index a9ea05838e..e372e5fa3c 100644 --- a/scripts/github-client.js +++ b/scripts/github-client.js @@ -64,7 +64,7 @@ const createOrUpdateReleaseDescription = async (tag, body) => { } }; -const downloadReleaseAssets = async (tag, directory) => { +const downloadReleaseAssets = async (tag, determineAssetLocation) => { const release = await octokit.repos.getReleaseByTag({repo, owner, tag}); const assets = await octokit.repos.listReleaseAssets({ owner, @@ -76,6 +76,7 @@ const downloadReleaseAssets = async (tag, directory) => { console.info( `Downloading asset ${asset.name} from ${asset.browser_download_url}.\nSize: ${asset.size} ...` ); + const directory = determineAssetLocation(asset.name); execSync( `curl -L ${asset.browser_download_url} --output ${directory}/${asset.name}` );