Skip to content

Commit fddca52

Browse files
committed
🎉 Init plugin with the Plugin SDK
0 parents  commit fddca52

File tree

31 files changed

+13432
-0
lines changed

31 files changed

+13432
-0
lines changed

.editorconfig

Lines changed: 16 additions & 0 deletions
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

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist

.gitignore

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
############################
4+
# OS X
5+
############################
6+
7+
.DS_Store
8+
.AppleDouble
9+
.LSOverride
10+
Icon
11+
.Spotlight-V100
12+
.Trashes
13+
._*
14+
15+
16+
############################
17+
# Linux
18+
############################
19+
20+
*~
21+
22+
23+
############################
24+
# Windows
25+
############################
26+
27+
Thumbs.db
28+
ehthumbs.db
29+
Desktop.ini
30+
$RECYCLE.BIN/
31+
*.cab
32+
*.msi
33+
*.msm
34+
*.msp
35+
36+
37+
############################
38+
# Packages
39+
############################
40+
41+
*.7z
42+
*.csv
43+
*.dat
44+
*.dmg
45+
*.gz
46+
*.iso
47+
*.jar
48+
*.rar
49+
*.tar
50+
*.zip
51+
*.com
52+
*.class
53+
*.dll
54+
*.exe
55+
*.o
56+
*.seed
57+
*.so
58+
*.swo
59+
*.swp
60+
*.swn
61+
*.swm
62+
*.out
63+
*.pid
64+
65+
66+
############################
67+
# Logs and databases
68+
############################
69+
70+
.tmp
71+
*.log
72+
*.sql
73+
*.sqlite
74+
*.sqlite3
75+
76+
77+
############################
78+
# Misc.
79+
############################
80+
81+
*#
82+
ssl
83+
.idea
84+
nbproject
85+
.tsbuildinfo
86+
.eslintcache
87+
.env
88+
89+
90+
############################
91+
# Strapi
92+
############################
93+
94+
public/uploads/*
95+
!public/uploads/.gitkeep
96+
97+
98+
############################
99+
# Build
100+
############################
101+
102+
dist
103+
build
104+
105+
106+
############################
107+
# Node.js
108+
############################
109+
110+
lib-cov
111+
lcov.info
112+
pids
113+
logs
114+
results
115+
node_modules
116+
.node_history
117+
118+
119+
############################
120+
# Package managers
121+
############################
122+
123+
.yarn/*
124+
!.yarn/cache
125+
!.yarn/unplugged
126+
!.yarn/patches
127+
!.yarn/releases
128+
!.yarn/sdks
129+
!.yarn/versions
130+
.pnp.*
131+
yarn-error.log
132+
133+
134+
############################
135+
# Tests
136+
############################
137+
138+
coverage

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist
2+
coverage

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"endOfLine": "lf",
3+
"tabWidth": 2,
4+
"printWidth": 100,
5+
"singleQuote": true,
6+
"trailingComma": "es5"
7+
}

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# gitlab-publish
2+
3+
Trigger GitLab pipeline in one click !

admin/jsconfig.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es6",
4+
"jsx": "react",
5+
"module": "esnext",
6+
"allowSyntheticDefaultImports": true,
7+
"esModuleInterop": true
8+
},
9+
"include": ["./src/**/*.js", "./src/**/*.jsx"]
10+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { useEffect, useRef } from 'react';
2+
3+
import { PLUGIN_ID } from '../pluginId';
4+
5+
/**
6+
* @type {import('react').FC<{ setPlugin: (id: string) => void }>}
7+
*/
8+
const Initializer = ({ setPlugin }) => {
9+
const ref = useRef(setPlugin);
10+
11+
useEffect(() => {
12+
ref.current(PLUGIN_ID);
13+
}, []);
14+
15+
return null;
16+
};
17+
18+
export { Initializer };
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { PuzzlePiece } from '@strapi/icons';
2+
3+
const PluginIcon = () => <PuzzlePiece />;
4+
5+
export { PluginIcon };

admin/src/index.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { getTranslation } from './utils/getTranslation';
2+
import { PLUGIN_ID } from './pluginId';
3+
import { Initializer } from './components/Initializer';
4+
import { PluginIcon } from './components/PluginIcon';
5+
6+
export default {
7+
register(app) {
8+
app.addMenuLink({
9+
to: `plugins/${PluginIcon}`,
10+
icon: PluginIcon,
11+
intlLabel: {
12+
id: `${PLUGIN_ID}.plugin.name`,
13+
defaultMessage: PLUGIN_ID,
14+
},
15+
Component: async () => {
16+
const { App } = await import('./pages/App');
17+
18+
return App;
19+
},
20+
});
21+
22+
app.registerPlugin({
23+
id: PLUGIN_ID,
24+
initializer: Initializer,
25+
isReady: false,
26+
name: PLUGIN_ID,
27+
});
28+
},
29+
30+
async registerTrads({ locales }) {
31+
return Promise.all(
32+
locales.map(async (locale) => {
33+
try {
34+
const { default: data } = await import(`./translations/${locale}.json`);
35+
36+
return { data, locale };
37+
} catch {
38+
return { data: {}, locale };
39+
}
40+
})
41+
);
42+
},
43+
};

0 commit comments

Comments
 (0)