From 9522c15ecde76618888f74a653b6e373e2ede2ea Mon Sep 17 00:00:00 2001 From: Christina Ying Wang Date: Mon, 20 Feb 2023 17:38:05 -0800 Subject: [PATCH] Change constants imports to remove 'require' Signed-off-by: Christina Ying Wang --- src/compose/app.ts | 2 +- src/compose/application-manager.ts | 2 +- src/compose/service-manager.ts | 2 +- src/compose/volume-manager.ts | 2 +- src/compose/volume.ts | 2 +- src/device-state.ts | 2 +- src/device-state/target-state.ts | 2 +- src/lib/blink.ts | 4 ++-- test/integration/config.spec.ts | 2 +- test/integration/lib/firewall.spec.ts | 7 +++---- 10 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/compose/app.ts b/src/compose/app.ts index 9d49440a..32742577 100644 --- a/src/compose/app.ts +++ b/src/compose/app.ts @@ -14,7 +14,7 @@ import { } from './composition-steps'; import * as targetStateCache from '../device-state/target-state-cache'; import * as dockerUtils from '../lib/docker-utils'; -import constants = require('../lib/constants'); +import * as constants from '../lib/constants'; import { getStepsFromStrategy } from './update-strategies'; diff --git a/src/compose/application-manager.ts b/src/compose/application-manager.ts index 05e78be3..34dccb17 100644 --- a/src/compose/application-manager.ts +++ b/src/compose/application-manager.ts @@ -9,7 +9,7 @@ import LocalModeManager from '../local-mode'; import * as dbFormat from '../device-state/db-format'; import { validateTargetContracts } from '../lib/contracts'; -import constants = require('../lib/constants'); +import * as constants from '../lib/constants'; import { docker } from '../lib/docker-utils'; import log from '../lib/supervisor-console'; import { diff --git a/src/compose/service-manager.ts b/src/compose/service-manager.ts index 150509aa..90279e06 100644 --- a/src/compose/service-manager.ts +++ b/src/compose/service-manager.ts @@ -12,7 +12,7 @@ import { docker } from '../lib/docker-utils'; import * as logger from '../logger'; import { PermissiveNumber } from '../config/types'; -import constants = require('../lib/constants'); +import * as constants from '../lib/constants'; import { InternalInconsistencyError, isNotFoundError, diff --git a/src/compose/volume-manager.ts b/src/compose/volume-manager.ts index 8004a9ce..f6ff61a7 100644 --- a/src/compose/volume-manager.ts +++ b/src/compose/volume-manager.ts @@ -2,7 +2,7 @@ import * as _ from 'lodash'; import * as Path from 'path'; import { VolumeInspectInfo } from 'dockerode'; -import constants = require('../lib/constants'); +import * as constants from '../lib/constants'; import { isNotFoundError, InternalInconsistencyError } from '../lib/errors'; import { safeRename } from '../lib/fs-utils'; import { docker } from '../lib/docker-utils'; diff --git a/src/compose/volume.ts b/src/compose/volume.ts index b9514bad..976eb507 100644 --- a/src/compose/volume.ts +++ b/src/compose/volume.ts @@ -2,7 +2,7 @@ import * as Docker from 'dockerode'; import isEqual = require('lodash/isEqual'); import omitBy = require('lodash/omitBy'); -import constants = require('../lib/constants'); +import * as constants from '../lib/constants'; import { docker } from '../lib/docker-utils'; import { InternalInconsistencyError } from '../lib/errors'; import * as LogTypes from '../lib/log-types'; diff --git a/src/device-state.ts b/src/device-state.ts index 86323c1a..476ca934 100644 --- a/src/device-state.ts +++ b/src/device-state.ts @@ -15,7 +15,7 @@ import * as globalEventBus from './event-bus'; import * as network from './network'; import * as deviceConfig from './device-config'; -import constants = require('./lib/constants'); +import * as constants from './lib/constants'; import * as dbus from './lib/dbus'; import { InternalInconsistencyError, diff --git a/src/device-state/target-state.ts b/src/device-state/target-state.ts index eff181f4..7281b4cb 100644 --- a/src/device-state/target-state.ts +++ b/src/device-state/target-state.ts @@ -10,7 +10,7 @@ import { InternalInconsistencyError } from '../lib/errors'; import { getGotInstance } from '../lib/request'; import * as config from '../config'; import { writeLock } from '../lib/update-lock'; -import constants = require('../lib/constants'); +import * as constants from '../lib/constants'; import log from '../lib/supervisor-console'; export class ApiResponseError extends Error {} diff --git a/src/lib/blink.ts b/src/lib/blink.ts index 6997e69f..71505ed9 100644 --- a/src/lib/blink.ts +++ b/src/lib/blink.ts @@ -1,5 +1,5 @@ import blinking = require('blinking'); -import constants = require('./constants'); +import { ledFile } from './constants'; -export = blinking(constants.ledFile); +export = blinking(ledFile); diff --git a/test/integration/config.spec.ts b/test/integration/config.spec.ts index ecdc3dc0..9c91d8f4 100644 --- a/test/integration/config.spec.ts +++ b/test/integration/config.spec.ts @@ -6,7 +6,7 @@ import { expect } from 'chai'; import { testfs, TestFs } from 'mocha-pod'; import * as hostUtils from '~/lib/host-utils'; -import constants = require('~/lib/constants'); +import * as constants from '~/lib/constants'; import { fnSchema } from '~/src/config/functions'; // Utility method to use along with `require` diff --git a/test/integration/lib/firewall.spec.ts b/test/integration/lib/firewall.spec.ts index e25fe375..9a272886 100644 --- a/test/integration/lib/firewall.spec.ts +++ b/test/integration/lib/firewall.spec.ts @@ -1,16 +1,15 @@ -import _ = require('lodash'); +import * as _ from 'lodash'; import { expect } from 'chai'; - import * as sinon from 'sinon'; import * as config from '~/src/config'; -import * as firewall from '~/lib/firewall'; import * as logger from '~/src/logger'; import * as iptablesMock from '~/test-lib/mocked-iptables'; import * as dbFormat from '~/src/device-state/db-format'; -import constants = require('~/lib/constants'); import * as iptables from '~/lib/iptables'; +import * as firewall from '~/lib/firewall'; +import * as constants from '~/lib/constants'; import { RuleAction, Rule } from '~/lib/iptables'; import { log } from '~/lib/supervisor-console';