From 7cc821c06f6318dc832c40135792f771e453f037 Mon Sep 17 00:00:00 2001 From: chenos Date: Mon, 7 Feb 2022 21:54:35 +0800 Subject: [PATCH] feat: add plugin-client --- packages/plugin-client/.npmignore | 7 +++++++ packages/plugin-client/package.json | 13 +++++++++++++ packages/plugin-client/src/index.ts | 25 +++++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 packages/plugin-client/.npmignore create mode 100644 packages/plugin-client/package.json create mode 100644 packages/plugin-client/src/index.ts diff --git a/packages/plugin-client/.npmignore b/packages/plugin-client/.npmignore new file mode 100644 index 0000000000..461574b2f4 --- /dev/null +++ b/packages/plugin-client/.npmignore @@ -0,0 +1,7 @@ +node_modules +*.log +docs +__tests__ +tsconfig.json +src +.fatherrc.ts \ No newline at end of file diff --git a/packages/plugin-client/package.json b/packages/plugin-client/package.json new file mode 100644 index 0000000000..4efbbcc10a --- /dev/null +++ b/packages/plugin-client/package.json @@ -0,0 +1,13 @@ +{ + "name": "@nocobase/plugin-client", + "version": "0.6.0-alpha.0", + "main": "lib/index.js", + "license": "MIT", + "dependencies": { + "@nocobase/server": "^0.6.0-alpha.0" + }, + "devDependencies": { + "@nocobase/test": "^0.6.0-alpha.0" + }, + "gitHead": "e7df1f93c4e23b9a666d99ee7372c02bdaec97c4" +} diff --git a/packages/plugin-client/src/index.ts b/packages/plugin-client/src/index.ts new file mode 100644 index 0000000000..f088a3fb7d --- /dev/null +++ b/packages/plugin-client/src/index.ts @@ -0,0 +1,25 @@ +import { Plugin } from '@nocobase/server'; + +export default class PluginClient extends Plugin { + async beforeLoad() { + const cmd = this.app.findCommand('install'); + if (cmd) { + cmd.option('--import-demo'); + cmd.option('--lang [lang]'); + } + + this.app.on('afterInstall', async (app, options) => { + const [opts] = options?.cliArgs || [{}]; + if (opts?.importDemo) { + + } + if (opts?.lang) { + + } + }); + } + + async load() { + + } +}