@fontoxml/fontoxml-development-tools
Version:
Development tools for Fonto.
104 lines (88 loc) • 3 kB
JavaScript
import path from 'path';
/** @typedef {import('../shared/src/addBackendDockerCommands').AddBackendDockerCommandsOptions} AddBackendDockerCommandsOptions */
export default async (moduleRegistration) => {
/** @type {AddBackendDockerCommandsOptions} */
const options = {
licenseProductName: 'content-quality',
licensesRequired: ['content-quality'],
productLabel: 'Fonto Content Quality',
commandPrefix: 'content-quality',
commandAlias: 'fcq',
documentationConfigurationGuide:
'https://documentation.fontoxml.com/latest/configuration-f6814dd919fd',
documentationExecuteError:
'https://documentation.fontoxml.com/latest/troubleshooting-fc105f9f1e60',
documentationGettingStartedGuide:
'https://documentation.fontoxml.com/latest/getting-started-86c3404e841c',
defaultHttpPort: 6000,
defaultImageName: 'fonto-content-quality',
defaultImageTag: 'latest',
manifestFileName: '.fontoxmlFcqManifest',
manifestVersionPropertyName: 'fcqVersion',
instanceBuildDockerfilePath: path.join(
moduleRegistration.getPath(),
'assets',
'instanceBuild',
'Dockerfile',
),
instanceDevBuildDirectoryPath: path.join(
moduleRegistration.getPath(),
'assets',
'instanceDevBuild',
),
instanceDevBuildDockerfilePath: path.join(
moduleRegistration.getPath(),
'assets',
'instanceBuild',
'Dockerfile',
),
instanceTemplateDirectoryPath: path.join(
moduleRegistration.getPath(),
'assets',
'instanceTemplate',
),
requiredConfiguration: ['Configuration'],
temporaryDirectoryName: '.contentQualityTmp',
temporaryBuildDirectoryName: '.contentQualityBuildTmp',
whitelist: [
// Required.
'Configuration',
// Optional.
'nlog.config',
],
debugEnvEntries: {
Logging__LogLevel__Default: 'Trace',
},
};
const command = moduleRegistration
.registerCommand(options.commandPrefix)
.setDescription(
`Provides tools for working with ${options.productLabel}.`
)
.addRequiredProductLicenses(options.licensesRequired)
.setHideIfMissingRequiredProductLicenses()
.setAsHelpCommand();
if (options.commandAlias) {
command.addAlias(options.commandAlias);
}
const sharedModuleName = '@fontoxml/fontoxml-development-tools-module-shared';
// Add the docker based commands.
const addBackendDockerCommands = await moduleRegistration.getExportFromModule(
sharedModuleName,
'addBackendDockerCommands',
);
addBackendDockerCommands(moduleRegistration, command, options);
// Add the version commands.
const addBackendVersionsCommands = await moduleRegistration.getExportFromModule(
sharedModuleName,
'addBackendVersionsCommands',
);
addBackendVersionsCommands(moduleRegistration, command, options);
// Add the download-self-contained command.
const addBackendDownloadSelfContainedCommands =
await moduleRegistration.getExportFromModule(
sharedModuleName,
'addBackendDownloadSelfContainedCommands',
);
addBackendDownloadSelfContainedCommands(moduleRegistration, command, options);
};