feat: migrate to esm

This commit is contained in:
2023-03-16 01:58:13 +01:00
parent fd740b3091
commit 4df19e8c20
512 changed files with 3016 additions and 2222 deletions

View File

@@ -16,7 +16,7 @@
import {Logger} from '@openstapps/logger';
import Dockerode from 'dockerode';
import isCidr from 'is-cidr';
import {render} from 'mustache';
import mustache from 'mustache';
import path from 'path';
import * as semver from 'semver';
import {
@@ -28,14 +28,13 @@ import {
sslHardeningParameters,
SupportedLogFormats,
TemplateView,
} from './common';
} from './common.js';
// @ts-expect-error missing type defs
import nodePortScanner from 'node-port-scanner';
/* eslint-disable unicorn/prefer-module */
/* eslint-disable unicorn/no-await-expression-member */
// eslint-disable-next-line @typescript-eslint/no-var-requires
const nodePortScanner = require('node-port-scanner');
/**
* Checks if a ContainerInfo matches a name and version regex
*
@@ -263,7 +262,7 @@ export async function generateMetricsServer(logFormat: string, enableMetrics?: b
async function renderTemplate(path: string, view: unknown): Promise<string> {
const content = await asyncReadFile(path, 'utf8');
return render(content, view);
return mustache.render(content, view);
}
/**