Update to typescript 4.0

Change-type: patch
This commit is contained in:
Pagan Gazzard 2020-08-27 11:50:57 +01:00
parent a59d85e833
commit 787966a0b6
10 changed files with 175 additions and 222 deletions

View File

@ -119,9 +119,7 @@ export default class LocalConfigureCmd extends Command {
readonly CONNECTIONS_FOLDER = '/system-connections'; readonly CONNECTIONS_FOLDER = '/system-connections';
getConfigurationSchema(connectionFileName?: string) { getConfigurationSchema(connectionFileName?: string) {
if (connectionFileName == null) { connectionFileName ??= 'resin-wifi';
connectionFileName = 'resin-wifi';
}
return { return {
mapper: [ mapper: [
{ {

View File

@ -115,10 +115,8 @@ export default class LogsCmd extends Command {
const displayCloudLog = async (line: LogMessage) => { const displayCloudLog = async (line: LogMessage) => {
if (!line.isSystem) { if (!line.isSystem) {
let serviceName = await serviceIdToName(balena, line.serviceId); const serviceName =
if (serviceName == null) { (await serviceIdToName(balena, line.serviceId)) ?? 'Unknown service';
serviceName = 'Unknown service';
}
displayLogObject( displayLogObject(
{ serviceName, ...line }, { serviceName, ...line },
logger, logger,

View File

@ -107,9 +107,7 @@ export default class OsBuildConfigCmd extends Command {
deviceTypeManifest: DeviceTypeJson.DeviceType, deviceTypeManifest: DeviceTypeJson.DeviceType,
advanced: boolean, advanced: boolean,
) { ) {
if (advanced == null) { advanced ??= false;
advanced = false;
}
let override; let override;
const questions = deviceTypeManifest.options; const questions = deviceTypeManifest.options;

View File

@ -40,17 +40,11 @@ import type { ResourceExpand } from 'pinejs-client-core';
interface FlagsDef extends DockerConnectionCliFlags { interface FlagsDef extends DockerConnectionCliFlags {
app?: string; app?: string;
appId?: string; // Internal use.
commit?: string; commit?: string;
'splash-image'?: string; 'splash-image'?: string;
splashImage?: string; // Internal use.
'dont-check-arch': boolean; 'dont-check-arch': boolean;
dontCheckArch?: boolean; // Internal use.
'pin-device-to-release': boolean; 'pin-device-to-release': boolean;
pinDevice?: boolean; // Internal use.
'add-certificate'?: string; 'add-certificate'?: string;
image?: string; // Internal use.
proxy?: string; // Internal use.
help: void; help: void;
} }
@ -169,12 +163,9 @@ Can be repeated to add multiple certificates.\
name: string; name: string;
percentage: number; percentage: number;
}) { }) {
let progressBar = progressBars[event.name]; const progressBar = (progressBars[event.name] ??= new visuals.Progress(
if (!progressBar) { event.name,
progressBar = progressBars[event.name] = new visuals.Progress( ));
event.name,
);
}
return progressBar.update({ percentage: event.percentage }); 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 }) { const spinnerHandler = function (event: { name: string; action: string }) {
let spinner = spinners[event.name]; const spinner = (spinners[event.name] ??= new visuals.Spinner(
if (!spinner) { event.name,
spinner = spinners[event.name] = new visuals.Spinner(event.name); ));
}
if (event.action === 'start') { if (event.action === 'start') {
return spinner.start(); return spinner.start();
} else { } 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' ? 'latest'
: options.commit; : options.commit;
options.image = params.image; const image = params.image;
options.appId = options.app; const appId = options.app;
delete options.app;
options.splashImage = options['splash-image']; const splashImage = options['splash-image'];
delete options['splash-image'];
options.dontCheckArch = options['dont-check-arch'] || false; const dontCheckArch = options['dont-check-arch'] || false;
delete options['dont-check-arch']; const pinDevice = options['pin-device-to-release'] || false;
if (options.dontCheckArch && !options.appId) {
if (dontCheckArch && !appId) {
throw new ExpectedError( throw new ExpectedError(
'You need to specify an app id if you disable the architecture check.', '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[]; let certificates: string[];
if (Array.isArray(options['add-certificate'])) { if (Array.isArray(options['add-certificate'])) {
certificates = options['add-certificate']; certificates = options['add-certificate'];
@ -236,13 +222,13 @@ Can be repeated to add multiple certificates.\
const preloader = new balenaPreload.Preloader( const preloader = new balenaPreload.Preloader(
null, null,
docker, docker,
options.appId, appId,
options.commit, commit,
options.image, image,
options.splashImage, splashImage,
options.proxy, // TODO: Currently always undefined, investigate approach in ssh command. undefined, // TODO: Currently always undefined, investigate approach in ssh command.
options.dontCheckArch, dontCheckArch,
options.pinDevice, pinDevice,
certificates, certificates,
); );
@ -270,7 +256,13 @@ Can be repeated to add multiple certificates.\
try { try {
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
preloader.on('error', reject); preloader.on('error', reject);
resolve(this.prepareAndPreload(preloader, balena, options)); resolve(
this.prepareAndPreload(preloader, balena, {
appId,
commit,
pinDevice,
}),
);
}); });
} catch (err) { } catch (err) {
if (instanceOf(err, balena.errors.BalenaError)) { if (instanceOf(err, balena.errors.BalenaError)) {
@ -494,7 +486,11 @@ Would you like to disable automatic updates for this application now?\
async prepareAndPreload( async prepareAndPreload(
preloader: Preloader, preloader: Preloader,
balenaSdk: BalenaSDK, balenaSdk: BalenaSDK,
options: FlagsDef, options: {
appId?: string;
commit?: string;
pinDevice: boolean;
},
) { ) {
await preloader.prepare(); await preloader.prepare();
@ -543,7 +539,7 @@ Would you like to disable automatic updates for this application now?\
await this.offerToDisableAutomaticUpdates( await this.offerToDisableAutomaticUpdates(
application, application,
commit, commit,
options.pinDevice!, options.pinDevice,
); );
// All options are ready: preload the image. // All options are ready: preload the image.

View File

@ -110,9 +110,7 @@ export default class TagSetCmd extends Command {
throw new ExpectedError(TagSetCmd.missingResourceMessage); throw new ExpectedError(TagSetCmd.missingResourceMessage);
} }
if (params.value == null) { params.value ??= '';
params.value = '';
}
if (options.application) { if (options.application) {
return balena.models.application.tags.set( return balena.models.application.tags.set(

View File

@ -144,9 +144,8 @@ export function createProject(composePath, composeStr, projectName = null) {
}); });
const composition = compose.normalize(rawComposition); const composition = compose.normalize(rawComposition);
if (projectName == null) { projectName ??= path.basename(composePath);
projectName = path.basename(composePath);
}
const descriptors = compose.parse(composition).map(function (descr) { const descriptors = compose.parse(composition).map(function (descr) {
// generate an image name based on the project and service names // generate an image name based on the project and service names
// if one is not given and the service requires a build // 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 // multibuild parses the composition internally so any tags we've
// set before are lost; re-assign them here // 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) { if (typeof d.image !== 'string' && d.image.context != null) {
d.image.tag = task.tag; d.image.tag = task.tag;
} }
// configure build opts appropriately // configure build opts appropriately
if (task.dockerOpts == null) { task.dockerOpts ??= {};
task.dockerOpts = {};
}
_.merge(task.dockerOpts, buildOpts, { t: task.tag }); _.merge(task.dockerOpts, buildOpts, { t: task.tag });
if (typeof d.image !== 'string') { if (typeof d.image !== 'string') {
/** @type {any} */ /** @type {any} */
const context = d.image.context; const context = d.image.context;
if (context?.args != null) { if (context?.args != null) {
if (task.dockerOpts.buildargs == null) { task.dockerOpts.buildargs ??= {};
task.dockerOpts.buildargs = {};
}
_.merge(task.dockerOpts.buildargs, context.args); _.merge(task.dockerOpts.buildargs, context.args);
} }
} }
@ -858,9 +853,7 @@ var buildProgressAdapter = function (inline) {
const match = stepRegex.exec(str); const match = stepRegex.exec(str);
if (match) { if (match) {
step = match[1]; step = match[1];
if (numSteps == null) { numSteps ??= match[2];
numSteps = match[2];
}
str = match[3]; str = match[3];
} }
if (step != null) { if (step != null) {
@ -1020,9 +1013,8 @@ class BuildProgressUI {
} }
_renderStatus(end) { _renderStatus(end) {
if (end == null) { end ??= false;
end = false;
}
const moment = require('moment'); const moment = require('moment');
require('moment-duration-format')(moment); require('moment-duration-format')(moment);

View File

@ -90,9 +90,7 @@ export async function sudo(
'Admin privileges required: you may be asked for your computer password to continue.', '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); await executeWithPrivileges(command, stderr, isCLIcmd);
} }

266
npm-shrinkwrap.json generated
View File

@ -13,9 +13,9 @@
} }
}, },
"@babel/generator": { "@babel/generator": {
"version": "7.11.0", "version": "7.11.4",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.11.0.tgz", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.11.4.tgz",
"integrity": "sha512-fEm3Uzw7Mc9Xi//qU20cBKatTfs2aOtKqmvy/Vm7RkJEGFQ4xc9myCfbXxqK//ZS8MR/ciOHw6meGASJuKmDfQ==", "integrity": "sha512-Rn26vueFx0eOoz7iifCN2UHT6rGtnkSGWSoDRIy8jZN3B91PzeSULbswfLoOWuTuAcNwpG/mxy+uCTDnZ9Mp1g==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/types": "^7.11.0", "@babel/types": "^7.11.0",
@ -222,28 +222,28 @@
"integrity": "sha512-o3/sRDyrXC75BUUziMAs+W5C02aVST0YqY5Ny31Ot3a+7CzK2XDRinMGywvK93tm2QVdL83HGkN483S62Xo9Dw==" "integrity": "sha512-o3/sRDyrXC75BUUziMAs+W5C02aVST0YqY5Ny31Ot3a+7CzK2XDRinMGywvK93tm2QVdL83HGkN483S62Xo9Dw=="
}, },
"@balena/lint": { "@balena/lint": {
"version": "5.1.0", "version": "5.2.0",
"resolved": "https://registry.npmjs.org/@balena/lint/-/lint-5.1.0.tgz", "resolved": "https://registry.npmjs.org/@balena/lint/-/lint-5.2.0.tgz",
"integrity": "sha512-ktyLx8bi2PwhED7KYKyi93RhpS9mI5X2KHA076hcpr/fD8W+XQF5DBga8Y40oNrt+qG8ZjVyMMXA3vvuVAslRA==", "integrity": "sha512-RJf1SG0FkY/d7o00UIdjfpYP/xQa148M8y9GN9quZryL50Gv3qtrp/ELDcoDylZjXVNhZ2OiQBl/urLpC21PKA==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/glob": "^7.1.1", "@types/glob": "^7.1.3",
"@types/lodash": "^4.14.150", "@types/lodash": "^4.14.159",
"@types/node": "^10.17.21", "@types/node": "^10.17.28",
"@types/optimist": "0.0.29", "@types/optimist": "0.0.29",
"@types/prettier": "^2.0.0", "@types/prettier": "^2.0.2",
"coffee-script": "^1.10.0", "coffee-script": "^1.10.0",
"coffeelint": "^1.15.0", "coffeelint": "^1.15.0",
"coffeescope2": "^0.4.5", "coffeescope2": "^0.4.5",
"depcheck": "^0.9.2", "depcheck": "^1.2.0",
"glob": "^7.1.6", "glob": "^7.1.6",
"lodash": "^4.17.15", "lodash": "^4.17.20",
"optimist": "^0.6.1", "optimist": "^0.6.1",
"prettier": "^2.0.5", "prettier": "^2.1.0",
"tslint": "^6.1.2", "tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0", "tslint-config-prettier": "^1.18.0",
"tslint-no-unused-expression-chai": "^0.1.4", "tslint-no-unused-expression-chai": "^0.1.4",
"typescript": "^3.9.2" "typescript": "^4.0.2"
} }
}, },
"@balena/node-web-streams": { "@balena/node-web-streams": {
@ -3361,28 +3361,27 @@
"resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz", "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz",
"integrity": "sha1-JtII6onje1y95gJQoV8DHBak1ms=" "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": { "caller-path": {
"version": "2.0.0", "version": "0.1.0",
"resolved": "https://registry.npmjs.org/caller-path/-/caller-path-2.0.0.tgz", "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz",
"integrity": "sha1-Ro+DBE42mrIBD6xfBs7uFbsssfQ=", "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=",
"dev": true, "dev": true,
"requires": { "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": { "callsites": {
"version": "2.0.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
"integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=", "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
"dev": true "dev": true
}, },
"camelcase": { "camelcase": {
@ -4262,15 +4261,30 @@
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
}, },
"cosmiconfig": { "cosmiconfig": {
"version": "5.2.1", "version": "6.0.0",
"resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-5.2.1.tgz", "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-6.0.0.tgz",
"integrity": "sha512-H65gsXo1SKjf8zmrJ67eJk8aIRKV5ff2D4uKZIBZShbhGSpEmsQOPW/SKMKYhSTrqR7ufy6RP69rPogdaPh/kA==", "integrity": "sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==",
"dev": true, "dev": true,
"requires": { "requires": {
"import-fresh": "^2.0.0", "@types/parse-json": "^4.0.0",
"is-directory": "^0.3.1", "import-fresh": "^3.1.0",
"js-yaml": "^3.13.1", "parse-json": "^5.0.0",
"parse-json": "^4.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": { "cp-file": {
@ -4691,28 +4705,39 @@
} }
}, },
"depcheck": { "depcheck": {
"version": "0.9.2", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/depcheck/-/depcheck-0.9.2.tgz", "resolved": "https://registry.npmjs.org/depcheck/-/depcheck-1.2.0.tgz",
"integrity": "sha512-w5f+lSZqLJJkk58s44eOd0Vor7hLZot4PlFL0y2JsIX5LuHQ2eAjHlDVeGBD4Mj6ZQSKakvKWRRCcPlvrdU2Sg==", "integrity": "sha512-857OvTMgWm35B+B0feJXbkaQo+sm/xMp2Jw4+dGXVsIdEmy9xyDV+q1T1bMp38bN5FbYTgdeqEn5AS7qxC0ubQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/parser": "^7.7.7", "@babel/parser": "^7.10.4",
"@babel/traverse": "^7.7.4", "@babel/traverse": "^7.10.4",
"builtin-modules": "^3.0.0", "builtin-modules": "^3.1.0",
"camelcase": "^5.3.1", "camelcase": "^6.0.0",
"cosmiconfig": "^5.2.1", "cosmiconfig": "^6.0.0",
"debug": "^4.1.1", "debug": "^4.1.1",
"deps-regex": "^0.1.4", "deps-regex": "^0.1.4",
"js-yaml": "^3.4.2", "ignore": "^5.1.8",
"lodash": "^4.17.15", "js-yaml": "^3.14.0",
"minimatch": "^3.0.2", "json5": "^2.1.3",
"node-sass-tilde-importer": "^1.0.2", "lodash": "^4.17.19",
"minimatch": "^3.0.4",
"multimatch": "^4.0.0",
"please-upgrade-node": "^3.2.0", "please-upgrade-node": "^3.2.0",
"readdirp": "^3.4.0",
"require-package-name": "^2.0.1", "require-package-name": "^2.0.1",
"resolve": "^1.14.1", "resolve": "^1.17.0",
"sass": "^1.26.10",
"vue-template-compiler": "^2.6.11", "vue-template-compiler": "^2.6.11",
"walkdir": "^0.4.1", "yargs": "^15.4.0"
"yargs": "^15.0.2" },
"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": { "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": { "find-up": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz",
@ -8410,40 +8429,16 @@
"supports-color": "^7.1.0" "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": { "has-flag": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true "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": { "parse-json": {
"version": "5.0.1", "version": "5.0.1",
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.0.1.tgz", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.0.1.tgz",
"integrity": "sha512-ztoZ4/DYeXQq4E21v169sC8qWINGpcosGv9XhTDvg9/hWvx/zrFkc9BiWxR58OJLHGk28j5BL0SDLeV2WmFZlQ==", "integrity": "sha512-ztoZ4/DYeXQq4E21v169sC8qWINGpcosGv9XhTDvg9/hWvx/zrFkc9BiWxR58OJLHGk28j5BL0SDLeV2WmFZlQ==",
"dev": true,
"requires": { "requires": {
"@babel/code-frame": "^7.0.0", "@babel/code-frame": "^7.0.0",
"error-ex": "^1.3.1", "error-ex": "^1.3.1",
@ -8451,12 +8446,6 @@
"lines-and-columns": "^1.1.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": { "supports-color": {
"version": "7.1.0", "version": "7.1.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
@ -8569,13 +8558,13 @@
} }
}, },
"import-fresh": { "import-fresh": {
"version": "2.0.0", "version": "3.2.1",
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-2.0.0.tgz", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz",
"integrity": "sha1-2BNVwVYS04bGH53dOSLUMEgipUY=", "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"caller-path": "^2.0.0", "parent-module": "^1.0.0",
"resolve-from": "^3.0.0" "resolve-from": "^4.0.0"
} }
}, },
"import-lazy": { "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": { "is-docker": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.1.1.tgz", "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", "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
"integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==" "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": { "json-schema": {
"version": "0.2.3", "version": "0.2.3",
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", "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", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
"integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" "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": { "jsonfile": {
"version": "6.0.1", "version": "6.0.1",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.0.1.tgz", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.0.1.tgz",
@ -11313,15 +11311,6 @@
"debug": "^4.1.1" "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": { "node-unzip-2": {
"version": "0.2.8", "version": "0.2.8",
"resolved": "https://registry.npmjs.org/node-unzip-2/-/node-unzip-2-0.2.8.tgz", "resolved": "https://registry.npmjs.org/node-unzip-2/-/node-unzip-2-0.2.8.tgz",
@ -12018,14 +12007,6 @@
"dev": true, "dev": true,
"requires": { "requires": {
"callsites": "^3.0.0" "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": { "parse-filepath": {
@ -12507,9 +12488,9 @@
"integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=" "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw="
}, },
"prettier": { "prettier": {
"version": "2.0.5", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz", "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.1.1.tgz",
"integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==", "integrity": "sha512-9bY+5ZWCfqj3ghYBLxApy2zf6m+NJo5GzmLTpr9FsApsfjriNnS2dahWReHMi7qNPhhHl9SYHJs2cHZLgexNIw==",
"dev": true "dev": true
}, },
"pretty-bytes": { "pretty-bytes": {
@ -13635,20 +13616,10 @@
"resolve-from": "^1.0.0" "resolve-from": "^1.0.0"
}, },
"dependencies": { "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": { "callsites": {
"version": "0.2.0", "version": "0.2.0",
"resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz", "resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz",
"integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=", "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo="
"dev": true
}, },
"resolve-from": { "resolve-from": {
"version": "1.0.1", "version": "1.0.1",
@ -13991,9 +13962,9 @@
} }
}, },
"resolve-from": { "resolve-from": {
"version": "3.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
"integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=", "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==",
"dev": true "dev": true
}, },
"resolve-options": { "resolve-options": {
@ -14162,6 +14133,15 @@
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" "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": { "sax": {
"version": "1.2.4", "version": "1.2.4",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
@ -15799,9 +15779,9 @@
} }
}, },
"typescript": { "typescript": {
"version": "3.9.7", "version": "4.0.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.2.tgz",
"integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==", "integrity": "sha512-e4ERvRV2wb+rRZ/IQeb3jm2VxBsirQLpQhdxplZ2MEzGvDkkMmPglecnNDfSUBivMjP93vRbngYYDQqQ/78bcQ==",
"dev": true "dev": true
}, },
"udif": { "udif": {
@ -16299,21 +16279,15 @@
} }
}, },
"vue-template-compiler": { "vue-template-compiler": {
"version": "2.6.11", "version": "2.6.12",
"resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.6.11.tgz", "resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.6.12.tgz",
"integrity": "sha512-KIq15bvQDrcCjpGjrAhx4mUlyyHfdmTaoNfeoATHLAiWB+MU3cx4lOzMwrnUh9cCxy0Lt1T11hAFY6TQgroUAA==", "integrity": "sha512-OzzZ52zS41YUbkCBfdXShQTe69j1gQDZ9HIX8miuC9C3rBCk9wIRjLiZZLrmX9V+Ftq/YEyv1JaVr5Y/hNtByg==",
"dev": true, "dev": true,
"requires": { "requires": {
"de-indent": "^1.0.2", "de-indent": "^1.0.2",
"he": "^1.1.0" "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": { "wcwidth": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz",

View File

@ -111,7 +111,7 @@
} }
}, },
"devDependencies": { "devDependencies": {
"@balena/lint": "^5.1.0", "@balena/lint": "^5.2.0",
"@oclif/config": "^1.17.0", "@oclif/config": "^1.17.0",
"@oclif/dev-cli": "^1.22.2", "@oclif/dev-cli": "^1.22.2",
"@oclif/parser": "^3.8.5", "@oclif/parser": "^3.8.5",
@ -180,14 +180,14 @@
"mock-require": "^3.0.3", "mock-require": "^3.0.3",
"nock": "^12.0.3", "nock": "^12.0.3",
"parse-link-header": "~1.0.1", "parse-link-header": "~1.0.1",
"pkg": "^4.4.9",
"pinejs-client-core": "^6.7.3", "pinejs-client-core": "^6.7.3",
"pkg": "^4.4.9",
"publish-release": "^1.6.1", "publish-release": "^1.6.1",
"rewire": "^4.0.1", "rewire": "^4.0.1",
"simple-git": "^1.132.0", "simple-git": "^1.132.0",
"sinon": "^9.0.3", "sinon": "^9.0.3",
"ts-node": "^8.10.2", "ts-node": "^8.10.2",
"typescript": "^3.9.7" "typescript": "^4.0.2"
}, },
"dependencies": { "dependencies": {
"@balena/dockerignore": "^1.0.2", "@balena/dockerignore": "^1.0.2",

View File

@ -29,7 +29,7 @@ export interface ScopeOpts {
export class NockMock { export class NockMock {
public readonly scope: nock.Scope; public readonly scope: nock.Scope;
// Expose `scope` as `expect` to allow for better semantics in tests // Expose `scope` as `expect` to allow for better semantics in tests
public readonly expect = this.scope; public readonly expect;
protected static instanceCount = 0; protected static instanceCount = 0;
constructor(public basePathPattern: string | RegExp) { constructor(public basePathPattern: string | RegExp) {
@ -45,6 +45,7 @@ export class NockMock {
} }
NockMock.instanceCount += 1; NockMock.instanceCount += 1;
this.scope = nock(this.basePathPattern); this.scope = nock(this.basePathPattern);
this.expect = this.scope;
} }
public optGet( public optGet(