Compare commits

..

100 Commits

Author SHA1 Message Date
5d0d02a24d v19.5.0 2024-10-17 14:56:42 +00:00
f5ca07a422 Merge pull request #2856 from balena-io/keys-to-key-list
Add `key list` alias for `keys` command
2024-10-17 10:55:51 -04:00
6b5c6e072b Add key list alias for keys command
Change-type: minor
2024-10-16 15:21:44 -04:00
3615f8e525 git mv keys/index to key/list 2024-10-16 15:15:23 -04:00
ec6cbd120e v19.4.0 2024-10-16 19:12:09 +00:00
65b278e40b Merge pull request #2855 from balena-io/releases-to-release-list
Add `release list` alias for `releases` command
2024-10-16 19:11:21 +00:00
8d1394a77d Add release list alias for releases command
Change-type: minor
2024-10-16 14:50:44 -04:00
ca0a3ee147 git mv releases/index to release/list 2024-10-16 14:25:20 -04:00
019af9e703 v19.3.0 2024-10-16 18:03:21 +00:00
f213940c84 Merge pull request #2854 from balena-io/fleets-to-fleet-list
Add alias `fleet list` for `fleets` command
2024-10-16 14:02:23 -04:00
5243803342 Add alias fleet list for fleets command
Change-type: minor
2024-10-16 12:36:45 -04:00
811e009ba9 git mv fleets/index to fleet/list 2024-10-16 12:31:21 -04:00
45e0f21685 v19.2.0 2024-10-16 16:11:52 +00:00
60f5f47930 Merge pull request #2853 from balena-io/api-keys-to-list
Add alias `api-key list` for command `api-keys`
2024-10-16 12:10:48 -04:00
cad5543863 Add alias api-key list for command api-keys
Change-type: minor
2024-10-16 11:20:30 -04:00
a1e936bb3f git mv api-keys/index to api-key/list 2024-10-16 11:15:23 -04:00
49984c2366 v19.1.3 2024-10-16 14:39:29 +00:00
2a0ab6abbb Merge pull request #2852 from balena-io/remove-custom-os-command-sorting
Remove custom sorting of OS commands in docs in favor of alphabetizing
2024-10-16 14:38:33 +00:00
349bab7702 Deduplicate dependencies 2024-10-16 10:13:38 -04:00
af2c04540f Remove custom sorting of OS commands in docs in favor of alphabetizing
Change-type: patch
2024-10-16 09:58:19 -04:00
cdfabb8f92 v19.1.2 2024-10-16 13:35:41 +00:00
5e058d5158 Merge pull request #2851 from balena-io/command-to-init
Remove custom override of oclif Command class in favor of `prerun` hook
2024-10-16 09:34:36 -04:00
6a81ed2d70 Update expected warnings 2024-10-14 15:56:54 -04:00
d323c0742c Remove no longer needed dependency get-stdin
Change-type: patch
2024-10-14 15:38:21 -04:00
9cdde4f6c2 Remove custom override of oclif Command class in favor of prerun hook
Change-type: patch
2024-10-14 15:38:21 -04:00
ebe10360b3 git mv src/command.ts to src/hooks/init.ts 2024-10-14 11:25:31 -04:00
440c5ad15b v19.1.1 2024-10-14 13:06:42 +00:00
0699278220 Merge pull request #2849 from balena-io/fix-changelog
Fix changelog entry for v19.1.0
2024-10-14 13:05:49 +00:00
0eb5c78e33 Deduplicate dependencies
Change-type: patch
2024-10-14 08:35:32 -04:00
067232b5c4 Fix changelog entry for v19.1.0
Change-type: patch
2024-10-14 07:51:00 -04:00
5716ba29ad v19.1.0 2024-10-11 17:15:09 +00:00
fc2234b0dd Merge pull request #2844 from balena-io/devices-to-device-list
Devices to device list
2024-10-11 17:14:15 +00:00
12cdb14638 Docs: Show aliases for commands
Change-type: patch
2024-10-11 12:54:09 -04:00
b936c51941 Deprecate devices command in favor of device list
Change-type: minor
2024-10-11 12:54:09 -04:00
6c23b06b4c git mv devices/index to device/list 2024-10-11 12:54:09 -04:00
87c52c55ed Deduplicate dependencies
Change-type: patch
2024-10-11 12:54:09 -04:00
f792343180 v19.0.20 2024-10-11 11:48:53 +00:00
680d592af2 Merge pull request #2846 from balena-io/use-default-usage
Use oclif default usage instead of manually filling it out
2024-10-11 11:47:51 +00:00
f52e6bd8b4 Docs: Generate CLI command references from file names instead of usage
Change-type: patch
2024-10-11 07:26:12 -04:00
0847daba1b Use default oclif USAGE message for all commands
Change-type: patch
2024-10-11 07:26:12 -04:00
057b37ae38 v19.0.19 2024-10-11 11:18:26 +00:00
deb7de8951 Merge pull request #2848 from balena-io/update-release-notes-link
Fix update notification release notes link
2024-10-11 11:17:38 +00:00
55dbe42e84 Deduplicate dependencies
Change-type: patch
2024-10-10 15:32:46 -04:00
3e8bc57fdb Fix update notification release notes link
Change-type: patch
2024-10-10 14:05:10 -04:00
d206e7cd66 v19.0.18 2024-10-08 15:25:16 +00:00
7092db8ee8 Merge pull request #2845 from balena-io/contributing-plural-folders
Contributing: No longer request separate folders for plural commands
2024-10-08 15:23:41 +00:00
276d61cf6c Contributing: No longer request separate folders for plural commands
Change-type: patch
2024-10-08 10:54:06 -04:00
77ccd9c39c v19.0.17 2024-10-08 14:04:45 +00:00
9e140eff13 Merge pull request #2842 from balena-io/remove-mixpanel
Remove mixpanel
2024-10-08 10:03:55 -04:00
da95baa70c Remove dev dependency parse-link-header
Change-type: patch
2024-10-08 09:37:37 -04:00
a3ec75c2c7 Remove dev dependency @octokit/rest
Change-type: patch
2024-10-08 09:37:37 -04:00
f6f6be8ee8 Remove dev dependency @octokit/plugin-throttling
Change-type: patch
2024-10-08 09:37:37 -04:00
09e653692b Remove no longer needed references and tests for mixpanel
Change-type: patch
2024-10-08 09:37:37 -04:00
3ac89b236a Remove dev dependency @types/mixpanel
Change-type: patch
2024-10-08 09:37:37 -04:00
bd472f2380 v19.0.16 2024-10-08 13:35:05 +00:00
b5dcf45c40 Merge pull request #2839 from balena-io/compose-reduce-patched-properties
compose: Reduce the properties updated to only the necessary
2024-10-08 16:34:06 +03:00
7e2b5abe60 compose: Reduce the properties updated to only the necessary
Change-type: patch
2024-10-08 16:11:28 +03:00
7b66e0d216 v19.0.15 2024-10-08 13:11:05 +00:00
877c5031a4 Merge pull request #2838 from balena-io/remove-mockery
Remove `mockery` dev dependency
2024-10-08 13:10:17 +00:00
1245b1c99b Remove unused mockery dev dependency
Change-type: patch
2024-10-08 08:47:14 -04:00
8dbe1af551 v19.0.14 2024-10-08 12:44:20 +00:00
aae303202b Merge pull request #2841 from balena-io/temporarily-skip-broken-image-manager-tests
Temporarily skip broken image-manager tests on Windows and Mac
2024-10-08 12:43:19 +00:00
284784505d Deduplicate dependencies 2024-10-08 08:21:07 -04:00
77b9514442 Temporarily skip broken image-manager tests on Windows and Mac
Change-type: patch
2024-10-08 08:21:01 -04:00
ff4afe3ab2 v19.0.13 2024-09-23 11:35:49 +00:00
5ea246f016 Merge pull request #2837 from balena-io/adjust-changelog-message
Remove extra line from recent changelog entry
2024-09-23 11:35:03 +00:00
127bd7ec72 Remove extra line from recent changelog entry
Change-type: patch
2024-09-23 07:12:22 -04:00
fa35877137 v19.0.12 2024-09-20 17:48:43 +00:00
a402dffbc5 Merge pull request #2834 from balena-io/remove-image-manager
Embed balena-image-manager instead of having it as a dependency
2024-09-20 13:47:48 -04:00
c7441b06ac skip
Change-type: patch
2024-09-20 12:05:00 -04:00
251d64eb88 Add image-manager tests
Change-type: patch
2024-09-20 08:38:21 -04:00
ff9bb52a20 Remove balena-image-manager dependency
Change-type: patch
2024-09-20 08:38:21 -04:00
c799c3f10d Embed balena-image-manager instead of having it as a dependency
Change-type: patch
2024-09-20 08:38:21 -04:00
89efe2a2c8 Add mime dependency 2024-09-20 08:38:21 -04:00
f6ff397969 Move mkdirp from devDependency to dependency 2024-09-18 12:56:41 -04:00
aaf709a1d4 v19.0.11 2024-09-18 16:38:59 +00:00
ca6eea4371 Merge pull request #2835 from balena-io/reduce-bluebird
Remove Bluebird as a direct dependency
2024-09-18 19:38:06 +03:00
d39dc5a39a Remove Bluebird as a direct dependency
Change-type: patch
2024-09-18 18:37:39 +03:00
1699419788 v19.0.10 2024-09-12 23:00:18 +00:00
c25591cb4a Merge pull request #2828 from balena-io/remove-package-resin-valid-email
Remove package `@resin.io/valid-email`
2024-09-12 22:59:27 +00:00
a2b4f76c94 Remove package @resin.io/valid-email
Change-type: patch
2024-09-12 18:39:21 -04:00
6a1239bd52 v19.0.9 2024-09-12 16:12:12 +00:00
ddf34326a4 Merge pull request #2830 from balena-io/renovate/actions-download-artifact-4.1.x
Update actions/download-artifact action to v4.1.8
2024-09-12 16:11:15 +00:00
58f480ad7c Update actions/download-artifact action to v4.1.8
Update actions/download-artifact from 4.1.7 to 4.1.8

Change-type: patch
2024-09-12 15:48:40 +00:00
7e6589a7d7 v19.0.8 2024-09-12 15:07:56 +00:00
c699bb1dbc Merge pull request #2829 from balena-io/renovate/actions-upload-artifact-digest
Update actions/upload-artifact digest to 5076954
2024-09-12 15:07:01 +00:00
e101e0f466 Update actions/upload-artifact digest to 5076954
Update actions/upload-artifact

Change-type: patch
2024-09-12 14:47:50 +00:00
e29273142e v19.0.7 2024-09-12 14:13:22 +00:00
519395cfcd Merge pull request #2825 from balena-io/renovate/actions-setup-node-digest
Update actions/setup-node digest to 1e60f62
2024-09-12 14:12:33 +00:00
314e8800d0 Update actions/setup-node digest to 1e60f62
Update actions/setup-node

Change-type: patch
2024-09-12 13:48:25 +00:00
0bb1c892e8 v19.0.6 2024-09-12 13:47:30 +00:00
5eb79f5cf0 Merge pull request #2802 from balena-io/remove-moment-library
Remove moment and moment-duration-format in favor of native time parsing
2024-09-12 10:46:29 -03:00
707b249e97 Remove moment and moment-duration-format in favor of native time parsing
Change-type: patch
2024-09-12 10:05:13 -03:00
2a725cd1f0 v19.0.5 2024-09-10 15:13:27 +00:00
83f274cc62 Merge pull request #2789 from balena-io/renovate/apple-actions-import-codesign-certs-2.x
Update apple-actions/import-codesign-certs action to v2
2024-09-10 12:12:42 -03:00
9242a3493a Update apple-actions/import-codesign-certs action to v2
Update apple-actions/import-codesign-certs from 1 to 2

Change-type: patch
2024-09-10 14:47:56 +00:00
aa46d314b4 v19.0.4 2024-09-10 14:44:44 +00:00
58f7dfc894 Merge pull request #2824 from balena-io/bump-ts-5_6_2
Bump TypeScript to 5.6.2
2024-09-10 14:43:53 +00:00
39e1c02648 Deduplicate dependencies
Resolves: #
Change-type:
2024-09-10 11:53:09 +03:00
5f92bbc846 Update TypeScript to 5.6.2
Change-type: patch
2024-09-10 11:49:41 +03:00
157 changed files with 3120 additions and 2638 deletions

View File

@ -28,7 +28,7 @@ runs:
using: 'composite'
steps:
- name: Download custom source artifact
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: custom-${{ github.event.pull_request.head.sha || github.event.head_commit.id }}-${{ runner.os }}-${{ runner.arch }}
path: ${{ runner.temp }}
@ -39,7 +39,7 @@ runs:
run: tar -xf ${{ runner.temp }}/custom.tgz
- name: Setup Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
with:
node-version: ${{ inputs.NODE_VERSION }}
cache: npm
@ -66,7 +66,7 @@ runs:
# https://github.com/Apple-Actions/import-codesign-certs
- name: Import Apple code signing certificate
if: runner.os == 'macOS'
uses: apple-actions/import-codesign-certs@253ddeeac23f2bdad1646faac5c8c2832e800071 # v1
uses: apple-actions/import-codesign-certs@8f3fb608891dd2244cdab3d69cd68c0d37a7fe93 # v2
with:
p12-file-base64: ${{ fromJSON(inputs.secrets).APPLE_SIGNING }}
p12-password: ${{ fromJSON(inputs.secrets).APPLE_SIGNING_PASSWORD }}
@ -135,7 +135,7 @@ runs:
XCODE_APP_LOADER_TEAM_ID: ${{ inputs.XCODE_APP_LOADER_TEAM_ID }}
- name: Upload artifacts
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
with:
name: gh-release-${{ github.event.pull_request.head.sha || github.event.head_commit.id }}-${{ strategy.job-index }}
path: dist

View File

@ -26,7 +26,7 @@ runs:
steps:
# https://github.com/actions/setup-node#caching-global-packages-data
- name: Setup Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
with:
node-version: ${{ inputs.NODE_VERSION }}
cache: npm
@ -58,7 +58,7 @@ runs:
run: tar --exclude-vcs -acf ${{ runner.temp }}/custom.tgz .
- name: Upload custom artifact
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
with:
name: custom-${{ github.event.pull_request.head.sha || github.event.head_commit.id }}-${{ runner.os }}-${{ runner.arch }}
path: ${{ runner.temp }}/custom.tgz

View File

@ -1,3 +1,411 @@
- commits:
- subject: Add `key list` alias for `keys` command
hash: 6b5c6e072b426a1e9517376ee756afa31ed96cfa
body: ""
footer:
Change-type: minor
change-type: minor
author: myarmolinsky
nested: []
version: 19.5.0
title: ""
date: 2024-10-17T14:56:38.422Z
- commits:
- subject: Add `release list` alias for `releases` command
hash: 8d1394a77d8cca4f18d162a3f522e80e8092ffa7
body: ""
footer:
Change-type: minor
change-type: minor
author: myarmolinsky
nested: []
version: 19.4.0
title: ""
date: 2024-10-16T19:12:05.274Z
- commits:
- subject: Add alias `fleet list` for `fleets` command
hash: 5243803342203ebac2a04c2fcfe1e9aa4a126a21
body: ""
footer:
Change-type: minor
change-type: minor
author: myarmolinsky
nested: []
version: 19.3.0
title: ""
date: 2024-10-16T18:03:16.667Z
- commits:
- subject: Add alias `api-key list` for command `api-keys`
hash: cad5543863b9f3e2b9c5883083dc3051b9e50ecf
body: ""
footer:
Change-type: minor
change-type: minor
author: myarmolinsky
nested: []
version: 19.2.0
title: ""
date: 2024-10-16T16:11:48.485Z
- commits:
- subject: Remove custom sorting of OS commands in docs in favor of alphabetizing
hash: af2c04540f41428b668ab0890dd498dfd28a4f11
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
version: 19.1.3
title: ""
date: 2024-10-16T14:39:24.641Z
- commits:
- subject: Remove no longer needed dependency `get-stdin`
hash: d323c0742cfbbcc017f11f9fd30a9539b1c46f84
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
- subject: Remove custom override of oclif Command class in favor of `prerun` hook
hash: 9cdde4f6c21ea1593de83107794a5b7323ed4cfe
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
version: 19.1.2
title: ""
date: 2024-10-16T13:35:36.846Z
- commits:
- subject: Deduplicate dependencies
hash: 0eb5c78e33979e7fbe7beb4e407949d53af6004b
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
- subject: Fix changelog entry for v19.1.0
hash: 067232b5c4d757913d4fb1c8f9611ed8eb394124
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
version: 19.1.1
title: ""
date: 2024-10-14T13:06:38.383Z
- commits:
- subject: "Docs: Show aliases for commands"
hash: 12cdb1463860a1ffef4e8ad44dde32f00369e3b5
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
- subject: Deprecate `devices` command in favor of `device list`
hash: b936c51941808db8c832678e11af86e2136cfea6
body: ""
footer:
Change-type: minor
change-type: minor
author: myarmolinsky
nested: []
- subject: Deduplicate dependencies
hash: 87c52c55eda0c7b6f9fa72e20b2298fa9ffefef2
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
version: 19.1.0
title: ""
date: 2024-10-11T17:15:02.716Z
- commits:
- subject: "Docs: Generate CLI command references from file names instead of usage"
hash: f52e6bd8b436d4243e39c9069b8ee885bb6401ff
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
- subject: Use default oclif `USAGE` message for all commands
hash: 0847daba1b58f807a222c5163b8383cc44cd13fc
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
version: 19.0.20
title: ""
date: 2024-10-11T11:48:49.138Z
- commits:
- subject: Deduplicate dependencies
hash: 55dbe42e84ebb14dac9c1da189594e345f69d7cd
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
- subject: Fix update notification release notes link
hash: 3e8bc57fdba35f7cbd4e357c5b8f0395c7bb0eef
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
version: 19.0.19
title: ""
date: 2024-10-11T11:18:22.541Z
- commits:
- subject: "Contributing: No longer request separate folders for plural commands"
hash: 276d61cf6c3dfac44796736ff4570f2aeaec971e
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
version: 19.0.18
title: ""
date: 2024-10-08T15:25:03.766Z
- commits:
- subject: Remove dev dependency `parse-link-header`
hash: da95baa70cc2dc72e6d529fa25c42cd2e1739c10
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
- subject: Remove dev dependency @octokit/rest
hash: a3ec75c2c752f734f07e84e9213887b4aec4e7fd
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
- subject: Remove dev dependency @octokit/plugin-throttling
hash: f6f6be8ee8be80048e621a4e75d2fbecacce47e4
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
- subject: Remove no longer needed references and tests for mixpanel
hash: 09e653692b00777aa56625751110305223bc5917
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
- subject: Remove dev dependency `@types/mixpanel`
hash: 3ac89b236abe3392c185010c3b3851a6923d083a
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
version: 19.0.17
title: ""
date: 2024-10-08T14:04:42.011Z
- commits:
- subject: "compose: Reduce the properties updated to only the necessary"
hash: 7e2b5abe600ab13f5f55fc86f0850b54a66debe5
body: ""
footer:
Change-type: patch
change-type: patch
author: Thodoris Greasidis
nested: []
version: 19.0.16
title: ""
date: 2024-10-08T13:35:01.015Z
- commits:
- subject: Remove unused `mockery` dev dependency
hash: 1245b1c99bab2d504a025f489451710cc140bc55
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
version: 19.0.15
title: ""
date: 2024-10-08T13:11:01.319Z
- commits:
- subject: Temporarily skip broken image-manager tests on Windows and Mac
hash: 77b9514442ab81ef1375a2517eb3e9aab7e724da
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
version: 19.0.14
title: ""
date: 2024-10-08T12:44:14.300Z
- commits:
- subject: Remove extra line from recent changelog entry
hash: 127bd7ec722133d81cd94a5e028d9f2e5219df7c
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
version: 19.0.13
title: ""
date: 2024-09-23T11:35:45.475Z
- commits:
- subject: skip
hash: c7441b06ac97a50d8ffefebff3af55e1d12d4035
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
- subject: Add `image-manager` tests
hash: 251d64eb8831555e2cfc8a54c73701eadb8c4f06
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
- subject: Remove `balena-image-manager` dependency
hash: ff9bb52a20b3f21281189ddfbbe1b800e104be1d
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
- subject: Embed `balena-image-manager` instead of having it as a dependency
hash: c799c3f10d1491227fe770ceace46b26ae209b19
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
version: 19.0.12
title: ""
date: 2024-09-20T17:48:39.881Z
- commits:
- subject: Remove Bluebird as a direct dependency
hash: d39dc5a39ad0ec25e0a690b881c8212699f64162
body: ""
footer:
Change-type: patch
change-type: patch
author: Thodoris Greasidis
nested: []
version: 19.0.11
title: ""
date: 2024-09-18T16:38:55.929Z
- commits:
- subject: Remove package `@resin.io/valid-email`
hash: a2b4f76c94e7fda3f122adf721e0a12d9a0e9164
body: ""
footer:
Change-type: patch
change-type: patch
author: myarmolinsky
nested: []
version: 19.0.10
title: ""
date: 2024-09-12T23:00:13.119Z
- commits:
- subject: Update actions/download-artifact action to v4.1.8
hash: 58f480ad7c097952b3ff4e0a5daebc163f2ce7c1
body: |
Update actions/download-artifact from 4.1.7 to 4.1.8
footer:
Change-type: patch
change-type: patch
author: Self-hosted Renovate Bot
nested: []
version: 19.0.9
title: ""
date: 2024-09-12T16:12:08.049Z
- commits:
- subject: Update actions/upload-artifact digest to 5076954
hash: e101e0f46663585d2999c1bd59c5335a2d012ae4
body: |
Update actions/upload-artifact
footer:
Change-type: patch
change-type: patch
author: Self-hosted Renovate Bot
nested: []
version: 19.0.8
title: ""
date: 2024-09-12T15:07:51.366Z
- commits:
- subject: Update actions/setup-node digest to 1e60f62
hash: 314e8800d0c6dfeade2140125cb3dd996713713e
body: |
Update actions/setup-node
footer:
Change-type: patch
change-type: patch
author: Self-hosted Renovate Bot
nested: []
version: 19.0.7
title: ""
date: 2024-09-12T14:13:18.381Z
- commits:
- subject: Remove moment and moment-duration-format in favor of native time parsing
hash: 707b249e972a6943d75014f487285c0dd8085b15
body: ""
footer:
Change-type: patch
change-type: patch
author: Otavio Jacobi
nested: []
version: 19.0.6
title: ""
date: 2024-09-12T13:47:25.357Z
- commits:
- subject: Update apple-actions/import-codesign-certs action to v2
hash: 9242a3493af4c518c4d1328f19ddf2d95c182af7
body: |
Update apple-actions/import-codesign-certs from 1 to 2
footer:
Change-type: patch
change-type: patch
author: Self-hosted Renovate Bot
nested: []
version: 19.0.5
title: ""
date: 2024-09-10T15:13:23.938Z
- commits:
- subject: Update TypeScript to 5.6.2
hash: 5f92bbc846fe93cc03ebe7717baafe24f17d4e0d
body: ""
footer:
Change-type: patch
change-type: patch
author: Thodoris Greasidis
nested: []
version: 19.0.4
title: ""
date: 2024-09-10T14:44:39.949Z
- commits:
- subject: Reduce use of CJS require() on automation files
hash: facc66e9f97d075610d4383efa92dceb5b4f7acf

View File

@ -4,6 +4,118 @@ All notable changes to this project will be documented in this file
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
This project adheres to [Semantic Versioning](http://semver.org/).
## 19.5.0 - 2024-10-17
* Add `key list` alias for `keys` command [myarmolinsky]
## 19.4.0 - 2024-10-16
* Add `release list` alias for `releases` command [myarmolinsky]
## 19.3.0 - 2024-10-16
* Add alias `fleet list` for `fleets` command [myarmolinsky]
## 19.2.0 - 2024-10-16
* Add alias `api-key list` for command `api-keys` [myarmolinsky]
## 19.1.3 - 2024-10-16
* Remove custom sorting of OS commands in docs in favor of alphabetizing [myarmolinsky]
## 19.1.2 - 2024-10-16
* Remove no longer needed dependency `get-stdin` [myarmolinsky]
* Remove custom override of oclif Command class in favor of `prerun` hook [myarmolinsky]
## 19.1.1 - 2024-10-14
* Deduplicate dependencies [myarmolinsky]
* Fix changelog entry for v19.1.0 [myarmolinsky]
## 19.1.0 - 2024-10-11
* Docs: Show aliases for commands [myarmolinsky]
* Add alias `device list` for `devices` command [myarmolinsky]
* Deduplicate dependencies [myarmolinsky]
## 19.0.20 - 2024-10-11
* Docs: Generate CLI command references from file names instead of usage [myarmolinsky]
* Use default oclif `USAGE` message for all commands [myarmolinsky]
## 19.0.19 - 2024-10-11
* Deduplicate dependencies [myarmolinsky]
* Fix update notification release notes link [myarmolinsky]
## 19.0.18 - 2024-10-08
* Contributing: No longer request separate folders for plural commands [myarmolinsky]
## 19.0.17 - 2024-10-08
* Remove dev dependency `parse-link-header` [myarmolinsky]
* Remove dev dependency @octokit/rest [myarmolinsky]
* Remove dev dependency @octokit/plugin-throttling [myarmolinsky]
* Remove no longer needed references and tests for mixpanel [myarmolinsky]
* Remove dev dependency `@types/mixpanel` [myarmolinsky]
## 19.0.16 - 2024-10-08
* compose: Reduce the properties updated to only the necessary [Thodoris Greasidis]
## 19.0.15 - 2024-10-08
* Remove unused `mockery` dev dependency [myarmolinsky]
## 19.0.14 - 2024-10-08
* Temporarily skip broken image-manager tests on Windows and Mac [myarmolinsky]
## 19.0.13 - 2024-09-23
* Remove extra line from recent changelog entry [myarmolinsky]
## 19.0.12 - 2024-09-20
* Add `image-manager` tests [myarmolinsky]
* Remove `balena-image-manager` dependency [myarmolinsky]
* Embed `balena-image-manager` instead of having it as a dependency [myarmolinsky]
## 19.0.11 - 2024-09-18
* Remove Bluebird as a direct dependency [Thodoris Greasidis]
## 19.0.10 - 2024-09-12
* Remove package `@resin.io/valid-email` [myarmolinsky]
## 19.0.9 - 2024-09-12
* Update actions/download-artifact action to v4.1.8 [Self-hosted Renovate Bot]
## 19.0.8 - 2024-09-12
* Update actions/upload-artifact digest to 5076954 [Self-hosted Renovate Bot]
## 19.0.7 - 2024-09-12
* Update actions/setup-node digest to 1e60f62 [Self-hosted Renovate Bot]
## 19.0.6 - 2024-09-12
* Remove moment and moment-duration-format in favor of native time parsing [Otavio Jacobi]
## 19.0.5 - 2024-09-10
* Update apple-actions/import-codesign-certs action to v2 [Self-hosted Renovate Bot]
## 19.0.4 - 2024-09-10
* Update TypeScript to 5.6.2 [Thodoris Greasidis]
## 19.0.3 - 2024-09-05
* Reduce use of CJS require() on automation files [Otavio Jacobi]

View File

@ -133,7 +133,6 @@ To add a new command to be documented,
1. Find the resource which it is part of or create a new one.
2. List the location of the build file
3. Make sure to add your files in alphabetical order
4. Resources with plural names needs to have 2 sections if they have commands like: "fleet, fleets" or "device, devices" or "tag, tags"
Once added, run the command `npm run build` to generate the documentation

View File

@ -19,7 +19,6 @@ import type { JsonVersions } from '../src/commands/version/index';
import { run as oclifRun } from '@oclif/core';
import * as archiver from 'archiver';
import * as Bluebird from 'bluebird';
import { exec, execFile } from 'child_process';
import * as filehound from 'filehound';
import type { Stats } from 'fs';
@ -42,6 +41,7 @@ import {
const execFileAsync = promisify(execFile);
const execAsync = promisify(exec);
const rimrafAsync = promisify(rimraf);
export const packageJSON = loadPackageJson();
export const version = 'v' + packageJSON.version;
@ -517,7 +517,7 @@ export async function buildOclifInstaller() {
}
for (const dir of dirs) {
console.log(`rimraf(${dir})`);
await Bluebird.fromCallback((cb) => rimraf(dir, cb));
await rimrafAsync(dir);
}
console.log('=======================================================');
console.log(`oclif ${packCmd} ${packOpts.join(' ')}`);

View File

@ -36,9 +36,6 @@ import { GlobSync } from 'glob';
* This dictionary is the source of truth that creates the docs config which is used
* to generate the CLI documentation. By default, the folder name will be used.
*
* Resources with plural names needs to have 2 sections if they have commands like:
* "fleet, fleets" or "device, devices" or "tag, tags"
*
*/
interface Category {
@ -55,7 +52,6 @@ interface Documentation {
// Mapping folders names to custom headings in the docs
const commandHeadings: { [key: string]: string } = {
'api-key': 'API Keys',
'api-keys': 'API Keys',
login: 'Authentication',
whoami: 'Authentication',
logout: 'Authentication',
@ -63,7 +59,6 @@ const commandHeadings: { [key: string]: string } = {
envs: 'Environment Variables',
help: 'Help and Version',
key: 'SSH Keys',
keys: 'SSH Keys',
orgs: 'Organizations',
os: 'OS',
util: 'Utilities',

View File

@ -26,7 +26,7 @@ export interface Document {
export interface Category {
title: string;
commands: OclifCommand[];
commands: Array<OclifCommand & { name: string }>;
}
export { OclifCommand };

View File

@ -18,7 +18,6 @@ import * as path from 'path';
import { getCapitanoDoc } from './capitanodoc';
import type { Category, Document, OclifCommand } from './doc-types';
import * as markdown from './markdown';
import { stripIndent } from '../../src/utils/lazy';
/**
* Generates the markdown document (as a string) for the CLI documentation
@ -39,7 +38,7 @@ export async function renderMarkdown(): Promise<string> {
};
for (const jsFilename of commandCategory.files) {
category.commands.push(...(await importOclifCommands(jsFilename)));
category.commands.push(await importOclifCommands(jsFilename));
}
result.categories.push(category);
}
@ -47,51 +46,23 @@ export async function renderMarkdown(): Promise<string> {
return markdown.render(result);
}
// Help is now managed via a plugin
// This fake command allows capitanodoc to include help in docs
class FakeHelpCommand {
description = stripIndent`
List balena commands, or get detailed help for a specific command.
async function importOclifCommands(jsFilename: string) {
const command = (await import(path.join(process.cwd(), jsFilename)))
.default as OclifCommand;
List balena commands, or get detailed help for a specific command.
`;
examples = [
'$ balena help',
'$ balena help login',
'$ balena help os download',
];
args = {
command: {
description: 'command to show help for',
},
};
usage = 'help [command]';
flags = {
verbose: {
description: 'show additional commands',
char: '-v',
},
};
}
async function importOclifCommands(
jsFilename: string,
): Promise<OclifCommand[]> {
// TODO: Currently oclif commands with no `usage` overridden will cause
// an error when parsed. This should be improved so that `usage` does not have
// to be overridden if not necessary.
const command: OclifCommand =
jsFilename === 'help'
? (new FakeHelpCommand() as unknown as OclifCommand)
: ((await import(path.join(process.cwd(), jsFilename)))
.default as OclifCommand);
return [command];
return {
...command,
// build/commands/device/index.js -> device
// build/commands/device/list.js -> device list
name: jsFilename
.split('/')
.slice(2)
.join(' ')
.split('.')
.slice(0, 1)
.join(' ')
.split(' index')[0],
} as Category['commands'][0];
}
/**

View File

@ -18,12 +18,20 @@ import { Parser } from '@oclif/core';
import * as ent from 'ent';
import * as _ from 'lodash';
import { getManualSortCompareFunction } from '../../src/utils/helpers';
import { capitanoizeOclifUsage } from '../../src/utils/oclif-utils';
import type { Category, Document, OclifCommand } from './doc-types';
import type { Category, Document } from './doc-types';
function renderOclifCommand(command: OclifCommand): string[] {
const result = [`## ${ent.encode(command.usage || '')}`];
function renderOclifCommand(command: Category['commands'][0]): string[] {
const result = [`## ${ent.encode(command.name || '')}`];
if (command.aliases?.length) {
result.push('### Aliases');
result.push(command.aliases.map((alias) => `- \`${alias}\``).join('\n'));
result.push(
`\nTo use one of the aliases, replace \`${command.name}\` with the alias.`,
);
}
result.push('### Description');
const description = (command.description || '')
.split('\n')
.slice(1) // remove the first line, which oclif uses as help header
@ -80,7 +88,7 @@ function renderToc(categories: Category[]): string[] {
result.push(
category.commands
.map((command) => {
const signature = capitanoizeOclifUsage(command.usage);
const signature = capitanoizeOclifUsage(command.name);
return `\t- [${ent.encode(signature)}](${getAnchor(signature)})`;
})
.join('\n'),
@ -89,33 +97,7 @@ function renderToc(categories: Category[]): string[] {
return result;
}
const manualCategorySorting: { [category: string]: string[] } = {
'Environment Variables': ['envs', 'env rm', 'env add', 'env rename'],
OS: [
'os versions',
'os download',
'os build config',
'os configure',
'os initialize',
],
};
function sortCommands(doc: Document): void {
for (const category of doc.categories) {
if (category.title in manualCategorySorting) {
category.commands = category.commands.sort(
getManualSortCompareFunction<OclifCommand, string>(
manualCategorySorting[category.title],
(cmd: OclifCommand, x: string) =>
(cmd.usage || '').toString().replace(/\W+/g, ' ').includes(x),
),
);
}
}
}
export function render(doc: Document) {
sortCommands(doc);
const result = [
`# ${doc.title}`,
doc.introduction,

View File

@ -1,215 +0,0 @@
/**
* @license
* Copyright 2019 Balena Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as _ from 'lodash';
import * as semver from 'semver';
import { Octokit } from '@octokit/rest';
import { throttling } from '@octokit/plugin-throttling';
const { GITHUB_TOKEN } = process.env;
/** Return a cached Octokit instance, creating a new one as needed. */
const getOctokit = _.once(function () {
const OctokitConstructor = Octokit.plugin(throttling);
return new OctokitConstructor({
auth: GITHUB_TOKEN,
throttle: {
onRateLimit: (retryAfter: number, options: any) => {
console.warn(
`Request quota exhausted for request ${options.method} ${options.url}`,
);
// retries 3 times
if (options.request.retryCount < 3) {
console.log(`Retrying after ${retryAfter} seconds!`);
return true;
}
},
onAbuseLimit: (_retryAfter: number, options: any) => {
// does not retry, only logs a warning
console.warn(
`Abuse detected for request ${options.method} ${options.url}`,
);
},
},
});
});
/**
* Extract pagination information (current page, total pages, ordinal number)
* from the 'link' response header (example below), using the parse-link-header
* npm package:
* "link": "<https://api.github.com/repositories/187370853/releases?per_page=2&page=2>; rel=\"next\",
* <https://api.github.com/repositories/187370853/releases?per_page=2&page=3>; rel=\"last\""
*
* @param response Octokit response object (including response.headers.link)
* @param perPageDefault Default per_page pagination value if missing in URL
* @return Object where 'page' is the current page number (1-based),
* 'pages' is the total number of pages, and 'ordinal' is the ordinal number
* (3rd, 4th, 5th...) of the first item in the current page.
*/
async function getPageNumbers(
response: any,
perPageDefault: number,
): Promise<{ page: number; pages: number; ordinal: number }> {
const res = { page: 1, pages: 1, ordinal: 1 };
if (!response.headers.link) {
return res;
}
const parse = await import('parse-link-header');
const parsed = parse(response.headers.link);
if (parsed == null) {
throw new Error(`Failed to parse link header: '${response.headers.link}'`);
}
let perPage = perPageDefault;
if (parsed.next) {
if (parsed.next.per_page) {
perPage = parseInt(parsed.next.per_page, 10);
}
res.page = parseInt(parsed.next.page!, 10) - 1;
res.pages = parseInt(parsed.last!.page!, 10);
} else {
if (parsed.prev!.per_page) {
perPage = parseInt(parsed.prev!.per_page, 10);
}
res.page = res.pages = parseInt(parsed.prev!.page!, 10) + 1;
}
res.ordinal = (res.page - 1) * perPage + 1;
return res;
}
/**
* Iterate over every GitHub release in the given owner/repo, check whether
* its tag_name matches against the affectedVersions semver spec, and if so
* replace its release description (body) with the given newDescription value.
* @param owner GitHub repo owner, e.g. 'balena-io' or 'pdcastro'
* @param repo GitHub repo, e.g. 'balena-cli'
* @param affectedVersions Semver spec, e.g. '2.6.1 - 7.10.9 || 8.0.0'
* @param newDescription New release description (body)
* @param editID Short string present in newDescription, e.g. '[AA101]', that
* can be searched to determine whether that release has already been updated.
*/
async function updateGitHubReleaseDescriptions(
owner: string,
repo: string,
affectedVersions: string,
newDescription: string,
editID: string,
) {
const perPage = 30;
const octokit = getOctokit();
const options = octokit.repos.listReleases.endpoint.merge({
owner,
repo,
per_page: perPage,
});
let errCount = 0;
type Release =
import('@octokit/rest').RestEndpointMethodTypes['repos']['listReleases']['response']['data'][0];
for await (const response of octokit.paginate.iterator<Release>(options)) {
const {
page: thisPage,
pages: totalPages,
ordinal,
} = await getPageNumbers(response, perPage);
let i = 0;
for (const cliRelease of response.data) {
const prefix = `[#${ordinal + i++} pg ${thisPage}/${totalPages}]`;
if (!cliRelease.id) {
console.error(
`${prefix} Error: missing release ID (errCount=${++errCount})`,
);
continue;
}
const skipMsg = `${prefix} skipping release "${cliRelease.tag_name}" (${cliRelease.id})`;
if (cliRelease.draft === true) {
console.info(`${skipMsg}: draft release`);
continue;
} else if (cliRelease.body && cliRelease.body.includes(editID)) {
console.info(`${skipMsg}: already updated`);
continue;
} else if (!semver.satisfies(cliRelease.tag_name, affectedVersions)) {
console.info(`${skipMsg}: outside version range`);
continue;
} else {
const updatedRelease = {
owner,
repo,
release_id: cliRelease.id,
body: newDescription,
};
let oldBodyPreview = cliRelease.body;
if (oldBodyPreview) {
oldBodyPreview = oldBodyPreview.replace(/\s+/g, ' ').trim();
if (oldBodyPreview.length > 12) {
oldBodyPreview = oldBodyPreview.substring(0, 9) + '...';
}
}
console.info(
`${prefix} updating release "${cliRelease.tag_name}" (${cliRelease.id}) old body="${oldBodyPreview}"`,
);
try {
await octokit.repos.updateRelease(updatedRelease);
} catch (err) {
console.error(
`${skipMsg}: Error: ${err.message} (count=${++errCount})`,
);
continue;
}
}
}
}
}
/**
* Add a warning description to CLI releases affected by a mixpanel tracking
* security issue (#1359). This function can be executed "manually" with the
* following command line:
*
* npx ts-node --type-check -P automation/tsconfig.json automation/run.ts fix1359
*/
export async function updateDescriptionOfReleasesAffectedByIssue1359() {
// Run only on Linux/Node10, instead of all platform/Node combinations.
// (It could have been any other platform, as long as it only runs once.)
if (process.platform !== 'linux' || semver.major(process.version) !== 10) {
return;
}
const owner = 'balena-io';
const repo = 'balena-cli';
const affectedVersions =
'2.6.1 - 7.10.9 || 8.0.0 - 8.1.0 || 9.0.0 - 9.15.6 || 10.0.0 - 10.17.5 || 11.0.0 - 11.7.2';
const editID = '[AA100]';
let newDescription = `
Please note: the "login" command in this release is affected by a
security issue fixed in versions
[7.10.10](https://github.com/balena-io/balena-cli/releases/tag/v7.10.10),
[8.1.1](https://github.com/balena-io/balena-cli/releases/tag/v8.1.1),
[9.15.7](https://github.com/balena-io/balena-cli/releases/tag/v9.15.7),
[10.17.6](https://github.com/balena-io/balena-cli/releases/tag/v10.17.6),
[11.7.3](https://github.com/balena-io/balena-cli/releases/tag/v11.7.3)
and later. If you need to use this version, avoid passing your password,
keys or tokens as command-line arguments. ${editID}`;
// remove line breaks and collapse white space
newDescription = newDescription.replace(/\s+/g, ' ').trim();
await updateGitHubReleaseDescriptions(
owner,
repo,
affectedVersions,
newDescription,
editID,
);
}

View File

@ -24,7 +24,6 @@ import {
signFilesForNotarization,
testShrinkwrap,
} from './build-bin';
import { updateDescriptionOfReleasesAffectedByIssue1359 } from './deploy-bin';
// DEBUG set to falsy for negative values else is truthy
process.env.DEBUG = ['0', 'no', 'false', '', undefined].includes(
@ -54,7 +53,6 @@ async function parse(args?: string[]) {
'sign:binaries': signFilesForNotarization,
'catch-uncommitted': catchUncommitted,
'test-shrinkwrap': testShrinkwrap,
fix1359: updateDescriptionOfReleasesAffectedByIssue1359,
};
for (const arg of args) {
if (!Object.hasOwn(commands, arg)) {

View File

@ -8,21 +8,21 @@ _balena() {
local context state line curcontext="$curcontext"
# Valid top-level completions
main_commands=( api-key api-keys app block build config deploy device devices env envs fleet fleets internal join key keys leave local login logout logs notes orgs os preload push release releases scan settings ssh support tag tags tunnel util version whoami )
main_commands=( api-key app block build config deploy device devices env envs fleet internal join key leave local login logout logs notes orgs os preload push release scan settings ssh support tag tags tunnel util version whoami )
# Sub-completions
api_key_cmds=( generate revoke )
api_key_cmds=( generate list revoke )
app_cmds=( create )
block_cmds=( create )
config_cmds=( generate inject read reconfigure write )
device_cmds=( deactivate identify init local-mode move os-update pin public-url purge reboot register rename restart rm shutdown start-service stop-service track-fleet )
device_cmds=( deactivate identify init list local-mode move os-update pin public-url purge reboot register rename restart rm shutdown start-service stop-service track-fleet )
devices_cmds=( supported )
env_cmds=( add rename rm )
fleet_cmds=( create pin purge rename restart rm track-latest )
fleet_cmds=( create list pin purge rename restart rm track-latest )
internal_cmds=( osinit )
key_cmds=( add rm )
key_cmds=( add list rm )
local_cmds=( configure flash )
os_cmds=( build-config configure download initialize versions )
release_cmds=( export finalize import invalidate validate )
release_cmds=( finalize invalidate list validate )
tag_cmds=( rm set )

View File

@ -7,21 +7,21 @@ _balena_complete()
local cur prev
# Valid top-level completions
main_commands="api-key api-keys app block build config deploy device devices env envs fleet fleets internal join key keys leave local login logout logs notes orgs os preload push release releases scan settings ssh support tag tags tunnel util version whoami"
main_commands="api-key app block build config deploy device devices env envs fleet internal join key leave local login logout logs notes orgs os preload push release scan settings ssh support tag tags tunnel util version whoami"
# Sub-completions
api_key_cmds="generate revoke"
api_key_cmds="generate list revoke"
app_cmds="create"
block_cmds="create"
config_cmds="generate inject read reconfigure write"
device_cmds="deactivate identify init local-mode move os-update pin public-url purge reboot register rename restart rm shutdown start-service stop-service track-fleet"
device_cmds="deactivate identify init list local-mode move os-update pin public-url purge reboot register rename restart rm shutdown start-service stop-service track-fleet"
devices_cmds="supported"
env_cmds="add rename rm"
fleet_cmds="create pin purge rename restart rm track-latest"
fleet_cmds="create list pin purge rename restart rm track-latest"
internal_cmds="osinit"
key_cmds="add rm"
key_cmds="add list rm"
local_cmds="configure flash"
os_cmds="build-config configure download initialize versions"
release_cmds="export finalize import invalidate validate"
release_cmds="finalize invalidate list validate"
tag_cmds="rm set"

File diff suppressed because it is too large Load Diff

765
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "balena-cli",
"version": "19.0.3",
"version": "19.5.0",
"description": "The official balena Command Line Interface",
"main": "./build/app.js",
"homepage": "https://github.com/balena-io/balena-cli",
@ -99,7 +99,7 @@
"helpClass": "./build/help",
"topicSeparator": " ",
"hooks": {
"prerun": "./build/hooks/prerun/track",
"prerun": "./build/hooks/prerun",
"command_not_found": "./build/hooks/command-not-found/suggest"
},
"additionalHelpFlags": [
@ -113,8 +113,6 @@
"devDependencies": {
"@balena/lint": "^8.0.0",
"@electron/notarize": "^2.0.0",
"@octokit/plugin-throttling": "^3.5.1",
"@octokit/rest": "^18.6.7",
"@types/archiver": "^6.0.2",
"@types/bluebird": "^3.5.36",
"@types/body-parser": "^1.19.2",
@ -138,14 +136,13 @@
"@types/jsonwebtoken": "^9.0.6",
"@types/klaw": "^3.0.6",
"@types/lodash": "^4.14.178",
"@types/mixpanel": "^2.14.3",
"@types/mime": "^3.0.4",
"@types/mocha": "^10.0.7",
"@types/mock-fs": "^4.13.4",
"@types/mock-require": "^2.0.1",
"@types/moment-duration-format": "^2.2.3",
"@types/ndjson": "^2.0.1",
"@types/node": "^20.0.0",
"@types/node-cleanup": "^2.1.2",
"@types/parse-link-header": "^2.0.3",
"@types/prettyjson": "^0.0.33",
"@types/progress-stream": "^2.0.2",
"@types/request": "^2.48.7",
@ -179,38 +176,34 @@
"intercept-stdout": "^0.1.2",
"jsonwebtoken": "^9.0.0",
"klaw": "^4.1.0",
"mkdirp": "^3.0.1",
"mocha": "^10.6.0",
"mock-fs": "^5.2.0",
"mock-require": "^3.0.3",
"nock": "^13.2.1",
"oclif": "^4.14.0",
"parse-link-header": "^2.0.0",
"rewire": "^7.0.0",
"simple-git": "^3.14.1",
"sinon": "^18.0.0",
"string-to-stream": "^3.0.1",
"ts-node": "^10.4.0",
"typescript": "^5.5.2"
"typescript": "^5.6.2"
},
"dependencies": {
"@balena/compose": "^4.0.1",
"@balena/dockerignore": "^1.0.2",
"@balena/env-parsing": "^1.1.8",
"@balena/es-version": "^1.0.1",
"@balena/release-bundle": "^0.5.2",
"@oclif/core": "^4.0.8",
"@resin.io/valid-email": "^0.1.0",
"@sentry/node": "^6.16.1",
"balena-config-json": "^4.2.0",
"balena-device-init": "^7.0.1",
"balena-errors": "^4.7.3",
"balena-image-fs": "^7.0.6",
"balena-image-manager": "^10.0.1",
"balena-preload": "^15.0.6",
"balena-sdk": "^19.7.3",
"balena-semver": "^2.3.0",
"balena-settings-client": "^5.0.2",
"balena-settings-storage": "^8.1.0",
"bluebird": "^3.7.2",
"body-parser": "^1.19.1",
"bonjour-service": "^1.2.1",
"chalk": "^3.0.0",
@ -228,7 +221,6 @@
"fast-boot2": "^1.1.0",
"fast-levenshtein": "^3.0.0",
"filenamify": "^4.3.0",
"get-stdin": "^8.0.0",
"glob": "^7.2.0",
"global-agent": "^2.2.0",
"global-tunnel-ng": "^2.1.1",
@ -241,8 +233,8 @@
"JSONStream": "^1.0.3",
"livepush": "^3.5.1",
"lodash": "^4.17.21",
"moment": "^2.29.1",
"moment-duration-format": "^2.3.2",
"mime": "^2.4.6",
"mkdirp": "^3.0.1",
"ndjson": "^2.0.0",
"node-cleanup": "^2.1.2",
"node-unzip-2": "^0.2.8",
@ -253,7 +245,7 @@
"reconfix": "^1.0.0-v0-1-0-fork-46760acff4d165f5238bfac5e464256ef1944476",
"request": "^2.88.2",
"resin-cli-form": "^3.0.0",
"resin-cli-visuals": "^2.0.0",
"resin-cli-visuals": "^2.0.1",
"resin-doodles": "^0.2.0",
"resin-stream-logger": "^0.1.2",
"rimraf": "^3.0.2",
@ -281,6 +273,6 @@
}
},
"versionist": {
"publishedAt": "2024-09-05T12:34:09.871Z"
"publishedAt": "2024-10-17T14:56:39.279Z"
}
}

View File

@ -153,7 +153,7 @@ async function oclifRun(command: string[], options: AppOptions) {
}
})(!options.noFlush);
const { trackPromise } = await import('./hooks/prerun/track');
const { trackPromise } = await import('./hooks/prerun');
await Promise.all([trackPromise, deprecationPromise, runPromise]);
}

View File

@ -1,170 +0,0 @@
/**
* @license
* Copyright 2020 Balena Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Command } from '@oclif/core';
import {
InsufficientPrivilegesError,
NotAvailableInOfflineModeError,
} from './errors';
import { stripIndent } from './utils/lazy';
export default abstract class BalenaCommand extends Command {
/**
* When set to true, command will be listed in `help`,
* otherwise listed in `help --verbose` with secondary commands.
*/
public static primary = false;
/**
* Require elevated privileges to run.
* When set to true, command will exit with an error
* if executed without root on Mac/Linux
* or if executed by non-Administrator on Windows.
*/
public static root = false;
/**
* Require authentication to run.
* When set to true, command will exit with an error
* if user is not already logged in.
*/
public static authenticated = false;
/**
* Require an internet connection to run.
* When set to true, command will exit with an error
* if user is running in offline mode (BALENARC_OFFLINE_MODE).
*/
public static offlineCompatible = false;
/**
* Accept piped input.
* When set to true, command will read from stdin during init
* and make contents available on member `stdin`.
*/
public static readStdin = false;
public stdin: string;
/**
* Throw InsufficientPrivilegesError if not root on Mac/Linux
* or non-Administrator on Windows.
*
* Called automatically if `root=true`.
* Can be called explicitly by command implementation, if e.g.:
* - check should only be done conditionally
* - other code needs to execute before check
*/
protected static async checkElevatedPrivileges() {
const isElevated = await (await import('is-elevated'))();
if (!isElevated) {
throw new InsufficientPrivilegesError(
'You need root/admin privileges to run this command',
);
}
}
/**
* Throw NotLoggedInError if not logged in.
*
* Called automatically if `authenticated=true`.
* Can be called explicitly by command implementation, if e.g.:
* - check should only be done conditionally
* - other code needs to execute before check
*
* Note, currently public to allow use outside of derived commands
* (as some command implementations require this. Can be made protected
* if this changes).
*
* @throws {NotLoggedInError}
*/
public static async checkLoggedIn() {
await (await import('./utils/patterns')).checkLoggedIn();
}
/**
* Throw NotLoggedInError if not logged in when condition true.
*
* @param {boolean} doCheck - will check if true.
* @throws {NotLoggedInError}
*/
public static async checkLoggedInIf(doCheck: boolean) {
if (doCheck) {
await this.checkLoggedIn();
}
}
/**
* Throw NotAvailableInOfflineModeError if in offline mode.
*
* Called automatically if `onlineOnly=true`.
* Can be called explicitly by command implementation, if e.g.:
* - check should only be done conditionally
* - other code needs to execute before check
*
* Note, currently public to allow use outside of derived commands
* (as some command implementations require this. Can be made protected
* if this changes).
*
* @throws {NotAvailableInOfflineModeError}
*/
public static checkNotUsingOfflineMode() {
if (process.env.BALENARC_OFFLINE_MODE) {
throw new NotAvailableInOfflineModeError(stripIndent`
This command requires an internet connection, and cannot be used in offline mode.
To leave offline mode, unset the BALENARC_OFFLINE_MODE environment variable.
`);
}
}
/**
* Read stdin contents and make available to command.
*
* This approach could be improved in the future to automatically set argument
* values from stdin based in configuration, minimising command implementation.
*/
protected async getStdin() {
this.stdin = await (await import('get-stdin'))();
}
/**
* Get a logger instance.
*/
protected static async getLogger() {
return (await import('./utils/logger')).getLogger();
}
protected async init() {
const ctr = this.constructor as typeof BalenaCommand;
if (ctr.root) {
await BalenaCommand.checkElevatedPrivileges();
}
if (ctr.authenticated) {
await BalenaCommand.checkLoggedIn();
}
if (!ctr.offlineCompatible) {
BalenaCommand.checkNotUsingOfflineMode();
}
if (ctr.readStdin) {
await this.getStdin();
}
}
}

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -40,8 +39,6 @@ export default class GenerateCmd extends Command {
}),
};
public static usage = 'api-key generate <name>';
public static flags = {
help: cf.help,
};

View File

@ -15,12 +15,13 @@
* limitations under the License.
*/
import { Flags } from '@oclif/core';
import Command from '../../command';
import { Flags, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
export default class ApiKeysCmd extends Command {
export default class APIKeyListCmd extends Command {
public static aliases = ['api-keys'];
public static description = stripIndent`
Print a list of balenaCloud API keys.
@ -28,9 +29,7 @@ export default class ApiKeysCmd extends Command {
Print a list of balenaCloud API keys for the current user or for a specific fleet with the \`--fleet\` option.
`;
public static examples = ['$ balena api-keys'];
public static usage = 'api-keys';
public static examples = ['$ balena api-key list'];
public static flags = {
help: cf.help,
@ -44,7 +43,7 @@ export default class ApiKeysCmd extends Command {
public static authenticated = true;
public async run() {
const { flags: options } = await this.parse(ApiKeysCmd);
const { flags: options } = await this.parse(APIKeyListCmd);
const { getApplication } = await import('../../utils/sdk');
const actorId = options.fleet

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -41,8 +40,6 @@ export default class RevokeCmd extends Command {
}),
};
public static usage = 'api-key revoke <ids>';
public static flags = {
help: cf.help,
};

View File

@ -15,9 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { stripIndent } from '../../utils/lazy';
@ -56,8 +54,6 @@ export default class AppCreateCmd extends Command {
}),
};
public static usage = 'app create <name>';
public static flags = {
organization: Flags.string({
char: 'o',

View File

@ -15,9 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { stripIndent } from '../../utils/lazy';
@ -56,8 +54,6 @@ export default class BlockCreateCmd extends Command {
}),
};
public static usage = 'block create <name>';
public static flags = {
organization: Flags.string({
char: 'o',

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args, Flags } from '@oclif/core';
import Command from '../../command';
import { Args, Flags, Command } from '@oclif/core';
import { getBalenaSdk } from '../../utils/lazy';
import * as cf from '../../utils/common-flags';
import * as compose from '../../utils/compose';
@ -84,8 +83,6 @@ ${dockerignoreHelp}
source: Args.string({ description: 'path of project source directory' }),
};
public static usage = 'build [source]';
public static flags = {
arch: Flags.string({
description: 'the architecture to build for',
@ -108,13 +105,16 @@ ${dockerignoreHelp}
public async run() {
const { args: params, flags: options } = await this.parse(BuildCmd);
await Command.checkLoggedInIf(!!options.fleet);
const Logger = await import('../../utils/logger');
const { checkLoggedInIf } = await import('../../utils/patterns');
await checkLoggedInIf(!!options.fleet);
(await import('events')).defaultMaxListeners = 1000;
const sdk = getBalenaSdk();
const logger = await Command.getLogger();
const logger = Logger.getLogger();
logger.logDebug('Parsing input...');
// `build` accepts `source` as a parameter, but compose expects it as an option

View File

@ -15,9 +15,8 @@
* limitations under the License.
*/
import { Flags } from '@oclif/core';
import { Flags, Command } from '@oclif/core';
import type { Interfaces } from '@oclif/core';
import Command from '../../command';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getCliForm, stripIndent } from '../../utils/lazy';
import {
@ -60,8 +59,6 @@ export default class ConfigGenerateCmd extends Command {
'$ balena config generate --fleet myorg/fleet --version 2.12.7 --network wifi --wifiSsid mySsid --wifiKey abcdefgh --appUpdatePollInterval 15',
];
public static usage = 'config generate';
public static flags = {
version: Flags.string({
description: 'a balenaOS version',

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getVisuals, stripIndent } from '../../utils/lazy';
@ -43,8 +42,6 @@ export default class ConfigInjectCmd extends Command {
}),
};
public static usage = 'config inject <file>';
public static flags = {
drive: cf.driveOrImg,
help: cf.help,

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
import Command from '../../command';
import { Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getVisuals, stripIndent } from '../../utils/lazy';
@ -36,8 +36,6 @@ export default class ConfigReadCmd extends Command {
'$ balena config read --drive balena.img',
];
public static usage = 'config read';
public static flags = {
drive: cf.driveOrImg,
help: cf.help,

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags } from '@oclif/core';
import Command from '../../command';
import { Flags, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getVisuals, stripIndent } from '../../utils/lazy';
@ -39,8 +38,6 @@ export default class ConfigReconfigureCmd extends Command {
'$ balena config reconfigure --drive balena.img --advanced',
];
public static usage = 'config reconfigure';
public static flags = {
drive: cf.driveOrImg,
advanced: Flags.boolean({

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getVisuals, stripIndent } from '../../utils/lazy';
@ -48,8 +47,6 @@ export default class ConfigWriteCmd extends Command {
}),
};
public static usage = 'config write <key> <value>';
public static flags = {
drive: cf.driveOrImg,
help: cf.help,

View File

@ -15,10 +15,8 @@
* limitations under the License.
*/
import { Args, Flags } from '@oclif/core';
import { Args, Flags, Command } from '@oclif/core';
import type { ImageDescriptor } from '@balena/compose/dist/parse';
import Command from '../../command';
import { ExpectedError } from '../../errors';
import { getBalenaSdk, getChalk, stripIndent } from '../../utils/lazy';
import {
@ -108,8 +106,6 @@ ${dockerignoreHelp}
image: Args.string({ description: 'the image to deploy' }),
};
public static usage = 'deploy <fleet> [image]';
public static flags = {
source: Flags.string({
description:
@ -157,7 +153,9 @@ ${dockerignoreHelp}
(await import('events')).defaultMaxListeners = 1000;
const logger = await Command.getLogger();
const Logger = await import('../../utils/logger');
const logger = Logger.getLogger();
logger.logDebug('Parsing input...');
const { fleet, image } = params;

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -41,8 +40,6 @@ export default class DeviceDeactivateCmd extends Command {
}),
};
public static usage = 'device deactivate <uuid>';
public static flags = {
yes: cf.yes,
help: cf.help,

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { ExpectedError } from '../../errors';
@ -36,8 +35,6 @@ export default class DeviceIdentifyCmd extends Command {
}),
};
public static usage = 'device identify <uuid>';
public static flags = {
help: cf.help,
};

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { expandForAppName } from '../../utils/helpers';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
@ -62,8 +61,6 @@ export default class DeviceCmd extends Command {
}),
};
public static usage = 'device <uuid>';
public static flags = {
json: cf.json,
help: cf.help,

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags } from '@oclif/core';
import Command from '../../command';
import { Flags, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { applicationIdInfo } from '../../utils/messages';
@ -43,17 +42,17 @@ export default class DeviceInitCmd extends Command {
This command effectively combines several other balena CLI commands in one,
namely:
'balena device register'
'balena os download'
'balena os build-config' or 'balena config generate'
'balena os configure'
'balena device register'
'balena os download'
'balena os build-config' or 'balena config generate'
'balena os configure'
'balena os local flash'
Possible arguments for the '--fleet', '--os-version' and '--drive' options can
be listed respectively with the commands:
'balena fleets'
'balena os versions'
'balena fleet list'
'balena os versions'
'balena util available-drives'
If the '--fleet' or '--drive' options are omitted, interactive menus will be
@ -74,8 +73,6 @@ export default class DeviceInitCmd extends Command {
'$ balena device init --fleet myFleet --os-version 2.83.21+rev1.prod --drive /dev/disk5 --config config.json --yes',
];
public static usage = 'device init';
public static flags = {
fleet: cf.fleet,
yes: cf.yes,
@ -119,8 +116,9 @@ export default class DeviceInitCmd extends Command {
tmp.setGracefulCleanup();
const { downloadOSImage } = await import('../../utils/cloud');
const { getApplication } = await import('../../utils/sdk');
const Logger = await import('../../utils/logger');
const logger = await Command.getLogger();
const logger = Logger.getLogger();
const balena = getBalenaSdk();
// Get application and

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
import Command from '../../command';
import { Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { expandForAppName } from '../../utils/helpers';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
@ -35,7 +35,9 @@ const devicesSelectFields = {
],
} satisfies PineOptions<Device>;
export default class DevicesCmd extends Command {
export default class DeviceListCmd extends Command {
public static aliases = ['devices'];
public static description = stripIndent`
List all devices.
@ -48,13 +50,11 @@ export default class DevicesCmd extends Command {
${jsonInfo.split('\n').join('\n\t\t')}
`;
public static examples = [
'$ balena devices',
'$ balena devices --fleet MyFleet',
'$ balena devices -f myorg/myfleet',
'$ balena device list',
'$ balena device list --fleet MyFleet',
'$ balena device list -f myorg/myfleet',
];
public static usage = 'devices';
public static flags = {
fleet: cf.fleet,
json: cf.json,
@ -66,7 +66,7 @@ export default class DevicesCmd extends Command {
public static authenticated = true;
public async run() {
const { flags: options } = await this.parse(DevicesCmd);
const { flags: options } = await this.parse(DeviceListCmd);
const balena = getBalenaSdk();
const devicesOptions = {

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -42,8 +41,6 @@ export default class DeviceLocalModeCmd extends Command {
}),
};
public static usage = 'device local-mode <uuid>';
public static flags = {
enable: Flags.boolean({
description: 'enable local mode',

View File

@ -15,14 +15,13 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import { Args, Command } from '@oclif/core';
import type {
BalenaSDK,
Device,
PineOptions,
PineTypedResult,
} from 'balena-sdk';
import Command from '../../command';
import * as cf from '../../utils/common-flags';
import { ExpectedError } from '../../errors';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -54,8 +53,6 @@ export default class DeviceMoveCmd extends Command {
}),
};
public static usage = 'device move <uuid(s)>';
public static flags = {
fleet: cf.fleet,
help: cf.help,

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent, getCliForm } from '../../utils/lazy';
import type { Device } from 'balena-sdk';
@ -47,8 +46,6 @@ export default class DeviceOsUpdateCmd extends Command {
}),
};
public static usage = 'device os-update <uuid>';
public static flags = {
version: Flags.string({
description: 'a balenaOS version',

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { getExpandedProp } from '../../utils/pine';
@ -44,8 +43,6 @@ export default class DevicePinCmd extends Command {
}),
};
public static usage = 'device pin <uuid> [releaseToPinTo]';
public static flags = {
help: cf.help,
};
@ -82,7 +79,7 @@ export default class DevicePinCmd extends Command {
pinnedRelease
? `This device is currently pinned to ${pinnedRelease}.`
: 'This device is not currently pinned to any release.'
} \n\nTo see a list of all releases this device can be pinned to, run \`balena releases ${appSlug}\`.`,
} \n\nTo see a list of all releases this device can be pinned to, run \`balena release list ${appSlug}\`.`,
);
} else {
await balena.models.device.pinToRelease(params.uuid, releaseToPinTo);

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -44,8 +43,6 @@ export default class DevicePublicUrlCmd extends Command {
}),
};
public static usage = 'device public-url <uuid>';
public static flags = {
enable: Flags.boolean({
description: 'enable the public URL',

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getCliUx, stripIndent } from '../../utils/lazy';
@ -35,8 +34,6 @@ export default class DevicePurgeCmd extends Command {
'$ balena device purge 55d43b3,23c73a1',
];
public static usage = 'device purge <uuid>';
public static args = {
uuid: Args.string({
description: 'comma-separated list (no blank spaces) of device UUIDs',

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -35,8 +34,6 @@ export default class DeviceRebootCmd extends Command {
}),
};
public static usage = 'device reboot <uuid>';
public static flags = {
force: cf.force,
help: cf.help,

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags } from '@oclif/core';
import Command from '../../command';
import { Flags, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import * as ca from '../../utils/common-args';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -44,8 +43,6 @@ export default class DeviceRegisterCmd extends Command {
fleet: ca.fleetRequired,
};
public static usage = 'device register <fleet>';
public static flags = {
uuid: Flags.string({
description: 'custom uuid',

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent, getCliForm } from '../../utils/lazy';
@ -43,8 +42,6 @@ export default class DeviceRenameCmd extends Command {
}),
};
public static usage = 'device rename <uuid> [newName]';
public static flags = {
help: cf.help,
};

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getCliUx, stripIndent } from '../../utils/lazy';
import type {
@ -53,8 +52,6 @@ export default class DeviceRestartCmd extends Command {
}),
};
public static usage = 'device restart <uuid>';
public static flags = {
service: Flags.string({
description:

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -43,8 +42,6 @@ export default class DeviceRmCmd extends Command {
}),
};
public static usage = 'device rm <uuid(s)>';
public static flags = {
yes: cf.yes,
help: cf.help,

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { ExpectedError } from '../../errors';
@ -36,8 +35,6 @@ export default class DeviceShutdownCmd extends Command {
}),
};
public static usage = 'device shutdown <uuid>';
public static flags = {
force: cf.force,
help: cf.help,

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getCliUx, stripIndent } from '../../utils/lazy';
import type { BalenaSDK } from 'balena-sdk';
@ -46,8 +45,6 @@ export default class DeviceStartServiceCmd extends Command {
}),
};
public static usage = 'device start-service <uuid>';
public static flags = {
help: cf.help,
};

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getCliUx, stripIndent } from '../../utils/lazy';
import type { BalenaSDK } from 'balena-sdk';
@ -46,8 +45,6 @@ export default class DeviceStopServiceCmd extends Command {
}),
};
public static usage = 'device stop-service <uuid>';
public static flags = {
help: cf.help,
};

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -35,8 +34,6 @@ export default class DeviceTrackFleetCmd extends Command {
}),
};
public static usage = 'device track-fleet <uuid>';
public static flags = {
help: cf.help,
};

View File

@ -14,14 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Flags } from '@oclif/core';
import { Flags, Command } from '@oclif/core';
import type * as BalenaSdk from 'balena-sdk';
import * as _ from 'lodash';
import Command from '../../command';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
import { CommandHelp } from '../../utils/oclif-utils';
export default class DevicesSupportedCmd extends Command {
public static description = stripIndent`
@ -40,11 +37,6 @@ export default class DevicesSupportedCmd extends Command {
'$ balena devices supported --json',
];
public static usage = (
'devices supported ' +
new CommandHelp({ args: DevicesSupportedCmd.args }).defaultUsage()
).trim();
public static flags = {
help: cf.help,
json: Flags.boolean({

View File

@ -15,9 +15,8 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import { Args, Command } from '@oclif/core';
import type * as BalenaSdk from 'balena-sdk';
import Command from '../../command';
import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -92,7 +91,6 @@ export default class EnvAddCmd extends Command {
// Required for supporting empty string ('') `value` args.
public static strict = false;
public static usage = 'env add <name> [value]';
public static flags = {
fleet: { ...cf.fleet, exclusive: ['device'] },
@ -112,7 +110,9 @@ export default class EnvAddCmd extends Command {
);
}
await Command.checkLoggedIn();
const { checkLoggedIn } = await import('../../utils/patterns');
await checkLoggedIn();
if (params.value == null) {
params.value = process.env[params.name];

View File

@ -14,9 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import * as ec from '../../utils/env-common';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -53,8 +51,6 @@ export default class EnvRenameCmd extends Command {
}),
};
public static usage = 'env rename <id> <value>';
public static flags = {
config: ec.booleanConfig,
device: ec.booleanDevice,
@ -65,7 +61,9 @@ export default class EnvRenameCmd extends Command {
public async run() {
const { args: params, flags: opt } = await this.parse(EnvRenameCmd);
await Command.checkLoggedIn();
const { checkLoggedIn } = await import('../../utils/patterns');
await checkLoggedIn();
await getBalenaSdk().pine.patch({
resource: ec.getVarResourceName(opt.config, opt.device, opt.service),

View File

@ -15,9 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import * as ec from '../../utils/env-common';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { parseAsInteger } from '../../utils/validation';
@ -52,8 +50,6 @@ export default class EnvRmCmd extends Command {
}),
};
public static usage = 'env rm <id>';
public static flags = {
config: ec.booleanConfig,
device: ec.booleanDevice,
@ -69,7 +65,9 @@ export default class EnvRmCmd extends Command {
public async run() {
const { args: params, flags: opt } = await this.parse(EnvRmCmd);
await Command.checkLoggedIn();
const { checkLoggedIn } = await import('../../utils/patterns');
await checkLoggedIn();
const { confirm } = await import('../../utils/patterns');
await confirm(

View File

@ -14,11 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Flags } from '@oclif/core';
import { Flags, Command } from '@oclif/core';
import type { Interfaces } from '@oclif/core';
import type * as SDK from 'balena-sdk';
import * as _ from 'lodash';
import Command from '../../command';
import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
@ -94,8 +93,6 @@ export default class EnvsCmd extends Command {
'$ balena envs --device 7cf02a6 --service MyService',
];
public static usage = 'envs';
public static flags = {
fleet: { ...cf.fleet, exclusive: ['device'] },
config: Flags.boolean({
@ -115,7 +112,9 @@ export default class EnvsCmd extends Command {
const variables: EnvironmentVariableInfo[] = [];
await Command.checkLoggedIn();
const { checkLoggedIn } = await import('../../utils/patterns');
await checkLoggedIn();
if (!options.fleet && !options.device) {
throw new ExpectedError('Missing --fleet or --device option');

View File

@ -15,9 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { stripIndent } from '../../utils/lazy';
@ -56,8 +54,6 @@ export default class FleetCreateCmd extends Command {
}),
};
public static usage = 'fleet create <name>';
public static flags = {
organization: Flags.string({
char: 'o',

View File

@ -15,9 +15,7 @@
* limitations under the License.
*/
import { Flags } from '@oclif/core';
import Command from '../../command';
import { Flags, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import * as ca from '../../utils/common-args';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
@ -41,8 +39,6 @@ export default class FleetCmd extends Command {
fleet: ca.fleetRequired,
};
public static usage = 'fleet <fleet>';
public static flags = {
help: cf.help,
view: Flags.boolean({

View File

@ -16,10 +16,9 @@
*/
import type * as BalenaSdk from 'balena-sdk';
import Command from '../../command';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
import { Command } from '@oclif/core';
interface ExtendedApplication extends ApplicationWithDeviceTypeSlug {
device_count: number;
@ -27,7 +26,9 @@ interface ExtendedApplication extends ApplicationWithDeviceTypeSlug {
device_type?: string;
}
export default class FleetsCmd extends Command {
export default class FleetListCmd extends Command {
public static aliases = ['fleets'];
public static description = stripIndent`
List all fleets.
@ -37,9 +38,7 @@ export default class FleetsCmd extends Command {
\`balena fleet <fleet>\`
`;
public static examples = ['$ balena fleets'];
public static usage = 'fleets';
public static examples = ['$ balena fleet list'];
public static flags = {
help: cf.help,
@ -50,7 +49,7 @@ export default class FleetsCmd extends Command {
public static primary = true;
public async run() {
const { flags: options } = await this.parse(FleetsCmd);
const { flags: options } = await this.parse(FleetListCmd);
const balena = getBalenaSdk();

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { getExpandedProp } from '../../utils/pine';
@ -44,8 +43,6 @@ export default class FleetPinCmd extends Command {
}),
};
public static usage = 'fleet pin <slug> [releaseToPinTo]';
public static flags = {
help: cf.help,
};
@ -79,7 +76,7 @@ export default class FleetPinCmd extends Command {
pinnedRelease
? `This fleet is currently pinned to ${pinnedRelease}.`
: 'This fleet is not currently pinned to any release.'
} \n\nTo see a list of all releases this fleet can be pinned to, run \`balena releases ${slug}\`.`,
} \n\nTo see a list of all releases this fleet can be pinned to, run \`balena release list ${slug}\`.`,
);
} else {
await balena.models.application.pinToRelease(slug, releaseToPinTo);

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
import Command from '../../command';
import { Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import * as ca from '../../utils/common-args';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -40,8 +40,6 @@ export default class FleetPurgeCmd extends Command {
fleet: ca.fleetRequired,
};
public static usage = 'fleet purge <fleet>';
public static flags = {
help: cf.help,
};

View File

@ -15,9 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import * as ca from '../../utils/common-args';
import { getBalenaSdk, stripIndent, getCliForm } from '../../utils/lazy';
@ -48,8 +46,6 @@ export default class FleetRenameCmd extends Command {
}),
};
public static usage = 'fleet rename <fleet> [newName]';
public static flags = {
help: cf.help,
};

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
import Command from '../../command';
import { Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import * as ca from '../../utils/common-args';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -39,8 +39,6 @@ export default class FleetRestartCmd extends Command {
fleet: ca.fleetRequired,
};
public static usage = 'fleet restart <fleet>';
public static flags = {
help: cf.help,
};

View File

@ -15,11 +15,11 @@
* limitations under the License.
*/
import Command from '../../command';
import * as cf from '../../utils/common-flags';
import * as ca from '../../utils/common-args';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { applicationIdInfo } from '../../utils/messages';
import { Command } from '@oclif/core';
export default class FleetRmCmd extends Command {
public static description = stripIndent`
@ -42,8 +42,6 @@ export default class FleetRmCmd extends Command {
fleet: ca.fleetRequired,
};
public static usage = 'fleet rm <fleet>';
public static flags = {
yes: cf.yes,
help: cf.help,

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -38,8 +37,6 @@ export default class FleetTrackLatestCmd extends Command {
}),
};
public static usage = 'fleet track-latest <slug>';
public static flags = {
help: cf.help,
};

View File

@ -15,10 +15,8 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import { stripIndent } from '../../utils/lazy';
import { CommandHelp } from '../../utils/oclif-utils';
// 'Internal' commands are called during the execution of other commands.
// `osinit` is called during `os initialize`
@ -48,11 +46,6 @@ export default class OsinitCmd extends Command {
}),
};
public static usage = (
'internal osinit ' +
new CommandHelp({ args: OsinitCmd.args }).defaultUsage()
).trim();
public static hidden = true;
public static root = true;
public static offlineCompatible = true;

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args, Flags } from '@oclif/core';
import Command from '../../command';
import { Args, Flags, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { applicationIdInfo } from '../../utils/messages';
@ -60,9 +59,6 @@ export default class JoinCmd extends Command {
}),
};
// Hardcoded to preserve camelcase
public static usage = 'join [deviceIpOrHostname]';
public static flags = {
fleet: cf.fleet,
pollInterval: Flags.integer({
@ -80,7 +76,8 @@ export default class JoinCmd extends Command {
const promote = await import('../../utils/promote');
const sdk = getBalenaSdk();
const logger = await Command.getLogger();
const Logger = await import('../../utils/logger');
const logger = Logger.getLogger();
return promote.join(
logger,
sdk,

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -29,7 +28,7 @@ export default class KeyAddCmd extends Command {
If \`path\` is omitted, the command will attempt to read the SSH key from stdin.
About SSH keys
About SSH keys
An "SSH key" actually consists of a public/private key pair. A typical name
for the private key file is "id_rsa", and a typical name for the public key
file is "id_rsa.pub". Both key files are saved to your computer (with the
@ -37,7 +36,7 @@ export default class KeyAddCmd extends Command {
saved to your balena account. This means that if you change computers or
otherwise lose the private key, you cannot recover the private key through
your balena account. You can however add new keys, and delete the old ones.
To generate a new SSH key pair, a nice guide can be found in GitHub's docs:
https://help.github.com/en/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
Skip the step about adding the key to a GitHub account, and instead add it to
@ -61,16 +60,12 @@ export default class KeyAddCmd extends Command {
}),
};
public static usage = 'key add <name> [path]';
public static flags = {
help: cf.help,
};
public static authenticated = true;
public static readStdin = true;
public async run() {
const { args: params } = await this.parse(KeyAddCmd);
@ -78,8 +73,6 @@ export default class KeyAddCmd extends Command {
if (params.path != null) {
const { readFile } = (await import('fs')).promises;
key = await readFile(params.path, 'utf8');
} else if (this.stdin.length > 0) {
key = this.stdin;
} else {
throw new ExpectedError('No public key file or path provided.');
}

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
import { parseAsInteger } from '../../utils/validation';
@ -38,8 +37,6 @@ export default class KeyCmd extends Command {
}),
};
public static usage = 'key <id>';
public static flags = {
help: cf.help,
};

View File

@ -15,19 +15,19 @@
* limitations under the License.
*/
import Command from '../../command';
import { Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
export default class KeysCmd extends Command {
export default class KeyListCmd extends Command {
public static aliases = ['keys'];
public static description = stripIndent`
List the SSH keys in balenaCloud.
List all SSH keys registered in balenaCloud for the logged in user.
`;
public static examples = ['$ balena keys'];
public static usage = 'keys';
public static examples = ['$ balena key list'];
public static flags = {
help: cf.help,
@ -36,7 +36,7 @@ export default class KeysCmd extends Command {
public static authenticated = true;
public async run() {
await this.parse(KeysCmd);
await this.parse(KeyListCmd);
const keys = await getBalenaSdk().models.key.getAll();

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { parseAsInteger } from '../../utils/validation';
@ -40,8 +39,6 @@ export default class KeyRmCmd extends Command {
}),
};
public static usage = 'key rm <id>';
public static flags = {
yes: cf.yes,
help: cf.help,

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { stripIndent } from '../../utils/lazy';
import { parseAsLocalHostnameOrIp } from '../../utils/validation';
@ -50,8 +49,6 @@ export default class LeaveCmd extends Command {
}),
};
public static usage = 'leave [deviceIpOrHostname]';
public static flags = {
help: cf.help,
};
@ -63,7 +60,8 @@ export default class LeaveCmd extends Command {
const { args: params } = await this.parse(LeaveCmd);
const promote = await import('../../utils/promote');
const logger = await Command.getLogger();
const Logger = await import('../../utils/logger');
const logger = Logger.getLogger();
return promote.leave(logger, params.deviceIpOrHostname);
}
}

View File

@ -15,9 +15,8 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import { Args, Command } from '@oclif/core';
import { promisify } from 'util';
import Command from '../../command';
import * as cf from '../../utils/common-flags';
import { stripIndent } from '../../utils/lazy';
@ -40,8 +39,6 @@ export default class LocalConfigureCmd extends Command {
}),
};
public static usage = 'local configure <target>';
public static flags = {
help: cf.help,
};

View File

@ -15,9 +15,8 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import { Args, Command } from '@oclif/core';
import type { BlockDevice } from 'etcher-sdk/build/source-destination';
import Command from '../../command';
import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags';
import { getChalk, getVisuals, stripIndent } from '../../utils/lazy';
@ -46,8 +45,6 @@ export default class LocalFlashCmd extends Command {
}),
};
public static usage = 'local flash <image>';
public static flags = {
drive: cf.drive,
yes: cf.yes,

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent, getCliForm } from '../../utils/lazy';
import { ExpectedError } from '../../errors';
@ -63,8 +62,6 @@ export default class LoginCmd extends Command {
}),
};
public static usage = 'login';
public static flags = {
web: Flags.boolean({
default: false,

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
import Command from '../../command';
import { Command } from '@oclif/core';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
export default class LogoutCmd extends Command {
@ -26,8 +26,6 @@ export default class LogoutCmd extends Command {
`;
public static examples = ['$ balena logout'];
public static usage = 'logout';
public async run() {
await this.parse(LogoutCmd);
await getBalenaSdk().auth.logout();

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import type { LogMessage } from 'balena-sdk';
@ -61,8 +60,6 @@ export default class LogsCmd extends Command {
}),
};
public static usage = 'logs <device>';
public static flags = {
'max-retry': Flags.integer({
description: stripIndent`
@ -153,8 +150,9 @@ export default class LogsCmd extends Command {
maxAttempts: 1 + (options['max-retry'] ?? MAX_RETRY),
});
} else {
const { checkLoggedIn } = await import('../../utils/patterns');
// Logs from cloud
await Command.checkLoggedIn();
await checkLoggedIn();
if (options.tail) {
const logStream = await balena.logs.subscribe(params.device, {
count: 100,

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -42,8 +41,6 @@ export default class NoteCmd extends Command {
}),
};
public static usage = 'note <|note>';
public static flags = {
device: { exclusive: ['dev'], ...cf.device },
dev: Flags.string({
@ -55,14 +52,10 @@ export default class NoteCmd extends Command {
public static authenticated = true;
public static readStdin = true;
public async run() {
const { args: params, flags: options } = await this.parse(NoteCmd);
params.note = params.note || this.stdin;
if (params.note.length === 0) {
if (params.note?.length === 0) {
throw new ExpectedError('Missing note content');
}
@ -75,6 +68,6 @@ export default class NoteCmd extends Command {
const balena = getBalenaSdk();
return balena.models.device.setNote(options.device, params.note);
return balena.models.device.setNote(options.device, params.note ?? '');
}
}

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
import Command from '../../command';
import { Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
@ -27,8 +27,6 @@ export default class OrgsCmd extends Command {
`;
public static examples = ['$ balena orgs'];
public static usage = 'orgs';
public static flags = {
help: cf.help,
};

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getCliForm, stripIndent } from '../../utils/lazy';
import * as _ from 'lodash';
@ -46,8 +45,6 @@ export default class OsBuildConfigCmd extends Command {
}),
};
public static usage = 'os build-config <image> <device-type>';
public static flags = {
advanced: Flags.boolean({
description: 'show advanced configuration options',

View File

@ -15,12 +15,11 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import { Flags, Args, Command } from '@oclif/core';
import type { Interfaces } from '@oclif/core';
import type * as BalenaSdk from 'balena-sdk';
import { promisify } from 'util';
import * as _ from 'lodash';
import Command from '../../command';
import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent, getCliForm } from '../../utils/lazy';
@ -92,8 +91,6 @@ export default class OsConfigureCmd extends Command {
}),
};
public static usage = 'os configure <image>';
public static flags = {
advanced: Flags.boolean({
char: 'v',
@ -321,7 +318,9 @@ async function validateOptions(options: FlagsDef) {
);
}
await Command.checkLoggedIn();
const { checkLoggedIn } = await import('../../utils/patterns');
await checkLoggedIn();
}
/**

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { stripIndent } from '../../utils/lazy';
@ -62,8 +61,6 @@ export default class OsDownloadCmd extends Command {
}),
};
public static usage = 'os download <type>';
public static flags = {
output: Flags.string({
description: 'output path',
@ -89,10 +86,11 @@ export default class OsDownloadCmd extends Command {
// balenaOS ESR versions require user authentication
if (options.version) {
const { isESR } = await import('balena-image-manager');
const { isESR } = await import('../../utils/image-manager');
if (options.version === 'menu-esr' || isESR(options.version)) {
try {
await OsDownloadCmd.checkLoggedIn();
const { checkLoggedIn } = await import('../../utils/patterns');
await checkLoggedIn();
} catch (e) {
const { ExpectedError, NotLoggedInError } = await import(
'../../errors'

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getCliForm, stripIndent } from '../../utils/lazy';
@ -48,8 +47,6 @@ export default class OsInitializeCmd extends Command {
}),
};
public static usage = 'os initialize <image>';
public static flags = {
type: cf.deviceType,
drive: cf.drive,

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { stripIndent } from '../../utils/lazy';
@ -40,8 +39,6 @@ export default class OsVersionsCmd extends Command {
}),
};
public static usage = 'os versions <type>';
public static flags = {
help: cf.help,
esr: Flags.boolean({

View File

@ -15,7 +15,6 @@
* limitations under the License.
*/
import Command from '../../command';
import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags';
import {
@ -27,8 +26,7 @@ import {
import { applicationIdInfo } from '../../utils/messages';
import { dockerConnectionCliFlags } from '../../utils/docker';
import { parseAsInteger } from '../../utils/validation';
import { Flags, Args } from '@oclif/core';
import { Flags, Args, Command } from '@oclif/core';
import * as _ from 'lodash';
import type {
Application,
@ -80,8 +78,6 @@ export default class PreloadCmd extends Command {
}),
};
public static usage = 'preload <image>';
public static flags = {
fleet: cf.fleet,
commit: Flags.string({

View File

@ -15,9 +15,8 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import { Flags, Args, Command } from '@oclif/core';
import type { Interfaces } from '@oclif/core';
import Command from '../../command';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { dockerignoreHelp, registrySecretsHelp } from '../../utils/messages';
@ -99,8 +98,6 @@ export default class PushCmd extends Command {
}),
};
public static usage = 'push <fleetOrDevice>';
public static flags = {
source: Flags.string({
description: stripIndent`
@ -229,7 +226,9 @@ export default class PushCmd extends Command {
public async run() {
const { args: params, flags: options } = await this.parse(PushCmd);
const logger = await Command.getLogger();
const Logger = await import('../../utils/logger');
const logger = Logger.getLogger();
logger.logDebug(`Using build source directory: ${options.source} `);
const sdk = getBalenaSdk();
@ -296,7 +295,9 @@ export default class PushCmd extends Command {
options['release-tag'] ?? [],
);
await Command.checkLoggedIn();
const { checkLoggedIn } = await import('../../utils/patterns');
await checkLoggedIn();
const [token, baseUrl] = await Promise.all([
sdk.auth.getToken(),
sdk.settings.get('balenaUrl'),

View File

@ -1,116 +0,0 @@
/**
* @license
* Copyright 2016-2024 Balena Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { commitOrIdArg } from '.';
import { Flags } from '@oclif/core';
import Command from '../../command';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { create } from '@balena/release-bundle';
import * as fs from 'fs/promises';
import * as semver from 'balena-semver';
import { ExpectedError } from '../../errors';
export default class ReleaseExportCmd extends Command {
public static description = stripIndent`
Exports a release into a file.
Exporting a release to a file allows you to import an exact
copy of the original release into another app.
If the SemVer of a release is provided using the --version option,
the first argument is assumed to be the fleet's slug.
Only successful releases can be exported.
`;
public static examples = [
'$ balena release export a777f7345fe3d655c1c981aa642e5555 -o ../path/to/release.tar',
'$ balena release export myOrg/myFleet --version 1.2.3 -o ../path/to/release.tar',
];
public static usage = 'release export <commitOrId>';
public static flags = {
output: Flags.string({
description: 'output path',
char: 'o',
required: true,
}),
version: Flags.string({
description: 'version of the release to export from the specified fleet',
}),
help: cf.help,
};
public static args = {
commitOrId: commitOrIdArg({
description: 'commit, ID, or version of the release to export',
required: true,
}),
};
public static authenticated = true;
public async run() {
const { args: params, flags: options } = await this.parse(ReleaseExportCmd);
const balena = getBalenaSdk();
let release: balenaSdk.Release;
if (typeof options.version === 'string') {
const application = params.commitOrId;
const parsedVersion = semver.parse(options.version);
if (parsedVersion == null) {
throw new ExpectedError(
`Release of ${application} with version ${options.version} could not be exported; version must be valid SemVer.`,
);
} else {
const rawVersion =
parsedVersion.build.length === 0
? parsedVersion.version
: `${parsedVersion.version}+${parsedVersion.build[0]}`;
release = await balena.models.release.get(
{ application, rawVersion },
{ $select: ['id'] },
);
}
} else {
release = await balena.models.release.get(params.commitOrId, {
$select: ['id'],
});
}
try {
const releaseBundle = await create({
sdk: balena,
releaseId: release.id,
});
await fs.writeFile(options.output, releaseBundle);
const versionInfo =
typeof options.version === 'string'
? ` version ${options.version}`
: '';
console.log(
`Release ${params.commitOrId}${versionInfo} has been exported to ${options.output}.`,
);
} catch (error) {
throw new ExpectedError(
`Release ${params.commitOrId} could not be exported: ${error.message}`,
);
}
}
}

View File

@ -15,8 +15,8 @@
* limitations under the License.
*/
import { Command } from '@oclif/core';
import { commitOrIdArg } from '.';
import Command from '../../command';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -40,8 +40,6 @@ export default class ReleaseFinalizeCmd extends Command {
'$ balena release finalize 1234567',
];
public static usage = 'release finalize <commitOrId>';
public static flags = {
help: cf.help,
};

View File

@ -1,103 +0,0 @@
/**
* @license
* Copyright 2016-2024 Balena Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { apply } from '@balena/release-bundle';
import { createReadStream } from 'fs';
import { ExpectedError } from '../../errors';
export default class ReleaseImportCmd extends Command {
public static description = stripIndent`
Imports a release from a file to an app or fleet. The revision field of the release
is automatically omitted when importing a release. The backend will auto-increment
the revision field of the imported release if a release exists with the same semver.
A release will not be imported if a successful release with the same commit already
exists.
To export a release to a file, use 'balena release export'.
Use the --override-version option to specify the version
of the imported release, overriding the one saved in the file.
`;
public static examples = [
'$ balena release import ../path/to/release.tar myFleet',
'$ balena release import ../path/to/release.tar myOrg/myFleet',
'$ balena release import ../path/to/release.tar myOrg/myFleet --override-version 1.2.3',
];
public static usage = 'release import <file> <fleet>';
public static flags = {
'override-version': Flags.string({
description:
'Imports this release with the specified version overriding the version in the file.',
required: false,
}),
help: cf.help,
};
public static args = {
bundle: Args.string({
required: true,
description: 'path to a file, e.g. "./release.tar"',
}),
fleet: Args.string({
required: true,
description:
'fleet that the release will be imported to, e.g. "myOrg/myFleet"',
}),
};
public static authenticated = true;
public async run() {
const { args: params, flags: options } = await this.parse(ReleaseImportCmd);
const balena = getBalenaSdk();
const bundle = createReadStream(params.bundle).on('error', () => {
throw new ExpectedError(
`Release bundle ${params.bundle} does not exist or is not accessible.`,
);
});
try {
const application = await balena.models.application.get(params.fleet, {
$select: ['id'],
});
if (application == null) {
throw new ExpectedError(`Fleet ${params.fleet} not found.`);
}
await apply({
sdk: balena,
application: application.id,
stream: bundle,
version: options['override-version'],
});
console.log(
`Release bundle ${params.bundle} has been imported to ${params.fleet}.`,
);
} catch (error) {
throw new ExpectedError(
`Could not import release bundle ${params.bundle} to fleet ${params.fleet}: ${error.message}`,
);
}
}
}

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags, Args, type Interfaces } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, type Interfaces, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
import type * as BalenaSdk from 'balena-sdk';
@ -42,8 +41,6 @@ export default class ReleaseCmd extends Command {
'$ balena release d3f3151f5ad25ca6b070aa4d08296aca --json',
];
public static usage = 'release <commitOrId>';
public static flags = {
json: cf.json,
help: cf.help,

View File

@ -15,8 +15,8 @@
* limitations under the License.
*/
import { Command } from '@oclif/core';
import { commitOrIdArg } from '.';
import Command from '../../command';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -35,8 +35,6 @@ export default class ReleaseInvalidateCmd extends Command {
'$ balena release invalidate 1234567',
];
public static usage = 'release invalidate <commitOrId>';
public static flags = {
help: cf.help,
};

View File

@ -15,15 +15,16 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
import { applicationNameNote } from '../../utils/messages';
import type * as BalenaSdk from 'balena-sdk';
import { jsonInfo } from '../../utils/messages';
export default class ReleasesCmd extends Command {
export default class ReleaseListCmd extends Command {
public static aliases = ['releases'];
public static description = stripIndent`
List all releases of a fleet.
@ -34,12 +35,10 @@ export default class ReleasesCmd extends Command {
${jsonInfo.split('\n').join('\n\t\t')}
`;
public static examples = [
'$ balena releases myorg/myfleet',
'$ balena releases myorg/myfleet --json',
'$ balena release list myorg/myfleet',
'$ balena release list myorg/myfleet --json',
];
public static usage = 'releases <fleet>';
public static flags = {
json: cf.json,
help: cf.help,
@ -55,7 +54,7 @@ export default class ReleasesCmd extends Command {
public static authenticated = true;
public async run() {
const { args: params, flags: options } = await this.parse(ReleasesCmd);
const { args: params, flags: options } = await this.parse(ReleaseListCmd);
const fields: Array<keyof BalenaSdk.Release> = [
'id',

View File

@ -15,8 +15,8 @@
* limitations under the License.
*/
import { Command } from '@oclif/core';
import { commitOrIdArg } from '.';
import Command from '../../command';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -34,8 +34,6 @@ export default class ReleaseValidateCmd extends Command {
'$ balena release validate 1234567',
];
public static usage = 'release validate <commitOrId>';
public static flags = {
help: cf.help,
};

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags } from '@oclif/core';
import Command from '../../command';
import { Flags, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getCliUx, stripIndent } from '../../utils/lazy';
@ -38,8 +37,6 @@ export default class ScanCmd extends Command {
'$ balena scan --verbose',
];
public static usage = 'scan';
public static flags = {
verbose: Flags.boolean({
default: false,

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
import Command from '../../command';
import { Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
@ -27,8 +27,6 @@ export default class SettingsCmd extends Command {
`;
public static examples = ['$ balena settings'];
public static usage = 'settings';
public static flags = {
help: cf.help,
};

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import {
@ -75,8 +74,6 @@ export default class SshCmd extends Command {
}),
};
public static usage = 'ssh <fleetOrDevice> [service]';
public static flags = {
port: Flags.integer({
description: stripIndent`
@ -123,15 +120,19 @@ export default class SshCmd extends Command {
// Remote connection
const { getProxyConfig } = await import('../../utils/helpers');
const { getOnlineTargetDeviceUuid } = await import('../../utils/patterns');
const {
getOnlineTargetDeviceUuid,
checkLoggedIn,
checkNotUsingOfflineMode,
} = await import('../../utils/patterns');
const sdk = getBalenaSdk();
const proxyConfig = getProxyConfig();
const useProxy = !!proxyConfig && !options.noproxy;
// this will be a tunnelled SSH connection...
await Command.checkNotUsingOfflineMode();
await Command.checkLoggedIn();
await checkNotUsingOfflineMode();
await checkLoggedIn();
const deviceUuid = await getOnlineTargetDeviceUuid(
sdk,
params.fleetOrDevice,

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Flags, Args } from '@oclif/core';
import Command from '../../command';
import { Flags, Args, Command } from '@oclif/core';
import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getCliUx, stripIndent } from '../../utils/lazy';
@ -52,8 +51,6 @@ export default class SupportCmd extends Command {
}),
};
public static usage = 'support <action>';
public static flags = {
device: Flags.string({
description: 'comma-separated list (no spaces) of device UUIDs',

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { applicationIdInfo } from '../../utils/messages';
@ -45,8 +44,6 @@ export default class TagRmCmd extends Command {
}),
};
public static usage = 'tag rm <tagKey>';
public static flags = {
fleet: {
...cf.fleet,

View File

@ -15,8 +15,7 @@
* limitations under the License.
*/
import { Args } from '@oclif/core';
import Command from '../../command';
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { applicationIdInfo } from '../../utils/messages';
@ -58,7 +57,6 @@ export default class TagSetCmd extends Command {
// Required for supporting empty string ('') `value` args.
public static strict = false;
public static usage = 'tag set <tagKey> [value]';
public static flags = {
fleet: {

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
import Command from '../../command';
import { Command } from '@oclif/core';
import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
@ -38,8 +38,6 @@ export default class TagsCmd extends Command {
'$ balena tags --release b376b0e544e9429483b656490e5b9443b4349bd6',
];
public static usage = 'tags';
public static flags = {
fleet: {
...cf.fleet,

Some files were not shown because too many files have changed in this diff Show More