Skip to content

Commit

Permalink
feature(cloudcmd) remove plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
coderaiser committed Aug 14, 2019
1 parent b93e759 commit a61eb22
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 181 deletions.
5 changes: 0 additions & 5 deletions HELP.md
Original file line number Diff line number Diff line change
Expand Up @@ -680,10 +680,6 @@ const config = {
name: 'cloudcmd :)'
};

const plugins = [
__dirname + '/plugin.js'
];

const filePicker = {
data: {
FilePicker: {
Expand All @@ -709,7 +705,6 @@ const configManager = createConfigManager({
app.use(prefix, cloudcmd({
socket, // used by Config, Edit (optional) and Console (required)
config, // config data (optional)
plugins, // DEPRECATED, use User Menu instead
modules, // optional
configManager, // optional
));
Expand Down
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@ const config = {
name: 'cloudcmd :)',
};

const plugins = [
__dirname + '/plugin.js'
];

const filePicker = {
data: {
FilePicker: {
Expand All @@ -119,7 +115,6 @@ const configManager = createConfigManager({
app.use(prefix, cloudcmd({
socket, // used by Config, Edit (optional) and Console (required)
config, // config data (optional)
plugins, // DEPRECATED, use User Menu instead
modules, // optional
configManager, // optional
}));
Expand Down
8 changes: 0 additions & 8 deletions client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ function CloudCmdProto(DOM) {
const func = bind(exec.series, [
initModules,
baseInit,
loadPlugins,
loadStyle,
exec.with(CloudCmd.route, location.hash),
], noop);
Expand Down Expand Up @@ -182,13 +181,6 @@ function CloudCmdProto(DOM) {
load.css(name, callback);
}

function loadPlugins(callback) {
const {prefix} = CloudCmd;
const plugins = prefix + '/plugins.js';

load.js(plugins, callback);
}

this.route = (path) => {
const query = path.split('/');

Expand Down
20 changes: 2 additions & 18 deletions server/cloudcmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const rest = require(DIR + 'rest');
const route = require(DIR + 'route');
const validate = require(DIR + 'validate');
const prefixer = require(DIR + 'prefixer');
const pluginer = require(DIR + 'plugins');
const terminal = require(DIR + 'terminal');
const distribute = require(DIR + 'distribute');

Expand Down Expand Up @@ -53,15 +52,10 @@ module.exports = (params) => {
configPath,
});

const {
modules,
plugins,
} = p;
const {modules} = p;

const keys = Object.keys(options);

checkPlugins(plugins);

for (const name of keys) {
let value = options[name];

Expand Down Expand Up @@ -90,7 +84,6 @@ module.exports = (params) => {
});

return cloudcmd({
plugins,
modules,
config,
});
Expand Down Expand Up @@ -181,7 +174,7 @@ function listen({prefixSocket, socket, config}) {
distribute.export(config, socket);
}

function cloudcmd({plugins, modules, config}) {
function cloudcmd({modules, config}) {
const online = apart(config, 'online');
const cache = false;
const diff = apart(config, 'diff');
Expand Down Expand Up @@ -256,7 +249,6 @@ function cloudcmd({plugins, modules, config}) {
html: defaultHtml,
}),

pluginer(plugins),
ponseStatic,
]);

Expand Down Expand Up @@ -297,11 +289,3 @@ function setSW(req, res, next) {
next();
}

function checkPlugins(plugins) {
if (typeof plugins === 'undefined')
return;

if (!Array.isArray(plugins))
throw Error('plugins should be an array!');
}

16 changes: 0 additions & 16 deletions server/cloudcmd.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,6 @@ const {request} = require('serve-once')(cloudcmd, {
},
});

test('cloudcmd: args: no', (t) => {
const fn = () => cloudcmd();

t.doesNotThrow(fn, /plugins should be an array!/, 'should throw when plugins not an array');
t.end();
});

test('cloudcmd: args: plugins: error', (t) => {
const fn = () => cloudcmd({
plugins: '',
});

t.throws(fn, /plugins should be an array!/, 'should throw when plugins not an array');
t.end();
});

test('cloudcmd: defaults: config', (t) => {
const configManager = createConfigManager();

Expand Down
24 changes: 0 additions & 24 deletions server/plugins.js

This file was deleted.

105 changes: 0 additions & 105 deletions server/plugins.spec.js

This file was deleted.

0 comments on commit a61eb22

Please sign in to comment.