From 636f35718632b4e2d006595d110e9e0302239e86 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Mon, 10 Jul 2017 17:06:40 -0300 Subject: [PATCH] Reverting changes from old branch --- bin/cli-plugins | 51 +------------------ .../client/components/MyPluginComponent.ejs | 25 --------- .../plugin/client/components/style.ejs | 27 ---------- client/coral-framework/helpers/plugins.js | 5 +- package.json | 1 - scripts/templates/plugin/client/.babelrc | 14 ----- .../templates/plugin/client/.eslintrc.json | 23 --------- scripts/templates/plugin/client/index.js | 20 -------- .../templates/plugin/client/translations.yml | 15 ------ scripts/templates/plugin/index.js | 1 - 10 files changed, 3 insertions(+), 179 deletions(-) delete mode 100644 bin/templates/plugin/client/components/MyPluginComponent.ejs delete mode 100644 bin/templates/plugin/client/components/style.ejs delete mode 100644 scripts/templates/plugin/client/.babelrc delete mode 100644 scripts/templates/plugin/client/.eslintrc.json delete mode 100644 scripts/templates/plugin/client/index.js delete mode 100644 scripts/templates/plugin/client/translations.yml delete mode 100644 scripts/templates/plugin/index.js diff --git a/bin/cli-plugins b/bin/cli-plugins index 6dc127697..b1dee381b 100755 --- a/bin/cli-plugins +++ b/bin/cli-plugins @@ -8,14 +8,13 @@ // https://yarnpkg.com/ const program = require('./commander'); -const inquirer = require('inquirer'); // Make things colorful! require('colors'); const emoji = require('node-emoji'); const dir = process.cwd(); -const fs = require('fs-extra'); +const fs = require('fs'); const path = require('path'); const spawn = require('cross-spawn'); const semver = require('semver'); @@ -273,58 +272,10 @@ async function reconcilePluginDeps({skipLocal, skipRemote, dryRun, upgradeRemote console.log(`✨ Done in ${totalTime}s.`); } -async function createSeedPlugin() { - const pluginsDir = path.join(dir, 'plugins'); - - function pluginNameExists(pluginName) { - const pluginNames = fs.readdirSync(pluginsDir); - return !!pluginNames - .filter((pn) => pn === pluginName).length; - } - - let answers = await inquirer.prompt([ - { - type: 'input', - name: 'pluginName', - message: 'Plugin Name: i.e talk-plugin-permalink', - validate: (input) => { - - if (pluginNameExists(input)) { - return 'Please, choose another name. That name already exists'; - } - - if (input && input.length > 0) { - return true; - } - - return 'Plugin Name is required.'; - } - } - ]); - - // Creating plugin seed - - const seedTemplatePlugin = path.join(dir, 'scripts/templates/plugin'); - const newPluginPath = path.join(pluginsDir, answers.pluginName); - - try { - fs.copySync(seedTemplatePlugin, newPluginPath); - - console.log('Success!'); - } catch (err) { - console.error(err); - } -} - //============================================================================== // Setting up the program command line arguments. //============================================================================== -program - .command('create') - .description('creates a seed plugin') - .action(createSeedPlugin); - program .command('list') .description('') diff --git a/bin/templates/plugin/client/components/MyPluginComponent.ejs b/bin/templates/plugin/client/components/MyPluginComponent.ejs deleted file mode 100644 index 5732cd146..000000000 --- a/bin/templates/plugin/client/components/MyPluginComponent.ejs +++ /dev/null @@ -1,25 +0,0 @@ -import React from 'react'; -import {CoralLogo} from 'plugin-api/beta/client/components/ui'; -import styles from './style.css'; - -class MyPluginComponent extends React.Component { - render() { - return ( -
- -
-

<%= pluginName %> Plugin created by Talk CLI

- - - To read more about plugins check{' '} - - our docs and guides! - - -
-
- ); - } -} - -export default MyPluginComponent; diff --git a/bin/templates/plugin/client/components/style.ejs b/bin/templates/plugin/client/components/style.ejs deleted file mode 100644 index 187e68750..000000000 --- a/bin/templates/plugin/client/components/style.ejs +++ /dev/null @@ -1,27 +0,0 @@ -.myPluginContainer { - padding: 10px; - background: #f0f0f0; - border: 1px solid #d6d6d6; - margin: 10px 0; - text-align: center; - border-radius: 3px; -} - -.logo { - position: block; - animation: spin 2s infinite ease; - animation-delay: 1s; -} - -@keyframes spin { - 0% { - transform: rotate(0deg); - } - 100% { - transform: rotate(360deg); - } -} - -.description { - color: #444444; -} diff --git a/client/coral-framework/helpers/plugins.js b/client/coral-framework/helpers/plugins.js index fcd0e6db6..ab5e3080e 100644 --- a/client/coral-framework/helpers/plugins.js +++ b/client/coral-framework/helpers/plugins.js @@ -15,9 +15,9 @@ function getSlotComponents(slot) { // Filter out components that have been disabled in `plugin_config` return flatten(plugins - + // Filter out components that have been disabled in `plugin_config` - .filter((o) => o.module.slots && (!pluginConfig || !pluginConfig[o.plugin] || !pluginConfig[o.plugin].disable_components)) + .filter((o) => !pluginConfig || !pluginConfig[o.plugin] || !pluginConfig[o.plugin].disable_components) .filter((o) => o.module.slots[slot]) .map((o) => o.module.slots[slot])); @@ -78,7 +78,6 @@ export function getSlotsFragments(slots) { } const components = uniq(flattenDeep(slots.map((slot) => { return plugins - .filter((o) => o.module.slots) .filter((o) => o.module.slots[slot]) .map((o) => o.module.slots[slot]); }))); diff --git a/package.json b/package.json index 6d792c70c..e9a3a8430 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,6 @@ "express-session": "^1.15.1", "file-loader": "^0.11.2", "form-data": "^2.1.2", - "fs-extra": "^3.0.1", "gql-merge": "^0.0.4", "graphql": "^0.9.1", "graphql-errors": "^2.1.0", diff --git a/scripts/templates/plugin/client/.babelrc b/scripts/templates/plugin/client/.babelrc deleted file mode 100644 index 60be246eb..000000000 --- a/scripts/templates/plugin/client/.babelrc +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - "es2015" - ], - "plugins": [ - "add-module-exports", - "transform-class-properties", - "transform-decorators-legacy", - "transform-object-assign", - "transform-object-rest-spread", - "transform-async-to-generator", - "transform-react-jsx" - ] -} \ No newline at end of file diff --git a/scripts/templates/plugin/client/.eslintrc.json b/scripts/templates/plugin/client/.eslintrc.json deleted file mode 100644 index 9fe56bd14..000000000 --- a/scripts/templates/plugin/client/.eslintrc.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "env": { - "browser": true, - "es6": true, - "mocha": true - }, - "parserOptions": { - "sourceType": "module", - "ecmaFeatures": { - "experimentalObjectRestSpread": true, - "jsx": true - } - }, - "parser": "babel-eslint", - "plugins": [ - "react" - ], - "rules": { - "react/jsx-uses-react": "error", - "react/jsx-uses-vars": "error", - "no-console": ["warn", { "allow": ["warn", "error"] }] - } -} diff --git a/scripts/templates/plugin/client/index.js b/scripts/templates/plugin/client/index.js deleted file mode 100644 index 931cd722c..000000000 --- a/scripts/templates/plugin/client/index.js +++ /dev/null @@ -1,20 +0,0 @@ - -/** - This is a client index example file and it should look like this: - - ``` - import LoveButton from './components/LoveButton'; - - export default { - slots: { - commentReactions: [LoveButton] - }, - reducer, - translations - }; - ``` - - To read more info on how to build client plugins. Please, go to: https://coralproject.github.io/talk/plugins-client.html - */ - -export default {}; diff --git a/scripts/templates/plugin/client/translations.yml b/scripts/templates/plugin/client/translations.yml deleted file mode 100644 index d8407b801..000000000 --- a/scripts/templates/plugin/client/translations.yml +++ /dev/null @@ -1,15 +0,0 @@ -# -# This file is for translations and they should look like this: -# -# -# ``` -# en: -# coral-plugin-respect: -# respect: Respect -# respected: Respected -# es: -# coral-plugin-respect: -# respect: Respetar -# respected: Respetado -# ``` -# diff --git a/scripts/templates/plugin/index.js b/scripts/templates/plugin/index.js deleted file mode 100644 index f053ebf79..000000000 --- a/scripts/templates/plugin/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = {};