From 6c5e35f68d2c179f980107193fd279272d9edc08 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 16 Jan 2023 15:02:27 +0200 Subject: [PATCH] fix: Remove copy plugins folder functionality --- packages/cli/src/commands/build/build.js | 2 -- packages/cli/src/commands/dev/dev.js | 2 -- packages/cli/src/utils/copyPluginsFolder.js | 35 --------------------- 3 files changed, 39 deletions(-) delete mode 100644 packages/cli/src/utils/copyPluginsFolder.js diff --git a/packages/cli/src/commands/build/build.js b/packages/cli/src/commands/build/build.js index 292716474..f7b4b7a04 100644 --- a/packages/cli/src/commands/build/build.js +++ b/packages/cli/src/commands/build/build.js @@ -15,7 +15,6 @@ */ import addCustomPluginsAsDeps from '../../utils/addCustomPluginsAsDeps.js'; -import copyPluginsFolder from '../../utils/copyPluginsFolder.js'; import getServer from '../../utils/getServer.js'; import installServer from '../../utils/installServer.js'; import readDotEnv from '../../utils/readDotEnv.js'; @@ -27,7 +26,6 @@ async function build({ context }) { readDotEnv(context); const directory = context.directories.server; await getServer({ context, packageName: '@lowdefy/server', directory }); - await copyPluginsFolder({ context, directory }); await addCustomPluginsAsDeps({ context, directory }); await installServer({ context, directory }); await runLowdefyBuild({ context, directory }); diff --git a/packages/cli/src/commands/dev/dev.js b/packages/cli/src/commands/dev/dev.js index cd454e97b..17c29a670 100644 --- a/packages/cli/src/commands/dev/dev.js +++ b/packages/cli/src/commands/dev/dev.js @@ -15,7 +15,6 @@ */ import addCustomPluginsAsDeps from '../../utils/addCustomPluginsAsDeps.js'; -import copyPluginsFolder from '../../utils/copyPluginsFolder.js'; import installServer from '../../utils/installServer.js'; import runDevServer from './runDevServer.js'; import getServer from '../../utils/getServer.js'; @@ -24,7 +23,6 @@ async function dev({ context }) { const directory = context.directories.dev; context.print.info('Starting development server.'); await getServer({ context, packageName: '@lowdefy/server-dev', directory }); - await copyPluginsFolder({ context, directory }); await addCustomPluginsAsDeps({ context, directory }); await installServer({ context, directory }); context.sendTelemetry(); diff --git a/packages/cli/src/utils/copyPluginsFolder.js b/packages/cli/src/utils/copyPluginsFolder.js deleted file mode 100644 index 19d6d12c4..000000000 --- a/packages/cli/src/utils/copyPluginsFolder.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - Copyright 2020-2022 Lowdefy, Inc - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -import path from 'path'; -import fs from 'fs'; -import { cleanDirectory, copyDirectory } from '@lowdefy/node-utils'; - -async function copyPluginsFolder({ context, directory }) { - if (context.directories.config === directory) return; - if (!fs.existsSync(path.join(context.directories.config, 'plugins'))) return; - - await cleanDirectory(path.join(directory, 'plugins')); - await copyDirectory( - path.join(context.directories.config, 'plugins'), - path.join(directory, 'plugins'), - { - filter: (path) => !path.includes('node_modules'), - } - ); -} - -export default copyPluginsFolder;