Skip to content

Commit 2638f67

Browse files
feat: init repo with settings in plugin
0 parents  commit 2638f67

File tree

26 files changed

+11257
-0
lines changed

26 files changed

+11257
-0
lines changed

.editorconfig

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[{package.json,*.yml}]
12+
indent_style = space
13+
indent_size = 2
14+
15+
[*.md]
16+
trim_trailing_whitespace = false

.env.example

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
HOST=0.0.0.0
2+
PORT=1337

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.cache
2+
build
3+
**/node_modules/**

.eslintrc

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"parser": "babel-eslint",
3+
"extends": "eslint:recommended",
4+
"env": {
5+
"commonjs": true,
6+
"es6": true,
7+
"node": true,
8+
"browser": false
9+
},
10+
"parserOptions": {
11+
"ecmaFeatures": {
12+
"experimentalObjectRestSpread": true,
13+
"jsx": false
14+
},
15+
"sourceType": "module"
16+
},
17+
"globals": {
18+
"strapi": true
19+
},
20+
"rules": {
21+
"indent": ["error", 2, { "SwitchCase": 1 }],
22+
"linebreak-style": ["error", "unix"],
23+
"no-console": 0,
24+
"quotes": ["error", "single"],
25+
"semi": ["error", "always"]
26+
}
27+
}

.gitignore

+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
############################
2+
# OS X
3+
############################
4+
5+
.DS_Store
6+
.AppleDouble
7+
.LSOverride
8+
Icon
9+
.Spotlight-V100
10+
.Trashes
11+
._*
12+
13+
14+
############################
15+
# Linux
16+
############################
17+
18+
*~
19+
20+
21+
############################
22+
# Windows
23+
############################
24+
25+
Thumbs.db
26+
ehthumbs.db
27+
Desktop.ini
28+
$RECYCLE.BIN/
29+
*.cab
30+
*.msi
31+
*.msm
32+
*.msp
33+
34+
35+
############################
36+
# Packages
37+
############################
38+
39+
*.7z
40+
*.csv
41+
*.dat
42+
*.dmg
43+
*.gz
44+
*.iso
45+
*.jar
46+
*.rar
47+
*.tar
48+
*.zip
49+
*.com
50+
*.class
51+
*.dll
52+
*.exe
53+
*.o
54+
*.seed
55+
*.so
56+
*.swo
57+
*.swp
58+
*.swn
59+
*.swm
60+
*.out
61+
*.pid
62+
63+
64+
############################
65+
# Logs and databases
66+
############################
67+
68+
.tmp
69+
*.log
70+
*.sql
71+
*.sqlite
72+
*.sqlite3
73+
74+
75+
############################
76+
# Misc.
77+
############################
78+
79+
*#
80+
ssl
81+
.idea
82+
nbproject
83+
public/uploads/*
84+
!public/uploads/.gitkeep
85+
86+
############################
87+
# Node.js
88+
############################
89+
90+
lib-cov
91+
lcov.info
92+
pids
93+
logs
94+
results
95+
node_modules
96+
.node_history
97+
98+
############################
99+
# Tests
100+
############################
101+
102+
testApp
103+
coverage
104+
105+
############################
106+
# Strapi
107+
############################
108+
109+
.env
110+
license.txt
111+
exports
112+
*.cache
113+
build
114+
.strapi-updater.json

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Strapi application
2+
3+
A quick description of your strapi application

api/.gitkeep

Whitespace-only changes.

config/database.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module.exports = ({ env }) => ({
2+
defaultConnection: 'default',
3+
connections: {
4+
default: {
5+
connector: 'bookshelf',
6+
settings: {
7+
client: 'sqlite',
8+
filename: env('DATABASE_FILENAME', '.tmp/data.db'),
9+
},
10+
options: {
11+
useNullAsDefault: true,
12+
},
13+
},
14+
},
15+
});

config/functions/bootstrap.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
'use strict';
2+
3+
/**
4+
* An asynchronous bootstrap function that runs before
5+
* your application gets started.
6+
*
7+
* This gives you an opportunity to set up your data model,
8+
* run jobs, or perform some special logic.
9+
*
10+
* See more details here: https://strapi.io/documentation/developer-docs/latest/setup-deployment-guides/configurations.html#bootstrap
11+
*/
12+
13+
module.exports = () => {};

config/functions/cron.js

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use strict';
2+
3+
/**
4+
* Cron config that gives you an opportunity
5+
* to run scheduled jobs.
6+
*
7+
* The cron format consists of:
8+
* [SECOND (optional)] [MINUTE] [HOUR] [DAY OF MONTH] [MONTH OF YEAR] [DAY OF WEEK]
9+
*
10+
* See more details here: https://strapi.io/documentation/developer-docs/latest/setup-deployment-guides/configurations.html#cron-tasks
11+
*/
12+
13+
module.exports = {
14+
/**
15+
* Simple example.
16+
* Every monday at 1am.
17+
*/
18+
// '0 1 * * 1': () => {
19+
//
20+
// }
21+
};

config/functions/responses/404.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
'use strict';
2+
3+
module.exports = async (/* ctx */) => {
4+
// return ctx.notFound('My custom message 404');
5+
};

config/server.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = ({ env }) => ({
2+
host: env('HOST', '0.0.0.0'),
3+
port: env.int('PORT', 1337),
4+
admin: {
5+
auth: {
6+
secret: env('ADMIN_JWT_SECRET', '50fc44edf1de5ff281c68bdc483cc7f7'),
7+
},
8+
},
9+
});

extensions/.gitkeep

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
jwtSecret: process.env.JWT_SECRET || 'a99e1f04-a899-4e60-a793-c55e6b1be0c0'
3+
};

favicon.ico

3.6 KB
Binary file not shown.

package.json

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "strapi-tests",
3+
"private": true,
4+
"version": "0.1.0",
5+
"description": "A Strapi application",
6+
"scripts": {
7+
"develop": "strapi develop",
8+
"start": "strapi start",
9+
"build": "strapi build",
10+
"strapi": "strapi"
11+
},
12+
"devDependencies": {},
13+
"dependencies": {
14+
"strapi": "3.6.6",
15+
"strapi-admin": "3.6.6",
16+
"strapi-utils": "3.6.6",
17+
"strapi-plugin-content-type-builder": "3.6.6",
18+
"strapi-plugin-content-manager": "3.6.6",
19+
"strapi-plugin-users-permissions": "3.6.6",
20+
"strapi-plugin-email": "3.6.6",
21+
"strapi-plugin-upload": "3.6.6",
22+
"strapi-plugin-i18n": "3.6.6",
23+
"strapi-connector-bookshelf": "3.6.6",
24+
"knex": "0.21.18",
25+
"sqlite3": "5.0.0"
26+
},
27+
"author": {
28+
"name": "A Strapi developer"
29+
},
30+
"strapi": {
31+
"uuid": "d998f6b4-9b10-4713-839f-eae1cca76758"
32+
},
33+
"engines": {
34+
"node": ">=10.16.0 <=14.x.x",
35+
"npm": "^6.0.0"
36+
},
37+
"license": "MIT"
38+
}

plugins/my-custom-plugin/README.md

Whitespace-only changes.
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import styled from 'styled-components';
2+
3+
const Wrapper = styled.div``;
4+
5+
export default Wrapper;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import React from 'react';
2+
import { Switch, Route } from 'react-router-dom';
3+
import { NotFound } from 'strapi-helper-plugin';
4+
import { Wrapper } from './Wrapper';
5+
6+
const App = () => {
7+
return (
8+
<Wrapper>
9+
<Switch>
10+
<Route component={NotFound} />
11+
</Switch>
12+
</Wrapper>
13+
);
14+
};
15+
16+
export default App;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import React, { useState } from 'react';
2+
import { Header } from '@buffetjs/custom';
3+
import {
4+
SettingsPageTitle,
5+
BaselineAlignment,
6+
} from 'strapi-helper-plugin';
7+
8+
const SettingsPage = () => {
9+
const [showLoader] = useState(false);
10+
11+
function handleSubmit(e) {
12+
e.preventDefault();
13+
}
14+
15+
return (
16+
<>
17+
<SettingsPageTitle name="My custom plugin" />
18+
<div>
19+
<form onSubmit={handleSubmit}>
20+
<Header
21+
title={{ label: 'Settings' }}
22+
content={'Configure awesome stuff!'}
23+
isLoading={showLoader}
24+
/>
25+
<BaselineAlignment top size="3px" />
26+
</form>
27+
</div>
28+
</>
29+
);
30+
};
31+
32+
export default SettingsPage;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// import React from 'react';
2+
import App from './containers/App';
3+
import pluginLogo from './assets/images/logo.svg';
4+
import Settings from './containers/Settings';
5+
import pluginId from './pluginId';
6+
7+
export default (strapi) => {
8+
const menuSection = {
9+
id: pluginId,
10+
title: {
11+
id: `${pluginId}.foo`,
12+
defaultMessage: 'Super cool setting',
13+
},
14+
links: [
15+
// this is causing the issue:
16+
{
17+
title: 'Setting page 1',
18+
name: 'setting1',
19+
to: `${strapi.settingsBaseURL}/setting1`,
20+
},
21+
],
22+
};
23+
24+
const plugin = {
25+
id: pluginId,
26+
icon: 'plug',
27+
name: 'My custom plugin',
28+
description: 'Homeland to do awesome things',
29+
pluginLogo,
30+
preventComponentRendering: false,
31+
isReady: true,
32+
isRequired: true,
33+
initializer: () => null,
34+
mainComponent: App,
35+
trads: {},
36+
injectedComponents: [],
37+
blockerComponent: null,
38+
blockerComponentProps: {},
39+
settings: {
40+
mainComponent: Settings,
41+
menuSection,
42+
},
43+
};
44+
45+
return strapi.registerPlugin(plugin);
46+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = 'my-custom-plugin';

public/robots.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# To prevent search engines from seeing the site altogether, uncomment the next two lines:
2+
# User-Agent: *
3+
# Disallow: /

public/uploads/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)