@fontoxml/fontoxml-development-tools
Version:
Development tools for Fonto.
67 lines (57 loc) • 2.19 kB
JavaScript
import path from 'path';
import commandConvertEditor from '../editor/src/commands/command.convert.editor.js';
import commandConvertPackage from '../editor/src/commands/command.convert.package.js';
import commandBuild from './src/command.build.js';
import commandInit from './src/command.init.js';
import commandRun from './src/command.run.js';
import commandSchemaCompileSchema from './src/command.schema.compile.js';
import commandUpgrade from './src/command.upgrade.js';
import commandVersion from './src/command.version.js';
import commandVersions from './src/command.versions.js';
export default (moduleRegistration) => {
const editorCommand = moduleRegistration
.registerCommand('editor')
.setDescription(
'Tools for creating, upgrading, building, and running Fonto Editor.'
)
.setAsHelpCommand();
// Editor commands
commandInit(moduleRegistration, editorCommand);
commandUpgrade(moduleRegistration, editorCommand);
commandBuild(moduleRegistration, editorCommand);
commandRun(moduleRegistration, editorCommand);
commandVersion(moduleRegistration, editorCommand);
commandVersions(moduleRegistration, editorCommand);
// Editor convert commands
const convertCommand = editorCommand
.addCommand('convert-for-770')
.setDescription(
'Tools for converting from pre Fonto 7.7.0 to a Fonto 7.7.0 codebase.'
)
.setAsHelpCommand();
// The current ModuleRegistration could be either editor or editor-pre-7-7-0. But for some
// commands the editor path is needed.
const editorModulePath = path.resolve(
moduleRegistration.getPath(),
'..',
'editor',
);
commandConvertEditor(moduleRegistration, convertCommand, editorModulePath);
commandConvertPackage(moduleRegistration, convertCommand, editorModulePath);
// Editor schema commands
const schemaCommand = editorCommand
.addCommand('schema')
.setDescription('Tools for compiling the schema.')
.setAsHelpCommand();
commandSchemaCompileSchema(moduleRegistration, schemaCommand);
// Register the exports for this module.
moduleRegistration.registerExport(
'downloadEditorSDK',
path.resolve(
moduleRegistration.getPath(),
'src',
'api',
'downloadEditorSDK.js',
),
);
};