@strapi/strapi 4.16.2 → 4.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin.d.ts +2 -2
- package/dist/admin.d.ts.map +1 -1
- package/dist/admin.js.map +1 -1
- package/dist/admin.mjs.map +1 -1
- package/dist/commands/actions/plugin/build-command/action.d.ts +2 -1
- package/dist/commands/actions/plugin/build-command/action.d.ts.map +1 -1
- package/dist/commands/actions/plugin/build-command/action.js +3 -6
- package/dist/commands/actions/plugin/build-command/action.js.map +1 -1
- package/dist/commands/actions/plugin/build-command/command.js +2 -2
- package/dist/commands/actions/plugin/build-command/command.js.map +1 -1
- package/dist/commands/actions/plugin/init/action.d.ts +7 -0
- package/dist/commands/actions/plugin/init/action.d.ts.map +1 -0
- package/dist/commands/actions/plugin/init/action.js +417 -0
- package/dist/commands/actions/plugin/init/action.js.map +1 -0
- package/dist/commands/actions/plugin/init/command.d.ts +7 -0
- package/dist/commands/actions/plugin/init/command.d.ts.map +1 -0
- package/dist/commands/actions/plugin/init/command.js +8 -0
- package/dist/commands/actions/plugin/init/command.js.map +1 -0
- package/dist/commands/actions/plugin/init/files/admin.d.ts +5 -0
- package/dist/commands/actions/plugin/init/files/admin.d.ts.map +1 -0
- package/dist/commands/actions/plugin/init/files/admin.js +283 -0
- package/dist/commands/actions/plugin/init/files/admin.js.map +1 -0
- package/dist/commands/actions/plugin/init/files/editorConfig.d.ts +4 -0
- package/dist/commands/actions/plugin/init/files/editorConfig.d.ts.map +1 -0
- package/dist/commands/actions/plugin/init/files/editorConfig.js +26 -0
- package/dist/commands/actions/plugin/init/files/editorConfig.js.map +1 -0
- package/dist/commands/actions/plugin/init/files/eslint.d.ts +4 -0
- package/dist/commands/actions/plugin/init/files/eslint.d.ts.map +1 -0
- package/dist/commands/actions/plugin/init/files/eslint.js +11 -0
- package/dist/commands/actions/plugin/init/files/eslint.js.map +1 -0
- package/dist/commands/actions/plugin/init/files/gitIgnore.d.ts +4 -0
- package/dist/commands/actions/plugin/init/files/gitIgnore.d.ts.map +1 -0
- package/dist/commands/actions/plugin/init/files/gitIgnore.js +34 -0
- package/dist/commands/actions/plugin/init/files/gitIgnore.js.map +1 -0
- package/dist/commands/actions/plugin/init/files/prettier.d.ts +5 -0
- package/dist/commands/actions/plugin/init/files/prettier.d.ts.map +1 -0
- package/dist/commands/actions/plugin/init/files/prettier.js +25 -0
- package/dist/commands/actions/plugin/init/files/prettier.js.map +1 -0
- package/dist/commands/actions/plugin/init/files/server.d.ts +5 -0
- package/dist/commands/actions/plugin/init/files/server.d.ts.map +1 -0
- package/dist/commands/actions/plugin/init/files/server.js +360 -0
- package/dist/commands/actions/plugin/init/files/server.js.map +1 -0
- package/dist/commands/actions/plugin/init/files/typescript.d.ts +9 -0
- package/dist/commands/actions/plugin/init/files/typescript.d.ts.map +1 -0
- package/dist/commands/actions/plugin/init/files/typescript.js +66 -0
- package/dist/commands/actions/plugin/init/files/typescript.js.map +1 -0
- package/dist/commands/actions/plugin/verify/action.d.ts +7 -0
- package/dist/commands/actions/plugin/verify/action.d.ts.map +1 -0
- package/dist/commands/actions/plugin/verify/action.js +34 -0
- package/dist/commands/actions/plugin/verify/action.js.map +1 -0
- package/dist/commands/actions/plugin/verify/command.d.ts +7 -0
- package/dist/commands/actions/plugin/verify/command.d.ts.map +1 -0
- package/dist/commands/actions/plugin/verify/command.js +8 -0
- package/dist/commands/actions/plugin/verify/command.js.map +1 -0
- package/dist/commands/actions/plugin/watch/action.d.ts +2 -2
- package/dist/commands/actions/plugin/watch/action.d.ts.map +1 -1
- package/dist/commands/actions/plugin/watch/action.js +4 -7
- package/dist/commands/actions/plugin/watch/action.js.map +1 -1
- package/dist/commands/actions/plugin/watch/command.d.ts +1 -1
- package/dist/commands/actions/plugin/watch/command.js +2 -2
- package/dist/commands/actions/plugin/watch/command.js.map +1 -1
- package/dist/commands/index.d.ts +2 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +6 -2
- package/dist/commands/index.js.map +1 -1
- package/dist/services/entity-validator/index.js.map +1 -1
- package/dist/services/entity-validator/index.mjs.map +1 -1
- package/package.json +23 -21
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.js","sources":["../../../../../src/commands/actions/plugin/init/command.ts"],"sourcesContent":["import type { StrapiCommand } from '../../../types';\nimport { runAction } from '../../../utils/helpers';\nimport action from './action';\n\n/**\n * `$ strapi plugin:init`\n */\nconst command: StrapiCommand = ({ command, ctx }) => {\n command\n .command('plugin:init')\n .description('Create a new plugin at a given path')\n .argument('[path]', 'path to the plugin', './src/plugins/my-plugin')\n .option('-d, --debug', 'Enable debugging mode with verbose logs', false)\n .option('--silent', \"Don't log anything\", false)\n .action((...args) => runAction('plugin:init', action)(...args, ctx));\n};\n\nexport default command;\n"],"names":["command","runAction"],"mappings":";;;AAOA,MAAM,UAAyB,CAAC,EAAE,SAAAA,UAAS,UAAU;AACnDA,WACG,QAAQ,aAAa,EACrB,YAAY,qCAAqC,EACjD,SAAS,UAAU,sBAAsB,yBAAyB,EAClE,OAAO,eAAe,2CAA2C,KAAK,EACtE,OAAO,YAAY,sBAAsB,KAAK,EAC9C,OAAO,IAAI,SAASC,QAAAA,UAAU,eAAe,MAAM,EAAE,GAAG,MAAM,GAAG,CAAC;AACvE;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../../../../../src/commands/actions/plugin/init/files/admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAkD/C,QAAA,MAAM,UAAU,EAAE,YAAY,EAyH7B,CAAC;AAEF,QAAA,MAAM,UAAU,EAAE,YAAY,EA8G7B,CAAC;AAEF,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,UAAU,IAAI,oBAAoB,EAAE,CAAC"}
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const outdent = require("outdent");
|
|
4
|
+
const PLUGIN_ICON_CODE = outdent.outdent`
|
|
5
|
+
import { Puzzle } from '@strapi/icons';
|
|
6
|
+
|
|
7
|
+
const PluginIcon = () => <Puzzle />;
|
|
8
|
+
|
|
9
|
+
export { PluginIcon };
|
|
10
|
+
`;
|
|
11
|
+
const APP_CODE = outdent.outdent`
|
|
12
|
+
import { AnErrorOccurred } from '@strapi/helper-plugin';
|
|
13
|
+
import { Switch, Route } from 'react-router-dom';
|
|
14
|
+
|
|
15
|
+
import { PLUGIN_ID } from '../pluginId';
|
|
16
|
+
|
|
17
|
+
import { HomePage } from './HomePage';
|
|
18
|
+
|
|
19
|
+
const App = () => {
|
|
20
|
+
return (
|
|
21
|
+
<Switch>
|
|
22
|
+
<Route path={\`/plugins/\${PLUGIN_ID}\`} component={HomePage} exact />
|
|
23
|
+
<Route component={AnErrorOccurred} />
|
|
24
|
+
</Switch>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { App };
|
|
29
|
+
`;
|
|
30
|
+
const HOMEPAGE_CODE = outdent.outdent`
|
|
31
|
+
import { Main } from '@strapi/design-system';
|
|
32
|
+
import { useIntl } from 'react-intl';
|
|
33
|
+
|
|
34
|
+
import { getTranslation } from '../utils/getTranslation';
|
|
35
|
+
|
|
36
|
+
const HomePage = () => {
|
|
37
|
+
const { formatMessage } = useIntl();
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Main>
|
|
41
|
+
<h1>Welcome to {formatMessage({ id: getTranslation("plugin.name") })}</h1>
|
|
42
|
+
</Main>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { HomePage };
|
|
47
|
+
`;
|
|
48
|
+
const TYPESCRIPT = [
|
|
49
|
+
{
|
|
50
|
+
name: "admin/src/index.ts",
|
|
51
|
+
contents: outdent.outdent`
|
|
52
|
+
import { prefixPluginTranslations } from '@strapi/helper-plugin';
|
|
53
|
+
import { PLUGIN_ID } from './pluginId';
|
|
54
|
+
import { Initializer } from './components/Initializer';
|
|
55
|
+
import { PluginIcon } from './components/PluginIcon';
|
|
56
|
+
|
|
57
|
+
export default {
|
|
58
|
+
register(app: any) {
|
|
59
|
+
app.addMenuLink({
|
|
60
|
+
to: \`/plugins/\${PluginIcon}\`,
|
|
61
|
+
icon: PluginIcon,
|
|
62
|
+
intlLabel: {
|
|
63
|
+
id: \`\${PLUGIN_ID}.plugin.name\`,
|
|
64
|
+
defaultMessage: PLUGIN_ID,
|
|
65
|
+
},
|
|
66
|
+
Component: async () => {
|
|
67
|
+
const { App } = await import('./pages/App');
|
|
68
|
+
|
|
69
|
+
return App;
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
app.registerPlugin({
|
|
74
|
+
id: PLUGIN_ID,
|
|
75
|
+
initializer: Initializer,
|
|
76
|
+
isReady: false,
|
|
77
|
+
name: PLUGIN_ID,
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
async registerTrads(app: any) {
|
|
82
|
+
const { locales } = app;
|
|
83
|
+
|
|
84
|
+
const importedTranslations = await Promise.all(
|
|
85
|
+
(locales as string[]).map((locale) => {
|
|
86
|
+
return import(\`./translations/\${locale}.json\`)
|
|
87
|
+
.then(({ default: data }) => {
|
|
88
|
+
return {
|
|
89
|
+
data: prefixPluginTranslations(data, PLUGIN_ID),
|
|
90
|
+
locale,
|
|
91
|
+
};
|
|
92
|
+
})
|
|
93
|
+
.catch(() => {
|
|
94
|
+
return {
|
|
95
|
+
data: {},
|
|
96
|
+
locale,
|
|
97
|
+
};
|
|
98
|
+
});
|
|
99
|
+
})
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
return importedTranslations;
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
`
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: "admin/src/components/PluginIcon.tsx",
|
|
109
|
+
contents: PLUGIN_ICON_CODE
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: "admin/src/components/Initializer.tsx",
|
|
113
|
+
contents: outdent.outdent`
|
|
114
|
+
import { useEffect, useRef } from 'react';
|
|
115
|
+
|
|
116
|
+
import { PLUGIN_ID } from '../pluginId';
|
|
117
|
+
|
|
118
|
+
type InitializerProps = {
|
|
119
|
+
setPlugin: (id: string) => void;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const Initializer = ({ setPlugin }: InitializerProps) => {
|
|
123
|
+
const ref = useRef(setPlugin);
|
|
124
|
+
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
ref.current(PLUGIN_ID);
|
|
127
|
+
}, []);
|
|
128
|
+
|
|
129
|
+
return null;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export { Initializer };
|
|
133
|
+
`
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
name: "admin/src/pages/App.tsx",
|
|
137
|
+
contents: APP_CODE
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: "admin/src/pages/HomePage.tsx",
|
|
141
|
+
contents: HOMEPAGE_CODE
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: "admin/src/utils/getTranslation.ts",
|
|
145
|
+
contents: outdent.outdent`
|
|
146
|
+
import { PLUGIN_ID } from '../pluginId';
|
|
147
|
+
|
|
148
|
+
const getTranslation = (id: string) => \`\${PLUGIN_ID}.\${id}\`;
|
|
149
|
+
|
|
150
|
+
export { getTranslation };
|
|
151
|
+
`
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
name: "admin/src/translations/en.json",
|
|
155
|
+
contents: outdent.outdent`
|
|
156
|
+
{}
|
|
157
|
+
`
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
/**
|
|
161
|
+
* TODO: remove this when we release design-system V2
|
|
162
|
+
*/
|
|
163
|
+
name: "admin/custom.d.ts",
|
|
164
|
+
contents: outdent.outdent`
|
|
165
|
+
declare module '@strapi/design-system/*';
|
|
166
|
+
declare module '@strapi/design-system';
|
|
167
|
+
`
|
|
168
|
+
}
|
|
169
|
+
];
|
|
170
|
+
const JAVASCRIPT = [
|
|
171
|
+
{
|
|
172
|
+
name: "admin/src/index.js",
|
|
173
|
+
contents: outdent.outdent`
|
|
174
|
+
import { prefixPluginTranslations } from '@strapi/helper-plugin';
|
|
175
|
+
import { PLUGIN_ID } from './pluginId';
|
|
176
|
+
import { Initializer } from './components/Initializer';
|
|
177
|
+
import { PluginIcon } from './components/PluginIcon';
|
|
178
|
+
|
|
179
|
+
export default {
|
|
180
|
+
register(app) {
|
|
181
|
+
app.addMenuLink({
|
|
182
|
+
to: \`/plugins/\${PluginIcon}\`,
|
|
183
|
+
icon: PluginIcon,
|
|
184
|
+
intlLabel: {
|
|
185
|
+
id: \`\${PLUGIN_ID}.plugin.name\`,
|
|
186
|
+
defaultMessage: PLUGIN_ID,
|
|
187
|
+
},
|
|
188
|
+
Component: async () => {
|
|
189
|
+
const { App } = await import('./pages/App');
|
|
190
|
+
|
|
191
|
+
return App;
|
|
192
|
+
},
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
app.registerPlugin({
|
|
196
|
+
id: PLUGIN_ID,
|
|
197
|
+
initializer: Initializer,
|
|
198
|
+
isReady: false,
|
|
199
|
+
name: PLUGIN_ID,
|
|
200
|
+
});
|
|
201
|
+
},
|
|
202
|
+
|
|
203
|
+
async registerTrads(app) {
|
|
204
|
+
const { locales } = app;
|
|
205
|
+
|
|
206
|
+
const importedTranslations = await Promise.all(
|
|
207
|
+
locales.map((locale) => {
|
|
208
|
+
return import(\`./translations/\${locale}.json\`)
|
|
209
|
+
.then(({ default: data }) => {
|
|
210
|
+
return {
|
|
211
|
+
data: prefixPluginTranslations(data, PLUGIN_ID),
|
|
212
|
+
locale,
|
|
213
|
+
};
|
|
214
|
+
})
|
|
215
|
+
.catch(() => {
|
|
216
|
+
return {
|
|
217
|
+
data: {},
|
|
218
|
+
locale,
|
|
219
|
+
};
|
|
220
|
+
});
|
|
221
|
+
})
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
return importedTranslations;
|
|
225
|
+
},
|
|
226
|
+
};
|
|
227
|
+
`
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
name: "admin/src/components/PluginIcon.jsx",
|
|
231
|
+
contents: PLUGIN_ICON_CODE
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
name: "admin/src/components/Initializer.jsx",
|
|
235
|
+
contents: outdent.outdent`
|
|
236
|
+
import { useEffect, useRef } from 'react';
|
|
237
|
+
|
|
238
|
+
import { PLUGIN_ID } from '../pluginId';
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* @type {import('react').FC<{ setPlugin: (id: string) => void }>}
|
|
242
|
+
*/
|
|
243
|
+
const Initializer = ({ setPlugin }) => {
|
|
244
|
+
const ref = useRef(setPlugin);
|
|
245
|
+
|
|
246
|
+
useEffect(() => {
|
|
247
|
+
ref.current(PLUGIN_ID);
|
|
248
|
+
}, []);
|
|
249
|
+
|
|
250
|
+
return null;
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
export { Initializer };
|
|
254
|
+
`
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
name: "admin/src/pages/App.jsx",
|
|
258
|
+
contents: APP_CODE
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
name: "admin/src/pages/HomePage.jsx",
|
|
262
|
+
contents: HOMEPAGE_CODE
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
name: "admin/src/utils/getTranslation.js",
|
|
266
|
+
contents: outdent.outdent`
|
|
267
|
+
import { PLUGIN_ID } from '../pluginId';
|
|
268
|
+
|
|
269
|
+
const getTranslation = (id) => \`\${PLUGIN_ID}.\${id}\`;
|
|
270
|
+
|
|
271
|
+
export { getTranslation };
|
|
272
|
+
`
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
name: "admin/src/translations/en.json",
|
|
276
|
+
contents: outdent.outdent`
|
|
277
|
+
{}
|
|
278
|
+
`
|
|
279
|
+
}
|
|
280
|
+
];
|
|
281
|
+
exports.adminJavascriptFiles = JAVASCRIPT;
|
|
282
|
+
exports.adminTypescriptFiles = TYPESCRIPT;
|
|
283
|
+
//# sourceMappingURL=admin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin.js","sources":["../../../../../../src/commands/actions/plugin/init/files/admin.ts"],"sourcesContent":["import { TemplateFile } from '@strapi/pack-up';\nimport { outdent } from 'outdent';\n\nconst PLUGIN_ICON_CODE = outdent`\nimport { Puzzle } from '@strapi/icons';\n\nconst PluginIcon = () => <Puzzle />;\n\nexport { PluginIcon };\n`;\n\nconst APP_CODE = outdent`\nimport { AnErrorOccurred } from '@strapi/helper-plugin';\nimport { Switch, Route } from 'react-router-dom';\n\nimport { PLUGIN_ID } from '../pluginId';\n\nimport { HomePage } from './HomePage';\n\nconst App = () => {\n return (\n <Switch>\n <Route path={\\`/plugins/\\${PLUGIN_ID}\\`} component={HomePage} exact />\n <Route component={AnErrorOccurred} />\n </Switch>\n );\n};\n\nexport { App };\n`;\n\nconst HOMEPAGE_CODE = outdent`\n import { Main } from '@strapi/design-system';\n import { useIntl } from 'react-intl';\n\n import { getTranslation } from '../utils/getTranslation';\n\n const HomePage = () => {\n const { formatMessage } = useIntl();\n\n return (\n <Main>\n <h1>Welcome to {formatMessage({ id: getTranslation(\"plugin.name\") })}</h1>\n </Main>\n )\n }\n\n export { HomePage };\n`;\n\nconst TYPESCRIPT: TemplateFile[] = [\n {\n name: 'admin/src/index.ts',\n contents: outdent`\n import { prefixPluginTranslations } from '@strapi/helper-plugin';\n import { PLUGIN_ID } from './pluginId';\n import { Initializer } from './components/Initializer';\n import { PluginIcon } from './components/PluginIcon';\n \n export default {\n register(app: any) {\n app.addMenuLink({\n to: \\`/plugins/\\${PluginIcon}\\`,\n icon: PluginIcon,\n intlLabel: {\n id: \\`\\${PLUGIN_ID}.plugin.name\\`,\n defaultMessage: PLUGIN_ID,\n },\n Component: async () => {\n const { App } = await import('./pages/App');\n \n return App;\n },\n });\n \n app.registerPlugin({\n id: PLUGIN_ID,\n initializer: Initializer,\n isReady: false,\n name: PLUGIN_ID,\n });\n },\n \n async registerTrads(app: any) {\n const { locales } = app;\n \n const importedTranslations = await Promise.all(\n (locales as string[]).map((locale) => {\n return import(\\`./translations/\\${locale}.json\\`)\n .then(({ default: data }) => {\n return {\n data: prefixPluginTranslations(data, PLUGIN_ID),\n locale,\n };\n })\n .catch(() => {\n return {\n data: {},\n locale,\n };\n });\n })\n );\n \n return importedTranslations;\n },\n };\n `,\n },\n {\n name: 'admin/src/components/PluginIcon.tsx',\n contents: PLUGIN_ICON_CODE,\n },\n {\n name: 'admin/src/components/Initializer.tsx',\n contents: outdent`\n import { useEffect, useRef } from 'react';\n\n import { PLUGIN_ID } from '../pluginId';\n \n type InitializerProps = {\n setPlugin: (id: string) => void;\n };\n \n const Initializer = ({ setPlugin }: InitializerProps) => {\n const ref = useRef(setPlugin);\n \n useEffect(() => {\n ref.current(PLUGIN_ID);\n }, []);\n \n return null;\n };\n \n export { Initializer };\n `,\n },\n {\n name: 'admin/src/pages/App.tsx',\n contents: APP_CODE,\n },\n {\n name: 'admin/src/pages/HomePage.tsx',\n contents: HOMEPAGE_CODE,\n },\n {\n name: 'admin/src/utils/getTranslation.ts',\n contents: outdent`\n import { PLUGIN_ID } from '../pluginId';\n\n const getTranslation = (id: string) => \\`\\${PLUGIN_ID}.\\${id}\\`;\n\n export { getTranslation };\n `,\n },\n {\n name: 'admin/src/translations/en.json',\n contents: outdent`\n {}\n `,\n },\n {\n /**\n * TODO: remove this when we release design-system V2\n */\n name: 'admin/custom.d.ts',\n contents: outdent`\n declare module '@strapi/design-system/*';\n declare module '@strapi/design-system';\n `,\n },\n];\n\nconst JAVASCRIPT: TemplateFile[] = [\n {\n name: 'admin/src/index.js',\n contents: outdent`\n import { prefixPluginTranslations } from '@strapi/helper-plugin';\n import { PLUGIN_ID } from './pluginId';\n import { Initializer } from './components/Initializer';\n import { PluginIcon } from './components/PluginIcon';\n \n export default {\n register(app) {\n app.addMenuLink({\n to: \\`/plugins/\\${PluginIcon}\\`,\n icon: PluginIcon,\n intlLabel: {\n id: \\`\\${PLUGIN_ID}.plugin.name\\`,\n defaultMessage: PLUGIN_ID,\n },\n Component: async () => {\n const { App } = await import('./pages/App');\n \n return App;\n },\n });\n \n app.registerPlugin({\n id: PLUGIN_ID,\n initializer: Initializer,\n isReady: false,\n name: PLUGIN_ID,\n });\n },\n \n async registerTrads(app) {\n const { locales } = app;\n \n const importedTranslations = await Promise.all(\n locales.map((locale) => {\n return import(\\`./translations/\\${locale}.json\\`)\n .then(({ default: data }) => {\n return {\n data: prefixPluginTranslations(data, PLUGIN_ID),\n locale,\n };\n })\n .catch(() => {\n return {\n data: {},\n locale,\n };\n });\n })\n );\n \n return importedTranslations;\n },\n };\n `,\n },\n {\n name: 'admin/src/components/PluginIcon.jsx',\n contents: PLUGIN_ICON_CODE,\n },\n {\n name: 'admin/src/components/Initializer.jsx',\n contents: outdent`\n import { useEffect, useRef } from 'react';\n \n import { PLUGIN_ID } from '../pluginId';\n \n /**\n * @type {import('react').FC<{ setPlugin: (id: string) => void }>}\n */ \n const Initializer = ({ setPlugin }) => {\n const ref = useRef(setPlugin);\n \n useEffect(() => {\n ref.current(PLUGIN_ID);\n }, []);\n \n return null;\n };\n \n export { Initializer };\n `,\n },\n {\n name: 'admin/src/pages/App.jsx',\n contents: APP_CODE,\n },\n {\n name: 'admin/src/pages/HomePage.jsx',\n contents: HOMEPAGE_CODE,\n },\n {\n name: 'admin/src/utils/getTranslation.js',\n contents: outdent`\n import { PLUGIN_ID } from '../pluginId';\n \n const getTranslation = (id) => \\`\\${PLUGIN_ID}.\\${id}\\`;\n \n export { getTranslation };\n `,\n },\n {\n name: 'admin/src/translations/en.json',\n contents: outdent`\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AA,IACE,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,UAAUA,QAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,EAOZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,UAAUA,QAAAA;AAAAA;AAAAA;AAAAA,EAGZ;AACF;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editorConfig.d.ts","sourceRoot":"","sources":["../../../../../../src/commands/actions/plugin/init/files/editorConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,QAAA,MAAM,gBAAgB,EAAE,YAoBvB,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const outdent = require("outdent");
|
|
4
|
+
const editorConfigFile = {
|
|
5
|
+
name: ".editorconfig",
|
|
6
|
+
contents: outdent.outdent`
|
|
7
|
+
root = true
|
|
8
|
+
|
|
9
|
+
[*]
|
|
10
|
+
indent_style = space
|
|
11
|
+
indent_size = 2
|
|
12
|
+
end_of_line = lf
|
|
13
|
+
charset = utf-8
|
|
14
|
+
trim_trailing_whitespace = true
|
|
15
|
+
insert_final_newline = true
|
|
16
|
+
|
|
17
|
+
[{package.json,*.yml}]
|
|
18
|
+
indent_style = space
|
|
19
|
+
indent_size = 2
|
|
20
|
+
|
|
21
|
+
[*.md]
|
|
22
|
+
trim_trailing_whitespace = false
|
|
23
|
+
`
|
|
24
|
+
};
|
|
25
|
+
exports.editorConfigFile = editorConfigFile;
|
|
26
|
+
//# sourceMappingURL=editorConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editorConfig.js","sources":["../../../../../../src/commands/actions/plugin/init/files/editorConfig.ts"],"sourcesContent":["import { TemplateFile } from '@strapi/pack-up';\nimport { outdent } from 'outdent';\n\nconst editorConfigFile: TemplateFile = {\n name: '.editorconfig',\n contents: outdent`\n root = true\n\n [*]\n indent_style = space\n indent_size = 2\n end_of_line = lf\n charset = utf-8\n trim_trailing_whitespace = true\n insert_final_newline = true\n \n [{package.json,*.yml}]\n indent_style = space\n indent_size = 2\n \n [*.md]\n trim_trailing_whitespace = false\n `,\n};\n\nexport { editorConfigFile };\n"],"names":["outdent"],"mappings":";;;AAGA,MAAM,mBAAiC;AAAA,EACrC,MAAM;AAAA,EACN,UAAUA,QAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAkBZ;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eslint.d.ts","sourceRoot":"","sources":["../../../../../../src/commands/actions/plugin/init/files/eslint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,QAAA,MAAM,gBAAgB,EAAE,YAKvB,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const outdent = require("outdent");
|
|
4
|
+
const eslintIgnoreFile = {
|
|
5
|
+
name: ".eslintignore",
|
|
6
|
+
contents: outdent.outdent`
|
|
7
|
+
dist
|
|
8
|
+
`
|
|
9
|
+
};
|
|
10
|
+
exports.eslintIgnoreFile = eslintIgnoreFile;
|
|
11
|
+
//# sourceMappingURL=eslint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eslint.js","sources":["../../../../../../src/commands/actions/plugin/init/files/eslint.ts"],"sourcesContent":["import { TemplateFile } from '@strapi/pack-up';\nimport { outdent } from 'outdent';\n\nconst eslintIgnoreFile: TemplateFile = {\n name: '.eslintignore',\n contents: outdent`\n dist\n `,\n};\n\nexport { eslintIgnoreFile };\n"],"names":["outdent"],"mappings":";;;AAGA,MAAM,mBAAiC;AAAA,EACrC,MAAM;AAAA,EACN,UAAUA,QAAAA;AAAAA;AAAAA;AAGZ;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitIgnore.d.ts","sourceRoot":"","sources":["../../../../../../src/commands/actions/plugin/init/files/gitIgnore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,QAAA,MAAM,aAAa,EAAE,YA4BpB,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const outdent = require("outdent");
|
|
4
|
+
const gitIgnoreFile = {
|
|
5
|
+
name: ".gitignore",
|
|
6
|
+
contents: outdent.outdent`
|
|
7
|
+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
8
|
+
|
|
9
|
+
# dependencies
|
|
10
|
+
node_modules
|
|
11
|
+
.pnp
|
|
12
|
+
.pnp.js
|
|
13
|
+
|
|
14
|
+
# testing
|
|
15
|
+
coverage
|
|
16
|
+
|
|
17
|
+
# production
|
|
18
|
+
dist
|
|
19
|
+
|
|
20
|
+
# misc
|
|
21
|
+
.DS_Store
|
|
22
|
+
*.pem
|
|
23
|
+
|
|
24
|
+
# debug
|
|
25
|
+
npm-debug.log*
|
|
26
|
+
yarn-debug.log*
|
|
27
|
+
yarn-error.log*
|
|
28
|
+
|
|
29
|
+
# local env files
|
|
30
|
+
.env
|
|
31
|
+
`
|
|
32
|
+
};
|
|
33
|
+
exports.gitIgnoreFile = gitIgnoreFile;
|
|
34
|
+
//# sourceMappingURL=gitIgnore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitIgnore.js","sources":["../../../../../../src/commands/actions/plugin/init/files/gitIgnore.ts"],"sourcesContent":["import { TemplateFile } from '@strapi/pack-up';\nimport { outdent } from 'outdent';\n\nconst gitIgnoreFile: TemplateFile = {\n name: '.gitignore',\n contents: outdent`\n # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.\n\n # dependencies\n node_modules\n .pnp\n .pnp.js\n \n # testing\n coverage\n \n # production\n dist\n \n # misc\n .DS_Store\n *.pem\n \n # debug\n npm-debug.log*\n yarn-debug.log*\n yarn-error.log*\n \n # local env files\n .env \n `,\n};\n\nexport { gitIgnoreFile };\n"],"names":["outdent"],"mappings":";;;AAGA,MAAM,gBAA8B;AAAA,EAClC,MAAM;AAAA,EACN,UAAUA,QAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AA0BZ;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prettier.d.ts","sourceRoot":"","sources":["../../../../../../src/commands/actions/plugin/init/files/prettier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,QAAA,MAAM,YAAY,EAAE,YAWnB,CAAC;AAEF,QAAA,MAAM,kBAAkB,EAAE,YAMzB,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const outdent = require("outdent");
|
|
4
|
+
const prettierFile = {
|
|
5
|
+
name: ".prettierrc",
|
|
6
|
+
contents: outdent.outdent`
|
|
7
|
+
{
|
|
8
|
+
"endOfLine": 'lf',
|
|
9
|
+
"tabWidth": 2,
|
|
10
|
+
"printWidth": 100,
|
|
11
|
+
"singleQuote": true,
|
|
12
|
+
"trailingComma": 'es5',
|
|
13
|
+
}
|
|
14
|
+
`
|
|
15
|
+
};
|
|
16
|
+
const prettierIgnoreFile = {
|
|
17
|
+
name: ".prettierignore",
|
|
18
|
+
contents: outdent.outdent`
|
|
19
|
+
dist
|
|
20
|
+
coverage
|
|
21
|
+
`
|
|
22
|
+
};
|
|
23
|
+
exports.prettierFile = prettierFile;
|
|
24
|
+
exports.prettierIgnoreFile = prettierIgnoreFile;
|
|
25
|
+
//# sourceMappingURL=prettier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prettier.js","sources":["../../../../../../src/commands/actions/plugin/init/files/prettier.ts"],"sourcesContent":["import { TemplateFile } from '@strapi/pack-up';\nimport { outdent } from 'outdent';\n\nconst prettierFile: TemplateFile = {\n name: '.prettierrc',\n contents: outdent`\n {\n \"endOfLine\": 'lf',\n \"tabWidth\": 2,\n \"printWidth\": 100,\n \"singleQuote\": true,\n \"trailingComma\": 'es5',\n }\n `,\n};\n\nconst prettierIgnoreFile: TemplateFile = {\n name: '.prettierignore',\n contents: outdent`\n dist\n coverage\n `,\n};\n\nexport { prettierFile, prettierIgnoreFile };\n"],"names":["outdent"],"mappings":";;;AAGA,MAAM,eAA6B;AAAA,EACjC,MAAM;AAAA,EACN,UAAUA,QAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AASZ;AAEA,MAAM,qBAAmC;AAAA,EACvC,MAAM;AAAA,EACN,UAAUA,QAAAA;AAAAA;AAAAA;AAAAA;AAIZ;;;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { TemplateFile } from '@strapi/pack-up';
|
|
2
|
+
declare const TYPESCRIPT: (pluginName: string) => TemplateFile[];
|
|
3
|
+
declare const JAVASCRIPT: (pluginName: string) => TemplateFile[];
|
|
4
|
+
export { TYPESCRIPT as serverTypescriptFiles, JAVASCRIPT as serverJavascriptFiles };
|
|
5
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../../../src/commands/actions/plugin/init/files/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,QAAA,MAAM,UAAU,eAAgB,MAAM,KAAG,YAAY,EAwKpD,CAAC;AAEF,QAAA,MAAM,UAAU,eAAgB,MAAM,KAAG,YAAY,EAwLpD,CAAC;AAEF,OAAO,EAAE,UAAU,IAAI,qBAAqB,EAAE,UAAU,IAAI,qBAAqB,EAAE,CAAC"}
|