@strapi/strapi 4.16.2 → 4.17.0
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,360 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const outdent = require("outdent");
|
|
4
|
+
const TYPESCRIPT = (pluginName) => [
|
|
5
|
+
{
|
|
6
|
+
name: "server/src/index.ts",
|
|
7
|
+
contents: outdent.outdent`
|
|
8
|
+
/**
|
|
9
|
+
* Application methods
|
|
10
|
+
*/
|
|
11
|
+
import bootstrap from './bootstrap';
|
|
12
|
+
import destroy from './destroy';
|
|
13
|
+
import register from './register';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Plugin server methods
|
|
17
|
+
*/
|
|
18
|
+
import config from './config';
|
|
19
|
+
import contentTypes from './content-types';
|
|
20
|
+
import controllers from './controllers';
|
|
21
|
+
import middlewares from './middlewares';
|
|
22
|
+
import policies from './policies';
|
|
23
|
+
import routes from './routes';
|
|
24
|
+
import services from './services';
|
|
25
|
+
|
|
26
|
+
export default {
|
|
27
|
+
bootstrap,
|
|
28
|
+
destroy,
|
|
29
|
+
register,
|
|
30
|
+
|
|
31
|
+
config,
|
|
32
|
+
controllers,
|
|
33
|
+
contentTypes,
|
|
34
|
+
middlewares,
|
|
35
|
+
policies,
|
|
36
|
+
routes,
|
|
37
|
+
services,
|
|
38
|
+
};
|
|
39
|
+
`
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "server/src/bootstrap.ts",
|
|
43
|
+
contents: outdent.outdent`
|
|
44
|
+
import type { Strapi } from '@strapi/strapi';
|
|
45
|
+
|
|
46
|
+
const bootstrap = ({ strapi }: { strapi: Strapi }) => {
|
|
47
|
+
// bootstrap phase
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default bootstrap;
|
|
51
|
+
`
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "server/src/destroy.ts",
|
|
55
|
+
contents: outdent.outdent`
|
|
56
|
+
import type { Strapi } from '@strapi/strapi';
|
|
57
|
+
|
|
58
|
+
const destroy = ({ strapi }: { strapi: Strapi }) => {
|
|
59
|
+
// destroy phase
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export default destroy;
|
|
63
|
+
`
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: "server/src/register.ts",
|
|
67
|
+
contents: outdent.outdent`
|
|
68
|
+
import type { Strapi } from '@strapi/strapi';
|
|
69
|
+
|
|
70
|
+
const register = ({ strapi }: { strapi: Strapi }) => {
|
|
71
|
+
// register phase
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export default register;
|
|
75
|
+
`
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: "server/src/config/index.ts",
|
|
79
|
+
contents: outdent.outdent`
|
|
80
|
+
export default {
|
|
81
|
+
default: {},
|
|
82
|
+
validator() {},
|
|
83
|
+
};
|
|
84
|
+
`
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: "server/src/content-types/index.ts",
|
|
88
|
+
contents: outdent.outdent`
|
|
89
|
+
export default {};
|
|
90
|
+
`
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: "server/src/controllers/index.ts",
|
|
94
|
+
contents: outdent.outdent`
|
|
95
|
+
import controller from './controller';
|
|
96
|
+
|
|
97
|
+
export default {
|
|
98
|
+
controller,
|
|
99
|
+
};
|
|
100
|
+
`
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: "server/src/controllers/controller.ts",
|
|
104
|
+
contents: outdent.outdent`
|
|
105
|
+
import type { Strapi } from '@strapi/strapi';
|
|
106
|
+
|
|
107
|
+
const controller = ({ strapi }: { strapi: Strapi }) => ({
|
|
108
|
+
index(ctx) {
|
|
109
|
+
ctx.body = strapi
|
|
110
|
+
.plugin('${pluginName}')
|
|
111
|
+
// the name of the service file & the method.
|
|
112
|
+
.service('service')
|
|
113
|
+
.getWelcomeMessage();
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
export default controller
|
|
118
|
+
`
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: "server/src/middlewares/index.ts",
|
|
122
|
+
contents: outdent.outdent`
|
|
123
|
+
export default {};
|
|
124
|
+
`
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: "server/src/policies/index.ts",
|
|
128
|
+
contents: outdent.outdent`
|
|
129
|
+
export default {};
|
|
130
|
+
`
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: "server/src/routes/index.ts",
|
|
134
|
+
contents: outdent.outdent`
|
|
135
|
+
export default [
|
|
136
|
+
{
|
|
137
|
+
method: 'GET',
|
|
138
|
+
path: '/',
|
|
139
|
+
// name of the controller file & the method.
|
|
140
|
+
handler: 'controller.index',
|
|
141
|
+
config: {
|
|
142
|
+
policies: [],
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
];
|
|
146
|
+
`
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
name: "server/src/services/index.ts",
|
|
150
|
+
contents: outdent.outdent`
|
|
151
|
+
import service from './service';
|
|
152
|
+
|
|
153
|
+
export default {
|
|
154
|
+
service,
|
|
155
|
+
};
|
|
156
|
+
`
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
name: "server/src/services/service.ts",
|
|
160
|
+
contents: outdent.outdent`
|
|
161
|
+
import type { Strapi } from '@strapi/strapi';
|
|
162
|
+
|
|
163
|
+
const service = ({ strapi }: { strapi: Strapi }) => ({
|
|
164
|
+
getWelcomeMessage() {
|
|
165
|
+
return 'Welcome to Strapi 🚀';
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
export default service
|
|
170
|
+
`
|
|
171
|
+
}
|
|
172
|
+
];
|
|
173
|
+
const JAVASCRIPT = (pluginName) => [
|
|
174
|
+
{
|
|
175
|
+
name: "server/src/index.ts",
|
|
176
|
+
contents: outdent.outdent`
|
|
177
|
+
'use strict';
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Application methods
|
|
181
|
+
*/
|
|
182
|
+
const bootstrap = require('./bootstrap');
|
|
183
|
+
const destroy = require('./destroy');
|
|
184
|
+
const register = require('./register');
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Plugin server methods
|
|
188
|
+
*/
|
|
189
|
+
const config = require('./config');
|
|
190
|
+
const contentTypes = require('./content-types');
|
|
191
|
+
const controllers = require('./controllers');
|
|
192
|
+
const middlewares = require('./middlewares');
|
|
193
|
+
const policies = require('./policies');
|
|
194
|
+
const routes = require('./routes');
|
|
195
|
+
const services = require('./services');
|
|
196
|
+
|
|
197
|
+
module.exports = {
|
|
198
|
+
bootstrap,
|
|
199
|
+
destroy,
|
|
200
|
+
register,
|
|
201
|
+
|
|
202
|
+
config,
|
|
203
|
+
controllers,
|
|
204
|
+
contentTypes,
|
|
205
|
+
middlewares,
|
|
206
|
+
policies,
|
|
207
|
+
routes,
|
|
208
|
+
services,
|
|
209
|
+
};
|
|
210
|
+
`
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
name: "server/src/bootstrap.ts",
|
|
214
|
+
contents: outdent.outdent`
|
|
215
|
+
'use strict';
|
|
216
|
+
|
|
217
|
+
const bootstrap = ({ strapi }) => {
|
|
218
|
+
// bootstrap phase
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
module.exports = bootstrap;
|
|
222
|
+
`
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
name: "server/src/destroy.ts",
|
|
226
|
+
contents: outdent.outdent`
|
|
227
|
+
'use strict';
|
|
228
|
+
|
|
229
|
+
const destroy = ({ strapi }) => {
|
|
230
|
+
// destroy phase
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
module.exports = destroy;
|
|
234
|
+
`
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
name: "server/src/register.ts",
|
|
238
|
+
contents: outdent.outdent`
|
|
239
|
+
'use strict';
|
|
240
|
+
|
|
241
|
+
const register = ({ strapi }) => {
|
|
242
|
+
// register phase
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
module.exports = register;
|
|
246
|
+
`
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
name: "server/src/config/index.ts",
|
|
250
|
+
contents: outdent.outdent`
|
|
251
|
+
'use strict';
|
|
252
|
+
|
|
253
|
+
module.exports = {
|
|
254
|
+
default: {},
|
|
255
|
+
validator() {},
|
|
256
|
+
};
|
|
257
|
+
`
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
name: "server/src/content-types/index.ts",
|
|
261
|
+
contents: outdent.outdent`
|
|
262
|
+
'use strict';
|
|
263
|
+
|
|
264
|
+
module.exports = {};
|
|
265
|
+
`
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
name: "server/src/controllers/index.ts",
|
|
269
|
+
contents: outdent.outdent`
|
|
270
|
+
'use strict';
|
|
271
|
+
|
|
272
|
+
const controller = require('./controller');
|
|
273
|
+
|
|
274
|
+
module.exports = {
|
|
275
|
+
controller,
|
|
276
|
+
};
|
|
277
|
+
`
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
name: "server/src/controllers/controller.ts",
|
|
281
|
+
contents: outdent.outdent`
|
|
282
|
+
'use strict';
|
|
283
|
+
|
|
284
|
+
const controller = ({ strapi }) => ({
|
|
285
|
+
index(ctx) {
|
|
286
|
+
ctx.body = strapi
|
|
287
|
+
.plugin('${pluginName}')
|
|
288
|
+
// the name of the service file & the method.
|
|
289
|
+
.service('service')
|
|
290
|
+
.getWelcomeMessage();
|
|
291
|
+
},
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
module.exports = controller
|
|
295
|
+
`
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
name: "server/src/middlewares/index.ts",
|
|
299
|
+
contents: outdent.outdent`
|
|
300
|
+
'use strict';
|
|
301
|
+
|
|
302
|
+
module.exports = {};
|
|
303
|
+
`
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
name: "server/src/policies/index.ts",
|
|
307
|
+
contents: outdent.outdent`
|
|
308
|
+
'use strict';
|
|
309
|
+
|
|
310
|
+
module.exports = {};
|
|
311
|
+
`
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
name: "server/src/routes/index.ts",
|
|
315
|
+
contents: outdent.outdent`
|
|
316
|
+
'use strict';
|
|
317
|
+
|
|
318
|
+
module.exports = [
|
|
319
|
+
{
|
|
320
|
+
method: 'GET',
|
|
321
|
+
path: '/',
|
|
322
|
+
// name of the controller file & the method.
|
|
323
|
+
handler: 'controller.index',
|
|
324
|
+
config: {
|
|
325
|
+
policies: [],
|
|
326
|
+
},
|
|
327
|
+
},
|
|
328
|
+
];
|
|
329
|
+
`
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
name: "server/src/services/index.ts",
|
|
333
|
+
contents: outdent.outdent`
|
|
334
|
+
'use strict';
|
|
335
|
+
|
|
336
|
+
const service = require('./service');
|
|
337
|
+
|
|
338
|
+
module.exports = {
|
|
339
|
+
service,
|
|
340
|
+
};
|
|
341
|
+
`
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
name: "server/src/services/service.ts",
|
|
345
|
+
contents: outdent.outdent`
|
|
346
|
+
'use strict';
|
|
347
|
+
|
|
348
|
+
const service = ({ strapi }) => ({
|
|
349
|
+
getWelcomeMessage() {
|
|
350
|
+
return 'Welcome to Strapi 🚀';
|
|
351
|
+
},
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
module.exports = service
|
|
355
|
+
`
|
|
356
|
+
}
|
|
357
|
+
];
|
|
358
|
+
exports.serverJavascriptFiles = JAVASCRIPT;
|
|
359
|
+
exports.serverTypescriptFiles = TYPESCRIPT;
|
|
360
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sources":["../../../../../../src/commands/actions/plugin/init/files/server.ts"],"sourcesContent":["import { TemplateFile } from '@strapi/pack-up';\nimport { outdent } from 'outdent';\n\nconst TYPESCRIPT = (pluginName: string): TemplateFile[] => [\n {\n name: 'server/src/index.ts',\n contents: outdent`\n /**\n * Application methods\n */\n import bootstrap from './bootstrap';\n import destroy from './destroy';\n import register from './register';\n\n /**\n * Plugin server methods\n */\n import config from './config';\n import contentTypes from './content-types';\n import controllers from './controllers';\n import middlewares from './middlewares';\n import policies from './policies';\n import routes from './routes';\n import services from './services';\n \n export default {\n bootstrap,\n destroy,\n register,\n \n config,\n controllers,\n contentTypes,\n middlewares,\n policies,\n routes,\n services,\n };\n `,\n },\n {\n name: 'server/src/bootstrap.ts',\n contents: outdent`\n import type { Strapi } from '@strapi/strapi';\n\n const bootstrap = ({ strapi }: { strapi: Strapi }) => {\n // bootstrap phase\n };\n\n export default bootstrap;\n `,\n },\n {\n name: 'server/src/destroy.ts',\n contents: outdent`\n import type { Strapi } from '@strapi/strapi';\n\n const destroy = ({ strapi }: { strapi: Strapi }) => {\n // destroy phase\n };\n\n export default destroy;\n `,\n },\n {\n name: 'server/src/register.ts',\n contents: outdent`\n import type { Strapi } from '@strapi/strapi';\n\n const register = ({ strapi }: { strapi: Strapi }) => {\n // register phase\n };\n\n export default register;\n `,\n },\n {\n name: 'server/src/config/index.ts',\n contents: outdent`\n export default {\n default: {},\n validator() {},\n };\n `,\n },\n {\n name: 'server/src/content-types/index.ts',\n contents: outdent`\n export default {};\n `,\n },\n {\n name: 'server/src/controllers/index.ts',\n contents: outdent`\n import controller from './controller';\n\n export default {\n controller,\n };\n `,\n },\n {\n name: 'server/src/controllers/controller.ts',\n contents: outdent`\n import type { Strapi } from '@strapi/strapi';\n\n const controller = ({ strapi }: { strapi: Strapi }) => ({\n index(ctx) {\n ctx.body = strapi\n .plugin('${pluginName}')\n // the name of the service file & the method.\n .service('service')\n .getWelcomeMessage();\n },\n });\n\n export default controller\n `,\n },\n {\n name: 'server/src/middlewares/index.ts',\n contents: outdent`\n export default {};\n `,\n },\n {\n name: 'server/src/policies/index.ts',\n contents: outdent`\n export default {};\n `,\n },\n {\n name: 'server/src/routes/index.ts',\n contents: outdent`\n export default [\n {\n method: 'GET',\n path: '/',\n // name of the controller file & the method.\n handler: 'controller.index',\n config: {\n policies: [],\n },\n },\n ];\n `,\n },\n {\n name: 'server/src/services/index.ts',\n contents: outdent`\n import service from './service';\n\n export default {\n service,\n };\n `,\n },\n {\n name: 'server/src/services/service.ts',\n contents: outdent`\n import type { Strapi } from '@strapi/strapi';\n\n const service = ({ strapi }: { strapi: Strapi }) => ({\n getWelcomeMessage() {\n return 'Welcome to Strapi 🚀';\n },\n });\n\n export default service\n `,\n },\n];\n\nconst JAVASCRIPT = (pluginName: string): TemplateFile[] => [\n {\n name: 'server/src/index.ts',\n contents: outdent`\n 'use strict';\n\n /**\n * Application methods\n */\n const bootstrap = require('./bootstrap');\n const destroy = require('./destroy');\n const register = require('./register');\n\n /**\n * Plugin server methods\n */\n const config = require('./config');\n const contentTypes = require('./content-types');\n const controllers = require('./controllers');\n const middlewares = require('./middlewares');\n const policies = require('./policies');\n const routes = require('./routes');\n const services = require('./services');\n\n module.exports = {\n bootstrap,\n destroy,\n register,\n \n config,\n controllers,\n contentTypes,\n middlewares,\n policies,\n routes,\n services,\n };\n `,\n },\n {\n name: 'server/src/bootstrap.ts',\n contents: outdent`\n 'use strict';\n\n const bootstrap = ({ strapi }) => {\n // bootstrap phase\n };\n\n module.exports = bootstrap;\n `,\n },\n {\n name: 'server/src/destroy.ts',\n contents: outdent`\n 'use strict';\n\n const destroy = ({ strapi }) => {\n // destroy phase\n };\n \n module.exports = destroy;\n `,\n },\n {\n name: 'server/src/register.ts',\n contents: outdent`\n 'use strict';\n\n const register = ({ strapi }) => {\n // register phase\n };\n \n module.exports = register;\n `,\n },\n {\n name: 'server/src/config/index.ts',\n contents: outdent`\n 'use strict';\n\n module.exports = {\n default: {},\n validator() {},\n };\n `,\n },\n {\n name: 'server/src/content-types/index.ts',\n contents: outdent`\n 'use strict';\n\n module.exports = {};\n `,\n },\n {\n name: 'server/src/controllers/index.ts',\n contents: outdent`\n 'use strict';\n\n const controller = require('./controller');\n\n module.exports = {\n controller,\n };\n `,\n },\n {\n name: 'server/src/controllers/controller.ts',\n contents: outdent`\n 'use strict';\n\n const controller = ({ strapi }) => ({\n index(ctx) {\n ctx.body = strapi\n .plugin('${pluginName}')\n // the name of the service file & the method.\n .service('service')\n .getWelcomeMessage();\n },\n });\n\n module.exports = controller\n `,\n },\n {\n name: 'server/src/middlewares/index.ts',\n contents: outdent`\n 'use strict';\n\n module.exports = {};\n `,\n },\n {\n name: 'server/src/policies/index.ts',\n contents: outdent`\n 'use strict';\n\n module.exports = {};\n `,\n },\n {\n name: 'server/src/routes/index.ts',\n contents: outdent`\n 'use strict';\n\n module.exports = [\n {\n method: 'GET',\n path: '/',\n // name of the controller file & the method.\n handler: 'controller.index',\n config: {\n policies: [],\n },\n },\n ];\n `,\n },\n {\n name: 'server/src/services/index.ts',\n contents: outdent`\n 'use strict';\n\n const service = require('./service');\n\n module.exports = {\n service,\n };\n `,\n },\n {\n name: 'server/src/services/service.ts',\n contents: outdent`\n 'use strict';\n\n const service = ({ strapi }) => ({\n getWelcomeMessage() {\n return 'Welcome to Strapi 🚀';\n },\n });\n\n module.exports = service\n `,\n },\n];\n\nexport { TYPESCRIPT as serverTypescriptFiles, JAVASCRIPT as serverJavascriptFiles };\n"],"names":["outdent"],"mappings":";;;AAGM,MAAA,aAAa,CAAC,eAAuC;AAAA,EACzD;AAAA,IACE,MAAM;AAAA,IACN,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;AA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UA,QAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,EASZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,UAAUA,QAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,qBAMO,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS7B;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,UAAUA,QAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,EAKZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,UAAUA,QAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,EAKZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,UAAUA,QAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,EAeZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,UAAUA,QAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,EASZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,UAAUA,QAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,EAWZ;AACF;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TemplateFile } from '@strapi/pack-up';
|
|
2
|
+
interface TsConfigFiles {
|
|
3
|
+
tsconfigFile: TemplateFile;
|
|
4
|
+
tsconfigBuildFile: TemplateFile;
|
|
5
|
+
}
|
|
6
|
+
declare const ADMIN: TsConfigFiles;
|
|
7
|
+
declare const SERVER: TsConfigFiles;
|
|
8
|
+
export { ADMIN as adminTsconfigFiles, SERVER as serverTsconfigFiles };
|
|
9
|
+
//# sourceMappingURL=typescript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../../../../src/commands/actions/plugin/init/files/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,UAAU,aAAa;IACrB,YAAY,EAAE,YAAY,CAAC;IAC3B,iBAAiB,EAAE,YAAY,CAAC;CACjC;AAED,QAAA,MAAM,KAAK,EAAE,aA6BZ,CAAC;AAEF,QAAA,MAAM,MAAM,EAAE,aA6Bb,CAAC;AAEF,OAAO,EAAE,KAAK,IAAI,kBAAkB,EAAE,MAAM,IAAI,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const outdent = require("outdent");
|
|
4
|
+
const ADMIN = {
|
|
5
|
+
tsconfigFile: {
|
|
6
|
+
name: "admin/tsconfig.json",
|
|
7
|
+
contents: outdent.outdent`
|
|
8
|
+
{
|
|
9
|
+
"extends": "@strapi/typescript-utils/tsconfigs/admin",
|
|
10
|
+
"include": ["./src", "./custom.d.ts"],
|
|
11
|
+
"compilerOptions": {
|
|
12
|
+
"rootDir": "../",
|
|
13
|
+
"baseUrl": ".",
|
|
14
|
+
},
|
|
15
|
+
}
|
|
16
|
+
`
|
|
17
|
+
},
|
|
18
|
+
tsconfigBuildFile: {
|
|
19
|
+
name: "admin/tsconfig.build.json",
|
|
20
|
+
contents: outdent.outdent`
|
|
21
|
+
{
|
|
22
|
+
"extends": "./tsconfig",
|
|
23
|
+
"include": ["./src", "./custom.d.ts"],
|
|
24
|
+
"exclude": ["**/*.test.ts", "**/*.test.tsx"],
|
|
25
|
+
"compilerOptions": {
|
|
26
|
+
"rootDir": "../",
|
|
27
|
+
"baseUrl": ".",
|
|
28
|
+
"outDir": "./dist",
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
`
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const SERVER = {
|
|
35
|
+
tsconfigFile: {
|
|
36
|
+
name: "server/tsconfig.json",
|
|
37
|
+
contents: outdent.outdent`
|
|
38
|
+
{
|
|
39
|
+
"extends": "@strapi/typescript-utils/tsconfigs/server",
|
|
40
|
+
"include": ["./src"],
|
|
41
|
+
"compilerOptions": {
|
|
42
|
+
"rootDir": "../",
|
|
43
|
+
"baseUrl": ".",
|
|
44
|
+
},
|
|
45
|
+
}
|
|
46
|
+
`
|
|
47
|
+
},
|
|
48
|
+
tsconfigBuildFile: {
|
|
49
|
+
name: "server/tsconfig.build.json",
|
|
50
|
+
contents: outdent.outdent`
|
|
51
|
+
{
|
|
52
|
+
"extends": "./tsconfig",
|
|
53
|
+
"include": ["./src"],
|
|
54
|
+
"exclude": ["**/*.test.ts"],
|
|
55
|
+
"compilerOptions": {
|
|
56
|
+
"rootDir": "../",
|
|
57
|
+
"baseUrl": ".",
|
|
58
|
+
"outDir": "./dist",
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
`
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
exports.adminTsconfigFiles = ADMIN;
|
|
65
|
+
exports.serverTsconfigFiles = SERVER;
|
|
66
|
+
//# sourceMappingURL=typescript.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript.js","sources":["../../../../../../src/commands/actions/plugin/init/files/typescript.ts"],"sourcesContent":["import { TemplateFile } from '@strapi/pack-up';\nimport { outdent } from 'outdent';\n\ninterface TsConfigFiles {\n tsconfigFile: TemplateFile;\n tsconfigBuildFile: TemplateFile;\n}\n\nconst ADMIN: TsConfigFiles = {\n tsconfigFile: {\n name: 'admin/tsconfig.json',\n contents: outdent`\n {\n \"extends\": \"@strapi/typescript-utils/tsconfigs/admin\",\n \"include\": [\"./src\", \"./custom.d.ts\"],\n \"compilerOptions\": {\n \"rootDir\": \"../\",\n \"baseUrl\": \".\",\n },\n }\n `,\n },\n tsconfigBuildFile: {\n name: 'admin/tsconfig.build.json',\n contents: outdent`\n {\n \"extends\": \"./tsconfig\",\n \"include\": [\"./src\", \"./custom.d.ts\"],\n \"exclude\": [\"**/*.test.ts\", \"**/*.test.tsx\"],\n \"compilerOptions\": {\n \"rootDir\": \"../\",\n \"baseUrl\": \".\",\n \"outDir\": \"./dist\",\n }\n }\n `,\n },\n};\n\nconst SERVER: TsConfigFiles = {\n tsconfigFile: {\n name: 'server/tsconfig.json',\n contents: outdent`\n {\n \"extends\": \"@strapi/typescript-utils/tsconfigs/server\",\n \"include\": [\"./src\"],\n \"compilerOptions\": {\n \"rootDir\": \"../\",\n \"baseUrl\": \".\",\n },\n }\n `,\n },\n tsconfigBuildFile: {\n name: 'server/tsconfig.build.json',\n contents: outdent`\n {\n \"extends\": \"./tsconfig\",\n \"include\": [\"./src\"],\n \"exclude\": [\"**/*.test.ts\"],\n \"compilerOptions\": {\n \"rootDir\": \"../\",\n \"baseUrl\": \".\",\n \"outDir\": \"./dist\",\n }\n }\n `,\n },\n};\n\nexport { ADMIN as adminTsconfigFiles, SERVER as serverTsconfigFiles };\n"],"names":["outdent"],"mappings":";;;AAQA,MAAM,QAAuB;AAAA,EAC3B,cAAc;AAAA,IACZ,MAAM;AAAA,IACN,UAAUA,QAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,EAUZ;AAAA,EACA,mBAAmB;AAAA,IACjB,MAAM;AAAA,IACN,UAAUA,QAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,EAYZ;AACF;AAEA,MAAM,SAAwB;AAAA,EAC5B,cAAc;AAAA,IACZ,MAAM;AAAA,IACN,UAAUA,QAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,EAUZ;AAAA,EACA,mBAAmB;AAAA,IACjB,MAAM;AAAA,IACN,UAAUA,QAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,EAYZ;AACF;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CheckOptions } from '@strapi/pack-up';
|
|
2
|
+
import { CLIContext } from '../../../types';
|
|
3
|
+
interface ActionOptions extends CheckOptions {
|
|
4
|
+
}
|
|
5
|
+
declare const _default: (opts: ActionOptions, _cmd: unknown, { cwd, logger }: CLIContext) => Promise<void>;
|
|
6
|
+
export default _default;
|
|
7
|
+
//# sourceMappingURL=action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../../../src/commands/actions/plugin/verify/action.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAS,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,UAAU,aAAc,SAAQ,YAAY;CAAG;+BAEnB,aAAa,QAAQ,OAAO,mBAAmB,UAAU;AAArF,wBA2BE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const boxen = require("boxen");
|
|
3
|
+
const chalk = require("chalk");
|
|
4
|
+
const packUp = require("@strapi/pack-up");
|
|
5
|
+
const helpers = require("../../../utils/helpers.js");
|
|
6
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
7
|
+
const boxen__default = /* @__PURE__ */ _interopDefault(boxen);
|
|
8
|
+
const chalk__default = /* @__PURE__ */ _interopDefault(chalk);
|
|
9
|
+
const action = async (opts, _cmd, { cwd, logger }) => {
|
|
10
|
+
try {
|
|
11
|
+
await helpers.notifyExperimentalCommand("plugin:verify", { force: true });
|
|
12
|
+
await packUp.check({
|
|
13
|
+
cwd,
|
|
14
|
+
...opts
|
|
15
|
+
});
|
|
16
|
+
} catch (err) {
|
|
17
|
+
logger.error(
|
|
18
|
+
"There seems to be an unexpected error, try again with --debug for more information \n"
|
|
19
|
+
);
|
|
20
|
+
if (err instanceof Error && err.stack) {
|
|
21
|
+
console.log(
|
|
22
|
+
chalk__default.default.red(
|
|
23
|
+
boxen__default.default(err.stack, {
|
|
24
|
+
padding: 1,
|
|
25
|
+
align: "left"
|
|
26
|
+
})
|
|
27
|
+
)
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
module.exports = action;
|
|
34
|
+
//# sourceMappingURL=action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.js","sources":["../../../../../src/commands/actions/plugin/verify/action.ts"],"sourcesContent":["import boxen from 'boxen';\nimport chalk from 'chalk';\nimport { CheckOptions, check } from '@strapi/pack-up';\nimport { notifyExperimentalCommand } from '../../../utils/helpers';\nimport { CLIContext } from '../../../types';\n\ninterface ActionOptions extends CheckOptions {}\n\nexport default async (opts: ActionOptions, _cmd: unknown, { cwd, logger }: CLIContext) => {\n try {\n /**\n * Notify users this is an experimental command.\n */\n await notifyExperimentalCommand('plugin:verify', { force: true });\n\n await check({\n cwd,\n ...opts,\n });\n } catch (err) {\n logger.error(\n 'There seems to be an unexpected error, try again with --debug for more information \\n'\n );\n if (err instanceof Error && err.stack) {\n console.log(\n chalk.red(\n boxen(err.stack, {\n padding: 1,\n align: 'left',\n })\n )\n );\n }\n process.exit(1);\n }\n};\n"],"names":["notifyExperimentalCommand","check","chalk","boxen"],"mappings":";;;;;;;;AAQA,MAAe,SAAA,OAAO,MAAqB,MAAe,EAAE,KAAK,aAAyB;AACpF,MAAA;AAIF,UAAMA,QAA0B,0BAAA,iBAAiB,EAAE,OAAO,KAAM,CAAA;AAEhE,UAAMC,aAAM;AAAA,MACV;AAAA,MACA,GAAG;AAAA,IAAA,CACJ;AAAA,WACM,KAAK;AACL,WAAA;AAAA,MACL;AAAA,IAAA;AAEE,QAAA,eAAe,SAAS,IAAI,OAAO;AAC7B,cAAA;AAAA,QACNC,eAAAA,QAAM;AAAA,UACJC,eAAA,QAAM,IAAI,OAAO;AAAA,YACf,SAAS;AAAA,YACT,OAAO;AAAA,UAAA,CACR;AAAA,QACH;AAAA,MAAA;AAAA,IAEJ;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../../src/commands/actions/plugin/verify/command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAIpD;;GAEG;AACH,QAAA,MAAM,OAAO,EAAE,aAOd,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const helpers = require("../../../utils/helpers.js");
|
|
3
|
+
const action = require("./action.js");
|
|
4
|
+
const command = ({ command: command2, ctx }) => {
|
|
5
|
+
command2.command("plugin:verify").description("Verify the output of your plugin before publishing it.").option("-d, --debug", "Enable debugging mode with verbose logs", false).option("--silent", "Don't log anything", false).action((...args) => helpers.runAction("plugin:verify", action)(...args, ctx));
|
|
6
|
+
};
|
|
7
|
+
module.exports = command;
|
|
8
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.js","sources":["../../../../../src/commands/actions/plugin/verify/command.ts"],"sourcesContent":["import type { StrapiCommand } from '../../../types';\nimport { runAction } from '../../../utils/helpers';\nimport action from './action';\n\n/**\n * `$ strapi plugin:verify`\n */\nconst command: StrapiCommand = ({ command, ctx }) => {\n command\n .command('plugin:verify')\n .description('Verify the output of your plugin before publishing it.')\n .option('-d, --debug', 'Enable debugging mode with verbose logs', false)\n .option('--silent', \"Don't log anything\", false)\n .action((...args) => runAction('plugin:verify', action)(...args, ctx));\n};\n\nexport default command;\n"],"names":["command","runAction"],"mappings":";;;AAOA,MAAM,UAAyB,CAAC,EAAE,SAAAA,UAAS,UAAU;AACnDA,WACG,QAAQ,eAAe,EACvB,YAAY,wDAAwD,EACpE,OAAO,eAAe,2CAA2C,KAAK,EACtE,OAAO,YAAY,sBAAsB,KAAK,EAC9C,OAAO,IAAI,SAASC,QAAAA,UAAU,iBAAiB,MAAM,EAAE,GAAG,MAAM,GAAG,CAAC;AACzE;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WatchCLIOptions } from '@strapi/pack-up';
|
|
2
|
+
import { CLIContext } from '../../../types';
|
|
2
3
|
interface ActionOptions extends WatchCLIOptions {
|
|
3
|
-
force?: boolean;
|
|
4
4
|
}
|
|
5
|
-
declare const _default: ({
|
|
5
|
+
declare const _default: (opts: ActionOptions, _cmd: unknown, { cwd, logger }: CLIContext) => Promise<void>;
|
|
6
6
|
export default _default;
|
|
7
7
|
//# sourceMappingURL=action.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../../../src/commands/actions/plugin/watch/action.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,eAAe,EAAS,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../../../src/commands/actions/plugin/watch/action.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,eAAe,EAAS,MAAM,iBAAiB,CAAC;AAGvE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,UAAU,aAAc,SAAQ,eAAe;CAAG;+BAEtB,aAAa,QAAQ,OAAO,mBAAmB,UAAU;AAArF,wBAuFE"}
|
|
@@ -3,17 +3,14 @@ const boxen = require("boxen");
|
|
|
3
3
|
const chalk = require("chalk");
|
|
4
4
|
const packUp = require("@strapi/pack-up");
|
|
5
5
|
const helpers = require("../../../utils/helpers.js");
|
|
6
|
-
const logger = require("../../../utils/logger.js");
|
|
7
6
|
const pkg = require("../../../utils/pkg.js");
|
|
8
7
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
9
8
|
const boxen__default = /* @__PURE__ */ _interopDefault(boxen);
|
|
10
9
|
const chalk__default = /* @__PURE__ */ _interopDefault(chalk);
|
|
11
|
-
const action = async ({
|
|
12
|
-
const logger$1 = logger.createLogger({ debug: opts.debug, silent: opts.silent, timestamp: false });
|
|
10
|
+
const action = async (opts, _cmd, { cwd, logger }) => {
|
|
13
11
|
try {
|
|
14
|
-
await helpers.notifyExperimentalCommand("plugin:watch", { force });
|
|
15
|
-
const
|
|
16
|
-
const pkg$1 = await pkg.loadPkg({ cwd, logger: logger$1 });
|
|
12
|
+
await helpers.notifyExperimentalCommand("plugin:watch", { force: true });
|
|
13
|
+
const pkg$1 = await pkg.loadPkg({ cwd, logger });
|
|
17
14
|
const pkgJson = await pkg.validatePkg({ pkg: pkg$1 });
|
|
18
15
|
if (!pkgJson.exports["./strapi-admin"] && !pkgJson.exports["./strapi-server"]) {
|
|
19
16
|
throw new Error(
|
|
@@ -65,7 +62,7 @@ const action = async ({ force, ...opts }) => {
|
|
|
65
62
|
...opts
|
|
66
63
|
});
|
|
67
64
|
} catch (err) {
|
|
68
|
-
logger
|
|
65
|
+
logger.error(
|
|
69
66
|
"There seems to be an unexpected error, try again with --debug for more information \n"
|
|
70
67
|
);
|
|
71
68
|
if (err instanceof Error && err.stack) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","sources":["../../../../../src/commands/actions/plugin/watch/action.ts"],"sourcesContent":["import boxen from 'boxen';\nimport chalk from 'chalk';\nimport { ConfigBundle, WatchCLIOptions, watch } from '@strapi/pack-up';\nimport { notifyExperimentalCommand } from '../../../utils/helpers';\nimport {
|
|
1
|
+
{"version":3,"file":"action.js","sources":["../../../../../src/commands/actions/plugin/watch/action.ts"],"sourcesContent":["import boxen from 'boxen';\nimport chalk from 'chalk';\nimport { ConfigBundle, WatchCLIOptions, watch } from '@strapi/pack-up';\nimport { notifyExperimentalCommand } from '../../../utils/helpers';\nimport { Export, loadPkg, validatePkg } from '../../../utils/pkg';\nimport { CLIContext } from '../../../types';\n\ninterface ActionOptions extends WatchCLIOptions {}\n\nexport default async (opts: ActionOptions, _cmd: unknown, { cwd, logger }: CLIContext) => {\n try {\n /**\n * Notify users this is an experimental command.\n */\n await notifyExperimentalCommand('plugin:watch', { force: true });\n\n const pkg = await loadPkg({ cwd, logger });\n const pkgJson = await validatePkg({ pkg });\n\n if (!pkgJson.exports['./strapi-admin'] && !pkgJson.exports['./strapi-server']) {\n throw new Error(\n 'You need to have either a strapi-admin or strapi-server export in your package.json'\n );\n }\n\n const bundles: ConfigBundle[] = [];\n\n if (pkgJson.exports['./strapi-admin']) {\n const exp = pkgJson.exports['./strapi-admin'] as Export;\n\n const bundle: ConfigBundle = {\n source: exp.source,\n import: exp.import,\n require: exp.require,\n runtime: 'web',\n };\n\n if (exp.types) {\n bundle.types = exp.types;\n // TODO: should this be sliced from the source path...?\n bundle.tsconfig = './admin/tsconfig.build.json';\n }\n\n bundles.push(bundle);\n }\n\n if (pkgJson.exports['./strapi-server']) {\n const exp = pkgJson.exports['./strapi-server'] as Export;\n\n const bundle: ConfigBundle = {\n source: exp.source,\n import: exp.import,\n require: exp.require,\n runtime: 'node',\n };\n\n if (exp.types) {\n bundle.types = exp.types;\n // TODO: should this be sliced from the source path...?\n bundle.tsconfig = './server/tsconfig.build.json';\n }\n\n bundles.push(bundle);\n }\n\n await watch({\n cwd,\n configFile: false,\n config: {\n bundles,\n dist: './dist',\n /**\n * ignore the exports map of a plugin, because we're streamlining the\n * process and ensuring the server package and admin package are built\n * with the correct runtime and their individual tsconfigs\n */\n exports: {},\n },\n ...opts,\n });\n } catch (err) {\n logger.error(\n 'There seems to be an unexpected error, try again with --debug for more information \\n'\n );\n if (err instanceof Error && err.stack) {\n console.log(\n chalk.red(\n boxen(err.stack, {\n padding: 1,\n align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AAA,MACZ,QAAQ;AAAA,QACN;AAAA,QACA,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAMN,SAAS,CAAC;AAAA,MACZ;AAAA,MACA,GAAG;AAAA,IAAA,CACJ;AAAA,WACM,KAAK;AACL,WAAA;AAAA,MACL;AAAA,IAAA;AAEE,QAAA,eAAe,SAAS,IAAI,OAAO;AAC7B,cAAA;AAAA,QACNC,eAAAA,QAAM;AAAA,UACJC,eAAA,QAAM,IAAI,OAAO;AAAA,YACf,SAAS;AAAA,YACT,OAAO;AAAA,UAAA,CACR;AAAA,QACH;AAAA,MAAA;AAAA,IAEJ;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const helpers = require("../../../utils/helpers.js");
|
|
3
3
|
const action = require("./action.js");
|
|
4
|
-
const command = ({ command: command2 }) => {
|
|
5
|
-
command2.command("plugin:watch").description("Watch & compile your strapi plugin for local development.").option("-d, --debug", "Enable debugging mode with verbose logs", false).option("--silent", "Don't log anything", false).action(helpers.runAction("plugin:watch", action));
|
|
4
|
+
const command = ({ command: command2, ctx }) => {
|
|
5
|
+
command2.command("plugin:watch").description("Watch & compile your strapi plugin for local development.").option("-d, --debug", "Enable debugging mode with verbose logs", false).option("--silent", "Don't log anything", false).action((...args) => helpers.runAction("plugin:watch", action)(...args, ctx));
|
|
6
6
|
};
|
|
7
7
|
module.exports = command;
|
|
8
8
|
//# sourceMappingURL=command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sources":["../../../../../src/commands/actions/plugin/watch/command.ts"],"sourcesContent":["import type { StrapiCommand } from '../../../types';\nimport { runAction } from '../../../utils/helpers';\nimport action from './action';\n\n/**\n * `$ strapi plugin:
|
|
1
|
+
{"version":3,"file":"command.js","sources":["../../../../../src/commands/actions/plugin/watch/command.ts"],"sourcesContent":["import type { StrapiCommand } from '../../../types';\nimport { runAction } from '../../../utils/helpers';\nimport action from './action';\n\n/**\n * `$ strapi plugin:watch`\n */\nconst command: StrapiCommand = ({ command, ctx }) => {\n command\n .command('plugin:watch')\n .description('Watch & compile your strapi plugin for local development.')\n .option('-d, --debug', 'Enable debugging mode with verbose logs', false)\n .option('--silent', \"Don't log anything\", false)\n .action((...args) => runAction('plugin:watch', action)(...args, ctx));\n};\n\nexport default command;\n"],"names":["command","runAction"],"mappings":";;;AAOA,MAAM,UAAyB,CAAC,EAAE,SAAAA,UAAS,UAAU;AACnDA,WACG,QAAQ,cAAc,EACtB,YAAY,2DAA2D,EACvE,OAAO,eAAe,2CAA2C,KAAK,EACtE,OAAO,YAAY,sBAAsB,KAAK,EAC9C,OAAO,IAAI,SAASC,QAAAA,UAAU,gBAAgB,MAAM,EAAE,GAAG,MAAM,GAAG,CAAC;AACxE;;"}
|