Initial commit

pull/1/head
Boaz Poolman 2021-03-19 19:04:22 +01:00
commit f6f9beb786
38 changed files with 410 additions and 0 deletions

7
.editorconfig Normal file
View File

@ -0,0 +1,7 @@
root = true
[*]
end_of_line = lf
insert_final_newline = false
indent_style = space
indent_size = 2

103
.gitattributes vendored Normal file
View File

@ -0,0 +1,103 @@
# From https://github.com/Danimoth/gitattributes/blob/master/Web.gitattributes
# Handle line endings automatically for files detected as text
# and leave all files detected as binary untouched.
* text=auto
#
# The above will handle all files NOT found below
#
#
## These files are text and should be normalized (Convert crlf => lf)
#
# source code
*.php text
*.css text
*.sass text
*.scss text
*.less text
*.styl text
*.js text eol=lf
*.coffee text
*.json text
*.htm text
*.html text
*.xml text
*.svg text
*.txt text
*.ini text
*.inc text
*.pl text
*.rb text
*.py text
*.scm text
*.sql text
*.sh text
*.bat text
# templates
*.ejs text
*.hbt text
*.jade text
*.haml text
*.hbs text
*.dot text
*.tmpl text
*.phtml text
# git config
.gitattributes text
.gitignore text
.gitconfig text
# code analysis config
.jshintrc text
.jscsrc text
.jshintignore text
.csslintrc text
# misc config
*.yaml text
*.yml text
.editorconfig text
# build config
*.npmignore text
*.bowerrc text
# Heroku
Procfile text
.slugignore text
# Documentation
*.md text
LICENSE text
AUTHORS text
#
## These files are binary and should be left untouched
#
# (binary is a macro for -text -diff)
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.mov binary
*.mp4 binary
*.mp3 binary
*.flv binary
*.fla binary
*.swf binary
*.gz binary
*.zip binary
*.7z binary
*.ttf binary
*.eot binary
*.woff binary
*.pyc binary
*.pdf binary

10
.gitignore vendored Normal file
View File

@ -0,0 +1,10 @@
# Don't check auto-generated stuff into git
coverage
node_modules
stats.json
package-lock.json
# Cruft
.DS_Store
npm-debug.log
.idea

3
README.md Normal file
View File

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

View File

@ -0,0 +1,27 @@
/**
*
* 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';
// Utils
import pluginId from '../../pluginId';
// Containers
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

@ -0,0 +1,20 @@
/*
*
* 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

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

52
admin/src/index.js Normal file
View File

@ -0,0 +1,52 @@
import pluginPkg from '../../package.json';
import pluginId from './pluginId';
import App from './containers/App';
import Initializer from './containers/Initializer';
import lifecycles from './lifecycles';
import trads from './translations';
export default strapi => {
const pluginDescription = pluginPkg.strapi.description || pluginPkg.description;
const icon = pluginPkg.strapi.icon;
const name = pluginPkg.strapi.name;
const plugin = {
blockerComponent: null,
blockerComponentProps: {},
description: pluginDescription,
icon,
id: pluginId,
initializer: Initializer,
injectedComponents: [],
isReady: false,
isRequired: pluginPkg.strapi.required || false,
layout: null,
lifecycles,
mainComponent: App,
name,
preventComponentRendering: false,
trads,
menu: {
pluginsSectionLinks: [
{
destination: `/plugins/${pluginId}`,
icon,
label: {
id: `${pluginId}.plugin.name`,
defaultMessage: name,
},
name,
permissions: [
// Uncomment to set the permissions of the plugin here
// {
// action: '', // the action name should be plugins::plugin-name.actionType
// subject: null,
// },
],
},
],
},
};
return strapi.registerPlugin(plugin);
};

3
admin/src/lifecycles.js Normal file
View File

@ -0,0 +1,3 @@
function lifecycles() {}
export default lifecycles;

7
admin/src/pluginId.js Normal file
View File

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

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1,49 @@
import ar from './ar.json';
import cs from './cs.json';
import de from './de.json';
import en from './en.json';
import es from './es.json';
import fr from './fr.json';
import id from './id.json';
import it from './it.json';
import ko from './ko.json';
import ms from './ms.json';
import nl from './nl.json';
import pl from './pl.json';
import ptBR from './pt-BR.json';
import pt from './pt.json';
import ru from './ru.json';
import th from './th.json';
import tr from './tr.json';
import uk from './uk.json';
import vi from './vi.json';
import zhHans from './zh-Hans.json';
import zh from './zh.json';
import sk from './sk.json';
const trads = {
ar,
cs,
de,
en,
es,
fr,
id,
it,
ko,
ms,
nl,
pl,
'pt-BR': ptBR,
pt,
ru,
th,
tr,
uk,
vi,
'zh-Hans': zhHans,
zh,
sk,
};
export default trads;

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

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

12
config/routes.json Normal file
View File

@ -0,0 +1,12 @@
{
"routes": [
{
"method": "GET",
"path": "/",
"handler": "config.index",
"config": {
"policies": []
}
}
]
}

25
controllers/config.js Normal file
View File

@ -0,0 +1,25 @@
'use strict';
/**
* config.js controller
*
* @description: A set of functions called "actions" of the `config` plugin.
*/
module.exports = {
/**
* Default action.
*
* @return {Object}
*/
index: async (ctx) => {
// Add your own logic here.
// Send 200 `ok`
ctx.send({
message: 'ok'
});
}
};

28
package.json Normal file
View File

@ -0,0 +1,28 @@
{
"name": "strapi-plugin-config",
"version": "0.0.0",
"description": "This is the description of the plugin.",
"strapi": {
"name": "config",
"icon": "plug",
"description": "Description of config plugin."
},
"dependencies": {},
"author": {
"name": "A Strapi developer",
"email": "",
"url": ""
},
"maintainers": [
{
"name": "A Strapi developer",
"email": "",
"url": ""
}
],
"engines": {
"node": ">=10.16.0 <=14.x.x",
"npm": ">=6.0.0"
},
"license": "MIT"
}

11
services/config.js Normal file
View File

@ -0,0 +1,11 @@
'use strict';
/**
* config.js service
*
* @description: A set of functions similar to controller's actions to avoid code duplication.
*/
module.exports = {
};