mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-06-24 18:45:07 +00:00
Compare commits
123 Commits
v19.0.0
...
bash-compl
Author | SHA1 | Date | |
---|---|---|---|
cad1cfc925 | |||
5d0d02a24d | |||
f5ca07a422 | |||
6b5c6e072b | |||
3615f8e525 | |||
ec6cbd120e | |||
65b278e40b | |||
8d1394a77d | |||
ca0a3ee147 | |||
019af9e703 | |||
f213940c84 | |||
5243803342 | |||
811e009ba9 | |||
45e0f21685 | |||
60f5f47930 | |||
cad5543863 | |||
a1e936bb3f | |||
49984c2366 | |||
2a0ab6abbb | |||
349bab7702 | |||
af2c04540f | |||
cdfabb8f92 | |||
5e058d5158 | |||
6a81ed2d70 | |||
d323c0742c | |||
9cdde4f6c2 | |||
ebe10360b3 | |||
440c5ad15b | |||
0699278220 | |||
0eb5c78e33 | |||
067232b5c4 | |||
5716ba29ad | |||
fc2234b0dd | |||
12cdb14638 | |||
b936c51941 | |||
6c23b06b4c | |||
87c52c55ed | |||
f792343180 | |||
680d592af2 | |||
f52e6bd8b4 | |||
0847daba1b | |||
057b37ae38 | |||
deb7de8951 | |||
55dbe42e84 | |||
3e8bc57fdb | |||
d206e7cd66 | |||
7092db8ee8 | |||
276d61cf6c | |||
77ccd9c39c | |||
9e140eff13 | |||
da95baa70c | |||
a3ec75c2c7 | |||
f6f6be8ee8 | |||
09e653692b | |||
3ac89b236a | |||
bd472f2380 | |||
b5dcf45c40 | |||
7e2b5abe60 | |||
7b66e0d216 | |||
877c5031a4 | |||
1245b1c99b | |||
8dbe1af551 | |||
aae303202b | |||
284784505d | |||
77b9514442 | |||
ff4afe3ab2 | |||
5ea246f016 | |||
127bd7ec72 | |||
fa35877137 | |||
a402dffbc5 | |||
c7441b06ac | |||
251d64eb88 | |||
ff9bb52a20 | |||
c799c3f10d | |||
89efe2a2c8 | |||
f6ff397969 | |||
aaf709a1d4 | |||
ca6eea4371 | |||
d39dc5a39a | |||
1699419788 | |||
c25591cb4a | |||
a2b4f76c94 | |||
6a1239bd52 | |||
ddf34326a4 | |||
58f480ad7c | |||
7e6589a7d7 | |||
c699bb1dbc | |||
e101e0f466 | |||
e29273142e | |||
519395cfcd | |||
314e8800d0 | |||
0bb1c892e8 | |||
5eb79f5cf0 | |||
707b249e97 | |||
2a725cd1f0 | |||
83f274cc62 | |||
9242a3493a | |||
aa46d314b4 | |||
58f7dfc894 | |||
39e1c02648 | |||
5f92bbc846 | |||
2f03b24bcf | |||
233ee990f9 | |||
facc66e9f9 | |||
6efd24489f | |||
0339160a0b | |||
0591f5edbd | |||
c30dd323f1 | |||
1640bd6457 | |||
da2ffde483 | |||
5c9e3ad8f6 | |||
7515d4b710 | |||
fae5af6b75 | |||
45aa1adacb | |||
b34ea14413 | |||
90eae06017 | |||
41da8f6f6f | |||
8d706a7d81 | |||
d67952024c | |||
8895fc485c | |||
c2dbcaaaf4 | |||
52cb951e49 | |||
2a357a438f |
8
.github/actions/publish/action.yml
vendored
8
.github/actions/publish/action.yml
vendored
@ -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
|
||||
|
4
.github/actions/test/action.yml
vendored
4
.github/actions/test/action.yml
vendored
@ -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
|
||||
|
1
.husky/pre-commit
Normal file
1
.husky/pre-commit
Normal file
@ -0,0 +1 @@
|
||||
node automation/check-npm-version.js && ts-node automation/check-doc.ts
|
@ -1,3 +1,551 @@
|
||||
- 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
|
||||
body: ""
|
||||
footer:
|
||||
Change-type: patch
|
||||
change-type: patch
|
||||
author: Otavio Jacobi
|
||||
nested: []
|
||||
- subject: Remove the use of CJS require() on test files
|
||||
hash: 6efd24489ffa10dc616cd0224d4de889b2029709
|
||||
body: ""
|
||||
footer:
|
||||
Change-type: patch
|
||||
change-type: patch
|
||||
author: Otavio Jacobi
|
||||
nested: []
|
||||
- subject: Remove not necessary 'import = require' syntax for js-yaml
|
||||
hash: 0339160a0b625a3e05e6dcdd3c4c642599cbab4e
|
||||
body: ""
|
||||
footer:
|
||||
Change-type: patch
|
||||
change-type: patch
|
||||
author: Otavio Jacobi
|
||||
nested: []
|
||||
version: 19.0.3
|
||||
title: ""
|
||||
date: 2024-09-05T12:34:08.897Z
|
||||
- commits:
|
||||
- subject: Update devDependency patch-package to v8.0.0
|
||||
hash: 1640bd645774bf9b2021cd38b3e9b9550d859f00
|
||||
body: ""
|
||||
footer:
|
||||
Change-type: patch
|
||||
change-type: patch
|
||||
author: Otavio Jacobi
|
||||
nested: []
|
||||
- subject: Update devDependency mkdirp to v3.0.1
|
||||
hash: da2ffde4835884352f280fc861757ca571dc8100
|
||||
body: ""
|
||||
footer:
|
||||
Change-type: patch
|
||||
change-type: patch
|
||||
author: Otavio Jacobi
|
||||
nested: []
|
||||
- subject: Update devDependency fs-extra(to v11) and @types/fs-extra(to v11)
|
||||
hash: 5c9e3ad8f6de0285d9805fc84a0f6f8884e01647
|
||||
body: ""
|
||||
footer:
|
||||
Change-type: patch
|
||||
change-type: patch
|
||||
author: Otavio Jacobi
|
||||
nested: []
|
||||
- subject: Update devDependency @types/parse-link-header to v2.0.3
|
||||
hash: 7515d4b7108948554ec008e426eef04ac9f63a0e
|
||||
body: ""
|
||||
footer:
|
||||
Change-type: patch
|
||||
change-type: patch
|
||||
author: Otavio Jacobi
|
||||
nested: []
|
||||
- subject: Remove unused devDependency @types/nock
|
||||
hash: fae5af6b757a535ab27e3e90255f01ba6f460a52
|
||||
body: ""
|
||||
footer:
|
||||
Change-type: patch
|
||||
change-type: patch
|
||||
author: Otavio Jacobi
|
||||
nested: []
|
||||
- subject: Update devDependency klaw(to v4) and @types/klaw(to v3.0.6)
|
||||
hash: 45aa1adacb758083e455939c05752c51e0e09216
|
||||
body: ""
|
||||
footer:
|
||||
Change-type: patch
|
||||
change-type: patch
|
||||
author: Otavio Jacobi
|
||||
nested: []
|
||||
- subject: Update husky to v9.1.5
|
||||
hash: b34ea14413ea467b3ee996a5a7357c4a3e6c7e7e
|
||||
body: ""
|
||||
footer:
|
||||
Change-type: patch
|
||||
change-type: patch
|
||||
author: Otavio Jacobi
|
||||
nested: []
|
||||
- subject: Update devDependency @types/jsonwebtoken to v9.0.6
|
||||
hash: 90eae06017f3aa9fd5e8c823c34551e1eca81ee6
|
||||
body: ""
|
||||
footer:
|
||||
Change-type: patch
|
||||
change-type: patch
|
||||
author: Otavio Jacobi
|
||||
nested: []
|
||||
- subject: Update devDependency archiver(to v7) and @types/archiver(to v6)
|
||||
hash: 41da8f6f6f9606544526faa6805470c2449aaadf
|
||||
body: ""
|
||||
footer:
|
||||
Change-type: patch
|
||||
change-type: patch
|
||||
author: Otavio Jacobi
|
||||
nested: []
|
||||
- subject: Removes unused devDependency @types/net-keepalive
|
||||
hash: 8d706a7d8168998e0a2db797d8404bd7e844becb
|
||||
body: ""
|
||||
footer:
|
||||
Change-type: patch
|
||||
change-type: patch
|
||||
author: Otavio Jacobi
|
||||
nested: []
|
||||
- subject: Update devDependency rewire(to v7) and @types/rewire(to v2.5.30)
|
||||
hash: d67952024cbf093710a0d2ab50f57e5d51d73d2a
|
||||
body: ""
|
||||
footer:
|
||||
Change-type: patch
|
||||
change-type: patch
|
||||
author: Otavio Jacobi
|
||||
nested: []
|
||||
- subject: Update devDependency sinon(to v18) and @types/sinon(to v17)
|
||||
hash: 8895fc485c9e730df7f8a0bb7e6bb0db63bae28e
|
||||
body: ""
|
||||
footer:
|
||||
Change-type: patch
|
||||
change-type: patch
|
||||
author: Otavio Jacobi
|
||||
nested: []
|
||||
version: 19.0.2
|
||||
title: ""
|
||||
date: 2024-09-03T14:56:13.341Z
|
||||
- commits:
|
||||
- subject: Bump @oclif/core from 3.27.0 to 4.0.18
|
||||
hash: 2a357a438f896ffc4932eda90336944294237a8a
|
||||
body: ""
|
||||
footer:
|
||||
Change-type: patch
|
||||
change-type: patch
|
||||
author: Otavio Jacobi
|
||||
nested: []
|
||||
version: 19.0.1
|
||||
title: ""
|
||||
date: 2024-09-02T13:21:54.739Z
|
||||
- commits:
|
||||
- subject: Update all references of lib to src
|
||||
hash: 4760866c7782b2651c1c319ae1a757f0ab21f1b3
|
||||
|
137
CHANGELOG.md
137
CHANGELOG.md
@ -4,6 +4,143 @@ 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]
|
||||
* Remove the use of CJS require() on test files [Otavio Jacobi]
|
||||
* Remove not necessary 'import = require' syntax for js-yaml [Otavio Jacobi]
|
||||
|
||||
## 19.0.2 - 2024-09-03
|
||||
|
||||
* Update devDependency patch-package to v8.0.0 [Otavio Jacobi]
|
||||
* Update devDependency mkdirp to v3.0.1 [Otavio Jacobi]
|
||||
* Update devDependency fs-extra(to v11) and @types/fs-extra(to v11) [Otavio Jacobi]
|
||||
* Update devDependency @types/parse-link-header to v2.0.3 [Otavio Jacobi]
|
||||
* Remove unused devDependency @types/nock [Otavio Jacobi]
|
||||
* Update devDependency klaw(to v4) and @types/klaw(to v3.0.6) [Otavio Jacobi]
|
||||
* Update husky to v9.1.5 [Otavio Jacobi]
|
||||
* Update devDependency @types/jsonwebtoken to v9.0.6 [Otavio Jacobi]
|
||||
* Update devDependency archiver(to v7) and @types/archiver(to v6) [Otavio Jacobi]
|
||||
* Removes unused devDependency @types/net-keepalive [Otavio Jacobi]
|
||||
* Update devDependency rewire(to v7) and @types/rewire(to v2.5.30) [Otavio Jacobi]
|
||||
* Update devDependency sinon(to v18) and @types/sinon(to v17) [Otavio Jacobi]
|
||||
|
||||
## 19.0.1 - 2024-09-02
|
||||
|
||||
* Bump @oclif/core from 3.27.0 to 4.0.18 [Otavio Jacobi]
|
||||
|
||||
## 19.0.0 - 2024-08-22
|
||||
|
||||
* Update all references of lib to src [Otavio Jacobi]
|
||||
|
@ -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
|
||||
|
||||
|
@ -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(' ')}`);
|
||||
|
@ -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',
|
||||
|
2
automation/capitanodoc/doc-types.d.ts
vendored
2
automation/capitanodoc/doc-types.d.ts
vendored
@ -26,7 +26,7 @@ export interface Document {
|
||||
|
||||
export interface Category {
|
||||
title: string;
|
||||
commands: OclifCommand[];
|
||||
commands: Array<OclifCommand & { name: string }>;
|
||||
}
|
||||
|
||||
export { OclifCommand };
|
||||
|
@ -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(...importOclifCommands(jsFilename));
|
||||
category.commands.push(await importOclifCommands(jsFilename));
|
||||
}
|
||||
result.categories.push(category);
|
||||
}
|
||||
@ -47,48 +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',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function importOclifCommands(jsFilename: string): 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)
|
||||
: (require(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];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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,
|
||||
|
@ -1,219 +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';
|
||||
|
||||
const { GITHUB_TOKEN } = process.env;
|
||||
|
||||
/** Return a cached Octokit instance, creating a new one as needed. */
|
||||
const getOctokit = _.once(function () {
|
||||
const Octokit = (
|
||||
require('@octokit/rest') as typeof import('@octokit/rest')
|
||||
).Octokit.plugin(
|
||||
(
|
||||
require('@octokit/plugin-throttling') as typeof import('@octokit/plugin-throttling')
|
||||
).throttling,
|
||||
);
|
||||
return new Octokit({
|
||||
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.
|
||||
*/
|
||||
function getPageNumbers(
|
||||
response: any,
|
||||
perPageDefault: number,
|
||||
): { page: number; pages: number; ordinal: number } {
|
||||
const res = { page: 1, pages: 1, ordinal: 1 };
|
||||
if (!response.headers.link) {
|
||||
return res;
|
||||
}
|
||||
const parse =
|
||||
require('parse-link-header') as typeof 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,
|
||||
} = 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,
|
||||
);
|
||||
}
|
@ -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)) {
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
import { spawn } from 'child_process';
|
||||
import * as path from 'path';
|
||||
import * as fs from 'fs';
|
||||
import { diffTrimmedLines } from 'diff';
|
||||
|
||||
export const ROOT = path.join(__dirname, '..');
|
||||
|
||||
@ -64,7 +66,6 @@ export class StdOutTap {
|
||||
* https://www.npmjs.com/package/diff
|
||||
*/
|
||||
export function diffLines(str1: string, str2: string): string {
|
||||
const { diffTrimmedLines } = require('diff');
|
||||
const diffObjs = diffTrimmedLines(str1, str2);
|
||||
const prefix = (chunk: string, char: string) =>
|
||||
chunk
|
||||
@ -84,7 +85,10 @@ export function diffLines(str1: string, str2: string): string {
|
||||
}
|
||||
|
||||
export function loadPackageJson() {
|
||||
return require(path.join(ROOT, 'package.json'));
|
||||
const packageJsonPath = path.join(ROOT, 'package.json');
|
||||
|
||||
const packageJson = fs.readFileSync(packageJsonPath, 'utf8');
|
||||
return JSON.parse(packageJson);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -10,19 +10,19 @@ _balena() {
|
||||
# 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 )
|
||||
# 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=( finalize invalidate validate )
|
||||
release_cmds=( finalize invalidate list validate )
|
||||
tag_cmds=( rm set )
|
||||
|
||||
|
||||
|
@ -9,19 +9,19 @@ _balena_complete()
|
||||
# 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"
|
||||
# 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="finalize invalidate validate"
|
||||
release_cmds="finalize invalidate list validate"
|
||||
tag_cmds="rm set"
|
||||
|
||||
|
||||
|
@ -33,7 +33,7 @@ const commandsJson = JSON.parse(fs.readFileSync(commandsFilePath, 'utf8'));
|
||||
|
||||
const mainCommands = [];
|
||||
const additionalCommands = [];
|
||||
for (const key of Object.keys(commandsJson.commands).sort()) {
|
||||
for (const [key, { aliases }] of Object.entries(commandsJson.commands).sort()) {
|
||||
const cmd = key.split(':');
|
||||
if (cmd.length > 1) {
|
||||
additionalCommands.push(cmd);
|
||||
@ -43,6 +43,17 @@ for (const key of Object.keys(commandsJson.commands).sort()) {
|
||||
} else {
|
||||
mainCommands.push(cmd[0]);
|
||||
}
|
||||
for (const alias of aliases) {
|
||||
const splitAlias = alias.split(' ');
|
||||
if (splitAlias.length > 1) {
|
||||
additionalCommands.push(splitAlias);
|
||||
if (!mainCommands.includes(splitAlias[0])) {
|
||||
mainCommands.push(splitAlias[0]);
|
||||
}
|
||||
} else {
|
||||
mainCommands.push(splitAlias[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
const mainCommandsStr = mainCommands.join(' ');
|
||||
|
||||
@ -73,29 +84,33 @@ fs.readFile(bashFilePathIn, 'utf8', function (err, data) {
|
||||
'main_commands="' + mainCommandsStr + '"',
|
||||
);
|
||||
let subCommands = [];
|
||||
let prevElement = additionalCommands[0][0];
|
||||
additionalCommands.forEach(function (element) {
|
||||
if (element[0] === prevElement) {
|
||||
subCommands.push(element[1]);
|
||||
} else {
|
||||
const prevElement2 = prevElement.replace(/-/g, '_') + '_cmds';
|
||||
data = data.replace(
|
||||
/\$sub_cmds\$/g,
|
||||
' ' + prevElement2 + '="' + subCommands.join(' ') + '"\n$sub_cmds$',
|
||||
);
|
||||
data = data.replace(
|
||||
/\$sub_cmds_prev\$/g,
|
||||
' ' +
|
||||
prevElement +
|
||||
')\n COMPREPLY=( $(compgen -W "$' +
|
||||
prevElement2 +
|
||||
'" -- $cur) )\n ;;\n$sub_cmds_prev$',
|
||||
);
|
||||
prevElement = element[0];
|
||||
subCommands = [];
|
||||
subCommands.push(element[1]);
|
||||
}
|
||||
});
|
||||
let prevElement = additionalCommands.sort((cmd1, cmd2) =>
|
||||
cmd1[0].localeCompare(cmd2[0]),
|
||||
)[0][0];
|
||||
additionalCommands
|
||||
.sort((cmd1, cmd2) => cmd1[0].localeCompare(cmd2[0]))
|
||||
.forEach(function (element) {
|
||||
if (element[0] === prevElement) {
|
||||
subCommands.push(element[1]);
|
||||
} else {
|
||||
const prevElement2 = prevElement.replace(/-/g, '_') + '_cmds';
|
||||
data = data.replace(
|
||||
/\$sub_cmds\$/g,
|
||||
' ' + prevElement2 + '="' + subCommands.join(' ') + '"\n$sub_cmds$',
|
||||
);
|
||||
data = data.replace(
|
||||
/\$sub_cmds_prev\$/g,
|
||||
' ' +
|
||||
prevElement +
|
||||
')\n COMPREPLY=( $(compgen -W "$' +
|
||||
prevElement2 +
|
||||
'" -- $cur) )\n ;;\n$sub_cmds_prev$',
|
||||
);
|
||||
prevElement = element[0];
|
||||
subCommands = [];
|
||||
subCommands.push(element[1]);
|
||||
}
|
||||
});
|
||||
// cleanup placeholders
|
||||
data = data.replace(/\$sub_cmds\$/g, '');
|
||||
data = data.replace(/\$sub_cmds_prev\$/g, '');
|
||||
|
1197
docs/balena-cli.md
1197
docs/balena-cli.md
File diff suppressed because it is too large
Load Diff
3040
npm-shrinkwrap.json
generated
3040
npm-shrinkwrap.json
generated
File diff suppressed because it is too large
Load Diff
66
package.json
66
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "balena-cli",
|
||||
"version": "19.0.0",
|
||||
"version": "19.5.0",
|
||||
"description": "The official balena Command Line Interface",
|
||||
"main": "./build/app.js",
|
||||
"homepage": "https://github.com/balena-io/balena-cli",
|
||||
@ -76,7 +76,7 @@
|
||||
"lint-tsconfig": "balena-lint -e ts -e js -t tsconfig.dev.json --fix automation/ src/ tests/ typings/",
|
||||
"lint-other": "balena-lint -e ts -e js --fix bin/run.js bin/dev.js completion/ .mocharc.js .mocharc-standalone.js",
|
||||
"update": "ts-node --transpile-only ./automation/update-module.ts",
|
||||
"prepare": "echo {} > bin/.fast-boot.json",
|
||||
"prepare": "echo {} > bin/.fast-boot.json && husky",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"keywords": [
|
||||
@ -93,18 +93,13 @@
|
||||
"engines": {
|
||||
"node": "^20.6.0"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "node automation/check-npm-version.js && ts-node automation/check-doc.ts"
|
||||
}
|
||||
},
|
||||
"oclif": {
|
||||
"bin": "balena",
|
||||
"commands": "./build/commands",
|
||||
"helpClass": "./build/help",
|
||||
"topicSeparator": " ",
|
||||
"hooks": {
|
||||
"prerun": "./build/hooks/prerun/track",
|
||||
"prerun": "./build/hooks/prerun",
|
||||
"command_not_found": "./build/hooks/command-not-found/suggest"
|
||||
},
|
||||
"additionalHelpFlags": [
|
||||
@ -118,9 +113,7 @@
|
||||
"devDependencies": {
|
||||
"@balena/lint": "^8.0.0",
|
||||
"@electron/notarize": "^2.0.0",
|
||||
"@octokit/plugin-throttling": "^3.5.1",
|
||||
"@octokit/rest": "^18.6.7",
|
||||
"@types/archiver": "^5.1.1",
|
||||
"@types/archiver": "^6.0.2",
|
||||
"@types/bluebird": "^3.5.36",
|
||||
"@types/body-parser": "^1.19.2",
|
||||
"@types/chai": "^4.3.0",
|
||||
@ -132,7 +125,7 @@
|
||||
"@types/ejs": "^3.1.0",
|
||||
"@types/express": "^4.17.13",
|
||||
"@types/fast-levenshtein": "^0.0.4",
|
||||
"@types/fs-extra": "^9.0.13",
|
||||
"@types/fs-extra": "^11.0.4",
|
||||
"@types/global-agent": "^2.1.1",
|
||||
"@types/global-tunnel-ng": "^2.1.1",
|
||||
"@types/http-proxy": "^1.17.8",
|
||||
@ -140,27 +133,24 @@
|
||||
"@types/intercept-stdout": "^0.1.0",
|
||||
"@types/is-root": "^2.1.2",
|
||||
"@types/js-yaml": "^4.0.5",
|
||||
"@types/jsonwebtoken": "^8.5.6",
|
||||
"@types/klaw": "^3.0.3",
|
||||
"@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/net-keepalive": "^0.4.1",
|
||||
"@types/nock": "^11.1.0",
|
||||
"@types/node": "^20.0.0",
|
||||
"@types/node-cleanup": "^2.1.2",
|
||||
"@types/parse-link-header": "^1.0.1",
|
||||
"@types/prettyjson": "^0.0.33",
|
||||
"@types/progress-stream": "^2.0.2",
|
||||
"@types/request": "^2.48.7",
|
||||
"@types/rewire": "^2.5.28",
|
||||
"@types/rewire": "^2.5.30",
|
||||
"@types/rimraf": "^3.0.2",
|
||||
"@types/semver": "^7.3.9",
|
||||
"@types/shell-escape": "^0.2.0",
|
||||
"@types/sinon": "^10.0.6",
|
||||
"@types/sinon": "^17.0.3",
|
||||
"@types/split": "^1.0.0",
|
||||
"@types/stream-to-promise": "^2.2.1",
|
||||
"@types/tar-stream": "^2.2.2",
|
||||
@ -170,7 +160,7 @@
|
||||
"@types/which": "^2.0.1",
|
||||
"@types/window-size": "^1.1.1",
|
||||
"@yao-pkg/pkg": "^5.11.1",
|
||||
"archiver": "^5.3.0",
|
||||
"archiver": "^7.0.1",
|
||||
"catch-uncommitted": "^2.0.0",
|
||||
"chai": "^4.3.4",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
@ -179,44 +169,41 @@
|
||||
"diff": "^5.0.0",
|
||||
"ent": "^2.2.0",
|
||||
"filehound": "^1.17.5",
|
||||
"fs-extra": "^9.1.0",
|
||||
"fs-extra": "^11.2.0",
|
||||
"http-proxy": "^1.18.1",
|
||||
"husky": "^4.3.8",
|
||||
"husky": "^9.1.5",
|
||||
"inline-source-cli": "^2.0.0",
|
||||
"intercept-stdout": "^0.1.2",
|
||||
"jsonwebtoken": "^9.0.0",
|
||||
"klaw": "^3.0.0",
|
||||
"mkdirp": "^1.0.4",
|
||||
"klaw": "^4.1.0",
|
||||
"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": "^5.0.0",
|
||||
"rewire": "^7.0.0",
|
||||
"simple-git": "^3.14.1",
|
||||
"sinon": "^11.1.2",
|
||||
"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",
|
||||
"@oclif/core": "^3.27.0",
|
||||
"@resin.io/valid-email": "^0.1.0",
|
||||
"@oclif/core": "^4.0.8",
|
||||
"@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",
|
||||
@ -234,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",
|
||||
@ -247,19 +233,19 @@
|
||||
"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",
|
||||
"open": "^7.1.0",
|
||||
"patch-package": "^6.5.1",
|
||||
"patch-package": "^8.0.0",
|
||||
"prettyjson": "^1.2.5",
|
||||
"progress-stream": "^2.0.0",
|
||||
"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",
|
||||
@ -287,6 +273,6 @@
|
||||
}
|
||||
},
|
||||
"versionist": {
|
||||
"publishedAt": "2024-08-22T17:43:31.517Z"
|
||||
"publishedAt": "2024-10-17T14:56:39.279Z"
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +1,8 @@
|
||||
diff --git a/node_modules/@oclif/core/lib/cli-ux/list.js b/node_modules/@oclif/core/lib/cli-ux/list.js
|
||||
index 607d8dc..07ba1f2 100644
|
||||
--- a/node_modules/@oclif/core/lib/cli-ux/list.js
|
||||
+++ b/node_modules/@oclif/core/lib/cli-ux/list.js
|
||||
@@ -22,7 +22,7 @@ function renderList(items) {
|
||||
}
|
||||
left = left.padEnd(maxLength);
|
||||
right = linewrap(maxLength + 2, right);
|
||||
- return `${left} ${right}`;
|
||||
+ return `${left} : ${right}`;
|
||||
});
|
||||
return lines.join('\n');
|
||||
}
|
||||
diff --git a/node_modules/@oclif/core/lib/help/command.js b/node_modules/@oclif/core/lib/help/command.js
|
||||
index 930598f..867799b 100644
|
||||
index 90922c8..6b7f417 100644
|
||||
--- a/node_modules/@oclif/core/lib/help/command.js
|
||||
+++ b/node_modules/@oclif/core/lib/help/command.js
|
||||
@@ -59,7 +59,8 @@ class CommandHelp extends formatter_1.HelpFormatter {
|
||||
@@ -58,7 +58,8 @@ class CommandHelp extends formatter_1.HelpFormatter {
|
||||
return;
|
||||
return args.map((a) => {
|
||||
// Add ellipsis to indicate that the argument takes multiple values if strict is false
|
||||
@ -26,7 +13,7 @@ index 930598f..867799b 100644
|
||||
if (a.default)
|
||||
description = `${(0, theme_1.colorize)(this.config?.theme?.flagDefaultValue, `[default: ${a.default}]`)} ${description}`;
|
||||
diff --git a/node_modules/@oclif/core/lib/help/index.js b/node_modules/@oclif/core/lib/help/index.js
|
||||
index e1859e1..756654c 100644
|
||||
index 4a34b89..d7eb6ac 100644
|
||||
--- a/node_modules/@oclif/core/lib/help/index.js
|
||||
+++ b/node_modules/@oclif/core/lib/help/index.js
|
||||
@@ -172,11 +172,12 @@ class Help extends HelpBase {
|
||||
@ -45,7 +32,7 @@ index e1859e1..756654c 100644
|
||||
const uniqueSubCommands = subCommands.filter((p) => {
|
||||
aliases.push(...p.aliases);
|
||||
diff --git a/node_modules/@oclif/core/lib/parser/errors.js b/node_modules/@oclif/core/lib/parser/errors.js
|
||||
index b37743a..6b2e5c3 100644
|
||||
index 168da99..538a880 100644
|
||||
--- a/node_modules/@oclif/core/lib/parser/errors.js
|
||||
+++ b/node_modules/@oclif/core/lib/parser/errors.js
|
||||
@@ -15,7 +15,8 @@ class CLIParseError extends errors_1.CLIError {
|
||||
@ -67,7 +54,7 @@ index b37743a..6b2e5c3 100644
|
||||
+ let message = `Missing ${args.length} required argument${args.length === 1 ? '' : 's'}`;
|
||||
const namedArgs = args.filter((a) => a.name);
|
||||
if (namedArgs.length > 0) {
|
||||
const list = (0, list_1.renderList)(namedArgs.map((a) => {
|
||||
const list = (0, list_1.default)(namedArgs.map((a) => {
|
||||
@@ -52,7 +54,7 @@ class RequiredArgsError extends CLIParseError {
|
||||
message += `\n\nNote: ${flags} allow${flagsWithMultiple.length === 1 ? 's' : ''} multiple values. Because of this you need to provide all arguments before providing ${flagsWithMultiple.length === 1 ? 'that flag' : 'those flags'}.`;
|
||||
message += '\nAlternatively, you can use "--" to signify the end of the flags and the beginning of arguments.';
|
||||
@ -77,3 +64,16 @@ index b37743a..6b2e5c3 100644
|
||||
this.args = args;
|
||||
this.showHelp = true;
|
||||
}
|
||||
diff --git a/node_modules/@oclif/core/lib/ux/list.js b/node_modules/@oclif/core/lib/ux/list.js
|
||||
index 954954c..0e507c7 100644
|
||||
--- a/node_modules/@oclif/core/lib/ux/list.js
|
||||
+++ b/node_modules/@oclif/core/lib/ux/list.js
|
||||
@@ -22,7 +22,7 @@ function renderList(items) {
|
||||
}
|
||||
left = left.padEnd(maxLength);
|
||||
right = linewrap(maxLength + 2, right);
|
||||
- return `${left} ${right}`;
|
||||
+ return `${left} : ${right}`;
|
||||
});
|
||||
return lines.join('\n');
|
||||
}
|
@ -137,7 +137,8 @@ async function oclifRun(command: string[], options: AppOptions) {
|
||||
}
|
||||
}
|
||||
if (shouldFlush) {
|
||||
await import('@oclif/core/flush');
|
||||
const { flush } = await import('@oclif/core');
|
||||
await flush();
|
||||
}
|
||||
// TODO: figure out why we need to call fast-boot stop() here, in
|
||||
// addition to calling it in the main `run()` function in this file.
|
||||
@ -152,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]);
|
||||
}
|
||||
|
170
src/command.ts
170
src/command.ts
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
@ -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,
|
||||
};
|
||||
|
@ -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
|
@ -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,
|
||||
};
|
||||
|
@ -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',
|
||||
|
@ -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',
|
||||
|
@ -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
|
||||
|
@ -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',
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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({
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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 = {
|
@ -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',
|
||||
|
@ -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,
|
||||
|
@ -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',
|
||||
|
@ -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);
|
||||
|
@ -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',
|
||||
|
@ -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',
|
||||
|
@ -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,
|
||||
|
@ -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',
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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:
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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({
|
||||
|
8
src/commands/env/add.ts
vendored
8
src/commands/env/add.ts
vendored
@ -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];
|
||||
|
10
src/commands/env/rename.ts
vendored
10
src/commands/env/rename.ts
vendored
@ -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),
|
||||
|
10
src/commands/env/rm.ts
vendored
10
src/commands/env/rm.ts
vendored
@ -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(
|
||||
|
@ -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');
|
||||
|
@ -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',
|
||||
|
@ -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({
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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.');
|
||||
}
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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();
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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();
|
||||
|
@ -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,
|
||||
|
@ -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 ?? '');
|
||||
}
|
||||
}
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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',
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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'
|
||||
|
@ -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,
|
||||
|
@ -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({
|
||||
|
@ -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({
|
||||
|
@ -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'),
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -15,12 +15,11 @@
|
||||
* 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';
|
||||
import jsyaml = require('js-yaml');
|
||||
import * as yaml from 'js-yaml';
|
||||
import { tryAsInteger } from '../../utils/validation';
|
||||
import { jsonInfo } from '../../utils/messages';
|
||||
|
||||
@ -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,
|
||||
@ -82,7 +79,7 @@ export default class ReleaseCmd extends Command {
|
||||
$select: 'composition',
|
||||
});
|
||||
|
||||
console.log(jsyaml.dump(release.composition));
|
||||
console.log(yaml.dump(release.composition));
|
||||
}
|
||||
|
||||
async showReleaseInfo(
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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',
|
@ -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,
|
||||
};
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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,
|
||||
|
@ -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',
|
||||
|
@ -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,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user