balena-supervisor/src
Felipe Lalanne 48e0733c7e Remove side effects for module imports
The supervisor uses the following pattern for async module
initialization

```typescript
// module.ts

export const initialised = (async () => {
    // do some async initialization
})();

// somewhere else
import * as module from 'module';

async function setup() {
  await module.initialise;
}
```

The above pattern means that whenever the module is imported, the
initialisation procedure will be ran, which is an anti-pattern.

This converts any instance of this pattern into a function

```typescript
export const initialised = _.once(async () => {
    // do some async initialization
});
```

And anywhere else on the code it replaces the call with a

```typescript
await module.initialised();
```

Change-type: patch
2022-09-06 15:48:18 -04:00
..
api-binder Remove side effects for module imports 2022-09-06 15:48:18 -04:00
compose Remove side effects for module imports 2022-09-06 15:48:18 -04:00
config Remove side effects for module imports 2022-09-06 15:48:18 -04:00
device-api Remove side effects for module imports 2022-09-06 15:48:18 -04:00
device-state Remove side effects for module imports 2022-09-06 15:48:18 -04:00
lib Remove side effects for module imports 2022-09-06 15:48:18 -04:00
logging Fix the "already delayed by" calculation 2021-12-10 15:54:30 +00:00
migrations Fix database migration for legacyApps 2022-04-01 17:58:20 -03:00
types Refactor current state report to patch v3 state 2022-03-22 19:28:36 -03:00
app.ts Ensure happy-eyeballs uses supervisor dns lookup 2021-12-16 11:59:59 -03:00
db.ts Remove side effects for module imports 2022-09-06 15:48:18 -04:00
device-config.ts Cleanup current state reporting methods 2022-03-22 19:08:03 -03:00
device-state.ts Remove side effects for module imports 2022-09-06 15:48:18 -04:00
event-bus.ts Add newTargetState event and use it for backup loading 2020-04-07 14:50:34 +01:00
event-tracker.ts Remove side effects for module imports 2022-09-06 15:48:18 -04:00
host-config.ts Allow host config patch regardless of running applications 2022-07-06 12:41:51 -07:00
local-mode.ts Backwards compatility changes for old resin namespaces 2021-05-06 17:05:26 +00:00
logger.ts Remove side effects for module imports 2022-09-06 15:48:18 -04:00
network.ts Add support for local ipv6 reporting 2022-02-08 19:06:13 -03:00
proxyvisor.js Remove side effects for module imports 2022-09-06 15:48:18 -04:00
supervisor-api.ts Remove side effects for module imports 2022-09-06 15:48:18 -04:00
supervisor.ts Remove side effects for module imports 2022-09-06 15:48:18 -04:00