@tuzki/cli
Version:
🐇 lowcode-cli is an efficient cli tool for Rabbitpre plugin component secondary development. ❤️
46 lines (45 loc) • 1.86 kB
JavaScript
/*
* 获取内置工程化插件
*
* @Author: xu.jin
* @Date: 2022-11-15 09:52:29
*
* Copyright © 2014-2022 Rabbitpre.com. All Rights Reserved.
*/
import pluginBusiness from '@tuzki/scaffold-plugin-business';
import pluginCenterModule from '@tuzki/scaffold-plugin-center-module';
import pluginCmplib from '@tuzki/scaffold-plugin-cmplib';
import pluginCore from '@tuzki/scaffold-plugin-core';
import pluginRendererExtension from '@tuzki/scaffold-plugin-renderer-extension';
import pluginComponent from '@tuzki/scaffold-plugin-component';
import Logger from '@tuzki/scaffold-logger';
const logger = Logger.get('cli:plugins');
const getBuiltInPlugins = userConfig => {
const { presetType, frameworkType = 'react', moduleName } = userConfig;
logger.debug('创建配置:', userConfig);
const corePlugin = pluginCore({ presetType, frameworkType });
// 应用核心插件
const plugins = [corePlugin];
// 组件库特有插件
if (presetType === "cmplib" /* ProjectType.CMPLIB */) {
plugins.push(pluginCmplib({ moduleName, presetType }));
}
// 渲染器拓展模块特有插件
if (presetType === "renderer-extension" /* ProjectType.RENDERER_EXTENSION */) {
plugins.push(pluginRendererExtension({ moduleName, presetType }));
}
// 业务插件
if (presetType === "business" /* ProjectType.BUSINESS */) {
plugins.push(pluginBusiness({ moduleName, presetType }));
}
// 组件插件
if (presetType === "component" /* ProjectType.COMPONENT */) {
plugins.push(pluginComponent({ moduleName, presetType }));
}
// 插件中心模块特有插件
if (presetType === "plugin-center-module" /* ProjectType.PLUGIN_CENTER_MODULE */) {
plugins.push(pluginCenterModule({ moduleName, presetType }));
}
return plugins;
};
export default getBuiltInPlugins;