Remove super-plugin

This commit is contained in:
Alexandre Bodin 2021-09-30 14:47:58 +02:00
parent 6ef3e1deb6
commit 5dc659c7a1
26 changed files with 2 additions and 335 deletions

View File

@ -6,6 +6,7 @@
"strapi": {
"name": "my-plugin",
"icon": "plug",
"description": "Description of my plugin."
"description": "Description of my plugin.",
"kind": "plugin"
}
}

View File

@ -1,3 +0,0 @@
# Strapi plugin super-plugin
A quick description of super-plugin.

View File

@ -1,26 +0,0 @@
/**
*
* Initializer
*
*/
import { useEffect, useRef } from 'react';
import PropTypes from 'prop-types';
import pluginId from '../../pluginId';
const Initializer = ({ setPlugin }) => {
const ref = useRef();
ref.current = setPlugin;
useEffect(() => {
ref.current(pluginId);
}, []);
return null;
};
Initializer.propTypes = {
setPlugin: PropTypes.func.isRequired,
};
export default Initializer;

View File

@ -1,25 +0,0 @@
/**
*
* This component is the skeleton around the actual pages, and should only
* contain code that should be seen on all pages. (e.g. navigation bar)
*
*/
import React from 'react';
import { Switch, Route } from 'react-router-dom';
import { NotFound } from '@strapi/helper-plugin';
import pluginId from '../../pluginId';
import HomePage from '../HomePage';
const App = () => {
return (
<div>
<Switch>
<Route path={`/plugins/${pluginId}`} component={HomePage} exact />
<Route component={NotFound} />
</Switch>
</div>
);
};
export default App;

View File

@ -1,20 +0,0 @@
/*
*
* HomePage
*
*/
import React, { memo } from 'react';
// import PropTypes from 'prop-types';
import pluginId from '../../pluginId';
const HomePage = () => {
return (
<div>
<h1>{pluginId}&apos;s HomePage</h1>
<p>Happy coding</p>
</div>
);
};
export default memo(HomePage);

View File

@ -1,26 +0,0 @@
/**
*
* Initializer
*
*/
import { useEffect, useRef } from 'react';
import PropTypes from 'prop-types';
import pluginId from '../../pluginId';
const Initializer = ({ setPlugin }) => {
const ref = useRef();
ref.current = setPlugin;
useEffect(() => {
ref.current(pluginId);
}, []);
return null;
};
Initializer.propTypes = {
setPlugin: PropTypes.func.isRequired,
};
export default Initializer;

View File

@ -1,65 +0,0 @@
import { prefixPluginTranslations } from '@strapi/helper-plugin';
import pluginPkg from '../../package.json';
import pluginId from './pluginId';
import Initializer from './components/Initializer';
const pluginDescription = pluginPkg.strapi.description || pluginPkg.description;
const icon = pluginPkg.strapi.icon;
const name = pluginPkg.strapi.name;
export default {
register(app) {
app.addMenuLink({
to: `/plugins/${pluginId}`,
icon,
intlLabel: {
id: `${pluginId}.plugin.name`,
defaultMessage: name,
},
Component: async () => {
const component = await import(/* webpackChunkName: "[request]" */ './pages/App');
return component;
},
permissions: [
// Uncomment to set the permissions of the plugin here
// {
// action: '', // the action name should be plugin::plugin-name.actionType
// subject: null,
// },
],
});
app.registerPlugin({
description: pluginDescription,
icon,
id: pluginId,
initializer: Initializer,
isReady: false,
isRequired: pluginPkg.strapi.required || false,
name,
});
},
bootstrap(app) {},
async registerTrads({ locales }) {
const importedTrads = await Promise.all(
locales.map(locale => {
return import(`./translations/${locale}.json`)
.then(({ default: data }) => {
return {
data: prefixPluginTranslations(data, pluginId),
locale,
};
})
.catch(() => {
return {
data: {},
locale,
};
});
})
);
return Promise.resolve(importedTrads);
},
};

View File

@ -1,25 +0,0 @@
/**
*
* This component is the skeleton around the actual pages, and should only
* contain code that should be seen on all pages. (e.g. navigation bar)
*
*/
import React from 'react';
import { Switch, Route } from 'react-router-dom';
import { NotFound } from '@strapi/helper-plugin';
import pluginId from '../../pluginId';
import HomePage from '../HomePage';
const App = () => {
return (
<div>
<Switch>
<Route path={`/plugins/${pluginId}`} component={HomePage} exact />
<Route component={NotFound} />
</Switch>
</div>
);
};
export default App;

View File

@ -1,20 +0,0 @@
/*
*
* HomePage
*
*/
import React, { memo } from 'react';
// import PropTypes from 'prop-types';
import pluginId from '../../pluginId';
const HomePage = () => {
return (
<div>
<h1>{pluginId}&apos;s HomePage</h1>
<p>Happy coding</p>
</div>
);
};
export default memo(HomePage);

View File

@ -1,5 +0,0 @@
const pluginPkg = require('../../package.json');
const pluginId = pluginPkg.name.replace(/^@strapi\/plugin-/i, '');
module.exports = pluginId;

View File

@ -1,5 +0,0 @@
import pluginId from '../pluginId';
const getTrad = id => `${pluginId}.${id}`;
export default getTrad;

View File

@ -1,25 +0,0 @@
{
"name": "super-plugin",
"version": "0.0.0",
"description": "This is the description of the plugin.",
"strapi": {
"name": "super-plugin",
"icon": "plug",
"description": "Description of super-plugin plugin",
"kind": "plugin"
},
"dependencies": {},
"author": {
"name": "A Strapi developer"
},
"maintainers": [
{
"name": "A Strapi developer"
}
],
"engines": {
"node": ">=12.x. <=16.x.x",
"npm": ">=6.0.0"
},
"license": "MIT"
}

View File

@ -1,5 +0,0 @@
'use strict';
module.exports = ({ strapi }) => {
// bootstrap phase
};

View File

@ -1,6 +0,0 @@
'use strict';
module.exports = {
default: {},
validator() {},
};

View File

@ -1,7 +0,0 @@
'use strict';
const myController = require('./my-controller');
module.exports = {
myController,
};

View File

@ -1,10 +0,0 @@
'use strict';
module.exports = {
index(ctx) {
ctx.body = strapi
.plugin('super-plugin')
.service('myService')
.getWelcomeMessage();
},
};

View File

@ -1,5 +0,0 @@
'use strict';
module.exports = ({ strapi }) => {
// destroy phase
};

View File

@ -1,22 +0,0 @@
'use strict';
const register = require('./register');
const bootstrap = require('./bootstrap');
const destroy = require('./destroy');
const config = require('./config');
const controllers = require('./controllers');
const routes = require('./routes');
const services = require('./services');
module.exports = {
register,
bootstrap,
destroy,
config,
controllers,
routes,
services,
contentTypes: {},
policies: {},
middlewares: {},
};

View File

@ -1,5 +0,0 @@
'use strict';
module.exports = ({ strapi }) => {
// registeration phase
};

View File

@ -1,10 +0,0 @@
module.exports = [
{
method: 'GET',
path: '/',
handler: 'myController.index',
config: {
policies: [],
},
},
];

View File

@ -1,7 +0,0 @@
'use strict';
const myService = require('./my-service');
module.exports = {
myService,
};

View File

@ -1,7 +0,0 @@
'use strict';
module.exports = ({ strapi }) => ({
getWelcomeMessage() {
return 'Welcome to Strapi 🚀';
},
});

View File

@ -1,3 +0,0 @@
'use strict';
module.exports = require('./server');