mirror of
https://github.com/strapi/strapi.git
synced 2025-12-24 21:54:24 +00:00
Remove super-plugin
This commit is contained in:
parent
6ef3e1deb6
commit
5dc659c7a1
@ -6,6 +6,7 @@
|
||||
"strapi": {
|
||||
"name": "my-plugin",
|
||||
"icon": "plug",
|
||||
"description": "Description of my plugin."
|
||||
"description": "Description of my plugin.",
|
||||
"kind": "plugin"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
# Strapi plugin super-plugin
|
||||
|
||||
A quick description of super-plugin.
|
||||
@ -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;
|
||||
@ -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;
|
||||
@ -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}'s HomePage</h1>
|
||||
<p>Happy coding</p>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default memo(HomePage);
|
||||
@ -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;
|
||||
@ -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);
|
||||
},
|
||||
};
|
||||
@ -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;
|
||||
@ -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}'s HomePage</h1>
|
||||
<p>Happy coding</p>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default memo(HomePage);
|
||||
@ -1,5 +0,0 @@
|
||||
const pluginPkg = require('../../package.json');
|
||||
|
||||
const pluginId = pluginPkg.name.replace(/^@strapi\/plugin-/i, '');
|
||||
|
||||
module.exports = pluginId;
|
||||
@ -1 +0,0 @@
|
||||
{}
|
||||
@ -1 +0,0 @@
|
||||
{}
|
||||
@ -1,5 +0,0 @@
|
||||
import pluginId from '../pluginId';
|
||||
|
||||
const getTrad = id => `${pluginId}.${id}`;
|
||||
|
||||
export default getTrad;
|
||||
@ -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"
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = ({ strapi }) => {
|
||||
// bootstrap phase
|
||||
};
|
||||
@ -1,6 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
default: {},
|
||||
validator() {},
|
||||
};
|
||||
@ -1,7 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const myController = require('./my-controller');
|
||||
|
||||
module.exports = {
|
||||
myController,
|
||||
};
|
||||
@ -1,10 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
index(ctx) {
|
||||
ctx.body = strapi
|
||||
.plugin('super-plugin')
|
||||
.service('myService')
|
||||
.getWelcomeMessage();
|
||||
},
|
||||
};
|
||||
@ -1,5 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = ({ strapi }) => {
|
||||
// destroy phase
|
||||
};
|
||||
@ -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: {},
|
||||
};
|
||||
@ -1,5 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = ({ strapi }) => {
|
||||
// registeration phase
|
||||
};
|
||||
@ -1,10 +0,0 @@
|
||||
module.exports = [
|
||||
{
|
||||
method: 'GET',
|
||||
path: '/',
|
||||
handler: 'myController.index',
|
||||
config: {
|
||||
policies: [],
|
||||
},
|
||||
},
|
||||
];
|
||||
@ -1,7 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const myService = require('./my-service');
|
||||
|
||||
module.exports = {
|
||||
myService,
|
||||
};
|
||||
@ -1,7 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = ({ strapi }) => ({
|
||||
getWelcomeMessage() {
|
||||
return 'Welcome to Strapi 🚀';
|
||||
},
|
||||
});
|
||||
@ -1,3 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./server');
|
||||
Loading…
x
Reference in New Issue
Block a user