Merge pull request #1886 from balena-io/directly-import-strip-tags

Import just strip-tags from common-tags to reduce startup time
This commit is contained in:
bulldozer-balena[bot] 2020-06-26 10:25:32 +00:00 committed by GitHub
commit 5b95a16fe1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
67 changed files with 74 additions and 121 deletions

View File

@ -21,7 +21,6 @@ import { run as oclifRun } from '@oclif/dev-cli';
import * as archiver from 'archiver'; import * as archiver from 'archiver';
import * as Bluebird from 'bluebird'; import * as Bluebird from 'bluebird';
import { execFile } from 'child_process'; import { execFile } from 'child_process';
import { stripIndent } from 'common-tags';
import * as filehound from 'filehound'; import * as filehound from 'filehound';
import * as fs from 'fs-extra'; import * as fs from 'fs-extra';
import * as _ from 'lodash'; import * as _ from 'lodash';
@ -31,6 +30,7 @@ import * as rimraf from 'rimraf';
import * as semver from 'semver'; import * as semver from 'semver';
import * as util from 'util'; import * as util from 'util';
import { stripIndent } from '../lib/utils/lazy';
import { import {
getSubprocessStdout, getSubprocessStdout,
loadPackageJson, loadPackageJson,

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
const { stripIndent } = require('common-tags'); const stripIndent = require('common-tags/lib/stripIndent');
const _ = require('lodash'); const _ = require('lodash');
const { promises: fs } = require('fs'); const { promises: fs } = require('fs');
const path = require('path'); const path = require('path');

View File

@ -16,11 +16,10 @@
*/ */
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import { stripIndent } from 'common-tags';
import Command from '../../command'; import Command from '../../command';
import { ExpectedError } from '../../errors'; import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags'; import * as cf from '../../utils/common-flags';
import { getBalenaSdk } from '../../utils/lazy'; import { getBalenaSdk, stripIndent } from '../../utils/lazy';
interface FlagsDef { interface FlagsDef {
help: void; help: void;

View File

@ -16,11 +16,10 @@
*/ */
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import { stripIndent } from 'common-tags';
import Command from '../../command'; import Command from '../../command';
import { ExpectedError } from '../../errors'; import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags'; import * as cf from '../../utils/common-flags';
import { getBalenaSdk } from '../../utils/lazy'; import { getBalenaSdk, stripIndent } from '../../utils/lazy';
interface FlagsDef { interface FlagsDef {
type?: string; // application device type type?: string; // application device type

View File

@ -16,10 +16,9 @@
*/ */
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import { stripIndent } from 'common-tags';
import Command from '../../command'; import Command from '../../command';
import * as cf from '../../utils/common-flags'; import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getVisuals } from '../../utils/lazy'; import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
import { tryAsInteger } from '../../utils/validation'; import { tryAsInteger } from '../../utils/validation';
interface FlagsDef { interface FlagsDef {

View File

@ -16,10 +16,9 @@
*/ */
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import { stripIndent } from 'common-tags';
import Command from '../../command'; import Command from '../../command';
import * as cf from '../../utils/common-flags'; import * as cf from '../../utils/common-flags';
import { getBalenaSdk } from '../../utils/lazy'; import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { tryAsInteger } from '../../utils/validation'; import { tryAsInteger } from '../../utils/validation';
interface FlagsDef { interface FlagsDef {

View File

@ -16,10 +16,9 @@
*/ */
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import { stripIndent } from 'common-tags';
import Command from '../../command'; import Command from '../../command';
import * as cf from '../../utils/common-flags'; import * as cf from '../../utils/common-flags';
import { getBalenaSdk } from '../../utils/lazy'; import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { tryAsInteger } from '../../utils/validation'; import { tryAsInteger } from '../../utils/validation';
interface FlagsDef { interface FlagsDef {

View File

@ -17,10 +17,9 @@
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import type { Application } from 'balena-sdk'; import type { Application } from 'balena-sdk';
import { stripIndent } from 'common-tags';
import Command from '../command'; import Command from '../command';
import * as cf from '../utils/common-flags'; import * as cf from '../utils/common-flags';
import { getBalenaSdk, getVisuals } from '../utils/lazy'; import { getBalenaSdk, getVisuals, stripIndent } from '../utils/lazy';
import { isV12 } from '../utils/version'; import { isV12 } from '../utils/version';
interface ExtendedApplication extends Application { interface ExtendedApplication extends Application {

View File

@ -17,10 +17,9 @@
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import type { IArg } from '@oclif/parser/lib/args'; import type { IArg } from '@oclif/parser/lib/args';
import { stripIndent } from 'common-tags';
import Command from '../../command'; import Command from '../../command';
import * as cf from '../../utils/common-flags'; import * as cf from '../../utils/common-flags';
import { getBalenaSdk } from '../../utils/lazy'; import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { tryAsInteger } from '../../utils/validation'; import { tryAsInteger } from '../../utils/validation';
import { ExpectedError } from '../../errors'; import { ExpectedError } from '../../errors';

View File

@ -17,11 +17,10 @@
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import { IArg } from '@oclif/parser/lib/args'; import { IArg } from '@oclif/parser/lib/args';
import { stripIndent } from 'common-tags';
import Command from '../../command'; import Command from '../../command';
import * as cf from '../../utils/common-flags'; import * as cf from '../../utils/common-flags';
import { expandForAppName } from '../../utils/helpers'; import { expandForAppName } from '../../utils/helpers';
import { getBalenaSdk, getVisuals } from '../../utils/lazy'; import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
import { tryAsInteger } from '../../utils/validation'; import { tryAsInteger } from '../../utils/validation';
import type { Application, Device } from 'balena-sdk'; import type { Application, Device } from 'balena-sdk';

View File

@ -18,12 +18,11 @@
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import type { IArg } from '@oclif/parser/lib/args'; import type { IArg } from '@oclif/parser/lib/args';
import type { Application, Device } from 'balena-sdk'; import type { Application, Device } from 'balena-sdk';
import { stripIndent } from 'common-tags';
import * as _ from 'lodash'; import * as _ from 'lodash';
import Command from '../../command'; import Command from '../../command';
import * as cf from '../../utils/common-flags'; import * as cf from '../../utils/common-flags';
import { expandForAppName } from '../../utils/helpers'; import { expandForAppName } from '../../utils/helpers';
import { getBalenaSdk } from '../../utils/lazy'; import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { tryAsInteger } from '../../utils/validation'; import { tryAsInteger } from '../../utils/validation';
interface ExtendedDevice extends Device { interface ExtendedDevice extends Device {

View File

@ -17,10 +17,9 @@
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import type { IArg } from '@oclif/parser/lib/args'; import type { IArg } from '@oclif/parser/lib/args';
import { stripIndent } from 'common-tags';
import Command from '../../command'; import Command from '../../command';
import * as cf from '../../utils/common-flags'; import * as cf from '../../utils/common-flags';
import { getBalenaSdk } from '../../utils/lazy'; import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { tryAsInteger } from '../../utils/validation'; import { tryAsInteger } from '../../utils/validation';
import type { Device } from 'balena-sdk'; import type { Device } from 'balena-sdk';
import { ExpectedError } from '../../errors'; import { ExpectedError } from '../../errors';

View File

@ -17,11 +17,10 @@
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import type { IArg } from '@oclif/parser/lib/args'; import type { IArg } from '@oclif/parser/lib/args';
import { stripIndent } from 'common-tags';
import Command from '../../command'; import Command from '../../command';
import { ExpectedError } from '../../errors'; import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags'; import * as cf from '../../utils/common-flags';
import { getBalenaSdk } from '../../utils/lazy'; import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { tryAsInteger } from '../../utils/validation'; import { tryAsInteger } from '../../utils/validation';
interface FlagsDef { interface FlagsDef {

View File

@ -17,10 +17,9 @@
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import type { IArg } from '@oclif/parser/lib/args'; import type { IArg } from '@oclif/parser/lib/args';
import { stripIndent } from 'common-tags';
import Command from '../../command'; import Command from '../../command';
import * as cf from '../../utils/common-flags'; import * as cf from '../../utils/common-flags';
import { getBalenaSdk } from '../../utils/lazy'; import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { tryAsInteger } from '../../utils/validation'; import { tryAsInteger } from '../../utils/validation';
interface FlagsDef { interface FlagsDef {

View File

@ -17,10 +17,9 @@
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import type { IArg } from '@oclif/parser/lib/args'; import type { IArg } from '@oclif/parser/lib/args';
import { stripIndent } from 'common-tags';
import Command from '../../command'; import Command from '../../command';
import * as cf from '../../utils/common-flags'; import * as cf from '../../utils/common-flags';
import { getBalenaSdk } from '../../utils/lazy'; import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { tryAsInteger } from '../../utils/validation'; import { tryAsInteger } from '../../utils/validation';
interface FlagsDef { interface FlagsDef {

View File

@ -17,10 +17,9 @@
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import type { IArg } from '@oclif/parser/lib/args'; import type { IArg } from '@oclif/parser/lib/args';
import { stripIndent } from 'common-tags';
import Command from '../../command'; import Command from '../../command';
import * as cf from '../../utils/common-flags'; import * as cf from '../../utils/common-flags';
import { getBalenaSdk } from '../../utils/lazy'; import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { tryAsInteger } from '../../utils/validation'; import { tryAsInteger } from '../../utils/validation';
interface FlagsDef { interface FlagsDef {

View File

@ -17,10 +17,9 @@
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import type { IArg } from '@oclif/parser/lib/args'; import type { IArg } from '@oclif/parser/lib/args';
import { stripIndent } from 'common-tags';
import Command from '../../command'; import Command from '../../command';
import * as cf from '../../utils/common-flags'; import * as cf from '../../utils/common-flags';
import { getBalenaSdk } from '../../utils/lazy'; import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { tryAsInteger } from '../../utils/validation'; import { tryAsInteger } from '../../utils/validation';
interface FlagsDef { interface FlagsDef {

View File

@ -17,10 +17,9 @@
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import type { IArg } from '@oclif/parser/lib/args'; import type { IArg } from '@oclif/parser/lib/args';
import { stripIndent } from 'common-tags';
import Command from '../../command'; import Command from '../../command';
import * as cf from '../../utils/common-flags'; import * as cf from '../../utils/common-flags';
import { getBalenaSdk } from '../../utils/lazy'; import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { tryAsInteger } from '../../utils/validation'; import { tryAsInteger } from '../../utils/validation';
import { ExpectedError } from '../../errors'; import { ExpectedError } from '../../errors';

View File

@ -16,12 +16,11 @@
*/ */
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import { stripIndent } from 'common-tags';
import * as _ from 'lodash'; import * as _ from 'lodash';
import Command from '../../command'; import Command from '../../command';
import * as cf from '../../utils/common-flags'; import * as cf from '../../utils/common-flags';
import { expandForAppName } from '../../utils/helpers'; import { expandForAppName } from '../../utils/helpers';
import { getBalenaSdk, getVisuals } from '../../utils/lazy'; import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
import { tryAsInteger } from '../../utils/validation'; import { tryAsInteger } from '../../utils/validation';
import type { Device, Application } from 'balena-sdk'; import type { Device, Application } from 'balena-sdk';

View File

@ -16,12 +16,11 @@
*/ */
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import type * as SDK from 'balena-sdk'; import type * as SDK from 'balena-sdk';
import { stripIndent } from 'common-tags';
import * as _ from 'lodash'; import * as _ from 'lodash';
import Command from '../../command'; import Command from '../../command';
import * as cf from '../../utils/common-flags'; import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getVisuals } from '../../utils/lazy'; import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
import { CommandHelp } from '../../utils/oclif-utils'; import { CommandHelp } from '../../utils/oclif-utils';
import { isV12 } from '../../utils/version'; import { isV12 } from '../../utils/version';

View File

@ -17,13 +17,12 @@
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import type * as BalenaSdk from 'balena-sdk'; import type * as BalenaSdk from 'balena-sdk';
import { stripIndent } from 'common-tags';
import * as _ from 'lodash'; import * as _ from 'lodash';
import Command from '../../command'; import Command from '../../command';
import { ExpectedError } from '../../errors'; import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags'; import * as cf from '../../utils/common-flags';
import { getBalenaSdk } from '../../utils/lazy'; import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { CommandHelp } from '../../utils/oclif-utils'; import { CommandHelp } from '../../utils/oclif-utils';
interface FlagsDef { interface FlagsDef {

View File

@ -15,12 +15,11 @@
* limitations under the License. * limitations under the License.
*/ */
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import { stripIndent } from 'common-tags';
import Command from '../../command'; import Command from '../../command';
import * as cf from '../../utils/common-flags'; import * as cf from '../../utils/common-flags';
import * as ec from '../../utils/env-common'; import * as ec from '../../utils/env-common';
import { getBalenaSdk } from '../../utils/lazy'; import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { CommandHelp } from '../../utils/oclif-utils'; import { CommandHelp } from '../../utils/oclif-utils';
import { parseAsInteger } from '../../utils/validation'; import { parseAsInteger } from '../../utils/validation';

View File

@ -16,11 +16,10 @@
*/ */
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import { stripIndent } from 'common-tags';
import Command from '../../command'; import Command from '../../command';
import * as ec from '../../utils/env-common'; import * as ec from '../../utils/env-common';
import { getBalenaSdk } from '../../utils/lazy'; import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { CommandHelp } from '../../utils/oclif-utils'; import { CommandHelp } from '../../utils/oclif-utils';
import { parseAsInteger } from '../../utils/validation'; import { parseAsInteger } from '../../utils/validation';

View File

@ -16,13 +16,12 @@
*/ */
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import type * as SDK from 'balena-sdk'; import type * as SDK from 'balena-sdk';
import { stripIndent } from 'common-tags';
import * as _ from 'lodash'; import * as _ from 'lodash';
import Command from '../command'; import Command from '../command';
import { ExpectedError } from '../errors'; import { ExpectedError } from '../errors';
import * as cf from '../utils/common-flags'; import * as cf from '../utils/common-flags';
import { getBalenaSdk, getVisuals } from '../utils/lazy'; import { getBalenaSdk, getVisuals, stripIndent } from '../utils/lazy';
import { CommandHelp } from '../utils/oclif-utils'; import { CommandHelp } from '../utils/oclif-utils';
import { isV12 } from '../utils/version'; import { isV12 } from '../utils/version';

View File

@ -15,8 +15,8 @@
* limitations under the License. * limitations under the License.
*/ */
import { stripIndent } from 'common-tags';
import Command from '../../command'; import Command from '../../command';
import { stripIndent } from '../../utils/lazy';
import { CommandHelp } from '../../utils/oclif-utils'; import { CommandHelp } from '../../utils/oclif-utils';
// 'Internal' commands are called during the execution of other commands. // 'Internal' commands are called during the execution of other commands.

View File

@ -15,8 +15,8 @@
* limitations under the License. * limitations under the License.
*/ */
import { stripIndent } from 'common-tags';
import Command from '../../command'; import Command from '../../command';
import { stripIndent } from '../../utils/lazy';
// 'Internal' commands are called during the execution of other commands. // 'Internal' commands are called during the execution of other commands.
// `scandevices` is called during by `join`,`leave'. // `scandevices` is called during by `join`,`leave'.

View File

@ -16,10 +16,9 @@
*/ */
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import { stripIndent } from 'common-tags';
import Command from '../command'; import Command from '../command';
import * as cf from '../utils/common-flags'; import * as cf from '../utils/common-flags';
import { getBalenaSdk } from '../utils/lazy'; import { getBalenaSdk, stripIndent } from '../utils/lazy';
interface FlagsDef { interface FlagsDef {
application?: string; application?: string;

View File

@ -16,11 +16,10 @@
*/ */
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import { stripIndent } from 'common-tags';
import Command from '../../command'; import Command from '../../command';
import { ExpectedError } from '../../errors'; import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags'; import * as cf from '../../utils/common-flags';
import { getBalenaSdk } from '../../utils/lazy'; import { getBalenaSdk, stripIndent } from '../../utils/lazy';
interface FlagsDef { interface FlagsDef {
help: void; help: void;

View File

@ -16,10 +16,9 @@
*/ */
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import { stripIndent } from 'common-tags';
import Command from '../../command'; import Command from '../../command';
import * as cf from '../../utils/common-flags'; import * as cf from '../../utils/common-flags';
import { getBalenaSdk, getVisuals } from '../../utils/lazy'; import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
import { parseAsInteger } from '../../utils/validation'; import { parseAsInteger } from '../../utils/validation';
type IArg<T> = import('@oclif/parser').args.IArg<T>; type IArg<T> = import('@oclif/parser').args.IArg<T>;

View File

@ -16,10 +16,9 @@
*/ */
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import { stripIndent } from 'common-tags';
import Command from '../../command'; import Command from '../../command';
import * as cf from '../../utils/common-flags'; import * as cf from '../../utils/common-flags';
import { getBalenaSdk } from '../../utils/lazy'; import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { parseAsInteger } from '../../utils/validation'; import { parseAsInteger } from '../../utils/validation';
type IArg<T> = import('@oclif/parser').args.IArg<T>; type IArg<T> = import('@oclif/parser').args.IArg<T>;

View File

@ -16,10 +16,9 @@
*/ */
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import { stripIndent } from 'common-tags';
import Command from '../command'; import Command from '../command';
import * as cf from '../utils/common-flags'; import * as cf from '../utils/common-flags';
import { getBalenaSdk, getVisuals } from '../utils/lazy'; import { getBalenaSdk, getVisuals, stripIndent } from '../utils/lazy';
interface FlagsDef { interface FlagsDef {
help: void; help: void;

View File

@ -16,10 +16,9 @@
*/ */
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import { stripIndent } from 'common-tags';
import Command from '../command'; import Command from '../command';
import * as cf from '../utils/common-flags'; import * as cf from '../utils/common-flags';
import { getBalenaSdk } from '../utils/lazy'; import { getBalenaSdk, stripIndent } from '../utils/lazy';
interface FlagsDef { interface FlagsDef {
help?: void; help?: void;

View File

@ -16,10 +16,9 @@
*/ */
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import { stripIndent } from 'common-tags';
import Command from '../command'; import Command from '../command';
import * as cf from '../utils/common-flags'; import * as cf from '../utils/common-flags';
import { getBalenaSdk } from '../utils/lazy'; import { getBalenaSdk, stripIndent } from '../utils/lazy';
import { ExpectedError } from '../errors'; import { ExpectedError } from '../errors';
interface FlagsDef { interface FlagsDef {

View File

@ -15,9 +15,8 @@
* limitations under the License. * limitations under the License.
*/ */
import { stripIndent } from 'common-tags';
import Command from '../command'; import Command from '../command';
import { getBalenaSdk } from '../utils/lazy'; import { getBalenaSdk, stripIndent } from '../utils/lazy';
export default class LogoutCmd extends Command { export default class LogoutCmd extends Command {
public static description = stripIndent` public static description = stripIndent`

View File

@ -16,12 +16,11 @@
*/ */
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import { stripIndent } from 'common-tags';
import * as _ from 'lodash'; import * as _ from 'lodash';
import Command from '../command'; import Command from '../command';
import { ExpectedError } from '../errors'; import { ExpectedError } from '../errors';
import * as cf from '../utils/common-flags'; import * as cf from '../utils/common-flags';
import { getBalenaSdk } from '../utils/lazy'; import { getBalenaSdk, stripIndent } from '../utils/lazy';
interface FlagsDef { interface FlagsDef {
device?: string; // device UUID device?: string; // device UUID

View File

@ -18,14 +18,13 @@
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import type * as BalenaSdk from 'balena-sdk'; import type * as BalenaSdk from 'balena-sdk';
import Bluebird = require('bluebird'); import Bluebird = require('bluebird');
import { stripIndent } from 'common-tags';
import * as _ from 'lodash'; import * as _ from 'lodash';
import * as path from 'path'; import * as path from 'path';
import Command from '../../command'; import Command from '../../command';
import { ExpectedError } from '../../errors'; import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags'; import * as cf from '../../utils/common-flags';
import { getBalenaSdk } from '../../utils/lazy'; import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { CommandHelp } from '../../utils/oclif-utils'; import { CommandHelp } from '../../utils/oclif-utils';
const BOOT_PARTITION = 1; const BOOT_PARTITION = 1;

View File

@ -17,10 +17,9 @@
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import type { LocalBalenaOsDevice } from 'balena-sync'; import type { LocalBalenaOsDevice } from 'balena-sync';
import { stripIndent } from 'common-tags';
import Command from '../command'; import Command from '../command';
import * as cf from '../utils/common-flags'; import * as cf from '../utils/common-flags';
import { getVisuals } from '../utils/lazy'; import { getVisuals, stripIndent } from '../utils/lazy';
interface FlagsDef { interface FlagsDef {
verbose: boolean; verbose: boolean;

View File

@ -16,10 +16,9 @@
*/ */
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import { stripIndent } from 'common-tags';
import Command from '../command'; import Command from '../command';
import * as cf from '../utils/common-flags'; import * as cf from '../utils/common-flags';
import { getBalenaSdk } from '../utils/lazy'; import { getBalenaSdk, stripIndent } from '../utils/lazy';
interface FlagsDef { interface FlagsDef {
help: void; help: void;

View File

@ -16,11 +16,10 @@
*/ */
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import { stripIndent } from 'common-tags';
import Command from '../../command'; import Command from '../../command';
import { ExpectedError } from '../../errors'; import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags'; import * as cf from '../../utils/common-flags';
import { getBalenaSdk } from '../../utils/lazy'; import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { disambiguateReleaseParam } from '../../utils/normalization'; import { disambiguateReleaseParam } from '../../utils/normalization';
import { tryAsInteger } from '../../utils/validation'; import { tryAsInteger } from '../../utils/validation';

View File

@ -16,11 +16,10 @@
*/ */
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import { stripIndent } from 'common-tags';
import Command from '../../command'; import Command from '../../command';
import { ExpectedError } from '../../errors'; import { ExpectedError } from '../../errors';
import * as cf from '../../utils/common-flags'; import * as cf from '../../utils/common-flags';
import { getBalenaSdk } from '../../utils/lazy'; import { getBalenaSdk, stripIndent } from '../../utils/lazy';
import { disambiguateReleaseParam } from '../../utils/normalization'; import { disambiguateReleaseParam } from '../../utils/normalization';
import { tryAsInteger } from '../../utils/validation'; import { tryAsInteger } from '../../utils/validation';

View File

@ -16,11 +16,10 @@
*/ */
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import { stripIndent } from 'common-tags';
import Command from '../command'; import Command from '../command';
import { ExpectedError } from '../errors'; import { ExpectedError } from '../errors';
import * as cf from '../utils/common-flags'; import * as cf from '../utils/common-flags';
import { getBalenaSdk, getVisuals } from '../utils/lazy'; import { getBalenaSdk, getVisuals, stripIndent } from '../utils/lazy';
import { disambiguateReleaseParam } from '../utils/normalization'; import { disambiguateReleaseParam } from '../utils/normalization';
import { tryAsInteger } from '../utils/validation'; import { tryAsInteger } from '../utils/validation';
import { isV12 } from '../utils/version'; import { isV12 } from '../utils/version';

View File

@ -16,8 +16,8 @@
*/ */
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import { stripIndent } from 'common-tags';
import Command from '../command'; import Command from '../command';
import { stripIndent } from '../utils/lazy';
interface FlagsDef { interface FlagsDef {
all?: boolean; all?: boolean;

View File

@ -15,9 +15,8 @@
* limitations under the License. * limitations under the License.
*/ */
import { stripIndent } from 'common-tags';
import Command from '../command'; import Command from '../command';
import { getBalenaSdk, getVisuals } from '../utils/lazy'; import { getBalenaSdk, getVisuals, stripIndent } from '../utils/lazy';
export default class WhoamiCmd extends Command { export default class WhoamiCmd extends Command {
public static description = stripIndent` public static description = stripIndent`

View File

@ -15,9 +15,8 @@ limitations under the License.
*/ */
import type { CommandDefinition } from 'capitano'; import type { CommandDefinition } from 'capitano';
import { stripIndent } from 'common-tags';
import type * as SDK from 'etcher-sdk'; import type * as SDK from 'etcher-sdk';
import { getChalk, getVisuals } from '../../utils/lazy'; import { getChalk, getVisuals, stripIndent } from '../../utils/lazy';
async function getDrive(options: { async function getDrive(options: {
drive?: string; drive?: string;

View File

@ -16,9 +16,8 @@ limitations under the License.
import type { LogMessage } from 'balena-sdk'; import type { LogMessage } from 'balena-sdk';
import type { CommandDefinition } from 'capitano'; import type { CommandDefinition } from 'capitano';
import { stripIndent } from 'common-tags';
import { getBalenaSdk } from '../utils/lazy'; import { getBalenaSdk, stripIndent } from '../utils/lazy';
import { normalizeUuidProp } from '../utils/normalization'; import { normalizeUuidProp } from '../utils/normalization';
import { validateDotLocalUrl } from '../utils/validation'; import { validateDotLocalUrl } from '../utils/validation';

View File

@ -16,10 +16,9 @@ limitations under the License.
import type { BalenaSDK } from 'balena-sdk'; import type { BalenaSDK } from 'balena-sdk';
import type { CommandDefinition } from 'capitano'; import type { CommandDefinition } from 'capitano';
import { stripIndent } from 'common-tags';
import { ExpectedError } from '../errors'; import { ExpectedError } from '../errors';
import { getBalenaSdk } from '../utils/lazy'; import { getBalenaSdk, stripIndent } from '../utils/lazy';
import { dockerignoreHelp, registrySecretsHelp } from '../utils/messages'; import { dockerignoreHelp, registrySecretsHelp } from '../utils/messages';
import { import {
validateApplicationName, validateApplicationName,

View File

@ -15,9 +15,8 @@ limitations under the License.
*/ */
import type * as BalenaSdk from 'balena-sdk'; import type * as BalenaSdk from 'balena-sdk';
import type { CommandDefinition } from 'capitano'; import type { CommandDefinition } from 'capitano';
import { stripIndent } from 'common-tags';
import { getBalenaSdk } from '../utils/lazy'; import { getBalenaSdk, stripIndent } from '../utils/lazy';
import { validateDotLocalUrl, validateIPAddress } from '../utils/validation'; import { validateDotLocalUrl, validateIPAddress } from '../utils/validation';
async function getContainerId( async function getContainerId(

View File

@ -15,11 +15,10 @@ limitations under the License.
*/ */
import * as Bluebird from 'bluebird'; import * as Bluebird from 'bluebird';
import type { CommandDefinition } from 'capitano'; import type { CommandDefinition } from 'capitano';
import { stripIndent } from 'common-tags';
import * as _ from 'lodash'; import * as _ from 'lodash';
import { createServer, Server, Socket } from 'net'; import { createServer, Server, Socket } from 'net';
import { getBalenaSdk } from '../utils/lazy'; import { getBalenaSdk, stripIndent } from '../utils/lazy';
import { getOnlineTargetUuid } from '../utils/patterns'; import { getOnlineTargetUuid } from '../utils/patterns';
import { tunnelConnectionToDevice } from '../utils/tunnel'; import { tunnelConnectionToDevice } from '../utils/tunnel';

View File

@ -20,8 +20,7 @@ limitations under the License.
*/ */
import type { CommandDefinition } from 'capitano'; import type { CommandDefinition } from 'capitano';
import { stripIndent } from 'common-tags'; import { getChalk, getVisuals, stripIndent } from '../utils/lazy';
import { getChalk, getVisuals } from '../utils/lazy';
export const availableDrives: CommandDefinition<{}, {}> = { export const availableDrives: CommandDefinition<{}, {}> = {
signature: 'util available-drives', signature: 'util available-drives',

View File

@ -16,7 +16,7 @@
*/ */
import * as packageJSON from '../package.json'; import * as packageJSON from '../package.json';
import { onceAsync } from './utils/lazy'; import { onceAsync, stripIndent } from './utils/lazy';
class CliSettings { class CliSettings {
public readonly settings: any; public readonly settings: any;
@ -64,10 +64,9 @@ export const setupSentry = onceAsync(async () => {
return Sentry.getCurrentHub(); return Sentry.getCurrentHub();
}); });
function checkNodeVersion() { async function checkNodeVersion() {
const validNodeVersions = packageJSON.engines.node; const validNodeVersions = packageJSON.engines.node;
if (!require('semver').satisfies(process.version, validNodeVersions)) { if (!(await import('semver')).satisfies(process.version, validNodeVersions)) {
const { stripIndent } = require('common-tags');
console.warn(stripIndent` console.warn(stripIndent`
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Warning: Node version "${process.version}" does not match required versions "${validNodeVersions}". Warning: Node version "${process.version}" does not match required versions "${validNodeVersions}".

View File

@ -14,12 +14,11 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { BalenaError } from 'balena-errors'; import type { BalenaError } from 'balena-errors';
import { stripIndent } from 'common-tags';
import * as _ from 'lodash'; import * as _ from 'lodash';
import * as os from 'os'; import * as os from 'os';
import { TypedError } from 'typed-error'; import { TypedError } from 'typed-error';
import { getChalk } from './utils/lazy'; import { getChalk, stripIndent } from './utils/lazy';
import { getHelp } from './utils/messages'; import { getHelp } from './utils/messages';
export class ExpectedError extends TypedError {} export class ExpectedError extends TypedError {}

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { stripIndent } from 'common-tags'; import { stripIndent } from './utils/lazy';
import { exitWithExpectedError } from './errors'; import { exitWithExpectedError } from './errors';

View File

@ -16,8 +16,8 @@
*/ */
import type * as SDK from 'balena-sdk'; import type * as SDK from 'balena-sdk';
import { stripIndent } from 'common-tags';
import * as _ from 'lodash'; import * as _ from 'lodash';
import { stripIndent } from './lazy';
import { ExpectedError } from '../errors'; import { ExpectedError } from '../errors';

View File

@ -16,10 +16,9 @@
*/ */
import * as Bluebird from 'bluebird'; import * as Bluebird from 'bluebird';
import { stripIndent } from 'common-tags';
import * as path from 'path'; import * as path from 'path';
import { getChalk } from './lazy'; import { getChalk, stripIndent } from './lazy';
export const appendProjectOptions = (opts) => export const appendProjectOptions = (opts) =>
opts.concat([ opts.concat([

View File

@ -16,7 +16,6 @@
*/ */
import { BalenaSDK } from 'balena-sdk'; import { BalenaSDK } from 'balena-sdk';
import * as Bluebird from 'bluebird'; import * as Bluebird from 'bluebird';
import { stripIndent } from 'common-tags';
import type * as Dockerode from 'dockerode'; import type * as Dockerode from 'dockerode';
import * as _ from 'lodash'; import * as _ from 'lodash';
import { promises as fs } from 'fs'; import { promises as fs } from 'fs';
@ -25,6 +24,7 @@ import { Composition } from 'resin-compose-parse';
import * as MultiBuild from 'resin-multibuild'; import * as MultiBuild from 'resin-multibuild';
import { Readable } from 'stream'; import { Readable } from 'stream';
import * as tar from 'tar-stream'; import * as tar from 'tar-stream';
import { stripIndent } from './lazy';
import { ExpectedError } from '../errors'; import { ExpectedError } from '../errors';
import { getBalenaSdk, getChalk } from '../utils/lazy'; import { getBalenaSdk, getChalk } from '../utils/lazy';

View File

@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import type { ContainerInfo } from 'dockerode'; import type { ContainerInfo } from 'dockerode';
import { stripIndent } from '../lazy';
export interface DeviceSSHOpts { export interface DeviceSSHOpts {
address: string; address: string;
@ -31,7 +32,6 @@ export async function performLocalDeviceSSH(
const reduce = await import('lodash/reduce'); const reduce = await import('lodash/reduce');
const { spawnSshAndExitOnError } = await import('../ssh'); const { spawnSshAndExitOnError } = await import('../ssh');
const { ExpectedError } = await import('../../errors'); const { ExpectedError } = await import('../../errors');
const { stripIndent } = await import('common-tags');
let command = ''; let command = '';

View File

@ -16,7 +16,7 @@
*/ */
import { flags } from '@oclif/command'; import { flags } from '@oclif/command';
import { stripIndent } from 'common-tags'; import { stripIndent } from './lazy';
import { ExpectedError } from '../errors'; import { ExpectedError } from '../errors';

View File

@ -19,6 +19,7 @@ limitations under the License.
import type * as BalenaSdk from 'balena-sdk'; import type * as BalenaSdk from 'balena-sdk';
import type { Chalk } from 'chalk'; import type { Chalk } from 'chalk';
import type * as visuals from 'resin-cli-visuals'; import type * as visuals from 'resin-cli-visuals';
import type { stripIndent as StripIndent } from 'common-tags';
// Equivalent of _.once but avoiding the need to import lodash for lazy deps // Equivalent of _.once but avoiding the need to import lodash for lazy deps
const once = <T>(fn: () => T) => { const once = <T>(fn: () => T) => {
@ -50,3 +51,7 @@ export const getVisuals = once(
); );
export const getChalk = once(() => require('chalk') as Chalk); export const getChalk = once(() => require('chalk') as Chalk);
// Directly export stripIndent as we always use it immediately, but importing just `stripIndent` reduces startup time
// tslint:disable-next-line:no-var-requires
export const stripIndent = require('common-tags/lib/stripIndent') as typeof StripIndent;

View File

@ -16,12 +16,11 @@ limitations under the License.
import { BalenaApplicationNotFound } from 'balena-errors'; import { BalenaApplicationNotFound } from 'balena-errors';
import type * as BalenaSdk from 'balena-sdk'; import type * as BalenaSdk from 'balena-sdk';
import Bluebird = require('bluebird'); import Bluebird = require('bluebird');
import { stripIndent } from 'common-tags';
import _ = require('lodash'); import _ = require('lodash');
import _form = require('resin-cli-form'); import _form = require('resin-cli-form');
import { exitWithExpectedError, instanceOf, NotLoggedInError } from '../errors'; import { exitWithExpectedError, instanceOf, NotLoggedInError } from '../errors';
import { getBalenaSdk, getVisuals } from './lazy'; import { getBalenaSdk, getVisuals, stripIndent } from './lazy';
import validation = require('./validation'); import validation = require('./validation');
import { isV12 } from './version'; import { isV12 } from './version';

View File

@ -15,10 +15,9 @@
* limitations under the License. * limitations under the License.
*/ */
import type * as BalenaSdk from 'balena-sdk'; import type * as BalenaSdk from 'balena-sdk';
import { stripIndent } from 'common-tags';
import { ExpectedError, printErrorMessage } from '../errors'; import { ExpectedError, printErrorMessage } from '../errors';
import { getVisuals } from './lazy'; import { getVisuals, stripIndent } from './lazy';
import Logger = require('./logger'); import Logger = require('./logger');
import { exec, execBuffered, getDeviceOsRelease } from './ssh'; import { exec, execBuffered, getDeviceOsRelease } from './ssh';

View File

@ -16,9 +16,8 @@
*/ */
import * as Bluebird from 'bluebird'; import * as Bluebird from 'bluebird';
import { stripIndent } from 'common-tags';
import type * as Dockerode from 'dockerode'; import type * as Dockerode from 'dockerode';
import { getBalenaSdk } from './lazy'; import { getBalenaSdk, stripIndent } from './lazy';
import Logger = require('./logger'); import Logger = require('./logger');
export const QEMU_VERSION = 'v4.0.0+balena2'; export const QEMU_VERSION = 'v4.0.0+balena2';

View File

@ -26,7 +26,7 @@ import type { Pack } from 'tar-stream';
import { ExpectedError } from '../errors'; import { ExpectedError } from '../errors';
import { exitWithExpectedError } from '../errors'; import { exitWithExpectedError } from '../errors';
import { tarDirectory } from './compose'; import { tarDirectory } from './compose';
import { getVisuals } from './lazy'; import { getVisuals, stripIndent } from './lazy';
import Logger = require('./logger'); import Logger = require('./logger');
const globalLogger = Logger.getLogger(); const globalLogger = Logger.getLogger();
@ -183,8 +183,6 @@ function handleHeadlessBuildMessage(message: HeadlessBuilderMessage) {
} }
function handleBuilderMetadata(obj: BuilderMessage, build: RemoteBuild) { function handleBuilderMetadata(obj: BuilderMessage, build: RemoteBuild) {
const { stripIndent } = require('common-tags');
switch (obj.resource) { switch (obj.resource) {
case 'cursor': case 'cursor':
if (obj.value == null) { if (obj.value == null) {

View File

@ -16,7 +16,7 @@
*/ */
import { ChildProcess, spawn, SpawnOptions } from 'child_process'; import { ChildProcess, spawn, SpawnOptions } from 'child_process';
import { stripIndent } from 'common-tags'; import { stripIndent } from './lazy';
/** /**
* Execute a child process with admin / superuser privileges, prompting the user for * Execute a child process with admin / superuser privileges, prompting the user for

View File

@ -19,11 +19,11 @@
require('../config-tests'); // required for side effects require('../config-tests'); // required for side effects
import { expect } from 'chai'; import { expect } from 'chai';
import { stripIndent } from 'common-tags';
import mock = require('mock-require'); import mock = require('mock-require');
import { promises as fs } from 'fs'; import { promises as fs } from 'fs';
import * as path from 'path'; import * as path from 'path';
import { stripIndent } from '../../lib/utils/lazy';
import { BalenaAPIMock } from '../balena-api-mock'; import { BalenaAPIMock } from '../balena-api-mock';
import { expectStreamNoCRLF, testDockerBuildStream } from '../docker-build'; import { expectStreamNoCRLF, testDockerBuildStream } from '../docker-build';
import { DockerMock, dockerResponsePath } from '../docker-mock'; import { DockerMock, dockerResponsePath } from '../docker-mock';

View File

@ -16,7 +16,7 @@
*/ */
import { expect } from 'chai'; import { expect } from 'chai';
import { stripIndent } from 'common-tags'; import { stripIndent } from '../../../lib/utils/lazy';
import { isV12 } from '../../../lib/utils/version'; import { isV12 } from '../../../lib/utils/version';
import { BalenaAPIMock } from '../../balena-api-mock'; import { BalenaAPIMock } from '../../balena-api-mock';

View File

@ -16,7 +16,6 @@
*/ */
import { expect } from 'chai'; import { expect } from 'chai';
import { stripIndent } from 'common-tags';
import * as _ from 'lodash'; import * as _ from 'lodash';
import { promises as fs } from 'fs'; import { promises as fs } from 'fs';
import * as path from 'path'; import * as path from 'path';
@ -27,6 +26,7 @@ import * as tar from 'tar-stream';
import { streamToBuffer } from 'tar-utils'; import { streamToBuffer } from 'tar-utils';
import { URL } from 'url'; import { URL } from 'url';
import { stripIndent } from '../lib/utils/lazy';
import { BuilderMock } from './builder-mock'; import { BuilderMock } from './builder-mock';
import { DockerMock } from './docker-mock'; import { DockerMock } from './docker-mock';
import { cleanOutput, fillTemplateArray, runCommand } from './helpers'; import { cleanOutput, fillTemplateArray, runCommand } from './helpers';

View File

@ -2,6 +2,6 @@
"extends": "./node_modules/@balena/lint/config/tslint-prettier.json", "extends": "./node_modules/@balena/lint/config/tslint-prettier.json",
"rules": { "rules": {
"ignoreDefinitionFiles": false, "ignoreDefinitionFiles": false,
"import-blacklist": [true, "resin-cli-visuals", "chalk"] "import-blacklist": [true, "resin-cli-visuals", "chalk", "common-tags"]
} }
} }