UNPKG

@lark-project/cli

Version:

飞书项目插件开发工具

40 lines (39 loc) 1.43 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.isPluginProject = void 0; const fs_extra_1 = __importDefault(require("fs-extra")); const types_1 = require("../types"); const is_empty_dir_1 = require("./is-empty-dir"); const get_project_directory_1 = require("./get-project-directory"); const resolve_project_path_1 = require("./resolve-project-path"); function isPluginProject() { const rootPath = (0, get_project_directory_1.getProjectDirectory)(); if ((0, is_empty_dir_1.isEmptyDir)(rootPath)) { return [false, undefined]; } // is v1 framework try { const manifestPath = (0, resolve_project_path_1.resolveProjectPath)('manifest.json'); if (fs_extra_1.default.existsSync(manifestPath)) { return [true, types_1.EPluginFrameworkVersion.v1]; } } catch (e) { // do nothing } // is v2 framework try { const pluginConfigPath = (0, resolve_project_path_1.resolveProjectPath)('plugin.config.json'); if (fs_extra_1.default.existsSync(pluginConfigPath)) { return [true, types_1.EPluginFrameworkVersion.v2]; } } catch (e) { // do nothing } return [false, undefined]; } exports.isPluginProject = isPluginProject;