feat(cli): Copy plugins folder to server.

This commit is contained in:
Sam 2022-03-03 13:04:48 +02:00
parent d66d395e01
commit 9f4ff92573
No known key found for this signature in database
GPG Key ID: D004126FCD1A6DF0
2 changed files with 33 additions and 0 deletions

View File

@ -15,6 +15,7 @@
*/
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 mergePackageJson from '../../utils/mergePackageJson.js';
@ -29,6 +30,7 @@ async function build({ context }) {
context,
serverDirectory: directory,
});
await copyPluginsFolder({ context });
await addCustomPluginsAsDeps({ context, directory });
await installServer({ context, directory });
await runLowdefyBuild({ context, directory });

View File

@ -0,0 +1,31 @@
/*
Copyright 2020-2021 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 { copyDirectory } from '@lowdefy/node-utils';
async function copyPluginsFolder({ context }) {
if (context.directories.config === context.directories.server) return;
if (!fs.existsSync(path.resolve(context.directories.config, 'plugins'))) return;
await copyDirectory(
path.resolve(context.directories.config, 'plugins'),
path.resolve(context.directories.server, 'plugins')
);
}
export default copyPluginsFolder;