Move to ESM

Change-type: major
This commit is contained in:
Otavio Jacobi 2024-12-19 15:31:07 -03:00
parent 0900db5b21
commit b11bfa2395
205 changed files with 1884 additions and 1213 deletions

View File

@ -1,2 +0,0 @@
/completion/*
/bin/*

View File

@ -1,21 +0,0 @@
module.exports = {
extends: ['./node_modules/@balena/lint/config/.eslintrc.js'],
parserOptions: {
project: 'tsconfig.dev.json',
},
root: true,
rules: {
ignoreDefinitionFiles: 0,
// to avoid the `warning Forbidden non-null assertion @typescript-eslint/no-non-null-assertion`
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-shadow': 'off',
'@typescript-eslint/no-var-requires': 'off',
'no-restricted-imports': [
'error',
{
paths: ['resin-cli-visuals', 'chalk', 'common-tags', 'resin-cli-form'],
},
],
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
},
};

View File

@ -1,4 +1,4 @@
const commonConfig = require('./.mocharc.js');
const commonConfig = require('./.mocharc.cjs');
module.exports = {
...commonConfig,

View File

@ -1,7 +1,7 @@
module.exports = {
reporter: 'spec',
require: 'ts-node/register/transpile-only',
file: './tests/config-tests',
require: 'tsx',
file: './tests/config-tests.ts',
timeout: 48000,
// To test only, say, 'push.spec.ts', do it as follows so that
// requests are authenticated:

View File

@ -18,14 +18,14 @@
import { run as oclifRun } from '@oclif/core';
import { exec, execFile } from 'child_process';
import type { Stats } from 'fs';
import * as fs from 'fs-extra';
import * as klaw from 'klaw';
import * as path from 'path';
import * as rimraf from 'rimraf';
import fs from 'fs-extra';
import klaw from 'klaw';
import path from 'path';
import rimraf from 'rimraf';
import { promisify } from 'util';
import { notarize } from '@electron/notarize';
import { loadPackageJson, ROOT, whichSpawn } from './utils';
import { loadPackageJson, ROOT, whichSpawn } from './utils.js';
const execFileAsync = promisify(execFile);
const execAsync = promisify(exec);
@ -347,6 +347,8 @@ export async function testShrinkwrap(): Promise<void> {
console.error(`[debug] platform=${process.platform}`);
}
if (process.platform !== 'win32') {
await whichSpawn(path.resolve(__dirname, 'test-lock-deduplicated.sh'));
await whichSpawn(
path.resolve(import.meta.dirname, 'test-lock-deduplicated.sh'),
);
}
}

View File

@ -15,9 +15,9 @@
* limitations under the License.
*/
import * as path from 'path';
import { MarkdownFileParser } from './utils';
import { GlobSync } from 'glob';
import path from 'path';
import { MarkdownFileParser } from './utils.js';
import glob from 'glob';
/**
* This is the skeleton of CLI documentation/reference web page at:
@ -73,7 +73,7 @@ const commandHeadings: { [key: string]: string } = {
};
// Fetch all available commands
const allCommandsPaths = new GlobSync('build/commands/**/*.js', {
const allCommandsPaths = new glob.GlobSync('build/commands/**/*.js', {
ignore: 'build/commands/internal/**',
}).found;
@ -135,7 +135,7 @@ capitanoDoc.categories.forEach((category) => {
* for the documentation web page.
*/
export async function getCapitanoDoc(): Promise<typeof capitanoDoc> {
const readmePath = path.join(__dirname, '..', '..', 'README.md');
const readmePath = path.join(import.meta.dirname, '..', '..', 'README.md');
const mdParser = new MarkdownFileParser(readmePath);
const sections: string[] = await Promise.all([
mdParser.getSectionOfTitle('About').then((sectionLines: string) => {

View File

@ -14,10 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as path from 'path';
import { getCapitanoDoc } from './capitanodoc';
import type { Category, Document, OclifCommand } from './doc-types';
import * as markdown from './markdown';
import path from 'path';
import { getCapitanoDoc } from './capitanodoc.js';
import type { Category, Document, OclifCommand } from './doc-types.js';
import * as markdown from './markdown.js';
/**
* Generates the markdown document (as a string) for the CLI documentation

View File

@ -16,10 +16,10 @@
*/
import { Parser } from '@oclif/core';
import * as ent from 'ent';
import * as _ from 'lodash';
import _ from 'lodash';
import { capitanoizeOclifUsage } from '../../src/utils/oclif-utils';
import type { Category, Document } from './doc-types';
import { capitanoizeOclifUsage } from '../../src/utils/oclif-utils.js';
import type { Category, Document } from './doc-types.js';
function renderOclifCommand(command: Category['commands'][0]): string[] {
const result = [`## ${ent.encode(command.name || '')}`];

View File

@ -15,8 +15,8 @@
* limitations under the License.
*/
import * as fs from 'fs';
import * as readline from 'readline';
import fs from 'fs';
import readline from 'readline';
export class MarkdownFileParser {
constructor(public mdFilePath: string) {}

View File

@ -17,12 +17,12 @@
// eslint-disable-next-line no-restricted-imports
import { stripIndent } from 'common-tags';
import * as _ from 'lodash';
import _ from 'lodash';
import { promises as fs } from 'fs';
import * as path from 'path';
import path from 'path';
import { simpleGit } from 'simple-git';
const ROOT = path.normalize(path.join(__dirname, '..'));
const ROOT = path.normalize(path.join(import.meta.dirname, '..'));
/**
* Compare the timestamp of balena-cli.md with the timestamp of staged files,

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
import * as _ from 'lodash';
import _ from 'lodash';
import {
buildOclifInstaller,
@ -23,7 +23,7 @@ import {
catchUncommitted,
signFilesForNotarization,
testShrinkwrap,
} from './build-bin';
} from './build-bin.js';
// DEBUG set to falsy for negative values else is truthy
process.env.DEBUG = ['0', 'no', 'false', '', undefined].includes(

View File

@ -54,7 +54,10 @@ interface Upstream {
const getUpstreams = async () => {
const fs = await import('fs');
const repoYaml = fs.readFileSync(__dirname + '/../repo.yml', 'utf8');
const repoYaml = fs.readFileSync(
import.meta.dirname + '/../repo.yml',
'utf8',
);
const yaml = await import('js-yaml');
const { upstream } = yaml.load(repoYaml) as {

View File

@ -16,11 +16,11 @@
*/
import { spawn } from 'child_process';
import * as path from 'path';
import * as fs from 'fs';
import * as whichMod from 'which';
import path from 'path';
import fs from 'fs';
import whichMod from 'which';
export const ROOT = path.join(__dirname, '..');
export const ROOT = path.join(import.meta.dirname, '..');
export function loadPackageJson() {
const packageJsonPath = path.join(ROOT, 'package.json');

View File

@ -26,7 +26,7 @@ process.env.UV_THREADPOOL_SIZE = '64';
// `CONTRIBUTING.md`.
const path = require('path');
const rootDir = path.join(__dirname, '..');
const rootDir = path.join(import.meta.dirname, '..');
// Allow balena-dev to work with oclif by temporarily
// pointing oclif config options to src/ instead of build/
@ -58,7 +58,7 @@ require('ts-node').register({
transpileOnly: true,
});
void require('../src/app').run(undefined, {
dir: __dirname,
dir: import.meta.dirname,
development: true,
});

View File

@ -9,13 +9,15 @@ process.env.OCLIF_TS_NODE = '0';
async function run() {
// Use fast-boot to cache require lookups, speeding up startup
await require('../build/fast-boot').start();
const { start } = await import('../build/fast-boot.js');
await start();
// Set the desired es version for downstream modules that support it
require('@balena/es-version').set('es2018');
// Run the CLI
await require('../build/app').run(undefined, { dir: __dirname });
(await import('@balena/es-version')).set('es2018');
//
// // Run the CLI
const { run } = await import('../build/app.js');
run(undefined, { dir: import.meta.url });
}
void run();

View File

@ -14,19 +14,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Module from 'node:module';
const require = Module.createRequire(import.meta.url);
const path = require('path');
const rootDir = path.join(__dirname, '..');
const rootDir = path.join(import.meta.dirname, '..');
const fs = require('fs');
const { exit } = require('process');
const manifestFile = 'oclif.manifest.json';
commandsFilePath = path.join(rootDir, manifestFile);
const commandsFilePath = path.join(rootDir, manifestFile);
if (fs.existsSync(commandsFilePath)) {
console.log('Generating shell auto completion files...');
} else {
console.error(`generate-completion.js: Could not find "${manifestFile}"`);
process.exitCode = 1;
return;
exit(1);
}
const commandsJson = JSON.parse(fs.readFileSync(commandsFilePath, 'utf8'));
@ -47,20 +50,28 @@ for (const key of Object.keys(commandsJson.commands).sort()) {
const mainCommandsStr = mainCommands.join(' ');
// GENERATE BASH COMPLETION FILE
bashFilePathIn = path.join(__dirname, '/templates/bash.template');
bashFilePathOut = path.join(__dirname, 'balena-completion.bash');
const bashFilePathIn = path.join(
import.meta.dirname,
'/templates/bash.template',
);
const bashFilePathOut = path.join(
import.meta.dirname,
'balena-completion.bash',
);
try {
fs.unlinkSync(bashFilePathOut);
} catch (error) {
process.exitCode = 1;
return console.error(error);
console.error(error);
exit(1);
}
fs.readFile(bashFilePathIn, 'utf8', function (err, data) {
if (err) {
process.exitCode = 1;
return console.error(err);
console.error(err);
exit(1);
}
data = data.replace(
@ -103,26 +114,29 @@ fs.readFile(bashFilePathIn, 'utf8', function (err, data) {
fs.writeFile(bashFilePathOut, data, 'utf8', function (error) {
if (error) {
process.exitCode = 1;
return console.error(error);
console.error(error);
exit(1);
}
});
});
// GENERATE ZSH COMPLETION FILE
zshFilePathIn = path.join(__dirname, '/templates/zsh.template');
zshFilePathOut = path.join(__dirname, '_balena');
const zshFilePathIn = path.join(import.meta.dirname, '/templates/zsh.template');
const zshFilePathOut = path.join(import.meta.dirname, '_balena');
try {
fs.unlinkSync(zshFilePathOut);
} catch (error) {
process.exitCode = 1;
return console.error(error);
console.error(error);
exit(1);
}
fs.readFile(zshFilePathIn, 'utf8', function (err, data) {
if (err) {
process.exitCode = 1;
return console.error(err);
console.error(err);
exit(1);
}
data = data.replace(
@ -169,7 +183,8 @@ fs.readFile(zshFilePathIn, 'utf8', function (err, data) {
fs.writeFile(zshFilePathOut, data, 'utf8', function (error) {
if (error) {
process.exitCode = 1;
return console.error(error);
console.error(error);
exit(1);
}
});
});

View File

@ -1,9 +1,12 @@
const { FlatCompat } = require('@eslint/eslintrc');
import { FlatCompat } from '@eslint/eslintrc';
import Module from 'node:module';
const require = Module.createRequire(import.meta.url);
const compat = new FlatCompat({
baseDirectory: __dirname,
baseDirectory: import.meta.dirname,
});
module.exports = [
export default [
...require('@balena/lint/config/eslint.config'),
...compat.config({
parserOptions: {

721
npm-shrinkwrap.json generated
View File

@ -159,6 +159,7 @@
"sinon": "^19.0.0",
"string-to-stream": "^3.0.1",
"ts-node": "^10.4.0",
"tsx": "4.19.2",
"typescript": "^5.7.2"
},
"engines": {
@ -2078,6 +2079,390 @@
"node": ">=16"
}
},
"node_modules/@esbuild/aix-ppc64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.23.1.tgz",
"integrity": "sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==",
"cpu": [
"ppc64"
],
"dev": true,
"optional": true,
"os": [
"aix"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/android-arm": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.23.1.tgz",
"integrity": "sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ==",
"cpu": [
"arm"
],
"dev": true,
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/android-arm64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.23.1.tgz",
"integrity": "sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/android-x64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.23.1.tgz",
"integrity": "sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/darwin-arm64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.23.1.tgz",
"integrity": "sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/darwin-x64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.23.1.tgz",
"integrity": "sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/freebsd-arm64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.23.1.tgz",
"integrity": "sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/freebsd-x64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.23.1.tgz",
"integrity": "sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-arm": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.23.1.tgz",
"integrity": "sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ==",
"cpu": [
"arm"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-arm64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.23.1.tgz",
"integrity": "sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-ia32": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.23.1.tgz",
"integrity": "sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ==",
"cpu": [
"ia32"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-loong64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.23.1.tgz",
"integrity": "sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw==",
"cpu": [
"loong64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-mips64el": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.23.1.tgz",
"integrity": "sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q==",
"cpu": [
"mips64el"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-ppc64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.23.1.tgz",
"integrity": "sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw==",
"cpu": [
"ppc64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-riscv64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.23.1.tgz",
"integrity": "sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA==",
"cpu": [
"riscv64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-s390x": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.23.1.tgz",
"integrity": "sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw==",
"cpu": [
"s390x"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/linux-x64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.23.1.tgz",
"integrity": "sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/netbsd-x64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.23.1.tgz",
"integrity": "sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"netbsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/openbsd-arm64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.23.1.tgz",
"integrity": "sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"openbsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/openbsd-x64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.23.1.tgz",
"integrity": "sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"openbsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/sunos-x64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.23.1.tgz",
"integrity": "sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"sunos"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/win32-arm64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.23.1.tgz",
"integrity": "sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/win32-ia32": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.23.1.tgz",
"integrity": "sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ==",
"cpu": [
"ia32"
],
"dev": true,
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/win32-x64": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.23.1.tgz",
"integrity": "sha512-BHpFFeslkWrXWyUPnbKm+xYYVYruCinGcftSBaa8zoF9hZO4BcSCFUvHVTtzpIY6YzUnYtuEhZ+C9iEXjxnasg==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@eslint-community/eslint-utils": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz",
@ -2220,6 +2605,73 @@
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
}
},
"node_modules/@grpc/grpc-js": {
"version": "1.12.5",
"resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.12.5.tgz",
"integrity": "sha512-d3iiHxdpg5+ZcJ6jnDSOT8Z0O0VMVGy34jAnYLUX8yd36b1qn8f1TwOA/Lc7TsOh03IkPJ38eGI5qD2EjNkoEA==",
"dependencies": {
"@grpc/proto-loader": "^0.7.13",
"@js-sdsl/ordered-map": "^4.4.2"
},
"engines": {
"node": ">=12.10.0"
}
},
"node_modules/@grpc/proto-loader": {
"version": "0.7.13",
"resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.7.13.tgz",
"integrity": "sha512-AiXO/bfe9bmxBjxxtYxFAXGZvMaN5s8kO+jBHAJCON8rJoB5YS/D6X7ZNc6XQkuHNmyl4CYaMI1fJ/Gn27RGGw==",
"dependencies": {
"lodash.camelcase": "^4.3.0",
"long": "^5.0.0",
"protobufjs": "^7.2.5",
"yargs": "^17.7.2"
},
"bin": {
"proto-loader-gen-types": "build/bin/proto-loader-gen-types.js"
},
"engines": {
"node": ">=6"
}
},
"node_modules/@grpc/proto-loader/node_modules/cliui": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz",
"integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==",
"dependencies": {
"string-width": "^4.2.0",
"strip-ansi": "^6.0.1",
"wrap-ansi": "^7.0.0"
},
"engines": {
"node": ">=12"
}
},
"node_modules/@grpc/proto-loader/node_modules/yargs": {
"version": "17.7.2",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
"integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==",
"dependencies": {
"cliui": "^8.0.1",
"escalade": "^3.1.1",
"get-caller-file": "^2.0.5",
"require-directory": "^2.1.1",
"string-width": "^4.2.3",
"y18n": "^5.0.5",
"yargs-parser": "^21.1.1"
},
"engines": {
"node": ">=12"
}
},
"node_modules/@grpc/proto-loader/node_modules/yargs-parser": {
"version": "21.1.1",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz",
"integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==",
"engines": {
"node": ">=12"
}
},
"node_modules/@humanfs/core": {
"version": "0.19.1",
"resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz",
@ -2474,9 +2926,9 @@
}
},
"node_modules/@inquirer/core/node_modules/@types/node": {
"version": "22.10.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.2.tgz",
"integrity": "sha512-Xxr6BBRCAOQixvonOye19wnzyDiUtTeqldOOmj3CkeblonbccA12PFwlufvRdrpjXxqnmUaeiU5EOA+7s5diUQ==",
"version": "22.10.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.5.tgz",
"integrity": "sha512-F8Q+SeGimwOo86fiovQh8qiXfFEh2/ocYv7tU5pJ3EXMSSxk1Joj5wefpFK2fHTf/N6HKGSxIDBT9f3gCxXPkQ==",
"dev": true,
"dependencies": {
"undici-types": "~6.20.0"
@ -3716,6 +4168,15 @@
"@jridgewell/sourcemap-codec": "^1.4.14"
}
},
"node_modules/@js-sdsl/ordered-map": {
"version": "4.4.2",
"resolved": "https://registry.npmjs.org/@js-sdsl/ordered-map/-/ordered-map-4.4.2.tgz",
"integrity": "sha512-iUKgm52T8HOE/makSxjqoWhe95ZJA1/G1sYsGev2JDKUSS14KAgg1LHb+Ba+IPow0xflbnSkOsZcO08C7w1gYw==",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/js-sdsl"
}
},
"node_modules/@kwsites/file-exists": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@kwsites/file-exists/-/file-exists-1.1.1.tgz",
@ -4069,6 +4530,60 @@
"node": ">=12"
}
},
"node_modules/@protobufjs/aspromise": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
"integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ=="
},
"node_modules/@protobufjs/base64": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz",
"integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg=="
},
"node_modules/@protobufjs/codegen": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz",
"integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg=="
},
"node_modules/@protobufjs/eventemitter": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz",
"integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q=="
},
"node_modules/@protobufjs/fetch": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz",
"integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==",
"dependencies": {
"@protobufjs/aspromise": "^1.1.1",
"@protobufjs/inquire": "^1.1.0"
}
},
"node_modules/@protobufjs/float": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz",
"integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ=="
},
"node_modules/@protobufjs/inquire": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz",
"integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q=="
},
"node_modules/@protobufjs/path": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz",
"integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA=="
},
"node_modules/@protobufjs/pool": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz",
"integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw=="
},
"node_modules/@protobufjs/utf8": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz",
"integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw=="
},
"node_modules/@resin.io/types-hidepath": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@resin.io/types-hidepath/-/types-hidepath-1.0.1.tgz",
@ -5062,27 +5577,27 @@
}
},
"node_modules/@tsconfig/node10": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz",
"integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==",
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz",
"integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==",
"dev": true
},
"node_modules/@tsconfig/node12": {
"version": "1.0.9",
"resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz",
"integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==",
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
"integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",
"dev": true
},
"node_modules/@tsconfig/node14": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz",
"integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==",
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
"integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",
"dev": true
},
"node_modules/@tsconfig/node16": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz",
"integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==",
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz",
"integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==",
"dev": true
},
"node_modules/@types/bluebird": {
@ -5407,9 +5922,9 @@
}
},
"node_modules/@types/node": {
"version": "20.17.10",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.10.tgz",
"integrity": "sha512-/jrvh5h6NXhEauFFexRin69nA0uHJ5gwk4iDivp/DeoEua3uwCUto6PC86IpRITBOs4+6i2I56K5x5b6WYGXHA==",
"version": "20.17.12",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.12.tgz",
"integrity": "sha512-vo/wmBgMIiEA23A/knMfn/cf37VnuF52nZh5ZoW0GWt4e4sxNquibrMRJ7UQsA06+MBx9r/H1jsI9grYjQCQlw==",
"dependencies": {
"undici-types": "~6.19.2"
}
@ -6013,10 +6528,13 @@
}
},
"node_modules/acorn-walk": {
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz",
"integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==",
"version": "8.3.4",
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz",
"integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==",
"dev": true,
"dependencies": {
"acorn": "^8.11.0"
},
"engines": {
"node": ">=0.4.0"
}
@ -6695,9 +7213,9 @@
}
},
"node_modules/balena-sdk/node_modules/@types/node": {
"version": "18.19.68",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.68.tgz",
"integrity": "sha512-QGtpFH1vB99ZmTa63K4/FU8twThj4fuVSBkGddTp7uIL/cuoLWIUSL2RcOaigBhfR+hg5pgGkBnkoOxrTVBMKw==",
"version": "18.19.70",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.70.tgz",
"integrity": "sha512-RE+K0+KZoEpDUbGGctnGdkrLFwi1eYKTlIHNl2Um98mUkGsm1u2Ff6Ltd0e8DktTtC98uy7rSj+hO8t/QuLoVQ==",
"dependencies": {
"undici-types": "~5.26.4"
}
@ -8513,9 +9031,9 @@
"integrity": "sha512-6+VnnhZpxwWvvKwjkRnuqlTtlBRJuM+3cCSXmZoYhyXcdgxx6l/3lwYpqmJ9qmhzgWVeATkpVsTua92BsObJjw=="
},
"node_modules/docker-modem": {
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/docker-modem/-/docker-modem-5.0.3.tgz",
"integrity": "sha512-89zhop5YVhcPEt5FpUFGr3cDyceGhq/F9J+ZndQ4KfqNvfbJpPMfgeixFgUj5OjCYAboElqODxY5Z1EBsSa6sg==",
"version": "5.0.5",
"resolved": "https://registry.npmjs.org/docker-modem/-/docker-modem-5.0.5.tgz",
"integrity": "sha512-Cxw8uEcvNTRmsQuGqzzfiCnfGgf96tVJItLh8taOX0miTcIBALKH5TckCSuZbpbjP7uhAl81dOL9sxfa6HgCIg==",
"dependencies": {
"debug": "^4.1.1",
"readable-stream": "^3.5.0",
@ -8561,13 +9079,17 @@
}
},
"node_modules/dockerode": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/dockerode/-/dockerode-4.0.2.tgz",
"integrity": "sha512-9wM1BVpVMFr2Pw3eJNXrYYt6DT9k0xMcsSCjtPvyQ+xa1iPg/Mo3T/gUcwI0B2cczqCeCYRPF8yFYDwtFXT0+w==",
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/dockerode/-/dockerode-4.0.3.tgz",
"integrity": "sha512-QSXJFcBQNaGZO6U3qWW4B7p8yRIJn/dWmvL2AQWfO/bjptBBO6QYdVkYSYFz9qoivP2jsOHZfmXMAfrK0BMKyg==",
"dependencies": {
"@balena/dockerignore": "^1.0.2",
"docker-modem": "^5.0.3",
"tar-fs": "~2.0.1"
"@grpc/grpc-js": "^1.11.1",
"@grpc/proto-loader": "^0.7.13",
"docker-modem": "^5.0.5",
"protobufjs": "^7.3.2",
"tar-fs": "~2.0.1",
"uuid": "^10.0.0"
},
"engines": {
"node": ">= 8.0"
@ -8584,6 +9106,18 @@
"tar-stream": "^2.0.0"
}
},
"node_modules/dockerode/node_modules/uuid": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-10.0.0.tgz",
"integrity": "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==",
"funding": [
"https://github.com/sponsors/broofa",
"https://github.com/sponsors/ctavan"
],
"bin": {
"uuid": "dist/bin/uuid"
}
},
"node_modules/doctrine": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
@ -9071,11 +9605,49 @@
"es6-symbol": "^3.1.1"
}
},
"node_modules/esbuild": {
"version": "0.23.1",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.23.1.tgz",
"integrity": "sha512-VVNz/9Sa0bs5SELtn3f7qhJCDPCF5oMEl5cO9/SSinpE9hbPVvxbd572HH5AKiP7WD8INO53GgfDDhRjkylHEg==",
"dev": true,
"hasInstallScript": true,
"bin": {
"esbuild": "bin/esbuild"
},
"engines": {
"node": ">=18"
},
"optionalDependencies": {
"@esbuild/aix-ppc64": "0.23.1",
"@esbuild/android-arm": "0.23.1",
"@esbuild/android-arm64": "0.23.1",
"@esbuild/android-x64": "0.23.1",
"@esbuild/darwin-arm64": "0.23.1",
"@esbuild/darwin-x64": "0.23.1",
"@esbuild/freebsd-arm64": "0.23.1",
"@esbuild/freebsd-x64": "0.23.1",
"@esbuild/linux-arm": "0.23.1",
"@esbuild/linux-arm64": "0.23.1",
"@esbuild/linux-ia32": "0.23.1",
"@esbuild/linux-loong64": "0.23.1",
"@esbuild/linux-mips64el": "0.23.1",
"@esbuild/linux-ppc64": "0.23.1",
"@esbuild/linux-riscv64": "0.23.1",
"@esbuild/linux-s390x": "0.23.1",
"@esbuild/linux-x64": "0.23.1",
"@esbuild/netbsd-x64": "0.23.1",
"@esbuild/openbsd-arm64": "0.23.1",
"@esbuild/openbsd-x64": "0.23.1",
"@esbuild/sunos-x64": "0.23.1",
"@esbuild/win32-arm64": "0.23.1",
"@esbuild/win32-ia32": "0.23.1",
"@esbuild/win32-x64": "0.23.1"
}
},
"node_modules/escalade": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
"integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==",
"dev": true,
"engines": {
"node": ">=6"
}
@ -10610,7 +11182,6 @@
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
"dev": true,
"engines": {
"node": "6.* || 8.* || >= 10.*"
}
@ -10703,6 +11274,18 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/get-tsconfig": {
"version": "4.8.1",
"resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.8.1.tgz",
"integrity": "sha512-k9PN+cFBmaLWtVz29SkUoqU5O0slLuHJXt/2P+tMVFT+phsSGXGkp9t3rQIqdz0e+06EHNGs3oM6ZX1s2zHxRg==",
"dev": true,
"dependencies": {
"resolve-pkg-maps": "^1.0.0"
},
"funding": {
"url": "https://github.com/privatenumber/get-tsconfig?sponsor=1"
}
},
"node_modules/getpass": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
@ -13039,6 +13622,11 @@
"integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=",
"dev": true
},
"node_modules/lodash.camelcase": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",
"integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA=="
},
"node_modules/lodash.get": {
"version": "4.4.2",
"resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
@ -13143,6 +13731,11 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/long": {
"version": "5.2.3",
"resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz",
"integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q=="
},
"node_modules/loose-envify": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
@ -15194,10 +15787,9 @@
}
},
"node_modules/patch-package/node_modules/yaml": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.6.1.tgz",
"integrity": "sha512-7r0XPzioN/Q9kXBro/XPnA6kznR73DHq+GXh5ON7ZozRO6aMjbmiBuKste2wslTFkC5d1dw0GooOCepZXJ2SAg==",
"license": "ISC",
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.7.0.tgz",
"integrity": "sha512-+hSoy/QHluxmC9kCIJyL/uyFmLmc+e5CFR5Wa+bpIhIj85LVb9ZH2nVnqrHoSvKogwODv0ClqZkmiSSaIH5LTA==",
"bin": {
"yaml": "bin.mjs"
},
@ -15573,6 +16165,29 @@
"resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz",
"integrity": "sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk="
},
"node_modules/protobufjs": {
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.4.0.tgz",
"integrity": "sha512-mRUWCc3KUU4w1jU8sGxICXH/gNS94DvI1gxqDvBzhj1JpcsimQkYiOJfwsPUykUI5ZaspFbSgmBLER8IrQ3tqw==",
"hasInstallScript": true,
"dependencies": {
"@protobufjs/aspromise": "^1.1.2",
"@protobufjs/base64": "^1.1.2",
"@protobufjs/codegen": "^2.0.4",
"@protobufjs/eventemitter": "^1.1.0",
"@protobufjs/fetch": "^1.1.0",
"@protobufjs/float": "^1.0.2",
"@protobufjs/inquire": "^1.1.0",
"@protobufjs/path": "^1.1.2",
"@protobufjs/pool": "^1.1.0",
"@protobufjs/utf8": "^1.1.0",
"@types/node": ">=13.7.0",
"long": "^5.0.0"
},
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/proxy-addr": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
@ -16048,7 +16663,6 @@
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
"integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
@ -16314,6 +16928,15 @@
"node": ">=4"
}
},
"node_modules/resolve-pkg-maps": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz",
"integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==",
"dev": true,
"funding": {
"url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1"
}
},
"node_modules/responselike": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.1.tgz",
@ -18081,6 +18704,25 @@
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="
},
"node_modules/tsx": {
"version": "4.19.2",
"resolved": "https://registry.npmjs.org/tsx/-/tsx-4.19.2.tgz",
"integrity": "sha512-pOUl6Vo2LUq/bSa8S5q7b91cgNSjctn9ugq/+Mvow99qW6x/UZYwzxy/3NmqoT66eHYfCVvFvACC58UBPFf28g==",
"dev": true,
"dependencies": {
"esbuild": "~0.23.0",
"get-tsconfig": "^4.7.5"
},
"bin": {
"tsx": "dist/cli.mjs"
},
"engines": {
"node": ">=18.0.0"
},
"optionalDependencies": {
"fsevents": "~2.3.3"
}
},
"node_modules/tunnel": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
@ -19001,7 +19643,6 @@
"version": "5.0.8",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
"integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
"dev": true,
"engines": {
"node": ">=10"
}

View File

@ -9,6 +9,7 @@
"url": "git@github.com:balena-io/balena-cli.git"
},
"preferGlobal": true,
"type": "module",
"files": [
"bin/.fast-boot.json",
"bin/",
@ -25,24 +26,24 @@
"balena": "./bin/run.js"
},
"scripts": {
"postinstall": "node patches/apply-patches.js",
"postinstall": "node patches/apply-patches.cjs",
"prebuild": "rimraf build/ build-bin/",
"pretarball": "ts-node --transpile-only ../../automation/run.ts sign:binaries",
"pretarball": "npx tsx ../../automation/run.ts sign:binaries",
"build": "npm run build:src && npm run catch-uncommitted",
"build:t": "npm run lint && npm run build:fast && npm run build:test",
"build:src": "npm run lint && npm run build:fast && npm run build:test && npm run build:doc && npm run build:completion",
"build:pages": "mkdirp ./build/auth/pages/&& inline-source --compress ./src/auth/pages/error.ejs ./build/auth/pages/error.ejs && inline-source --compress ./src/auth/pages/success.ejs ./build/auth/pages/success.ejs",
"build:fast": "npm run build:pages && tsc && npx oclif manifest",
"build:test": "tsc -P ./tsconfig.dev.json --noEmit",
"build:doc": "ts-node --transpile-only automation/capitanodoc/index.ts > docs/balena-cli.md",
"build:doc": "npx tsx automation/capitanodoc/index.ts > docs/balena-cli.md",
"build:completion": "node completion/generate-completion.js",
"build:standalone": "ts-node --transpile-only automation/run.ts build:standalone",
"build:installer": "ts-node --transpile-only automation/run.ts build:installer",
"build:standalone": "npx tsx automation/run.ts build:standalone",
"build:installer": "npx tsx automation/run.ts build:installer",
"package": "npm run build:fast && npm run build:standalone && npm run build:installer",
"pretest": "npm run build",
"test": "npm run test:shrinkwrap && npm run test:core",
"test:core": "npm run test:source && npm run test:standalone",
"test:shrinkwrap": "ts-node --transpile-only automation/run.ts test-shrinkwrap",
"test:shrinkwrap": "npx tsx automation/run.ts test-shrinkwrap",
"test:source": "cross-env BALENA_CLI_TEST_TYPE=source mocha",
"test:standalone": "npm run build:standalone && npm run test:standalone:fast",
"test:standalone:fast": "cross-env BALENA_CLI_TEST_TYPE=standalone mocha --config .mocharc-standalone.js",
@ -50,12 +51,12 @@
"test:fast-profile": "npm run test:fast -- -- --inspect-brk=0.0.0.0",
"test:debug": "cross-env BALENA_CLI_TEST_TYPE=source mocha --inspect-brk=0.0.0.0",
"test:only": "npm run build:fast && cross-env BALENA_CLI_TEST_TYPE=source mocha \"tests/**/${npm_config_test}.spec.ts\"",
"catch-uncommitted": "ts-node --transpile-only automation/run.ts catch-uncommitted",
"catch-uncommitted": "npx tsx automation/run.ts catch-uncommitted",
"ci": "npm run test && npm run catch-uncommitted",
"lint": "npm run lint-tsconfig && npm run lint-other",
"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",
"lint-other": "balena-lint -e ts -e js --fix bin/run.js bin/dev.js completion/ .mocharc.cjs .mocharc-standalone.js",
"update": "npx tsx ./automation/update-module.ts",
"prepare": "echo {} > bin/.fast-boot.json && husky",
"prepublishOnly": "npm run build"
},
@ -160,6 +161,7 @@
"sinon": "^19.0.0",
"string-to-stream": "^3.0.1",
"ts-node": "^10.4.0",
"tsx": "4.19.2",
"typescript": "^5.7.2"
},
"dependencies": {

View File

@ -80,4 +80,4 @@ async function run() {
}
}
run();
void run();

View File

@ -15,23 +15,24 @@
* limitations under the License.
*/
import * as packageJSON from '../package.json';
import type { AppOptions } from './preparser';
import type { AppOptions } from './preparser.js';
import {
checkDeletedCommand,
preparseArgs,
unsupportedFlag,
} from './preparser';
import { CliSettings } from './utils/bootstrap';
import { onceAsync } from './utils/lazy';
} from './preparser.js';
import { CliSettings } from './utils/bootstrap.js';
import { onceAsync, getPackageJson } from './utils/lazy.js';
import { run as mainRun, settings } from '@oclif/core';
const packageJSON = getPackageJson();
/**
* Sentry.io setup
* @see https://docs.sentry.io/error-reporting/quickstart/?platform=node
*/
export const setupSentry = onceAsync(async () => {
const config = await import('./config');
const config = await import('./config.js');
const Sentry = await import('@sentry/node');
Sentry.init({
autoSessionTracking: false,
@ -51,30 +52,20 @@ export const setupSentry = onceAsync(async () => {
async function checkNodeVersion() {
const validNodeVersions = packageJSON.engines.node;
if (!(await import('semver')).satisfies(process.version, validNodeVersions)) {
const { getNodeEngineVersionWarn } = await import('./utils/messages');
const { getNodeEngineVersionWarn } = await import('./utils/messages.js');
console.warn(getNodeEngineVersionWarn(process.version, validNodeVersions));
}
}
/** Setup balena-sdk options that are shared with imported packages */
function setupBalenaSdkSharedOptions(settings: CliSettings) {
const BalenaSdk = require('balena-sdk') as typeof import('balena-sdk');
async function setupBalenaSdkSharedOptions(settings: CliSettings) {
const BalenaSdk = await import('balena-sdk');
BalenaSdk.setSharedOptions({
apiUrl: settings.get<string>('apiUrl'),
dataDirectory: settings.get<string>('dataDirectory'),
});
}
/**
* Addresses the console warning:
* (node:49500) MaxListenersExceededWarning: Possible EventEmitter memory
* leak detected. 11 error listeners added. Use emitter.setMaxListeners() to
* increase limit
*/
export function setMaxListeners(maxListeners: number) {
require('events').EventEmitter.defaultMaxListeners = maxListeners;
}
/** Selected CLI initialization steps */
async function init() {
if (process.env.BALENARC_NO_SENTRY) {
@ -89,13 +80,13 @@ async function init() {
const settings = new CliSettings();
// Proxy setup should be done early on, before loading balena-sdk
await (await import('./utils/proxy')).setupGlobalHttpProxy(settings);
await (await import('./utils/proxy.js')).setupGlobalHttpProxy(settings);
setupBalenaSdkSharedOptions(settings);
await setupBalenaSdkSharedOptions(settings);
// check for CLI updates once a day
if (!process.env.BALENARC_OFFLINE_MODE) {
(await import('./utils/update')).notify();
await (await import('./utils/update.js')).notify();
}
}
@ -104,7 +95,7 @@ async function oclifRun(command: string[], options: AppOptions) {
let deprecationPromise: Promise<void> | undefined;
// check and enforce the CLI's deprecation policy
if (!(unsupportedFlag || process.env.BALENARC_UNSUPPORTED)) {
const { DeprecationChecker } = await import('./deprecation');
const { DeprecationChecker } = await import('./deprecation.js');
const deprecationChecker = new DeprecationChecker(packageJSON.version);
// warnAndAbortIfDeprecated uses previously cached data only
await deprecationChecker.warnAndAbortIfDeprecated();
@ -147,11 +138,11 @@ async function oclifRun(command: string[], options: AppOptions) {
// the try/catch block above, execution does not get past the
// Promise.all() call below, but I don't understand why.
if (isEEXIT) {
(await import('./fast-boot')).stop();
(await import('./fast-boot.js')).stop();
}
})(!options.noFlush);
const { trackPromise } = await import('./hooks/prerun');
const { trackPromise } = await import('./hooks/prerun.js');
await Promise.all([trackPromise, deprecationPromise, runPromise]);
}
@ -160,7 +151,7 @@ async function oclifRun(command: string[], options: AppOptions) {
export async function run(cliArgs = process.argv, options: AppOptions) {
try {
const { setOfflineModeEnvVars, normalizeEnvVars } = await import(
'./utils/bootstrap'
'./utils/bootstrap.js'
);
setOfflineModeEnvVars();
normalizeEnvVars();
@ -168,15 +159,15 @@ export async function run(cliArgs = process.argv, options: AppOptions) {
await init();
// Look for commands that have been removed and if so, exit with a notice
checkDeletedCommand(cliArgs.slice(2));
await checkDeletedCommand(cliArgs.slice(2));
const args = await preparseArgs(cliArgs);
await oclifRun(args, options);
} catch (err) {
await (await import('./errors')).handleError(err);
await (await import('./errors.js')).handleError(err);
} finally {
try {
(await import('./fast-boot')).stop();
(await import('./fast-boot.js')).stop();
} catch (e) {
if (process.env.DEBUG) {
console.error(`[debug] Stopping fast-boot: ${e}`);

View File

@ -14,8 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import { getBalenaSdk } from '../utils/lazy';
import { LoginServer } from './server';
import { getBalenaSdk } from '../utils/lazy.js';
import { LoginServer } from './server.js';
/**
* @module auth
@ -42,7 +42,7 @@ import { LoginServer } from './server';
* console.log("My session token is: #{sessionToken}")
*/
export async function login({ host = '127.0.0.1', port = 0 }) {
const utils = await import('./utils');
const utils = await import('./utils.js');
const loginServer = new LoginServer();
const {
@ -55,7 +55,7 @@ export async function login({ host = '127.0.0.1', port = 0 }) {
const loginUrl = await utils.getDashboardLoginURL(callbackUrl);
console.info(`Opening web browser for URL:\n${loginUrl}`);
const open = await import('open');
const { default: open } = await import('open');
await open(loginUrl, { wait: false });
const balena = getBalenaSdk();

View File

@ -14,14 +14,14 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import * as bodyParser from 'body-parser';
import bodyParser from 'body-parser';
import { EventEmitter } from 'events';
import * as express from 'express';
import express from 'express';
import type { Socket } from 'net';
import * as path from 'path';
import path from 'path';
import * as utils from './utils';
import { ExpectedError } from '../errors';
import * as utils from './utils.js';
import { ExpectedError } from '../errors.js';
export class LoginServer extends EventEmitter {
protected expressApp: express.Express;
@ -56,7 +56,7 @@ export class LoginServer extends EventEmitter {
);
app.set('view engine', 'ejs');
app.set('views', path.join(__dirname, 'pages'));
app.set('views', path.join(import.meta.dirname, 'pages'));
this.server = await new Promise<import('net').Server>((resolve, reject) => {
const callback = (err: Error) => {

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import { getBalenaSdk } from '../utils/lazy';
import { getBalenaSdk } from '../utils/lazy.js';
/**
* Get dashboard CLI login URL
@ -49,7 +49,9 @@ export async function getDashboardLoginURL(
* @param token - session token or api key
* @returns whether the login was successful or not
*/
export async function loginIfTokenValid(token?: string): Promise<boolean> {
export async function loginIfTokenValid(
token?: string | null,
): Promise<boolean> {
token = (token || '').trim();
if (!token) {
return false;

View File

@ -16,15 +16,15 @@
*/
import { Args, Command } from '@oclif/core';
import { ExpectedError } from '../../errors';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { ExpectedError } from '../../errors.js';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
async function isLoggedInWithJwt() {
const balena = getBalenaSdk();
try {
const token = await balena.auth.getToken();
const { default: jwtDecode } = await import('jwt-decode');
jwtDecode(token);
jwtDecode.default(token);
return true;
} catch {
return false;

View File

@ -16,8 +16,8 @@
*/
import { Flags, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
import * as cf from '../../utils/common-flags.js';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy.js';
export default class APIKeyListCmd extends Command {
public static aliases = ['api-keys'];
@ -45,7 +45,7 @@ export default class APIKeyListCmd extends Command {
public async run() {
const { flags: options } = await this.parse(APIKeyListCmd);
const { getApplication } = await import('../../utils/sdk');
const { getApplication } = await import('../../utils/sdk.js');
const actorId = options.fleet
? (
await getApplication(getBalenaSdk(), options.fleet, {
@ -71,7 +71,7 @@ export default class APIKeyListCmd extends Command {
},
});
const fields = ['id', 'name', 'created_at', 'description', 'expiry_date'];
const _ = await import('lodash');
const { default: _ } = await import('lodash');
console.log(
getVisuals().table.horizontal(
keys.map((key) => _.mapValues(key, (val) => val ?? 'N/a')),

View File

@ -16,7 +16,7 @@
*/
import { Args, Command } from '@oclif/core';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
export default class RevokeCmd extends Command {
public static description = stripIndent`

View File

@ -16,7 +16,7 @@
*/
import { Flags, Args, Command } from '@oclif/core';
import { stripIndent } from '../../utils/lazy';
import { stripIndent } from '../../utils/lazy.js';
export default class AppCreateCmd extends Command {
public static description = stripIndent`
@ -71,7 +71,7 @@ export default class AppCreateCmd extends Command {
const { args: params, flags: options } = await this.parse(AppCreateCmd);
await (
await import('../../utils/application-create')
await import('../../utils/application-create.js')
).applicationCreateBase('app', options, params);
}
}

View File

@ -16,7 +16,7 @@
*/
import { Flags, Args, Command } from '@oclif/core';
import { stripIndent } from '../../utils/lazy';
import { stripIndent } from '../../utils/lazy.js';
export default class BlockCreateCmd extends Command {
public static description = stripIndent`
@ -71,7 +71,7 @@ export default class BlockCreateCmd extends Command {
const { args: params, flags: options } = await this.parse(BlockCreateCmd);
await (
await import('../../utils/application-create')
await import('../../utils/application-create.js')
).applicationCreateBase('block', options, params);
}
}

View File

@ -16,9 +16,9 @@
*/
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';
import { getBalenaSdk } from '../../utils/lazy.js';
import * as cf from '../../utils/common-flags.js';
import * as compose from '../../utils/compose.js';
import type {
ApplicationType,
BalenaSDK,
@ -30,11 +30,15 @@ import {
buildArgDeprecation,
dockerignoreHelp,
registrySecretsHelp,
} from '../../utils/messages';
import type { ComposeCliFlags, ComposeOpts } from '../../utils/compose-types';
import { buildProject, composeCliFlags } from '../../utils/compose_ts';
import type { BuildOpts, DockerCliFlags } from '../../utils/docker';
import { dockerCliFlags } from '../../utils/docker';
} from '../../utils/messages.js';
import type {
ComposeCliFlags,
ComposeOpts,
} from '../../utils/compose-types.js';
import { buildProject, composeCliFlags } from '../../utils/compose_ts.js';
import type { BuildOpts, DockerCliFlags } from '../../utils/docker.js';
import { dockerCliFlags } from '../../utils/docker.js';
import type Dockerode from 'dockerode';
type ComposeGenerateOptsParam = Parameters<typeof compose.generateOpts>[0];
@ -103,12 +107,12 @@ ${dockerignoreHelp}
public async run() {
const { args: params, flags: options } = await this.parse(BuildCmd);
const Logger = await import('../../utils/logger');
const { checkLoggedInIf } = await import('../../utils/patterns');
const { default: Logger } = await import('../../utils/logger.js');
const { checkLoggedInIf } = await import('../../utils/patterns.js');
await checkLoggedInIf(!!options.fleet);
(await import('events')).defaultMaxListeners = 1000;
(await import('events')).default.defaultMaxListeners = 1000;
const sdk = getBalenaSdk();
@ -157,14 +161,16 @@ ${dockerignoreHelp}
(opts.fleet == null && (opts.arch == null || opts.deviceType == null)) ||
(opts.fleet != null && (opts.arch != null || opts.deviceType != null))
) {
const { ExpectedError } = await import('../../errors');
const { ExpectedError } = await import('../../errors.js');
throw new ExpectedError(
'You must specify either a fleet (-f), or the device type (-d) and optionally the architecture (-A)',
);
}
// Validate project directory
const { validateProjectDirectory } = await import('../../utils/compose_ts');
const { validateProjectDirectory } = await import(
'../../utils/compose_ts.js'
);
const { dockerfilePath, registrySecrets } = await validateProjectDirectory(
sdk,
{
@ -200,7 +206,7 @@ ${dockerignoreHelp}
)) as PineTypedResult<DeviceType, typeof deviceTypeOpts>
).is_of__cpu_architecture[0].slug;
} catch (err) {
const { ExpectedError } = await import('../../errors');
const { ExpectedError } = await import('../../errors.js');
if (err instanceof sdk.errors.BalenaInvalidDeviceType) {
let message = err.message;
if (!(await sdk.auth.isLoggedIn())) {
@ -217,7 +223,7 @@ ${dockerignoreHelp}
protected async getAppAndResolveArch(opts: PrepareBuildOpts) {
if (opts.fleet) {
const { getAppWithArch } = await import('../../utils/helpers');
const { getAppWithArch } = await import('../../utils/helpers.js');
const app = await getAppWithArch(opts.fleet);
opts.arch = app.arch;
opts.deviceType = app.is_for__device_type[0].slug;
@ -225,8 +231,14 @@ ${dockerignoreHelp}
}
}
protected async prepareBuild(options: PrepareBuildOpts) {
const { getDocker, generateBuildOpts } = await import('../../utils/docker');
protected async prepareBuild(options: PrepareBuildOpts): Promise<{
docker: Dockerode;
buildOpts: BuildOpts;
composeOpts: ComposeOpts;
}> {
const { getDocker, generateBuildOpts } = await import(
'../../utils/docker.js'
);
const [docker, buildOpts, composeOpts] = await Promise.all([
getDocker(options),
generateBuildOpts(options),
@ -254,7 +266,7 @@ ${dockerignoreHelp}
*/
protected async buildProject(
docker: import('dockerode'),
logger: import('../../utils/logger'),
logger: import('../../utils/logger.js').default,
composeOpts: ComposeOpts,
opts: {
appType?: Pick<ApplicationType, 'supports_multicontainer'>;
@ -264,7 +276,7 @@ ${dockerignoreHelp}
buildOpts: BuildOpts;
},
) {
const { loadProject } = await import('../../utils/compose_ts');
const { loadProject } = await import('../../utils/compose_ts.js');
const project = await loadProject(
logger,

View File

@ -17,13 +17,13 @@
import { Flags, Command } from '@oclif/core';
import type { Interfaces } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getCliForm, stripIndent } from '../../utils/lazy';
import * as cf from '../../utils/common-flags.js';
import { getBalenaSdk, getCliForm, stripIndent } from '../../utils/lazy.js';
import {
applicationIdInfo,
devModeInfo,
secureBootInfo,
} from '../../utils/messages';
} from '../../utils/messages.js';
import type { BalenaSDK, PineDeferred } from 'balena-sdk';
export default class ConfigGenerateCmd extends Command {
@ -64,17 +64,14 @@ export default class ConfigGenerateCmd extends Command {
description: 'a balenaOS version',
required: true,
}),
fleet: { ...cf.fleet, exclusive: ['device'] },
fleet: cf.fleetExclusive(['device']),
dev: cf.dev,
secureBoot: cf.secureBoot,
device: {
...cf.device,
exclusive: [
'fleet',
'provisioning-key-name',
'provisioning-key-expiry-date',
],
},
device: cf.deviceExclusive([
'fleet',
'provisioning-key-name',
'provisioning-key-expiry-date',
]),
deviceApiKey: Flags.string({
description:
'custom device key - note that this is only supported on balenaOS 2.0.3+',
@ -122,7 +119,7 @@ export default class ConfigGenerateCmd extends Command {
public static authenticated = true;
public async getApplication(balena: BalenaSDK, fleet: string) {
const { getApplication } = await import('../../utils/sdk');
const { getApplication } = await import('../../utils/sdk.js');
return await getApplication(balena, fleet, {
$select: 'slug',
$expand: {
@ -148,7 +145,7 @@ export default class ConfigGenerateCmd extends Command {
$expand: { is_of__device_type: { $select: 'slug' } },
});
if (!rawDevice.belongs_to__application) {
const { ExpectedError } = await import('../../errors');
const { ExpectedError } = await import('../../errors.js');
throw new ExpectedError(stripIndent`
Device ${options.device} does not appear to belong to an accessible fleet.
Try with a different device, or use '--fleet' instead of '--device'.`);
@ -167,14 +164,14 @@ export default class ConfigGenerateCmd extends Command {
// Check compatibility if application and deviceType provided
if (options.fleet && options.deviceType) {
const helpers = await import('../../utils/helpers');
const helpers = await import('../../utils/helpers.js');
if (
!(await helpers.areDeviceTypesCompatible(
resourceDeviceType,
deviceType,
))
) {
const { ExpectedError } = await import('../../errors');
const { ExpectedError } = await import('../../errors.js');
throw new ExpectedError(
`Device type ${options.deviceType} is incompatible with fleet ${options.fleet}`,
);
@ -185,7 +182,7 @@ export default class ConfigGenerateCmd extends Command {
await balena.models.config.getDeviceTypeManifestBySlug(deviceType);
const { validateSecureBootOptionAndWarn } = await import(
'../../utils/config'
'../../utils/config.js'
);
await validateSecureBootOptionAndWarn(
options.secureBoot,
@ -207,7 +204,7 @@ export default class ConfigGenerateCmd extends Command {
// Generate config
const { generateDeviceConfig, generateApplicationConfig } = await import(
'../../utils/config'
'../../utils/config.js'
);
let config;
@ -246,7 +243,7 @@ export default class ConfigGenerateCmd extends Command {
protected async validateOptions(
options: Interfaces.InferredFlags<typeof ConfigGenerateCmd.flags>,
) {
const { ExpectedError } = await import('../../errors');
const { ExpectedError } = await import('../../errors.js');
if (options.device == null && options.fleet == null) {
throw new ExpectedError(this.missingDeviceOrAppMessage);
@ -255,9 +252,9 @@ export default class ConfigGenerateCmd extends Command {
if (!options.fleet && options.deviceType) {
throw new ExpectedError(this.deviceTypeNotAllowedMessage);
}
const { normalizeOsVersion } = await import('../../utils/normalization');
const { normalizeOsVersion } = await import('../../utils/normalization.js');
options.version = normalizeOsVersion(options.version);
const { validateDevOptionAndWarn } = await import('../../utils/config');
const { validateDevOptionAndWarn } = await import('../../utils/config.js');
await validateDevOptionAndWarn(options.dev, options.version);
}
}

View File

@ -16,8 +16,8 @@
*/
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getVisuals, stripIndent } from '../../utils/lazy';
import * as cf from '../../utils/common-flags.js';
import { getVisuals, stripIndent } from '../../utils/lazy.js';
export default class ConfigInjectCmd extends Command {
public static description = stripIndent`
@ -52,7 +52,7 @@ export default class ConfigInjectCmd extends Command {
public async run() {
const { args: params, flags: options } = await this.parse(ConfigInjectCmd);
const { safeUmount } = await import('../../utils/umount');
const { safeUmount } = await import('../../utils/umount.js');
const drive =
options.drive || (await getVisuals().drive('Select the device/OS drive'));

View File

@ -16,8 +16,8 @@
*/
import { Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getVisuals, stripIndent } from '../../utils/lazy';
import * as cf from '../../utils/common-flags.js';
import { getVisuals, stripIndent } from '../../utils/lazy.js';
export default class ConfigReadCmd extends Command {
public static description = stripIndent`
@ -47,7 +47,7 @@ export default class ConfigReadCmd extends Command {
public async run() {
const { flags: options } = await this.parse(ConfigReadCmd);
const { safeUmount } = await import('../../utils/umount');
const { safeUmount } = await import('../../utils/umount.js');
const drive =
options.drive || (await getVisuals().drive('Select the device drive'));

View File

@ -16,8 +16,8 @@
*/
import { Flags, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getVisuals, stripIndent } from '../../utils/lazy';
import * as cf from '../../utils/common-flags.js';
import { getVisuals, stripIndent } from '../../utils/lazy.js';
export default class ConfigReconfigureCmd extends Command {
public static description = stripIndent`
@ -55,7 +55,7 @@ export default class ConfigReconfigureCmd extends Command {
public async run() {
const { flags: options } = await this.parse(ConfigReconfigureCmd);
const { safeUmount } = await import('../../utils/umount');
const { safeUmount } = await import('../../utils/umount.js');
const drive =
options.drive || (await getVisuals().drive('Select the device drive'));
@ -66,7 +66,7 @@ export default class ConfigReconfigureCmd extends Command {
await safeUmount(drive);
if (!uuid) {
const { ExpectedError } = await import('../../errors');
const { ExpectedError } = await import('../../errors.js');
throw new ExpectedError(
`Error: UUID not found in 'config.json' file for '${drive}'`,
);
@ -80,7 +80,7 @@ export default class ConfigReconfigureCmd extends Command {
configureCommand.push('--advanced');
}
const { runCommand } = await import('../../utils/helpers');
const { runCommand } = await import('../../utils/helpers.js');
await runCommand(configureCommand);
console.info('Done');

View File

@ -16,8 +16,8 @@
*/
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getVisuals, stripIndent } from '../../utils/lazy';
import * as cf from '../../utils/common-flags.js';
import { getVisuals, stripIndent } from '../../utils/lazy.js';
export default class ConfigWriteCmd extends Command {
public static description = stripIndent`
@ -57,7 +57,7 @@ export default class ConfigWriteCmd extends Command {
public async run() {
const { args: params, flags: options } = await this.parse(ConfigWriteCmd);
const { denyMount, safeUmount } = await import('../../utils/umount');
const { denyMount, safeUmount } = await import('../../utils/umount.js');
const drive =
options.drive || (await getVisuals().drive('Select the device drive'));
@ -67,7 +67,7 @@ export default class ConfigWriteCmd extends Command {
const configJSON = await config.read(drive, '');
console.info(`Setting ${params.key} to ${params.value}`);
ConfigWriteCmd.updateConfigJson(configJSON, params.key, params.value);
await ConfigWriteCmd.updateConfigJson(configJSON, params.key, params.value);
await denyMount(drive, async () => {
await safeUmount(drive);
@ -78,8 +78,12 @@ export default class ConfigWriteCmd extends Command {
}
/** Call Lodash's _.setWith(). Moved here for ease of testing. */
static updateConfigJson(configJSON: object, key: string, value: string) {
const _ = require('lodash') as typeof import('lodash');
static async updateConfigJson(
configJSON: object,
key: string,
value: string,
) {
const { default: _ } = await import('lodash');
// note: _.setWith() is needed instead of _.set() because, given a key
// like `os.udevRules.101`, _.set() creates a udevRules array (rather
// than a dictionary) and sets the 101st array element to value, while

View File

@ -17,30 +17,29 @@
import { Args, Flags, Command } from '@oclif/core';
import type { ImageDescriptor } from '@balena/compose/dist/parse';
import { ExpectedError } from '../../errors';
import { getBalenaSdk, getChalk, stripIndent } from '../../utils/lazy';
import { ExpectedError } from '../../errors.js';
import { getBalenaSdk, getChalk, stripIndent } from '../../utils/lazy.js';
import {
dockerignoreHelp,
registrySecretsHelp,
buildArgDeprecation,
} from '../../utils/messages';
import * as ca from '../../utils/common-args';
import * as compose from '../../utils/compose';
} from '../../utils/messages.js';
import * as ca from '../../utils/common-args.js';
import * as compose from '../../utils/compose.js';
import type {
BuiltImage,
ComposeCliFlags,
ComposeOpts,
Release as ComposeReleaseInfo,
} from '../../utils/compose-types';
import type { BuildOpts, DockerCliFlags } from '../../utils/docker';
} from '../../utils/compose-types.js';
import type { BuildOpts, DockerCliFlags } from '../../utils/docker.js';
import {
applyReleaseTagKeysAndValues,
buildProject,
composeCliFlags,
isBuildConfig,
parseReleaseTagKeysAndValues,
} from '../../utils/compose_ts';
import { dockerCliFlags } from '../../utils/docker';
} from '../../utils/compose_ts.js';
import { dockerCliFlags } from '../../utils/docker.js';
import type { ApplicationType, DeviceType, Release } from 'balena-sdk';
interface ApplicationWithArch {
@ -147,9 +146,9 @@ ${dockerignoreHelp}
public async run() {
const { args: params, flags: options } = await this.parse(DeployCmd);
(await import('events')).defaultMaxListeners = 1000;
(await import('events')).default.defaultMaxListeners = 1000;
const Logger = await import('../../utils/logger');
const { default: Logger } = await import('../../utils/logger.js');
const logger = Logger.getLogger();
logger.logDebug('Parsing input...');
@ -169,7 +168,7 @@ ${dockerignoreHelp}
const sdk = getBalenaSdk();
const { getRegistrySecrets, validateProjectDirectory } = await import(
'../../utils/compose_ts'
'../../utils/compose_ts.js'
);
const { releaseTagKeys, releaseTagValues } = parseReleaseTagKeysAndValues(
@ -193,10 +192,10 @@ ${dockerignoreHelp}
(options as FlagsDef)['registry-secrets'] = registrySecrets;
}
const helpers = await import('../../utils/helpers');
const helpers = await import('../../utils/helpers.js');
const app = await helpers.getAppWithArch(fleet);
const dockerUtils = await import('../../utils/docker');
const dockerUtils = await import('../../utils/docker.js');
const [docker, buildOpts, composeOpts] = await Promise.all([
dockerUtils.getDocker(options),
dockerUtils.generateBuildOpts(options as FlagsDef),
@ -226,7 +225,7 @@ ${dockerignoreHelp}
async deployProject(
docker: import('dockerode'),
logger: import('../../utils/logger'),
logger: import('../../utils/logger.js').default,
composeOpts: ComposeOpts,
opts: {
app: ApplicationWithArch; // the application instance to deploy to
@ -240,11 +239,11 @@ ${dockerignoreHelp}
createAsDraft: boolean;
},
) {
const _ = await import('lodash');
const { default: _ } = await import('lodash');
const doodles = await import('resin-doodles');
const sdk = getBalenaSdk();
const { deployProject: $deployProject, loadProject } = await import(
'../../utils/compose_ts'
'../../utils/compose_ts.js'
);
const appType = opts.app.application_type[0];
@ -315,7 +314,7 @@ ${dockerignoreHelp}
builtImagesByService = _.keyBy(builtImages, 'serviceName');
}
const images: BuiltImage[] = project.descriptors.map(
(d) =>
(d: ImageDescriptor) =>
builtImagesByService[d.serviceName] ?? {
serviceName: d.serviceName,
name: (isBuildConfig(d.image) ? d.image.tag : d.image) || '',
@ -324,9 +323,9 @@ ${dockerignoreHelp}
},
);
let release: Release | ComposeReleaseInfo['release'];
let release: Release | Awaited<ReturnType<typeof $deployProject>>;
if (appType.slug === 'legacy-v1' || appType.slug === 'legacy-v2') {
const { deployLegacy } = require('../../utils/deploy-legacy');
const { deployLegacy } = await import('../../utils/deploy-legacy.js');
const msg = getChalk().yellow(
'Target fleet requires legacy deploy method.',

View File

@ -16,8 +16,8 @@
*/
import { Flags, Command } from '@oclif/core';
import type * as BalenaSdk from 'balena-sdk';
import * as _ from 'lodash';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
import _ from 'lodash';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy.js';
export default class DeviceTypeListCmd extends Command {
public static aliases = ['devices supported'];

View File

@ -16,8 +16,8 @@
*/
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import * as cf from '../../utils/common-flags.js';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
export default class DeviceDeactivateCmd extends Command {
public static description = stripIndent`
@ -51,7 +51,7 @@ export default class DeviceDeactivateCmd extends Command {
await this.parse(DeviceDeactivateCmd);
const balena = getBalenaSdk();
const patterns = await import('../../utils/patterns');
const patterns = await import('../../utils/patterns.js');
const uuid = params.uuid;
const deactivationWarning = `

View File

@ -16,7 +16,7 @@
*/
import { Flags, Command } from '@oclif/core';
import { getCliUx, stripIndent } from '../../utils/lazy';
import { getCliUx, stripIndent } from '../../utils/lazy.js';
export default class DeviceDetectCmd extends Command {
public static aliases = ['scan'];
@ -61,12 +61,12 @@ export default class DeviceDetectCmd extends Command {
public static offlineCompatible = true;
public async run() {
const _ = await import('lodash');
const { default: _ } = await import('lodash');
const { discoverLocalBalenaOsDevices } = await import(
'../../utils/discover'
'../../utils/discover.js'
);
const prettyjson = await import('prettyjson');
const dockerUtils = await import('../../utils/docker');
const dockerUtils = await import('../../utils/docker.js');
const dockerPort = 2375;
const dockerTimeout = 2000;

View File

@ -16,8 +16,8 @@
*/
import { Args, Command } from '@oclif/core';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { ExpectedError } from '../../errors';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
import { ExpectedError } from '../../errors.js';
export default class DeviceIdentifyCmd extends Command {
public static description = stripIndent`

View File

@ -16,10 +16,10 @@
*/
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';
import { jsonInfo } from '../../utils/messages';
import * as cf from '../../utils/common-flags.js';
import { expandForAppName } from '../../utils/helpers.js';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy.js';
import { jsonInfo } from '../../utils/messages.js';
import type { Application, Release } from 'balena-sdk';
@ -118,7 +118,7 @@ export default class DeviceCmd extends Command {
)) as ExtendedDevice;
if (options.view) {
const open = await import('open');
const { default: open } = await import('open');
const dashboardUrl = balena.models.device.getDashboardUrl(device.uuid);
await open(dashboardUrl, { wait: false });
return;

View File

@ -16,10 +16,10 @@
*/
import { Flags, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { applicationIdInfo } from '../../utils/messages';
import { runCommand } from '../../utils/helpers';
import * as cf from '../../utils/common-flags.js';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
import { applicationIdInfo } from '../../utils/messages.js';
import { runCommand } from '../../utils/helpers.js';
interface FlagsDef {
fleet?: string;
@ -108,13 +108,13 @@ export default class DeviceInitCmd extends Command {
// Imports
const { promisify } = await import('util');
const rimraf = promisify(await import('rimraf'));
const rimraf = promisify((await import('rimraf')).default);
const tmp = await import('tmp');
const tmpNameAsync = promisify(tmp.tmpName);
tmp.setGracefulCleanup();
const { downloadOSImage } = await import('../../utils/cloud');
const { getApplication } = await import('../../utils/sdk');
const Logger = await import('../../utils/logger');
const { downloadOSImage } = await import('../../utils/cloud.js');
const { getApplication } = await import('../../utils/sdk.js');
const { default: Logger } = await import('../../utils/logger.js');
const logger = Logger.getLogger();
const balena = getBalenaSdk();
@ -129,7 +129,7 @@ export default class DeviceInitCmd extends Command {
},
},
})
: await (await import('../../utils/patterns')).selectApplication();
: await (await import('../../utils/patterns.js')).selectApplication();
// Register new device
const deviceUuid = balena.models.device.generateUniqueKey();

View File

@ -16,10 +16,10 @@
*/
import { Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { expandForAppName } from '../../utils/helpers';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
import { applicationIdInfo, jsonInfo } from '../../utils/messages';
import * as cf from '../../utils/common-flags.js';
import { expandForAppName } from '../../utils/helpers.js';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy.js';
import { applicationIdInfo, jsonInfo } from '../../utils/messages.js';
import type { Device, PineOptions } from 'balena-sdk';
@ -78,7 +78,7 @@ export default class DeviceListCmd extends Command {
const devices = (
await (async () => {
if (options.fleet != null) {
const { getApplication } = await import('../../utils/sdk');
const { getApplication } = await import('../../utils/sdk.js');
const application = await getApplication(balena, options.fleet, {
$select: 'slug',
$expand: {
@ -115,11 +115,11 @@ export default class DeviceListCmd extends Command {
];
if (options.json) {
const { pickAndRename } = await import('../../utils/helpers');
const { pickAndRename } = await import('../../utils/helpers.js');
const mapped = devices.map((device) => pickAndRename(device, fields));
console.log(JSON.stringify(mapped, null, 4));
} else {
const _ = await import('lodash');
const { default: _ } = await import('lodash');
console.log(
getVisuals().table.horizontal(
devices.map((dev) => _.mapValues(dev, (val) => val ?? 'N/a')),

View File

@ -16,7 +16,7 @@
*/
import { Flags, Args, Command } from '@oclif/core';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
export default class DeviceLocalModeCmd extends Command {
public static description = stripIndent`

View File

@ -16,7 +16,7 @@
*/
import { Flags, Args, Command } from '@oclif/core';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
import type { LogMessage } from 'balena-sdk';
const MAX_RETRY = 1000;
@ -94,14 +94,14 @@ export default class DeviceLogsCmd extends Command {
const { args: params, flags: options } = await this.parse(DeviceLogsCmd);
const balena = getBalenaSdk();
const { serviceIdToName } = await import('../../utils/cloud');
const { serviceIdToName } = await import('../../utils/cloud.js');
const { connectAndDisplayDeviceLogs, displayLogObject } = await import(
'../../utils/device/logs'
'../../utils/device/logs.js'
);
const { validateIPAddress, validateDotLocalUrl } = await import(
'../../utils/validation'
'../../utils/validation.js'
);
const Logger = await import('../../utils/logger');
const { default: Logger } = await import('../../utils/logger.js');
const logger = Logger.getLogger();
@ -130,13 +130,13 @@ export default class DeviceLogsCmd extends Command {
validateDotLocalUrl(params.device)
) {
// Logs from local device
const { DeviceAPI } = await import('../../utils/device/api');
const { DeviceAPI } = await import('../../utils/device/api.js');
const deviceApi = new DeviceAPI(logger, params.device);
logger.logDebug('Checking we can access device');
try {
await deviceApi.ping();
} catch {
const { ExpectedError } = await import('../../errors');
const { ExpectedError } = await import('../../errors.js');
throw new ExpectedError(
`Cannot access device at address ${params.device}. Device may not be in local mode.`,
);
@ -151,7 +151,7 @@ export default class DeviceLogsCmd extends Command {
maxAttempts: 1 + (options['max-retry'] ?? MAX_RETRY),
});
} else {
const { checkLoggedIn } = await import('../../utils/patterns');
const { checkLoggedIn } = await import('../../utils/patterns.js');
// Logs from cloud
await checkLoggedIn();
if (options.tail) {

View File

@ -22,10 +22,10 @@ import type {
PineOptions,
PineTypedResult,
} from 'balena-sdk';
import * as cf from '../../utils/common-flags';
import { ExpectedError } from '../../errors';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { applicationIdInfo } from '../../utils/messages';
import * as cf from '../../utils/common-flags.js';
import { ExpectedError } from '../../errors.js';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
import { applicationIdInfo } from '../../utils/messages.js';
export default class DeviceMoveCmd extends Command {
public static description = stripIndent`
@ -97,7 +97,7 @@ export default class DeviceMoveCmd extends Command {
const devices = await this.getDevices(balena, deviceUuids);
// Disambiguate application
const { getApplication } = await import('../../utils/sdk');
const { getApplication } = await import('../../utils/sdk.js');
// Get destination application
const application = options.fleet
@ -147,7 +147,7 @@ export default class DeviceMoveCmd extends Command {
})
.map((deviceType) => deviceType.id);
const patterns = await import('../../utils/patterns');
const patterns = await import('../../utils/patterns.js');
try {
const application = await patterns.selectApplication(
{

View File

@ -16,9 +16,9 @@
*/
import { Flags, Args, Command } from '@oclif/core';
import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { ExpectedError } from '../../errors.js';
import * as cf from '../../utils/common-flags.js';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
export default class DeviceNoteCmd extends Command {
public static aliases = ['notes'];
@ -45,7 +45,7 @@ export default class DeviceNoteCmd extends Command {
};
public static flags = {
device: { exclusive: ['dev'], ...cf.device },
device: cf.deviceExclusive(['dev']),
dev: Flags.string({
exclusive: ['device'],
hidden: true,

View File

@ -16,11 +16,11 @@
*/
import { Flags, Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent, getCliForm } from '../../utils/lazy';
import * as cf from '../../utils/common-flags.js';
import { getBalenaSdk, stripIndent, getCliForm } from '../../utils/lazy.js';
import type { Device } from 'balena-sdk';
import { ExpectedError } from '../../errors';
import { getExpandedProp } from '../../utils/pine';
import { ExpectedError } from '../../errors.js';
import { getExpandedProp } from '../../utils/pine.js';
export default class DeviceOsUpdateCmd extends Command {
public static description = stripIndent`
@ -119,7 +119,9 @@ export default class DeviceOsUpdateCmd extends Command {
// Get target OS version
let targetOsVersion = options.version;
if (targetOsVersion != null) {
const { normalizeOsVersion } = await import('../../utils/normalization');
const { normalizeOsVersion } = await import(
'../../utils/normalization.js'
);
targetOsVersion = normalizeOsVersion(targetOsVersion);
if (!hupVersionInfo.versions.includes(targetOsVersion)) {
throw new ExpectedError(
@ -155,7 +157,7 @@ export default class DeviceOsUpdateCmd extends Command {
currentOsVersion,
targetOsVersion,
)) === 'takeover';
const patterns = await import('../../utils/patterns');
const patterns = await import('../../utils/patterns.js');
// Warn the user if the update requires a takeover
if (takeoverRequired) {
await patterns.confirm(

View File

@ -16,8 +16,8 @@
*/
import { Args, Command } from '@oclif/core';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { getExpandedProp } from '../../utils/pine';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
import { getExpandedProp } from '../../utils/pine.js';
export default class DevicePinCmd extends Command {
public static description = stripIndent`

View File

@ -16,8 +16,8 @@
*/
import { Flags, Args, Command } from '@oclif/core';
import { ExpectedError } from '../../errors';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { ExpectedError } from '../../errors.js';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
export default class DevicePublicUrlCmd extends Command {
public static description = stripIndent`

View File

@ -16,7 +16,7 @@
*/
import { Args, Command } from '@oclif/core';
import { getBalenaSdk, getCliUx, stripIndent } from '../../utils/lazy';
import { getBalenaSdk, getCliUx, stripIndent } from '../../utils/lazy.js';
export default class DevicePurgeCmd extends Command {
public static description = stripIndent`

View File

@ -16,8 +16,8 @@
*/
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import * as cf from '../../utils/common-flags.js';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
export default class DeviceRebootCmd extends Command {
public static description = stripIndent`

View File

@ -16,9 +16,9 @@
*/
import { Flags, Command } from '@oclif/core';
import * as ca from '../../utils/common-args';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { applicationIdInfo } from '../../utils/messages';
import * as ca from '../../utils/common-args.js';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
import { applicationIdInfo } from '../../utils/messages.js';
export default class DeviceRegisterCmd extends Command {
public static description = stripIndent`
@ -59,7 +59,7 @@ export default class DeviceRegisterCmd extends Command {
const { args: params, flags: options } =
await this.parse(DeviceRegisterCmd);
const { getApplication } = await import('../../utils/sdk');
const { getApplication } = await import('../../utils/sdk.js');
const balena = getBalenaSdk();

View File

@ -16,7 +16,7 @@
*/
import { Args, Command } from '@oclif/core';
import { getBalenaSdk, stripIndent, getCliForm } from '../../utils/lazy';
import { getBalenaSdk, stripIndent, getCliForm } from '../../utils/lazy.js';
export default class DeviceRenameCmd extends Command {
public static description = stripIndent`

View File

@ -16,7 +16,7 @@
*/
import { Flags, Args, Command } from '@oclif/core';
import { getBalenaSdk, getCliUx, stripIndent } from '../../utils/lazy';
import { getBalenaSdk, getCliUx, stripIndent } from '../../utils/lazy.js';
import type {
BalenaSDK,
DeviceWithServiceDetails,
@ -89,8 +89,8 @@ export default class DeviceRestartCmd extends Command {
deviceUuid: string,
serviceNames: string[],
) {
const { ExpectedError, instanceOf } = await import('../../errors');
const { getExpandedProp } = await import('../../utils/pine');
const { ExpectedError, instanceOf } = await import('../../errors.js');
const { getExpandedProp } = await import('../../utils/pine.js');
// Get device
let device: DeviceWithServiceDetails<CurrentServiceWithCommit>;
@ -156,7 +156,7 @@ export default class DeviceRestartCmd extends Command {
// Note: device.restartApplication throws `BalenaDeviceNotFound: Device not found` if device not online.
// Need to use device.get first to distinguish between non-existant and disconnected devices.
// Remove this workaround when SDK issue resolved: https://github.com/balena-io/balena-sdk/issues/649
const { instanceOf, ExpectedError } = await import('../../errors');
const { instanceOf, ExpectedError } = await import('../../errors.js');
try {
const device = await balena.models.device.get(deviceUuid);
if (!device.is_online) {

View File

@ -16,8 +16,8 @@
*/
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import * as cf from '../../utils/common-flags.js';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
export default class DeviceRmCmd extends Command {
public static description = stripIndent`
@ -52,7 +52,7 @@ export default class DeviceRmCmd extends Command {
const { args: params, flags: options } = await this.parse(DeviceRmCmd);
const balena = getBalenaSdk();
const patterns = await import('../../utils/patterns');
const patterns = await import('../../utils/patterns.js');
// Confirm
const uuids = params.uuid.split(',');

View File

@ -16,9 +16,9 @@
*/
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags.js';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
import { ExpectedError } from '../../errors.js';
export default class DeviceShutdownCmd extends Command {
public static description = stripIndent`

View File

@ -16,11 +16,11 @@
*/
import { Flags, Args, Command } from '@oclif/core';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
import {
parseAsInteger,
validateLocalHostnameOrIp,
} from '../../utils/validation';
} from '../../utils/validation.js';
export default class DeviceSSHCmd extends Command {
public static aliases = ['ssh'];
@ -109,7 +109,9 @@ export default class DeviceSSHCmd extends Command {
// Local connection
if (validateLocalHostnameOrIp(params.fleetOrDevice)) {
const { performLocalDeviceSSH } = await import('../../utils/device/ssh');
const { performLocalDeviceSSH } = await import(
'../../utils/device/ssh.js'
);
await performLocalDeviceSSH({
hostname: params.fleetOrDevice,
port: options.port || 'local',
@ -121,12 +123,12 @@ export default class DeviceSSHCmd extends Command {
}
// Remote connection
const { getProxyConfig } = await import('../../utils/helpers');
const { getProxyConfig } = await import('../../utils/helpers.js');
const {
getOnlineTargetDeviceUuid,
checkLoggedIn,
checkNotUsingOfflineMode,
} = await import('../../utils/patterns');
} = await import('../../utils/patterns.js');
const sdk = getBalenaSdk();
const proxyConfig = getProxyConfig();
@ -140,7 +142,7 @@ export default class DeviceSSHCmd extends Command {
params.fleetOrDevice,
);
const { which } = await import('../../utils/which');
const { which } = await import('../../utils/which.js');
const [whichProxytunnel, { username }, proxyUrl] = await Promise.all([
useProxy ? which('proxytunnel', false) : undefined,
@ -192,7 +194,7 @@ export default class DeviceSSHCmd extends Command {
let containerId: string | undefined;
if (params.service != null) {
const { getContainerIdForService } = await import(
'../../utils/device/ssh'
'../../utils/device/ssh.js'
);
containerId = await getContainerIdForService({
deviceUuid,
@ -210,7 +212,7 @@ export default class DeviceSSHCmd extends Command {
} else {
accessCommand = `host ${deviceUuid}`;
}
const { runRemoteCommand } = await import('../../utils/ssh');
const { runRemoteCommand } = await import('../../utils/ssh.js');
await runRemoteCommand({
cmd: accessCommand,
hostname: `ssh.${proxyUrl}`,

View File

@ -16,7 +16,7 @@
*/
import { Args, Command } from '@oclif/core';
import { getBalenaSdk, getCliUx, stripIndent } from '../../utils/lazy';
import { getBalenaSdk, getCliUx, stripIndent } from '../../utils/lazy.js';
import type { BalenaSDK } from 'balena-sdk';
export default class DeviceStartServiceCmd extends Command {
@ -70,8 +70,8 @@ export default class DeviceStartServiceCmd extends Command {
deviceUuid: string,
serviceNames: string[],
) {
const { ExpectedError } = await import('../../errors');
const { getExpandedProp } = await import('../../utils/pine');
const { ExpectedError } = await import('../../errors.js');
const { getExpandedProp } = await import('../../utils/pine.js');
// Get device
const device = await balena.models.device.getWithServiceDetails(

View File

@ -16,7 +16,7 @@
*/
import { Args, Command } from '@oclif/core';
import { getBalenaSdk, getCliUx, stripIndent } from '../../utils/lazy';
import { getBalenaSdk, getCliUx, stripIndent } from '../../utils/lazy.js';
import type { BalenaSDK } from 'balena-sdk';
export default class DeviceStopServiceCmd extends Command {
@ -70,8 +70,8 @@ export default class DeviceStopServiceCmd extends Command {
deviceUuid: string,
serviceNames: string[],
) {
const { ExpectedError } = await import('../../errors');
const { getExpandedProp } = await import('../../utils/pine');
const { ExpectedError } = await import('../../errors.js');
const { getExpandedProp } = await import('../../utils/pine.js');
// Get device
const device = await balena.models.device.getWithServiceDetails(

View File

@ -16,7 +16,7 @@
*/
import { Args, Command } from '@oclif/core';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
export default class DeviceTrackFleetCmd extends Command {
public static description = stripIndent`

View File

@ -20,9 +20,9 @@ import {
NoPortsDefinedError,
InvalidPortMappingError,
ExpectedError,
} from '../../errors';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { lowercaseIfSlug } from '../../utils/normalization';
} from '../../errors.js';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
import { lowercaseIfSlug } from '../../utils/normalization.js';
import type { Server, Socket } from 'net';
@ -94,7 +94,7 @@ export default class DeviceTunnelCmd extends Command {
public async run() {
const { args: params, flags: options } = await this.parse(DeviceTunnelCmd);
const Logger = await import('../../utils/logger');
const { default: Logger } = await import('../../utils/logger.js');
const logger = Logger.getLogger();
const sdk = getBalenaSdk();
@ -122,11 +122,13 @@ export default class DeviceTunnelCmd extends Command {
}
// Ascertain device uuid
const { getOnlineTargetDeviceUuid } = await import('../../utils/patterns');
const { getOnlineTargetDeviceUuid } = await import(
'../../utils/patterns.js'
);
const uuid = await getOnlineTargetDeviceUuid(sdk, params.deviceOrFleet);
logger.logInfo(`Opening a tunnel to ${uuid}...`);
const _ = await import('lodash');
const { default: _ } = await import('lodash');
const localListeners = _.chain(options.port)
.map((mapping) => {
return this.parsePortMapping(mapping);
@ -134,7 +136,7 @@ export default class DeviceTunnelCmd extends Command {
.map(async ({ localPort, localAddress, remotePort }) => {
try {
const { tunnelConnectionToDevice } = await import(
'../../utils/tunnel'
'../../utils/tunnel.js'
);
const handler = await tunnelConnectionToDevice(uuid, remotePort, sdk);

View File

@ -17,11 +17,11 @@
import { Flags, Command } from '@oclif/core';
import type { Interfaces } from '@oclif/core';
import type * as SDK from 'balena-sdk';
import * as _ from 'lodash';
import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
import { applicationIdInfo } from '../../utils/messages';
import _ from 'lodash';
import { ExpectedError } from '../../errors.js';
import * as cf from '../../utils/common-flags.js';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy.js';
import { applicationIdInfo } from '../../utils/messages.js';
type FlagsDef = Interfaces.InferredFlags<typeof EnvListCmd.flags>;
@ -97,16 +97,16 @@ export default class EnvListCmd extends Command {
];
public static flags = {
fleet: { ...cf.fleet, exclusive: ['device'] },
fleet: cf.fleetExclusive(['device']),
config: Flags.boolean({
default: false,
char: 'c',
description: 'show configuration variables only',
exclusive: ['service'],
}),
device: { ...cf.device, exclusive: ['fleet'] },
device: cf.deviceExclusive(['fleet']),
json: cf.json,
service: { ...cf.service, exclusive: ['config'] },
service: cf.serviceExclusive(['config']),
};
public async run() {
@ -114,7 +114,7 @@ export default class EnvListCmd extends Command {
const variables: EnvironmentVariableInfo[] = [];
const { checkLoggedIn } = await import('../../utils/patterns');
const { checkLoggedIn } = await import('../../utils/patterns.js');
await checkLoggedIn();
@ -126,14 +126,14 @@ export default class EnvListCmd extends Command {
let fleetSlug: string | undefined = options.fleet
? await (
await import('../../utils/sdk')
await import('../../utils/sdk.js')
).getFleetSlug(balena, options.fleet)
: undefined;
let fullUUID: string | undefined; // as oppposed to the short, 7-char UUID
if (options.device) {
const { getDeviceAndMaybeAppFromUUID } = await import(
'../../utils/cloud'
'../../utils/cloud.js'
);
const [device, app] = await getDeviceAndMaybeAppFromUUID(
balena,
@ -187,7 +187,7 @@ export default class EnvListCmd extends Command {
}
if (options.json) {
const { pickAndRename } = await import('../../utils/helpers');
const { pickAndRename } = await import('../../utils/helpers.js');
const mapped = varArray.map((o) => pickAndRename(o, fields));
this.log(JSON.stringify(mapped, null, 4));
} else {

View File

@ -15,9 +15,9 @@
* limitations under the License.
*/
import { Args, Command } from '@oclif/core';
import * as ec from '../../utils/env-common';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { parseAsInteger } from '../../utils/validation';
import * as ec from '../../utils/env-common.js';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
import { parseAsInteger } from '../../utils/validation.js';
export default class EnvRenameCmd extends Command {
public static description = stripIndent`
@ -59,7 +59,7 @@ export default class EnvRenameCmd extends Command {
public async run() {
const { args: params, flags: opt } = await this.parse(EnvRenameCmd);
const { checkLoggedIn } = await import('../../utils/patterns');
const { checkLoggedIn } = await import('../../utils/patterns.js');
await checkLoggedIn();

View File

@ -16,9 +16,9 @@
*/
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';
import * as ec from '../../utils/env-common.js';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
import { parseAsInteger } from '../../utils/validation.js';
export default class EnvRmCmd extends Command {
public static description = stripIndent`
@ -65,11 +65,11 @@ export default class EnvRmCmd extends Command {
public async run() {
const { args: params, flags: opt } = await this.parse(EnvRmCmd);
const { checkLoggedIn } = await import('../../utils/patterns');
const { checkLoggedIn } = await import('../../utils/patterns.js');
await checkLoggedIn();
const { confirm } = await import('../../utils/patterns');
const { confirm } = await import('../../utils/patterns.js');
await confirm(
opt.yes || false,
'Are you sure you want to delete the environment variable?',

View File

@ -17,10 +17,10 @@
import { Args, Command } from '@oclif/core';
import type * as BalenaSdk from 'balena-sdk';
import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { applicationIdInfo } from '../../utils/messages';
import { ExpectedError } from '../../errors.js';
import * as cf from '../../utils/common-flags.js';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
import { applicationIdInfo } from '../../utils/messages.js';
interface FlagsDef {
fleet?: string;
@ -95,8 +95,8 @@ export default class EnvSetCmd extends Command {
public static strict = false;
public static flags = {
fleet: { ...cf.fleet, exclusive: ['device'] },
device: { ...cf.device, exclusive: ['fleet'] },
fleet: cf.fleetExclusive(['device']),
device: cf.deviceExclusive(['fleet']),
quiet: cf.quiet,
service: cf.service,
};
@ -111,7 +111,7 @@ export default class EnvSetCmd extends Command {
);
}
const { checkLoggedIn } = await import('../../utils/patterns');
const { checkLoggedIn } = await import('../../utils/patterns.js');
await checkLoggedIn();
@ -186,7 +186,7 @@ async function resolveFleetSlugs(
fleetOption: string,
) {
const fleetSlugs: string[] = [];
const { getFleetSlug } = await import('../../utils/sdk');
const { getFleetSlug } = await import('../../utils/sdk.js');
for (const appNameOrSlug of fleetOption.split(',')) {
try {
fleetSlugs.push(await getFleetSlug(balena, appNameOrSlug));
@ -223,7 +223,7 @@ async function setServiceVars(
}
}
} else if (options.device) {
const { getDeviceAndAppFromUUID } = await import('../../utils/cloud');
const { getDeviceAndAppFromUUID } = await import('../../utils/cloud.js');
for (const uuid of options.device.split(',')) {
let device;
let app;

View File

@ -16,7 +16,7 @@
*/
import { Flags, Args, Command } from '@oclif/core';
import { stripIndent } from '../../utils/lazy';
import { stripIndent } from '../../utils/lazy.js';
export default class FleetCreateCmd extends Command {
public static description = stripIndent`
@ -71,7 +71,7 @@ export default class FleetCreateCmd extends Command {
const { args: params, flags: options } = await this.parse(FleetCreateCmd);
await (
await import('../../utils/application-create')
await import('../../utils/application-create.js')
).applicationCreateBase('fleet', options, params);
}
}

View File

@ -16,10 +16,10 @@
*/
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';
import { applicationIdInfo } from '../../utils/messages';
import * as cf from '../../utils/common-flags.js';
import * as ca from '../../utils/common-args.js';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy.js';
import { applicationIdInfo } from '../../utils/messages.js';
export default class FleetCmd extends Command {
public static description = stripIndent`
@ -53,7 +53,7 @@ export default class FleetCmd extends Command {
public async run() {
const { args: params, flags: options } = await this.parse(FleetCmd);
const { getApplication } = await import('../../utils/sdk');
const { getApplication } = await import('../../utils/sdk.js');
const balena = getBalenaSdk();
@ -65,7 +65,7 @@ export default class FleetCmd extends Command {
});
if (options.view) {
const open = await import('open');
const { default: open } = await import('open');
const dashboardUrl = balena.models.application.getDashboardUrl(
application.id,
);

View File

@ -16,8 +16,8 @@
*/
import type * as BalenaSdk from 'balena-sdk';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
import * as cf from '../../utils/common-flags.js';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy.js';
import { Command } from '@oclif/core';
interface ExtendedApplication extends ApplicationWithDeviceTypeSlug {

View File

@ -16,8 +16,8 @@
*/
import { Args, Command } from '@oclif/core';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { getExpandedProp } from '../../utils/pine';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
import { getExpandedProp } from '../../utils/pine.js';
export default class FleetPinCmd extends Command {
public static description = stripIndent`

View File

@ -16,9 +16,9 @@
*/
import { Command } from '@oclif/core';
import * as ca from '../../utils/common-args';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { applicationIdInfo } from '../../utils/messages';
import * as ca from '../../utils/common-args.js';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
import { applicationIdInfo } from '../../utils/messages.js';
export default class FleetPurgeCmd extends Command {
public static description = stripIndent`
@ -44,7 +44,7 @@ export default class FleetPurgeCmd extends Command {
public async run() {
const { args: params } = await this.parse(FleetPurgeCmd);
const { getApplication } = await import('../../utils/sdk');
const { getApplication } = await import('../../utils/sdk.js');
const balena = getBalenaSdk();

View File

@ -16,9 +16,9 @@
*/
import { Args, Command } from '@oclif/core';
import * as ca from '../../utils/common-args';
import { getBalenaSdk, stripIndent, getCliForm } from '../../utils/lazy';
import { applicationIdInfo } from '../../utils/messages';
import * as ca from '../../utils/common-args.js';
import { getBalenaSdk, stripIndent, getCliForm } from '../../utils/lazy.js';
import { applicationIdInfo } from '../../utils/messages.js';
export default class FleetRenameCmd extends Command {
public static description = stripIndent`
@ -50,13 +50,15 @@ export default class FleetRenameCmd extends Command {
public async run() {
const { args: params } = await this.parse(FleetRenameCmd);
const { validateApplicationName } = await import('../../utils/validation');
const { ExpectedError } = await import('../../errors');
const { validateApplicationName } = await import(
'../../utils/validation.js'
);
const { ExpectedError } = await import('../../errors.js');
const balena = getBalenaSdk();
// Disambiguate target application (if params.params is a number, it could either be an ID or a numerical name)
const { getApplication } = await import('../../utils/sdk');
const { getApplication } = await import('../../utils/sdk.js');
const application = await getApplication(balena, params.fleet, {
$select: ['id', 'app_name', 'slug'],
$expand: {

View File

@ -16,9 +16,9 @@
*/
import { Command } from '@oclif/core';
import * as ca from '../../utils/common-args';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { applicationIdInfo } from '../../utils/messages';
import * as ca from '../../utils/common-args.js';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
import { applicationIdInfo } from '../../utils/messages.js';
export default class FleetRestartCmd extends Command {
public static description = stripIndent`
@ -43,7 +43,7 @@ export default class FleetRestartCmd extends Command {
public async run() {
const { args: params } = await this.parse(FleetRestartCmd);
const { getApplication } = await import('../../utils/sdk');
const { getApplication } = await import('../../utils/sdk.js');
const balena = getBalenaSdk();

View File

@ -15,10 +15,10 @@
* limitations under the License.
*/
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 * as cf from '../../utils/common-flags.js';
import * as ca from '../../utils/common-args.js';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
import { applicationIdInfo } from '../../utils/messages.js';
import { Command } from '@oclif/core';
export default class FleetRmCmd extends Command {
@ -51,8 +51,8 @@ export default class FleetRmCmd extends Command {
public async run() {
const { args: params, flags: options } = await this.parse(FleetRmCmd);
const { confirm } = await import('../../utils/patterns');
const { getApplication } = await import('../../utils/sdk');
const { confirm } = await import('../../utils/patterns.js');
const { getApplication } = await import('../../utils/sdk.js');
const balena = getBalenaSdk();
// Confirm

View File

@ -16,7 +16,7 @@
*/
import { Args, Command } from '@oclif/core';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
export default class FleetTrackLatestCmd extends Command {
public static description = stripIndent`

View File

@ -16,7 +16,7 @@
*/
import { Args, Command } from '@oclif/core';
import { stripIndent } from '../../utils/lazy';
import { stripIndent } from '../../utils/lazy.js';
// 'Internal' commands are called during the execution of other commands.
// `osinit` is called during `os initialize`
@ -56,7 +56,7 @@ export default class OsinitCmd extends Command {
const config = JSON.parse(params.config);
const { getManifest, osProgressHandler } = await import(
'../../utils/helpers'
'../../utils/helpers.js'
);
const manifest = await getManifest(params.image, params.type);

View File

@ -16,10 +16,10 @@
*/
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';
import { parseAsLocalHostnameOrIp } from '../../utils/validation';
import * as cf from '../../utils/common-flags.js';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
import { applicationIdInfo } from '../../utils/messages.js';
import { parseAsLocalHostnameOrIp } from '../../utils/validation.js';
export default class JoinCmd extends Command {
public static description = stripIndent`
@ -73,9 +73,9 @@ export default class JoinCmd extends Command {
public async run() {
const { args: params, flags: options } = await this.parse(JoinCmd);
const promote = await import('../../utils/promote');
const promote = await import('../../utils/promote.js');
const sdk = getBalenaSdk();
const Logger = await import('../../utils/logger');
const { default: Logger } = await import('../../utils/logger.js');
const logger = Logger.getLogger();
return promote.join(
logger,

View File

@ -16,8 +16,8 @@
*/
import { Args, Command } from '@oclif/core';
import { stripIndent } from '../../utils/lazy';
import { parseAsLocalHostnameOrIp } from '../../utils/validation';
import { stripIndent } from '../../utils/lazy.js';
import { parseAsLocalHostnameOrIp } from '../../utils/validation.js';
export default class LeaveCmd extends Command {
public static description = stripIndent`
@ -54,8 +54,8 @@ export default class LeaveCmd extends Command {
public async run() {
const { args: params } = await this.parse(LeaveCmd);
const promote = await import('../../utils/promote');
const Logger = await import('../../utils/logger');
const promote = await import('../../utils/promote.js');
const { default: Logger } = await import('../../utils/logger.js');
const logger = Logger.getLogger();
return promote.leave(logger, params.deviceIpOrHostname);
}

View File

@ -17,7 +17,7 @@
import { Args, Command } from '@oclif/core';
import { promisify } from 'util';
import { stripIndent } from '../../utils/lazy';
import { stripIndent } from '../../utils/lazy.js';
export default class LocalConfigureCmd extends Command {
public static description = stripIndent`
@ -45,8 +45,8 @@ export default class LocalConfigureCmd extends Command {
const { args: params } = await this.parse(LocalConfigureCmd);
const reconfix = await import('reconfix');
const { denyMount, safeUmount } = await import('../../utils/umount');
const Logger = await import('../../utils/logger');
const { denyMount, safeUmount } = await import('../../utils/umount.js');
const { default: Logger } = await import('../../utils/logger.js');
const logger = Logger.getLogger();
@ -186,7 +186,7 @@ export default class LocalConfigureCmd extends Command {
];
getConfiguration = async (data: any) => {
const _ = await import('lodash');
const { default: _ } = await import('lodash');
const inquirer = await import('inquirer');
// `persistentLogging` can be `undefined`, so we want
@ -230,7 +230,7 @@ export default class LocalConfigureCmd extends Command {
* otherwise, the new file is created
*/
async prepareConnectionFile(target: string) {
const _ = await import('lodash');
const { default: _ } = await import('lodash');
const imagefs = await import('balena-image-fs');
const { getBootPartition } = await import('balena-config-json');
@ -276,7 +276,7 @@ export default class LocalConfigureCmd extends Command {
}
async removeHostname(schema: any) {
const _ = await import('lodash');
const { default: _ } = await import('lodash');
schema.mapper = _.reject(schema.mapper, (mapper: any) =>
_.isEqual(Object.keys(mapper.template), ['hostname']),
);

View File

@ -17,9 +17,9 @@
import { Args, Command } from '@oclif/core';
import type { BlockDevice } from 'etcher-sdk/build/source-destination';
import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags';
import { getChalk, getVisuals, stripIndent } from '../../utils/lazy';
import { ExpectedError } from '../../errors.js';
import * as cf from '../../utils/common-flags.js';
import { getChalk, getVisuals, stripIndent } from '../../utils/lazy.js';
export default class LocalFlashCmd extends Command {
public static description = stripIndent`
@ -75,7 +75,7 @@ export default class LocalFlashCmd extends Command {
const drive = await this.getDrive(options);
const { confirm } = await import('../../utils/patterns');
const { confirm } = await import('../../utils/patterns.js');
await confirm(
options.yes,
'This will erase the selected drive. Are you sure?',

View File

@ -16,8 +16,8 @@
*/
import { Flags, Args, Command } from '@oclif/core';
import { getBalenaSdk, stripIndent, getCliForm } from '../../utils/lazy';
import { ExpectedError } from '../../errors';
import { getBalenaSdk, stripIndent, getCliForm } from '../../utils/lazy.js';
import { ExpectedError } from '../../errors.js';
import type { WhoamiResult } from 'balena-sdk';
interface FlagsDef {
@ -117,7 +117,7 @@ export default class LoginCmd extends Command {
const { flags: options, args: params } = await this.parse(LoginCmd);
const balena = getBalenaSdk();
const messages = await import('../../utils/messages');
const messages = await import('../../utils/messages.js');
const balenaUrl = await balena.settings.get('balenaUrl');
// Consolidate user/email options
@ -196,20 +196,20 @@ ${messages.reachingOut}`);
}
// Credentials
else if (loginOptions.credentials) {
const patterns = await import('../../utils/patterns');
const patterns = await import('../../utils/patterns.js');
return patterns.authenticate(loginOptions);
}
// Web
else if (loginOptions.web) {
const auth = await import('../../auth');
const auth = await import('../../auth/index.js');
await auth.login({ port: loginOptions.port });
return;
} else {
const patterns = await import('../../utils/patterns');
const patterns = await import('../../utils/patterns.js');
// User had not selected login preference, prompt interactively
const loginType = await patterns.askLoginType();
if (loginType === 'register') {
const open = await import('open');
const { default: open } = await import('open');
const signupUrl = `https://dashboard.${balenaUrl}/signup`;
await open(signupUrl, { wait: false });
throw new ExpectedError(`Please sign up at ${signupUrl}`);

View File

@ -16,7 +16,7 @@
*/
import { Command } from '@oclif/core';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
export default class LogoutCmd extends Command {
public static description = stripIndent`

View File

@ -16,7 +16,7 @@
*/
import { Command } from '@oclif/core';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy.js';
export default class OrganizationListCmd extends Command {
public static aliases = ['orgs'];
@ -34,7 +34,7 @@ export default class OrganizationListCmd extends Command {
public async run() {
await this.parse(OrganizationListCmd);
const { getOwnOrganizations } = await import('../../utils/sdk');
const { getOwnOrganizations } = await import('../../utils/sdk.js');
// Get organizations
const organizations = await getOwnOrganizations(getBalenaSdk(), {

View File

@ -16,8 +16,8 @@
*/
import { Flags, Args, Command } from '@oclif/core';
import { getCliForm, stripIndent } from '../../utils/lazy';
import * as _ from 'lodash';
import { getCliForm, stripIndent } from '../../utils/lazy.js';
import _ from 'lodash';
import type { DeviceTypeJson } from 'balena-sdk';
export default class OsBuildConfigCmd extends Command {
@ -77,7 +77,7 @@ export default class OsBuildConfigCmd extends Command {
async buildConfig(image: string, deviceTypeSlug: string, advanced: boolean) {
advanced = advanced || false;
const { getManifest } = await import('../../utils/helpers');
const { getManifest } = await import('../../utils/helpers.js');
const deviceTypeManifest = await getManifest(image, deviceTypeSlug);
return this.buildConfigForDeviceType(deviceTypeManifest, advanced);
@ -98,7 +98,7 @@ export default class OsBuildConfigCmd extends Command {
});
if (advancedGroup != null) {
const { getGroupDefaults } = await import('../../utils/helpers');
const { getGroupDefaults } = await import('../../utils/helpers.js');
override = getGroupDefaults(advancedGroup);
}
}

View File

@ -19,15 +19,15 @@ 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 { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent, getCliForm } from '../../utils/lazy';
import _ from 'lodash';
import { ExpectedError } from '../../errors.js';
import * as cf from '../../utils/common-flags.js';
import { getBalenaSdk, stripIndent, getCliForm } from '../../utils/lazy.js';
import {
applicationIdInfo,
devModeInfo,
secureBootInfo,
} from '../../utils/messages';
} from '../../utils/messages.js';
const CONNECTIONS_FOLDER = '/system-connections';
@ -97,7 +97,7 @@ export default class OsConfigureCmd extends Command {
description:
'ask advanced configuration questions (when in interactive mode)',
}),
fleet: { ...cf.fleet, exclusive: ['device'] },
fleet: cf.fleetExclusive(['device']),
config: Flags.string({
description:
'path to a pre-generated config.json file to be injected in the OS image',
@ -119,14 +119,11 @@ export default class OsConfigureCmd extends Command {
}),
dev: cf.dev,
secureBoot: cf.secureBoot,
device: {
...cf.device,
exclusive: [
'fleet',
'provisioning-key-name',
'provisioning-key-expiry-date',
],
},
device: cf.deviceExclusive([
'fleet',
'provisioning-key-name',
'provisioning-key-expiry-date',
]),
'device-type': Flags.string({
description:
'device type slug (e.g. "raspberrypi3") to override the fleet device type',
@ -166,10 +163,10 @@ export default class OsConfigureCmd extends Command {
const devInit = await import('balena-device-init');
const { promises: fs } = await import('fs');
const { generateDeviceConfig, generateApplicationConfig } = await import(
'../../utils/config'
'../../utils/config.js'
);
const helpers = await import('../../utils/helpers');
const { getApplication } = await import('../../utils/sdk');
const helpers = await import('../../utils/helpers.js');
const { getApplication } = await import('../../utils/sdk.js');
let app: ApplicationWithDeviceTypeSlug | undefined;
let device;
@ -201,13 +198,13 @@ export default class OsConfigureCmd extends Command {
deviceTypeSlug,
);
let configJson: import('../../utils/config').ImgConfig | undefined;
let configJson: import('../../utils/config.js').ImgConfig | undefined;
if (options.config) {
const rawConfig = await fs.readFile(options.config, 'utf8');
configJson = JSON.parse(rawConfig);
}
const { normalizeOsVersion } = await import('../../utils/normalization');
const { normalizeOsVersion } = await import('../../utils/normalization.js');
const osVersion = normalizeOsVersion(
options.version ||
(await getOsVersionFromImage(
@ -217,11 +214,11 @@ export default class OsConfigureCmd extends Command {
)),
);
const { validateDevOptionAndWarn } = await import('../../utils/config');
const { validateDevOptionAndWarn } = await import('../../utils/config.js');
await validateDevOptionAndWarn(options.dev, osVersion);
const { validateSecureBootOptionAndWarn } = await import(
'../../utils/config'
'../../utils/config.js'
);
await validateSecureBootOptionAndWarn(
options.secureBoot,
@ -317,7 +314,7 @@ async function validateOptions(options: FlagsDef) {
);
}
const { checkLoggedIn } = await import('../../utils/patterns');
const { checkLoggedIn } = await import('../../utils/patterns.js');
await checkLoggedIn();
}
@ -361,7 +358,7 @@ async function checkDeviceTypeCompatibility(
},
) {
if (options['device-type']) {
const helpers = await import('../../utils/helpers');
const helpers = await import('../../utils/helpers.js');
if (
!(await helpers.areDeviceTypesCompatible(
app.is_for__device_type[0].slug,
@ -392,7 +389,7 @@ async function checkDeviceTypeCompatibility(
async function askQuestionsForDeviceType(
deviceType: BalenaSdk.DeviceTypeJson.DeviceType,
options: FlagsDef,
configJson?: import('../../utils/config').ImgConfig,
configJson?: import('../../utils/config.js').ImgConfig,
): Promise<Answers> {
const answerSources: any[] = [
{
@ -415,7 +412,7 @@ async function askQuestionsForDeviceType(
isGroup: true,
});
if (!_.isEmpty(advancedGroup)) {
const helpers = await import('../../utils/helpers');
const helpers = await import('../../utils/helpers.js');
answerSources.push(helpers.getGroupDefaults(advancedGroup));
}
}

View File

@ -16,7 +16,7 @@
*/
import { Flags, Args, Command } from '@oclif/core';
import { stripIndent } from '../../utils/lazy';
import { stripIndent } from '../../utils/lazy.js';
export default class OsDownloadCmd extends Command {
public static description = stripIndent`
@ -84,14 +84,14 @@ export default class OsDownloadCmd extends Command {
// balenaOS ESR versions require user authentication
if (options.version) {
const { isESR } = await import('../../utils/image-manager');
const { isESR } = await import('../../utils/image-manager.js');
if (options.version === 'menu-esr' || isESR(options.version)) {
try {
const { checkLoggedIn } = await import('../../utils/patterns');
const { checkLoggedIn } = await import('../../utils/patterns.js');
await checkLoggedIn();
} catch (e) {
const { ExpectedError, NotLoggedInError } = await import(
'../../errors'
'../../errors.js'
);
if (e instanceof NotLoggedInError) {
throw new ExpectedError(stripIndent`
@ -103,7 +103,7 @@ export default class OsDownloadCmd extends Command {
}
}
const { downloadOSImage } = await import('../../utils/cloud');
const { downloadOSImage } = await import('../../utils/cloud.js');
try {
await downloadOSImage(params.type, options.output, options.version);

View File

@ -16,8 +16,8 @@
*/
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getCliForm, stripIndent } from '../../utils/lazy';
import * as cf from '../../utils/common-flags.js';
import { getCliForm, stripIndent } from '../../utils/lazy.js';
const INIT_WARNING_MESSAGE = `
@ -58,7 +58,7 @@ export default class OsInitializeCmd extends Command {
public async run() {
const { args: params, flags: options } = await this.parse(OsInitializeCmd);
const { getManifest, sudo } = await import('../../utils/helpers');
const { getManifest, sudo } = await import('../../utils/helpers.js');
console.info(`Initializing device ${INIT_WARNING_MESSAGE}`);
@ -71,13 +71,13 @@ export default class OsInitializeCmd extends Command {
});
if (answers.drive != null) {
const { confirm } = await import('../../utils/patterns');
const { confirm } = await import('../../utils/patterns.js');
await confirm(
options.yes,
`This will erase ${answers.drive}. Are you sure?`,
`Going to erase ${answers.drive}.`,
);
const { safeUmount } = await import('../../utils/umount');
const { safeUmount } = await import('../../utils/umount.js');
await safeUmount(answers.drive);
}
@ -90,7 +90,7 @@ export default class OsInitializeCmd extends Command {
]);
if (answers.drive != null) {
const { safeUmount } = await import('../../utils/umount');
const { safeUmount } = await import('../../utils/umount.js');
await safeUmount(answers.drive);
console.info(`You can safely remove ${answers.drive} now`);
}

View File

@ -16,7 +16,7 @@
*/
import { Flags, Args, Command } from '@oclif/core';
import { stripIndent } from '../../utils/lazy';
import { stripIndent } from '../../utils/lazy.js';
export default class OsVersionsCmd extends Command {
public static description = stripIndent`
@ -53,7 +53,7 @@ export default class OsVersionsCmd extends Command {
const { args: params, flags: options } = await this.parse(OsVersionsCmd);
if (options['include-draft']) {
const { warnify } = await import('../../utils/messages');
const { warnify } = await import('../../utils/messages.js');
console.error(
warnify(stripIndent`
Using pre-release balenaOS versions is only supported for OS updates
@ -63,7 +63,7 @@ export default class OsVersionsCmd extends Command {
}
const { formatOsVersion, getOsVersions } = await import(
'../../utils/cloud'
'../../utils/cloud.js'
);
const vs = await getOsVersions(
params.type,

View File

@ -15,19 +15,19 @@
* limitations under the License.
*/
import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags';
import { ExpectedError } from '../../errors.js';
import * as cf from '../../utils/common-flags.js';
import {
getBalenaSdk,
getCliForm,
getVisuals,
stripIndent,
} from '../../utils/lazy';
import { applicationIdInfo } from '../../utils/messages';
import { dockerConnectionCliFlags } from '../../utils/docker';
import { parseAsInteger } from '../../utils/validation';
} from '../../utils/lazy.js';
import { applicationIdInfo } from '../../utils/messages.js';
import { dockerConnectionCliFlags } from '../../utils/docker.js';
import { parseAsInteger } from '../../utils/validation.js';
import { Flags, Args, Command } from '@oclif/core';
import * as _ from 'lodash';
import _ from 'lodash';
import type {
Application,
BalenaSDK,
@ -37,6 +37,7 @@ import type {
Release,
} from 'balena-sdk';
import type { Preloader } from 'balena-preload';
import type { EventEmitter } from 'node:events';
export default class PreloadCmd extends Command {
public static description = stripIndent`
@ -138,10 +139,10 @@ Can be repeated to add multiple certificates.\
const { args: params, flags: options } = await this.parse(PreloadCmd);
const balena = getBalenaSdk();
const balenaPreload = await import('balena-preload');
const { default: balenaPreload } = await import('balena-preload');
const visuals = getVisuals();
const nodeCleanup = await import('node-cleanup');
const { instanceOf } = await import('../../errors');
const { default: nodeCleanup } = await import('node-cleanup');
const { instanceOf } = await import('../../errors.js');
// Check image file exists
try {
@ -165,7 +166,7 @@ Can be repeated to add multiple certificates.\
// Load app here, and use app slug from hereon
const fleetSlug: string | undefined = options.fleet
? await (
await import('../../utils/sdk')
await import('../../utils/sdk.js')
).getFleetSlug(balena, options.fleet)
: undefined;
@ -222,7 +223,7 @@ Can be repeated to add multiple certificates.\
}
// Get a configured dockerode instance
const dockerUtils = await import('../../utils/docker');
const dockerUtils = await import('../../utils/docker.js');
const docker = await dockerUtils.getDocker(options);
const preloader = new balenaPreload.Preloader(
undefined,
@ -236,7 +237,7 @@ Can be repeated to add multiple certificates.\
pinDevice ?? false,
certificates,
additionalSpace,
);
) as Preloader & EventEmitter;
let gotSignal = false;
@ -476,7 +477,7 @@ Would you like to disable automatic updates for this fleet now?\
}
async getAppWithReleases(balenaSdk: BalenaSDK, slug: string) {
const { getApplication } = await import('../../utils/sdk');
const { getApplication } = await import('../../utils/sdk.js');
return await getApplication(balenaSdk, slug, {
$expand: this.applicationExpandOptions,

View File

@ -17,16 +17,16 @@
import { Flags, Args, Command } from '@oclif/core';
import type { Interfaces } from '@oclif/core';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { dockerignoreHelp, registrySecretsHelp } from '../../utils/messages';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
import { dockerignoreHelp, registrySecretsHelp } from '../../utils/messages.js';
import type { BalenaSDK } from 'balena-sdk';
import { ExpectedError, instanceOf } from '../../errors';
import { ExpectedError, instanceOf } from '../../errors.js';
import type { RegistrySecrets } from '@balena/compose/dist/multibuild';
import { lowercaseIfSlug } from '../../utils/normalization';
import { lowercaseIfSlug } from '../../utils/normalization.js';
import {
applyReleaseTagKeysAndValues,
parseReleaseTagKeysAndValues,
} from '../../utils/compose_ts';
} from '../../utils/compose_ts.js';
enum BuildTarget {
Cloud,
@ -224,13 +224,15 @@ export default class PushCmd extends Command {
public async run() {
const { args: params, flags: options } = await this.parse(PushCmd);
const Logger = await import('../../utils/logger');
const { default: Logger } = await import('../../utils/logger.js');
const logger = Logger.getLogger();
logger.logDebug(`Using build source directory: ${options.source} `);
const sdk = getBalenaSdk();
const { validateProjectDirectory } = await import('../../utils/compose_ts');
const { validateProjectDirectory } = await import(
'../../utils/compose_ts.js'
);
const { dockerfilePath, registrySecrets } = await validateProjectDirectory(
sdk,
{
@ -273,8 +275,8 @@ export default class PushCmd extends Command {
dockerfilePath: string,
registrySecrets: RegistrySecrets,
) {
const remote = await import('../../utils/remote-build');
const { getApplication } = await import('../../utils/sdk');
const remote = await import('../../utils/remote-build.js');
const { getApplication } = await import('../../utils/sdk.js');
// Check for invalid options
const localOnlyOptions: Array<keyof FlagsDef> = [
@ -293,7 +295,7 @@ export default class PushCmd extends Command {
options['release-tag'] ?? [],
);
const { checkLoggedIn } = await import('../../utils/patterns');
const { checkLoggedIn } = await import('../../utils/patterns.js');
await checkLoggedIn();
const [token, baseUrl] = await Promise.all([
@ -355,7 +357,7 @@ export default class PushCmd extends Command {
'is only valid when pushing to a fleet',
);
const deviceDeploy = await import('../../utils/device/deploy');
const deviceDeploy = await import('../../utils/device/deploy.js');
try {
await deviceDeploy.deployToDevice({
@ -375,7 +377,7 @@ export default class PushCmd extends Command {
convertEol: !options['noconvert-eol'],
});
} catch (e) {
const { BuildError } = await import('../../utils/device/errors');
const { BuildError } = await import('../../utils/device/errors.js');
if (instanceOf(e, BuildError)) {
throw new ExpectedError(e.toString());
} else {
@ -386,7 +388,7 @@ export default class PushCmd extends Command {
protected async getBuildTarget(appOrDevice: string): Promise<BuildTarget> {
const { validateLocalHostnameOrIp } = await import(
'../../utils/validation'
'../../utils/validation.js'
);
return validateLocalHostnameOrIp(appOrDevice)

View File

@ -16,8 +16,8 @@
*/
import { Command } from '@oclif/core';
import { commitOrIdArg } from '.';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { commitOrIdArg } from './index.js';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
export default class ReleaseFinalizeCmd extends Command {
public static description = stripIndent`

View File

@ -16,12 +16,12 @@
*/
import { Flags, Args, type Interfaces, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
import * as cf from '../../utils/common-flags.js';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy.js';
import type * as BalenaSdk from 'balena-sdk';
import * as yaml from 'js-yaml';
import { tryAsInteger } from '../../utils/validation';
import { jsonInfo } from '../../utils/messages';
import { tryAsInteger } from '../../utils/validation.js';
import { jsonInfo } from '../../utils/messages.js';
export const commitOrIdArg = Args.custom({
parse: tryAsInteger,
@ -114,7 +114,7 @@ export default class ReleaseCmd extends Command {
.release_tag!.map((t) => `${t.tag_key}=${t.value}`)
.join('\n');
const _ = await import('lodash');
const { default: _ } = await import('lodash');
const values = _.mapValues(
release,
(val) => val ?? 'N/a',

View File

@ -16,8 +16,8 @@
*/
import { Command } from '@oclif/core';
import { commitOrIdArg } from '.';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { commitOrIdArg } from './index.js';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
export default class ReleaseInvalidateCmd extends Command {
public static description = stripIndent`

View File

@ -16,11 +16,11 @@
*/
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 * as cf from '../../utils/common-flags.js';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy.js';
import { applicationNameNote } from '../../utils/messages.js';
import type * as BalenaSdk from 'balena-sdk';
import { jsonInfo } from '../../utils/messages';
import { jsonInfo } from '../../utils/messages.js';
export default class ReleaseListCmd extends Command {
public static aliases = ['releases'];
@ -66,7 +66,7 @@ export default class ReleaseListCmd extends Command {
] satisfies BalenaSdk.PineOptions<BalenaSdk.Release>['$select'];
const balena = getBalenaSdk();
const { getFleetSlug } = await import('../../utils/sdk');
const { getFleetSlug } = await import('../../utils/sdk.js');
const releases = await balena.models.release.getAllByApplication(
await getFleetSlug(balena, params.fleet),
@ -84,7 +84,7 @@ export default class ReleaseListCmd extends Command {
if (options.json) {
console.log(JSON.stringify(releases, null, 4));
} else {
const _ = await import('lodash');
const { default: _ } = await import('lodash');
console.log(
getVisuals().table.horizontal(
releases.map((rel) => _.mapValues(rel, (val) => val ?? 'N/a')),

View File

@ -16,8 +16,8 @@
*/
import { Command } from '@oclif/core';
import { commitOrIdArg } from '.';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { commitOrIdArg } from './index.js';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
export default class ReleaseValidateCmd extends Command {
public static description = stripIndent`

View File

@ -16,7 +16,7 @@
*/
import { Command } from '@oclif/core';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
export default class SettingsCmd extends Command {
public static description = stripIndent`

View File

@ -16,7 +16,7 @@
*/
import { Args, Command } from '@oclif/core';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
export default class SSHKeyAddCmd extends Command {
public static aliases = ['key add'];

View File

@ -16,8 +16,8 @@
*/
import { Args, Command } from '@oclif/core';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
import { parseAsInteger } from '../../utils/validation';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy.js';
import { parseAsInteger } from '../../utils/validation.js';
export default class SSHKeyCmd extends Command {
public static aliases = ['key'];

View File

@ -16,7 +16,7 @@
*/
import { Command } from '@oclif/core';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy.js';
export default class SSHKeyListCmd extends Command {
public static aliases = ['keys', 'key list'];

View File

@ -16,9 +16,9 @@
*/
import { Args, Command } from '@oclif/core';
import * as cf from '../../utils/common-flags';
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { parseAsInteger } from '../../utils/validation';
import * as cf from '../../utils/common-flags.js';
import { getBalenaSdk, stripIndent } from '../../utils/lazy.js';
import { parseAsInteger } from '../../utils/validation.js';
export default class SSHKeyRmCmd extends Command {
public static aliases = ['key rm'];
@ -54,7 +54,7 @@ export default class SSHKeyRmCmd extends Command {
public async run() {
const { args: params, flags: options } = await this.parse(SSHKeyRmCmd);
const patterns = await import('../../utils/patterns');
const patterns = await import('../../utils/patterns.js');
await patterns.confirm(
options.yes ?? false,

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