Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow users to disable plugins via config #5031

Merged
merged 4 commits into from Mar 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -54,3 +54,5 @@ imports/plugins/custom/*
.reaction/config.json

coverage/*

.reaction/pluginConfig.js
6 changes: 6 additions & 0 deletions .reaction/pluginConfig.js
@@ -0,0 +1,6 @@
// Place directory names here that want to not be included in the build
const disabledPlugins = [];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment above here explaining what goes in the array? At first glance I would have thought the plugin's name, but it looks like actually the directory name.

Also, should we gitignore this file? (after this initial commit)


module.exports = {
disabledPlugins
};
7 changes: 4 additions & 3 deletions .reaction/run/loadPlugins.mjs
Expand Up @@ -4,6 +4,7 @@ import childProcess from 'child_process';
import _ from 'lodash';
import Log from './logger';
import { exists, getDirectories } from './fs';
import pluginConfig from "../pluginConfig";

// add a message to the top of the plugins import file
const importFileMessage = `
Expand Down Expand Up @@ -59,9 +60,9 @@ function getImportPaths(baseDirPath) {
};

// get all plugin directories at provided base path
// (ignore directories starting with a dot '.')
const pluginDirs = _.reject(getDirectories(baseDirPath), (d) => d.charAt(0) === '.');

// (ignore directories starting with a dot '.' or any directories in disabledPlugins)
const { disabledPlugins } = pluginConfig;
const pluginDirs = _.reject(getDirectories(baseDirPath), (d) => d.charAt(0) === '.' || _.includes(disabledPlugins, d));
const clientImportPaths = [];
const serverImportPaths = [];
const registryImportPaths = [];
Expand Down