diff --git a/lib/actions-oclif/local/configure.ts b/lib/actions-oclif/local/configure.ts index c949a68e..7506a796 100644 --- a/lib/actions-oclif/local/configure.ts +++ b/lib/actions-oclif/local/configure.ts @@ -119,9 +119,7 @@ export default class LocalConfigureCmd extends Command { readonly CONNECTIONS_FOLDER = '/system-connections'; getConfigurationSchema(connectionFileName?: string) { - if (connectionFileName == null) { - connectionFileName = 'resin-wifi'; - } + connectionFileName ??= 'resin-wifi'; return { mapper: [ { diff --git a/lib/actions-oclif/logs.ts b/lib/actions-oclif/logs.ts index ad187ec7..a317fd9c 100644 --- a/lib/actions-oclif/logs.ts +++ b/lib/actions-oclif/logs.ts @@ -115,10 +115,8 @@ export default class LogsCmd extends Command { const displayCloudLog = async (line: LogMessage) => { if (!line.isSystem) { - let serviceName = await serviceIdToName(balena, line.serviceId); - if (serviceName == null) { - serviceName = 'Unknown service'; - } + const serviceName = + (await serviceIdToName(balena, line.serviceId)) ?? 'Unknown service'; displayLogObject( { serviceName, ...line }, logger, diff --git a/lib/actions-oclif/os/build-config.ts b/lib/actions-oclif/os/build-config.ts index 2aa9129b..c00eaff2 100644 --- a/lib/actions-oclif/os/build-config.ts +++ b/lib/actions-oclif/os/build-config.ts @@ -107,9 +107,7 @@ export default class OsBuildConfigCmd extends Command { deviceTypeManifest: DeviceTypeJson.DeviceType, advanced: boolean, ) { - if (advanced == null) { - advanced = false; - } + advanced ??= false; let override; const questions = deviceTypeManifest.options; diff --git a/lib/actions-oclif/preload.ts b/lib/actions-oclif/preload.ts index 03d7c12a..260bf196 100644 --- a/lib/actions-oclif/preload.ts +++ b/lib/actions-oclif/preload.ts @@ -40,17 +40,11 @@ import type { ResourceExpand } from 'pinejs-client-core'; interface FlagsDef extends DockerConnectionCliFlags { app?: string; - appId?: string; // Internal use. commit?: string; 'splash-image'?: string; - splashImage?: string; // Internal use. 'dont-check-arch': boolean; - dontCheckArch?: boolean; // Internal use. 'pin-device-to-release': boolean; - pinDevice?: boolean; // Internal use. 'add-certificate'?: string; - image?: string; // Internal use. - proxy?: string; // Internal use. help: void; } @@ -169,12 +163,9 @@ Can be repeated to add multiple certificates.\ name: string; percentage: number; }) { - let progressBar = progressBars[event.name]; - if (!progressBar) { - progressBar = progressBars[event.name] = new visuals.Progress( - event.name, - ); - } + const progressBar = (progressBars[event.name] ??= new visuals.Progress( + event.name, + )); return progressBar.update({ percentage: event.percentage }); }; @@ -183,10 +174,9 @@ Can be repeated to add multiple certificates.\ } = {}; const spinnerHandler = function (event: { name: string; action: string }) { - let spinner = spinners[event.name]; - if (!spinner) { - spinner = spinners[event.name] = new visuals.Spinner(event.name); - } + const spinner = (spinners[event.name] ??= new visuals.Spinner( + event.name, + )); if (event.action === 'start') { return spinner.start(); } else { @@ -195,27 +185,23 @@ Can be repeated to add multiple certificates.\ } }; - options.commit = this.isCurrentCommit(options.commit || '') + const commit = this.isCurrentCommit(options.commit || '') ? 'latest' : options.commit; - options.image = params.image; - options.appId = options.app; - delete options.app; + const image = params.image; + const appId = options.app; - options.splashImage = options['splash-image']; - delete options['splash-image']; + const splashImage = options['splash-image']; - options.dontCheckArch = options['dont-check-arch'] || false; - delete options['dont-check-arch']; - if (options.dontCheckArch && !options.appId) { + const dontCheckArch = options['dont-check-arch'] || false; + const pinDevice = options['pin-device-to-release'] || false; + + if (dontCheckArch && !appId) { throw new ExpectedError( 'You need to specify an app id if you disable the architecture check.', ); } - options.pinDevice = options['pin-device-to-release'] || false; - delete options['pin-device-to-release']; - let certificates: string[]; if (Array.isArray(options['add-certificate'])) { certificates = options['add-certificate']; @@ -236,13 +222,13 @@ Can be repeated to add multiple certificates.\ const preloader = new balenaPreload.Preloader( null, docker, - options.appId, - options.commit, - options.image, - options.splashImage, - options.proxy, // TODO: Currently always undefined, investigate approach in ssh command. - options.dontCheckArch, - options.pinDevice, + appId, + commit, + image, + splashImage, + undefined, // TODO: Currently always undefined, investigate approach in ssh command. + dontCheckArch, + pinDevice, certificates, ); @@ -270,7 +256,13 @@ Can be repeated to add multiple certificates.\ try { await new Promise((resolve, reject) => { preloader.on('error', reject); - resolve(this.prepareAndPreload(preloader, balena, options)); + resolve( + this.prepareAndPreload(preloader, balena, { + appId, + commit, + pinDevice, + }), + ); }); } catch (err) { if (instanceOf(err, balena.errors.BalenaError)) { @@ -494,7 +486,11 @@ Would you like to disable automatic updates for this application now?\ async prepareAndPreload( preloader: Preloader, balenaSdk: BalenaSDK, - options: FlagsDef, + options: { + appId?: string; + commit?: string; + pinDevice: boolean; + }, ) { await preloader.prepare(); @@ -543,7 +539,7 @@ Would you like to disable automatic updates for this application now?\ await this.offerToDisableAutomaticUpdates( application, commit, - options.pinDevice!, + options.pinDevice, ); // All options are ready: preload the image. diff --git a/lib/actions-oclif/tag/set.ts b/lib/actions-oclif/tag/set.ts index 1492aa62..9ba8e70f 100644 --- a/lib/actions-oclif/tag/set.ts +++ b/lib/actions-oclif/tag/set.ts @@ -110,9 +110,7 @@ export default class TagSetCmd extends Command { throw new ExpectedError(TagSetCmd.missingResourceMessage); } - if (params.value == null) { - params.value = ''; - } + params.value ??= ''; if (options.application) { return balena.models.application.tags.set( diff --git a/lib/utils/compose.js b/lib/utils/compose.js index a1df8e19..027956d1 100644 --- a/lib/utils/compose.js +++ b/lib/utils/compose.js @@ -144,9 +144,8 @@ export function createProject(composePath, composeStr, projectName = null) { }); const composition = compose.normalize(rawComposition); - if (projectName == null) { - projectName = path.basename(composePath); - } + projectName ??= path.basename(composePath); + const descriptors = compose.parse(composition).map(function (descr) { // generate an image name based on the project and service names // if one is not given and the service requires a build @@ -380,25 +379,21 @@ export function buildProject( // multibuild parses the composition internally so any tags we've // set before are lost; re-assign them here - if (task.tag == null) { - task.tag = [projectName, task.serviceName].join('_').toLowerCase(); - } + task.tag ??= [projectName, task.serviceName].join('_').toLowerCase(); + if (typeof d.image !== 'string' && d.image.context != null) { d.image.tag = task.tag; } // configure build opts appropriately - if (task.dockerOpts == null) { - task.dockerOpts = {}; - } + task.dockerOpts ??= {}; + _.merge(task.dockerOpts, buildOpts, { t: task.tag }); if (typeof d.image !== 'string') { /** @type {any} */ const context = d.image.context; if (context?.args != null) { - if (task.dockerOpts.buildargs == null) { - task.dockerOpts.buildargs = {}; - } + task.dockerOpts.buildargs ??= {}; _.merge(task.dockerOpts.buildargs, context.args); } } @@ -858,9 +853,7 @@ var buildProgressAdapter = function (inline) { const match = stepRegex.exec(str); if (match) { step = match[1]; - if (numSteps == null) { - numSteps = match[2]; - } + numSteps ??= match[2]; str = match[3]; } if (step != null) { @@ -1020,9 +1013,8 @@ class BuildProgressUI { } _renderStatus(end) { - if (end == null) { - end = false; - } + end ??= false; + const moment = require('moment'); require('moment-duration-format')(moment); diff --git a/lib/utils/helpers.ts b/lib/utils/helpers.ts index d0dce33c..43dfee70 100644 --- a/lib/utils/helpers.ts +++ b/lib/utils/helpers.ts @@ -90,9 +90,7 @@ export async function sudo( 'Admin privileges required: you may be asked for your computer password to continue.', ); } - if (isCLIcmd == null) { - isCLIcmd = true; - } + isCLIcmd ??= true; await executeWithPrivileges(command, stderr, isCLIcmd); } diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 2d8602c8..2f15ac33 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -13,9 +13,9 @@ } }, "@babel/generator": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.11.0.tgz", - "integrity": "sha512-fEm3Uzw7Mc9Xi//qU20cBKatTfs2aOtKqmvy/Vm7RkJEGFQ4xc9myCfbXxqK//ZS8MR/ciOHw6meGASJuKmDfQ==", + "version": "7.11.4", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.11.4.tgz", + "integrity": "sha512-Rn26vueFx0eOoz7iifCN2UHT6rGtnkSGWSoDRIy8jZN3B91PzeSULbswfLoOWuTuAcNwpG/mxy+uCTDnZ9Mp1g==", "dev": true, "requires": { "@babel/types": "^7.11.0", @@ -222,28 +222,28 @@ "integrity": "sha512-o3/sRDyrXC75BUUziMAs+W5C02aVST0YqY5Ny31Ot3a+7CzK2XDRinMGywvK93tm2QVdL83HGkN483S62Xo9Dw==" }, "@balena/lint": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@balena/lint/-/lint-5.1.0.tgz", - "integrity": "sha512-ktyLx8bi2PwhED7KYKyi93RhpS9mI5X2KHA076hcpr/fD8W+XQF5DBga8Y40oNrt+qG8ZjVyMMXA3vvuVAslRA==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@balena/lint/-/lint-5.2.0.tgz", + "integrity": "sha512-RJf1SG0FkY/d7o00UIdjfpYP/xQa148M8y9GN9quZryL50Gv3qtrp/ELDcoDylZjXVNhZ2OiQBl/urLpC21PKA==", "dev": true, "requires": { - "@types/glob": "^7.1.1", - "@types/lodash": "^4.14.150", - "@types/node": "^10.17.21", + "@types/glob": "^7.1.3", + "@types/lodash": "^4.14.159", + "@types/node": "^10.17.28", "@types/optimist": "0.0.29", - "@types/prettier": "^2.0.0", + "@types/prettier": "^2.0.2", "coffee-script": "^1.10.0", "coffeelint": "^1.15.0", "coffeescope2": "^0.4.5", - "depcheck": "^0.9.2", + "depcheck": "^1.2.0", "glob": "^7.1.6", - "lodash": "^4.17.15", + "lodash": "^4.17.20", "optimist": "^0.6.1", - "prettier": "^2.0.5", - "tslint": "^6.1.2", + "prettier": "^2.1.0", + "tslint": "^6.1.3", "tslint-config-prettier": "^1.18.0", "tslint-no-unused-expression-chai": "^0.1.4", - "typescript": "^3.9.2" + "typescript": "^4.0.2" } }, "@balena/node-web-streams": { @@ -3361,28 +3361,27 @@ "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz", "integrity": "sha1-JtII6onje1y95gJQoV8DHBak1ms=" }, - "caller-callsite": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/caller-callsite/-/caller-callsite-2.0.0.tgz", - "integrity": "sha1-hH4PzgoiN1CpoCfFSzNzGtMVQTQ=", - "dev": true, - "requires": { - "callsites": "^2.0.0" - } - }, "caller-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-2.0.0.tgz", - "integrity": "sha1-Ro+DBE42mrIBD6xfBs7uFbsssfQ=", + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz", + "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=", "dev": true, "requires": { - "caller-callsite": "^2.0.0" + "callsites": "^0.2.0" + }, + "dependencies": { + "callsites": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz", + "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=", + "dev": true + } } }, "callsites": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", - "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", "dev": true }, "camelcase": { @@ -4262,15 +4261,30 @@ "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, "cosmiconfig": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-5.2.1.tgz", - "integrity": "sha512-H65gsXo1SKjf8zmrJ67eJk8aIRKV5ff2D4uKZIBZShbhGSpEmsQOPW/SKMKYhSTrqR7ufy6RP69rPogdaPh/kA==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-6.0.0.tgz", + "integrity": "sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==", "dev": true, "requires": { - "import-fresh": "^2.0.0", - "is-directory": "^0.3.1", - "js-yaml": "^3.13.1", - "parse-json": "^4.0.0" + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.1.0", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.7.2" + }, + "dependencies": { + "parse-json": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.1.0.tgz", + "integrity": "sha512-+mi/lmVVNKFNVyLXV31ERiy2CY5E1/F6QtJFEzoChPRwwngMNXRDQ9GJ5WdE2Z2P4AujsOi0/+2qHID68KwfIQ==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + } + } } }, "cp-file": { @@ -4691,28 +4705,39 @@ } }, "depcheck": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/depcheck/-/depcheck-0.9.2.tgz", - "integrity": "sha512-w5f+lSZqLJJkk58s44eOd0Vor7hLZot4PlFL0y2JsIX5LuHQ2eAjHlDVeGBD4Mj6ZQSKakvKWRRCcPlvrdU2Sg==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/depcheck/-/depcheck-1.2.0.tgz", + "integrity": "sha512-857OvTMgWm35B+B0feJXbkaQo+sm/xMp2Jw4+dGXVsIdEmy9xyDV+q1T1bMp38bN5FbYTgdeqEn5AS7qxC0ubQ==", "dev": true, "requires": { - "@babel/parser": "^7.7.7", - "@babel/traverse": "^7.7.4", - "builtin-modules": "^3.0.0", - "camelcase": "^5.3.1", - "cosmiconfig": "^5.2.1", + "@babel/parser": "^7.10.4", + "@babel/traverse": "^7.10.4", + "builtin-modules": "^3.1.0", + "camelcase": "^6.0.0", + "cosmiconfig": "^6.0.0", "debug": "^4.1.1", "deps-regex": "^0.1.4", - "js-yaml": "^3.4.2", - "lodash": "^4.17.15", - "minimatch": "^3.0.2", - "node-sass-tilde-importer": "^1.0.2", + "ignore": "^5.1.8", + "js-yaml": "^3.14.0", + "json5": "^2.1.3", + "lodash": "^4.17.19", + "minimatch": "^3.0.4", + "multimatch": "^4.0.0", "please-upgrade-node": "^3.2.0", + "readdirp": "^3.4.0", "require-package-name": "^2.0.1", - "resolve": "^1.14.1", + "resolve": "^1.17.0", + "sass": "^1.26.10", "vue-template-compiler": "^2.6.11", - "walkdir": "^0.4.1", - "yargs": "^15.0.2" + "yargs": "^15.4.0" + }, + "dependencies": { + "camelcase": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.0.0.tgz", + "integrity": "sha512-8KMDF1Vz2gzOq54ONPJS65IvTUaB1cHJ2DMM7MbPmLZljDH1qpzzLsWdiN9pHh6qvkRVDTi/07+eNGch/oLU4w==", + "dev": true + } } }, "depd": { @@ -6562,12 +6587,6 @@ } } }, - "find-parent-dir": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/find-parent-dir/-/find-parent-dir-0.3.0.tgz", - "integrity": "sha1-M8RLQpqysvBkYpnF+fcY83b/jVQ=", - "dev": true - }, "find-up": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", @@ -8410,40 +8429,16 @@ "supports-color": "^7.1.0" } }, - "cosmiconfig": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-6.0.0.tgz", - "integrity": "sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==", - "dev": true, - "requires": { - "@types/parse-json": "^4.0.0", - "import-fresh": "^3.1.0", - "parse-json": "^5.0.0", - "path-type": "^4.0.0", - "yaml": "^1.7.2" - } - }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, - "import-fresh": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", - "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", - "dev": true, - "requires": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - } - }, "parse-json": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.0.1.tgz", "integrity": "sha512-ztoZ4/DYeXQq4E21v169sC8qWINGpcosGv9XhTDvg9/hWvx/zrFkc9BiWxR58OJLHGk28j5BL0SDLeV2WmFZlQ==", - "dev": true, "requires": { "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", @@ -8451,12 +8446,6 @@ "lines-and-columns": "^1.1.6" } }, - "resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true - }, "supports-color": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", @@ -8569,13 +8558,13 @@ } }, "import-fresh": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-2.0.0.tgz", - "integrity": "sha1-2BNVwVYS04bGH53dOSLUMEgipUY=", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", + "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", "dev": true, "requires": { - "caller-path": "^2.0.0", - "resolve-from": "^3.0.0" + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" } }, "import-lazy": { @@ -8920,12 +8909,6 @@ } } }, - "is-directory": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/is-directory/-/is-directory-0.3.1.tgz", - "integrity": "sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE=", - "dev": true - }, "is-docker": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.1.1.tgz", @@ -9271,6 +9254,12 @@ "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==" }, + "json-parse-even-better-errors": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.0.tgz", + "integrity": "sha512-o3aP+RsWDJZayj1SbHNQAI8x0v3T3SKiGoZlNYfbUP1S3omJQ6i9CnqADqkSPaOAxwua4/1YWx5CM7oiChJt2Q==", + "dev": true + }, "json-schema": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", @@ -9293,6 +9282,15 @@ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, + "json5": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz", + "integrity": "sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, "jsonfile": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.0.1.tgz", @@ -11313,15 +11311,6 @@ "debug": "^4.1.1" } }, - "node-sass-tilde-importer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/node-sass-tilde-importer/-/node-sass-tilde-importer-1.0.2.tgz", - "integrity": "sha512-Swcmr38Y7uB78itQeBm3mThjxBy9/Ah/ykPIaURY/L6Nec9AyRoL/jJ7ECfMR+oZeCTVQNxVMu/aHU+TLRVbdg==", - "dev": true, - "requires": { - "find-parent-dir": "^0.3.0" - } - }, "node-unzip-2": { "version": "0.2.8", "resolved": "https://registry.npmjs.org/node-unzip-2/-/node-unzip-2-0.2.8.tgz", @@ -12018,14 +12007,6 @@ "dev": true, "requires": { "callsites": "^3.0.0" - }, - "dependencies": { - "callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true - } } }, "parse-filepath": { @@ -12507,9 +12488,9 @@ "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=" }, "prettier": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz", - "integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.1.1.tgz", + "integrity": "sha512-9bY+5ZWCfqj3ghYBLxApy2zf6m+NJo5GzmLTpr9FsApsfjriNnS2dahWReHMi7qNPhhHl9SYHJs2cHZLgexNIw==", "dev": true }, "pretty-bytes": { @@ -13635,20 +13616,10 @@ "resolve-from": "^1.0.0" }, "dependencies": { - "caller-path": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz", - "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=", - "dev": true, - "requires": { - "callsites": "^0.2.0" - } - }, "callsites": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz", - "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=", - "dev": true + "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=" }, "resolve-from": { "version": "1.0.1", @@ -13991,9 +13962,9 @@ } }, "resolve-from": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", - "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true }, "resolve-options": { @@ -14162,6 +14133,15 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, + "sass": { + "version": "1.26.10", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.26.10.tgz", + "integrity": "sha512-bzN0uvmzfsTvjz0qwccN1sPm2HxxpNI/Xa+7PlUEMS+nQvbyuEK7Y0qFqxlPHhiNHb1Ze8WQJtU31olMObkAMw==", + "dev": true, + "requires": { + "chokidar": ">=2.0.0 <4.0.0" + } + }, "sax": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", @@ -15799,9 +15779,9 @@ } }, "typescript": { - "version": "3.9.7", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz", - "integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.2.tgz", + "integrity": "sha512-e4ERvRV2wb+rRZ/IQeb3jm2VxBsirQLpQhdxplZ2MEzGvDkkMmPglecnNDfSUBivMjP93vRbngYYDQqQ/78bcQ==", "dev": true }, "udif": { @@ -16299,21 +16279,15 @@ } }, "vue-template-compiler": { - "version": "2.6.11", - "resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.6.11.tgz", - "integrity": "sha512-KIq15bvQDrcCjpGjrAhx4mUlyyHfdmTaoNfeoATHLAiWB+MU3cx4lOzMwrnUh9cCxy0Lt1T11hAFY6TQgroUAA==", + "version": "2.6.12", + "resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.6.12.tgz", + "integrity": "sha512-OzzZ52zS41YUbkCBfdXShQTe69j1gQDZ9HIX8miuC9C3rBCk9wIRjLiZZLrmX9V+Ftq/YEyv1JaVr5Y/hNtByg==", "dev": true, "requires": { "de-indent": "^1.0.2", "he": "^1.1.0" } }, - "walkdir": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/walkdir/-/walkdir-0.4.1.tgz", - "integrity": "sha512-3eBwRyEln6E1MSzcxcVpQIhRG8Q1jLvEqRmCZqS3dsfXEDR/AhOF4d+jHg1qvDCpYaVRZjENPQyrVxAkQqxPgQ==", - "dev": true - }, "wcwidth": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", diff --git a/package.json b/package.json index a4961231..2b0cbb82 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,7 @@ } }, "devDependencies": { - "@balena/lint": "^5.1.0", + "@balena/lint": "^5.2.0", "@oclif/config": "^1.17.0", "@oclif/dev-cli": "^1.22.2", "@oclif/parser": "^3.8.5", @@ -180,14 +180,14 @@ "mock-require": "^3.0.3", "nock": "^12.0.3", "parse-link-header": "~1.0.1", - "pkg": "^4.4.9", "pinejs-client-core": "^6.7.3", + "pkg": "^4.4.9", "publish-release": "^1.6.1", "rewire": "^4.0.1", "simple-git": "^1.132.0", "sinon": "^9.0.3", "ts-node": "^8.10.2", - "typescript": "^3.9.7" + "typescript": "^4.0.2" }, "dependencies": { "@balena/dockerignore": "^1.0.2", diff --git a/tests/nock-mock.ts b/tests/nock-mock.ts index 87bcb1ba..4fe1e47c 100644 --- a/tests/nock-mock.ts +++ b/tests/nock-mock.ts @@ -29,7 +29,7 @@ export interface ScopeOpts { export class NockMock { public readonly scope: nock.Scope; // Expose `scope` as `expect` to allow for better semantics in tests - public readonly expect = this.scope; + public readonly expect; protected static instanceCount = 0; constructor(public basePathPattern: string | RegExp) { @@ -45,6 +45,7 @@ export class NockMock { } NockMock.instanceCount += 1; this.scope = nock(this.basePathPattern); + this.expect = this.scope; } public optGet(