@fontoxml/fontoxml-development-tools
Version:
Development tools for Fonto.
101 lines (85 loc) • 2.92 kB
JavaScript
import path from 'path';
/** @typedef {import('../shared/src/addBackendDockerCommands').AddBackendDockerCommandsOptions} AddBackendDockerCommandsOptions */
export default async (moduleRegistration) => {
/** @type {AddBackendDockerCommandsOptions} */
const options = {
licenseProductName: 'schema-compiler',
licensesRequired: ['editor'],
productLabel: 'Fonto Schema Compiler',
commandPrefix: 'schema-compiler',
documentationConfigurationGuide:
'https://documentation.fontoxml.com/latest/editor-b4ee7cad8e30',
documentationExecuteError:
'https://documentation.fontoxml.com/latest/editor-b4ee7cad8e30',
documentationGettingStartedGuide:
'https://documentation.fontoxml.com/latest/editor-b4ee7cad8e30',
defaultHttpPort: 6040,
defaultImageName: 'fonto-schema-compiler',
defaultImageTag: 'latest',
manifestFileName: '.fontoxmlSchemaCompilerManifest',
manifestVersionPropertyName: 'schemaCompilerVersion',
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: [],
temporaryDirectoryName: '.schemaCompilerTmp',
temporaryBuildDirectoryName: '.schemaCompilerBuildTmp',
whitelist: [
// Optional.
'nlog.config',
],
debugEnvEntries: {
Logging__LogLevel__Default: 'Trace',
},
};
const command = moduleRegistration
.registerHiddenCommand(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);
};