This commit is contained in:
Balena CI 2022-09-06 21:05:01 -04:00 committed by VersionBot
parent 5b0438ae49
commit 42dd4f75ac
6 changed files with 56 additions and 5 deletions

View File

@ -1,3 +1,49 @@
- commits:
- subject: Remove side effects for module imports
hash: 48e0733c7e734b401f6072df5a396dfc04075d98
body: |
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();
```
footer:
Change-type: patch
change-type: patch
author: Felipe Lalanne
nested: []
version: 14.0.17
title: "'Remove side effects for module imports'"
date: 2022-09-06T19:50:43.463Z
- commits: - commits:
- subject: Add custom DTB support for imx8mm-var-som - subject: Add custom DTB support for imx8mm-var-som
hash: 36544b7d6e53c8a501a6def40ac0370346e63b78 hash: 36544b7d6e53c8a501a6def40ac0370346e63b78

View File

@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY! automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
This project adheres to [Semantic Versioning](http://semver.org/). This project adheres to [Semantic Versioning](http://semver.org/).
# v14.0.17
## (2022-09-06)
* Remove side effects for module imports [Felipe Lalanne]
# v14.0.16 # v14.0.16
## (2022-09-06) ## (2022-09-06)

View File

@ -1 +1 @@
14.0.16 14.0.17

View File

@ -2,6 +2,6 @@ name: balena-supervisor
description: 'Balena Supervisor: balena''s agent on devices.' description: 'Balena Supervisor: balena''s agent on devices.'
joinable: false joinable: false
type: sw.application type: sw.application
version: 14.0.16 version: 14.0.17
provides: provides:
- slug: sw.compose.long-volume-syntax - slug: sw.compose.long-volume-syntax

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "balena-supervisor", "name": "balena-supervisor",
"version": "14.0.16", "version": "14.0.17",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,7 +1,7 @@
{ {
"name": "balena-supervisor", "name": "balena-supervisor",
"description": "This is balena's Supervisor, a program that runs on IoT devices and has the task of running user Apps (which are Docker containers), and updating them as the balena API informs it to.", "description": "This is balena's Supervisor, a program that runs on IoT devices and has the task of running user Apps (which are Docker containers), and updating them as the balena API informs it to.",
"version": "14.0.16", "version": "14.0.17",
"license": "Apache-2.0", "license": "Apache-2.0",
"repository": { "repository": {
"type": "git", "type": "git",
@ -140,6 +140,6 @@
} }
}, },
"versionist": { "versionist": {
"publishedAt": "2022-09-06T14:36:03.587Z" "publishedAt": "2022-09-06T19:50:43.834Z"
} }
} }