@strapi/strapi 5.0.0-beta.8 → 5.0.0-beta.9
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/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +1 -14
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/index.mjs +1 -14
- package/dist/cli/commands/index.mjs.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +30 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +30 -0
- package/dist/cli/index.mjs.map +1 -1
- package/package.json +23 -23
- package/dist/cli/commands/plugin/build.d.ts +0 -7
- package/dist/cli/commands/plugin/build.d.ts.map +0 -1
- package/dist/cli/commands/plugin/build.js +0 -88
- package/dist/cli/commands/plugin/build.js.map +0 -1
- package/dist/cli/commands/plugin/build.mjs +0 -85
- package/dist/cli/commands/plugin/build.mjs.map +0 -1
- package/dist/cli/commands/plugin/init/action.d.ts +0 -6
- package/dist/cli/commands/plugin/init/action.d.ts.map +0 -1
- package/dist/cli/commands/plugin/init/action.js +0 -413
- package/dist/cli/commands/plugin/init/action.js.map +0 -1
- package/dist/cli/commands/plugin/init/action.mjs +0 -408
- package/dist/cli/commands/plugin/init/action.mjs.map +0 -1
- package/dist/cli/commands/plugin/init/command.d.ts +0 -7
- package/dist/cli/commands/plugin/init/command.d.ts.map +0 -1
- package/dist/cli/commands/plugin/init/command.js +0 -9
- package/dist/cli/commands/plugin/init/command.js.map +0 -1
- package/dist/cli/commands/plugin/init/command.mjs +0 -10
- package/dist/cli/commands/plugin/init/command.mjs.map +0 -1
- package/dist/cli/commands/plugin/init/files/admin.d.ts +0 -5
- package/dist/cli/commands/plugin/init/files/admin.d.ts.map +0 -1
- package/dist/cli/commands/plugin/init/files/admin.js +0 -283
- package/dist/cli/commands/plugin/init/files/admin.js.map +0 -1
- package/dist/cli/commands/plugin/init/files/admin.mjs +0 -283
- package/dist/cli/commands/plugin/init/files/admin.mjs.map +0 -1
- package/dist/cli/commands/plugin/init/files/editorConfig.d.ts +0 -4
- package/dist/cli/commands/plugin/init/files/editorConfig.d.ts.map +0 -1
- package/dist/cli/commands/plugin/init/files/editorConfig.js +0 -26
- package/dist/cli/commands/plugin/init/files/editorConfig.js.map +0 -1
- package/dist/cli/commands/plugin/init/files/editorConfig.mjs +0 -26
- package/dist/cli/commands/plugin/init/files/editorConfig.mjs.map +0 -1
- package/dist/cli/commands/plugin/init/files/eslint.d.ts +0 -4
- package/dist/cli/commands/plugin/init/files/eslint.d.ts.map +0 -1
- package/dist/cli/commands/plugin/init/files/eslint.js +0 -11
- package/dist/cli/commands/plugin/init/files/eslint.js.map +0 -1
- package/dist/cli/commands/plugin/init/files/eslint.mjs +0 -11
- package/dist/cli/commands/plugin/init/files/eslint.mjs.map +0 -1
- package/dist/cli/commands/plugin/init/files/gitIgnore.d.ts +0 -4
- package/dist/cli/commands/plugin/init/files/gitIgnore.d.ts.map +0 -1
- package/dist/cli/commands/plugin/init/files/gitIgnore.js +0 -34
- package/dist/cli/commands/plugin/init/files/gitIgnore.js.map +0 -1
- package/dist/cli/commands/plugin/init/files/gitIgnore.mjs +0 -34
- package/dist/cli/commands/plugin/init/files/gitIgnore.mjs.map +0 -1
- package/dist/cli/commands/plugin/init/files/prettier.d.ts +0 -5
- package/dist/cli/commands/plugin/init/files/prettier.d.ts.map +0 -1
- package/dist/cli/commands/plugin/init/files/prettier.js +0 -25
- package/dist/cli/commands/plugin/init/files/prettier.js.map +0 -1
- package/dist/cli/commands/plugin/init/files/prettier.mjs +0 -25
- package/dist/cli/commands/plugin/init/files/prettier.mjs.map +0 -1
- package/dist/cli/commands/plugin/init/files/server.d.ts +0 -5
- package/dist/cli/commands/plugin/init/files/server.d.ts.map +0 -1
- package/dist/cli/commands/plugin/init/files/server.js +0 -360
- package/dist/cli/commands/plugin/init/files/server.js.map +0 -1
- package/dist/cli/commands/plugin/init/files/server.mjs +0 -360
- package/dist/cli/commands/plugin/init/files/server.mjs.map +0 -1
- package/dist/cli/commands/plugin/init/files/typescript.d.ts +0 -9
- package/dist/cli/commands/plugin/init/files/typescript.d.ts.map +0 -1
- package/dist/cli/commands/plugin/init/files/typescript.js +0 -66
- package/dist/cli/commands/plugin/init/files/typescript.js.map +0 -1
- package/dist/cli/commands/plugin/init/files/typescript.mjs +0 -66
- package/dist/cli/commands/plugin/init/files/typescript.mjs.map +0 -1
- package/dist/cli/commands/plugin/init/index.d.ts +0 -2
- package/dist/cli/commands/plugin/init/index.d.ts.map +0 -1
- package/dist/cli/commands/plugin/link-watch.d.ts +0 -7
- package/dist/cli/commands/plugin/link-watch.d.ts.map +0 -1
- package/dist/cli/commands/plugin/link-watch.js +0 -89
- package/dist/cli/commands/plugin/link-watch.js.map +0 -1
- package/dist/cli/commands/plugin/link-watch.mjs +0 -82
- package/dist/cli/commands/plugin/link-watch.mjs.map +0 -1
- package/dist/cli/commands/plugin/verify.d.ts +0 -7
- package/dist/cli/commands/plugin/verify.d.ts.map +0 -1
- package/dist/cli/commands/plugin/verify.js +0 -37
- package/dist/cli/commands/plugin/verify.js.map +0 -1
- package/dist/cli/commands/plugin/verify.mjs +0 -34
- package/dist/cli/commands/plugin/verify.mjs.map +0 -1
- package/dist/cli/commands/plugin/watch.d.ts +0 -7
- package/dist/cli/commands/plugin/watch.d.ts.map +0 -1
- package/dist/cli/commands/plugin/watch.js +0 -86
- package/dist/cli/commands/plugin/watch.js.map +0 -1
- package/dist/cli/commands/plugin/watch.mjs +0 -83
- package/dist/cli/commands/plugin/watch.mjs.map +0 -1
- package/dist/cli/utils/pkg.js +0 -111
- package/dist/cli/utils/pkg.js.map +0 -1
- package/dist/cli/utils/pkg.mjs +0 -87
- package/dist/cli/utils/pkg.mjs.map +0 -1
|
@@ -1,360 +0,0 @@
|
|
|
1
|
-
import { outdent } from "outdent";
|
|
2
|
-
const TYPESCRIPT = (pluginName) => [
|
|
3
|
-
{
|
|
4
|
-
name: "server/src/index.ts",
|
|
5
|
-
contents: outdent`
|
|
6
|
-
/**
|
|
7
|
-
* Application methods
|
|
8
|
-
*/
|
|
9
|
-
import bootstrap from './bootstrap';
|
|
10
|
-
import destroy from './destroy';
|
|
11
|
-
import register from './register';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Plugin server methods
|
|
15
|
-
*/
|
|
16
|
-
import config from './config';
|
|
17
|
-
import contentTypes from './content-types';
|
|
18
|
-
import controllers from './controllers';
|
|
19
|
-
import middlewares from './middlewares';
|
|
20
|
-
import policies from './policies';
|
|
21
|
-
import routes from './routes';
|
|
22
|
-
import services from './services';
|
|
23
|
-
|
|
24
|
-
export default {
|
|
25
|
-
bootstrap,
|
|
26
|
-
destroy,
|
|
27
|
-
register,
|
|
28
|
-
|
|
29
|
-
config,
|
|
30
|
-
controllers,
|
|
31
|
-
contentTypes,
|
|
32
|
-
middlewares,
|
|
33
|
-
policies,
|
|
34
|
-
routes,
|
|
35
|
-
services,
|
|
36
|
-
};
|
|
37
|
-
`
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
name: "server/src/bootstrap.ts",
|
|
41
|
-
contents: outdent`
|
|
42
|
-
import type { Core } from '@strapi/strapi';
|
|
43
|
-
|
|
44
|
-
const bootstrap = ({ strapi }: { strapi: Core.Strapi }) => {
|
|
45
|
-
// bootstrap phase
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export default bootstrap;
|
|
49
|
-
`
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
name: "server/src/destroy.ts",
|
|
53
|
-
contents: outdent`
|
|
54
|
-
import type { Core } from '@strapi/strapi';
|
|
55
|
-
|
|
56
|
-
const destroy = ({ strapi }: { strapi: Core.Strapi }) => {
|
|
57
|
-
// destroy phase
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export default destroy;
|
|
61
|
-
`
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
name: "server/src/register.ts",
|
|
65
|
-
contents: outdent`
|
|
66
|
-
import type { Core } from '@strapi/strapi';
|
|
67
|
-
|
|
68
|
-
const register = ({ strapi }: { strapi: Core.Strapi }) => {
|
|
69
|
-
// register phase
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export default register;
|
|
73
|
-
`
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
name: "server/src/config/index.ts",
|
|
77
|
-
contents: outdent`
|
|
78
|
-
export default {
|
|
79
|
-
default: {},
|
|
80
|
-
validator() {},
|
|
81
|
-
};
|
|
82
|
-
`
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
name: "server/src/content-types/index.ts",
|
|
86
|
-
contents: outdent`
|
|
87
|
-
export default {};
|
|
88
|
-
`
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
name: "server/src/controllers/index.ts",
|
|
92
|
-
contents: outdent`
|
|
93
|
-
import controller from './controller';
|
|
94
|
-
|
|
95
|
-
export default {
|
|
96
|
-
controller,
|
|
97
|
-
};
|
|
98
|
-
`
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
name: "server/src/controllers/controller.ts",
|
|
102
|
-
contents: outdent`
|
|
103
|
-
import type { Core } from '@strapi/strapi';
|
|
104
|
-
|
|
105
|
-
const controller = ({ strapi }: { strapi: Core.Strapi }) => ({
|
|
106
|
-
index(ctx) {
|
|
107
|
-
ctx.body = strapi
|
|
108
|
-
.plugin('${pluginName}')
|
|
109
|
-
// the name of the service file & the method.
|
|
110
|
-
.service('service')
|
|
111
|
-
.getWelcomeMessage();
|
|
112
|
-
},
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
export default controller
|
|
116
|
-
`
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
name: "server/src/middlewares/index.ts",
|
|
120
|
-
contents: outdent`
|
|
121
|
-
export default {};
|
|
122
|
-
`
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
name: "server/src/policies/index.ts",
|
|
126
|
-
contents: outdent`
|
|
127
|
-
export default {};
|
|
128
|
-
`
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
name: "server/src/routes/index.ts",
|
|
132
|
-
contents: outdent`
|
|
133
|
-
export default [
|
|
134
|
-
{
|
|
135
|
-
method: 'GET',
|
|
136
|
-
path: '/',
|
|
137
|
-
// name of the controller file & the method.
|
|
138
|
-
handler: 'controller.index',
|
|
139
|
-
config: {
|
|
140
|
-
policies: [],
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
];
|
|
144
|
-
`
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
name: "server/src/services/index.ts",
|
|
148
|
-
contents: outdent`
|
|
149
|
-
import service from './service';
|
|
150
|
-
|
|
151
|
-
export default {
|
|
152
|
-
service,
|
|
153
|
-
};
|
|
154
|
-
`
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
name: "server/src/services/service.ts",
|
|
158
|
-
contents: outdent`
|
|
159
|
-
import type { Core } from '@strapi/strapi';
|
|
160
|
-
|
|
161
|
-
const service = ({ strapi }: { strapi: Core.Strapi }) => ({
|
|
162
|
-
getWelcomeMessage() {
|
|
163
|
-
return 'Welcome to Strapi 🚀';
|
|
164
|
-
},
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
export default service
|
|
168
|
-
`
|
|
169
|
-
}
|
|
170
|
-
];
|
|
171
|
-
const JAVASCRIPT = (pluginName) => [
|
|
172
|
-
{
|
|
173
|
-
name: "server/src/index.ts",
|
|
174
|
-
contents: outdent`
|
|
175
|
-
'use strict';
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Application methods
|
|
179
|
-
*/
|
|
180
|
-
const bootstrap = require('./bootstrap');
|
|
181
|
-
const destroy = require('./destroy');
|
|
182
|
-
const register = require('./register');
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Plugin server methods
|
|
186
|
-
*/
|
|
187
|
-
const config = require('./config');
|
|
188
|
-
const contentTypes = require('./content-types');
|
|
189
|
-
const controllers = require('./controllers');
|
|
190
|
-
const middlewares = require('./middlewares');
|
|
191
|
-
const policies = require('./policies');
|
|
192
|
-
const routes = require('./routes');
|
|
193
|
-
const services = require('./services');
|
|
194
|
-
|
|
195
|
-
module.exports = {
|
|
196
|
-
bootstrap,
|
|
197
|
-
destroy,
|
|
198
|
-
register,
|
|
199
|
-
|
|
200
|
-
config,
|
|
201
|
-
controllers,
|
|
202
|
-
contentTypes,
|
|
203
|
-
middlewares,
|
|
204
|
-
policies,
|
|
205
|
-
routes,
|
|
206
|
-
services,
|
|
207
|
-
};
|
|
208
|
-
`
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
name: "server/src/bootstrap.ts",
|
|
212
|
-
contents: outdent`
|
|
213
|
-
'use strict';
|
|
214
|
-
|
|
215
|
-
const bootstrap = ({ strapi }) => {
|
|
216
|
-
// bootstrap phase
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
module.exports = bootstrap;
|
|
220
|
-
`
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
name: "server/src/destroy.ts",
|
|
224
|
-
contents: outdent`
|
|
225
|
-
'use strict';
|
|
226
|
-
|
|
227
|
-
const destroy = ({ strapi }) => {
|
|
228
|
-
// destroy phase
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
module.exports = destroy;
|
|
232
|
-
`
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
name: "server/src/register.ts",
|
|
236
|
-
contents: outdent`
|
|
237
|
-
'use strict';
|
|
238
|
-
|
|
239
|
-
const register = ({ strapi }) => {
|
|
240
|
-
// register phase
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
module.exports = register;
|
|
244
|
-
`
|
|
245
|
-
},
|
|
246
|
-
{
|
|
247
|
-
name: "server/src/config/index.ts",
|
|
248
|
-
contents: outdent`
|
|
249
|
-
'use strict';
|
|
250
|
-
|
|
251
|
-
module.exports = {
|
|
252
|
-
default: {},
|
|
253
|
-
validator() {},
|
|
254
|
-
};
|
|
255
|
-
`
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
name: "server/src/content-types/index.ts",
|
|
259
|
-
contents: outdent`
|
|
260
|
-
'use strict';
|
|
261
|
-
|
|
262
|
-
module.exports = {};
|
|
263
|
-
`
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
name: "server/src/controllers/index.ts",
|
|
267
|
-
contents: outdent`
|
|
268
|
-
'use strict';
|
|
269
|
-
|
|
270
|
-
const controller = require('./controller');
|
|
271
|
-
|
|
272
|
-
module.exports = {
|
|
273
|
-
controller,
|
|
274
|
-
};
|
|
275
|
-
`
|
|
276
|
-
},
|
|
277
|
-
{
|
|
278
|
-
name: "server/src/controllers/controller.ts",
|
|
279
|
-
contents: outdent`
|
|
280
|
-
'use strict';
|
|
281
|
-
|
|
282
|
-
const controller = ({ strapi }) => ({
|
|
283
|
-
index(ctx) {
|
|
284
|
-
ctx.body = strapi
|
|
285
|
-
.plugin('${pluginName}')
|
|
286
|
-
// the name of the service file & the method.
|
|
287
|
-
.service('service')
|
|
288
|
-
.getWelcomeMessage();
|
|
289
|
-
},
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
module.exports = controller
|
|
293
|
-
`
|
|
294
|
-
},
|
|
295
|
-
{
|
|
296
|
-
name: "server/src/middlewares/index.ts",
|
|
297
|
-
contents: outdent`
|
|
298
|
-
'use strict';
|
|
299
|
-
|
|
300
|
-
module.exports = {};
|
|
301
|
-
`
|
|
302
|
-
},
|
|
303
|
-
{
|
|
304
|
-
name: "server/src/policies/index.ts",
|
|
305
|
-
contents: outdent`
|
|
306
|
-
'use strict';
|
|
307
|
-
|
|
308
|
-
module.exports = {};
|
|
309
|
-
`
|
|
310
|
-
},
|
|
311
|
-
{
|
|
312
|
-
name: "server/src/routes/index.ts",
|
|
313
|
-
contents: outdent`
|
|
314
|
-
'use strict';
|
|
315
|
-
|
|
316
|
-
module.exports = [
|
|
317
|
-
{
|
|
318
|
-
method: 'GET',
|
|
319
|
-
path: '/',
|
|
320
|
-
// name of the controller file & the method.
|
|
321
|
-
handler: 'controller.index',
|
|
322
|
-
config: {
|
|
323
|
-
policies: [],
|
|
324
|
-
},
|
|
325
|
-
},
|
|
326
|
-
];
|
|
327
|
-
`
|
|
328
|
-
},
|
|
329
|
-
{
|
|
330
|
-
name: "server/src/services/index.ts",
|
|
331
|
-
contents: outdent`
|
|
332
|
-
'use strict';
|
|
333
|
-
|
|
334
|
-
const service = require('./service');
|
|
335
|
-
|
|
336
|
-
module.exports = {
|
|
337
|
-
service,
|
|
338
|
-
};
|
|
339
|
-
`
|
|
340
|
-
},
|
|
341
|
-
{
|
|
342
|
-
name: "server/src/services/service.ts",
|
|
343
|
-
contents: outdent`
|
|
344
|
-
'use strict';
|
|
345
|
-
|
|
346
|
-
const service = ({ strapi }) => ({
|
|
347
|
-
getWelcomeMessage() {
|
|
348
|
-
return 'Welcome to Strapi 🚀';
|
|
349
|
-
},
|
|
350
|
-
});
|
|
351
|
-
|
|
352
|
-
module.exports = service
|
|
353
|
-
`
|
|
354
|
-
}
|
|
355
|
-
];
|
|
356
|
-
export {
|
|
357
|
-
JAVASCRIPT as serverJavascriptFiles,
|
|
358
|
-
TYPESCRIPT as serverTypescriptFiles
|
|
359
|
-
};
|
|
360
|
-
//# sourceMappingURL=server.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.mjs","sources":["../../../../../../src/cli/commands/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 { Core } from '@strapi/strapi';\n\n const bootstrap = ({ strapi }: { strapi: Core.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 { Core } from '@strapi/strapi';\n\n const destroy = ({ strapi }: { strapi: Core.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 { Core } from '@strapi/strapi';\n\n const register = ({ strapi }: { strapi: Core.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 { Core } from '@strapi/strapi';\n\n const controller = ({ strapi }: { strapi: Core.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 { Core } from '@strapi/strapi';\n\n const service = ({ strapi }: { strapi: Core.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":[],"mappings":";AAGM,MAAA,aAAa,CAAC,eAAuC;AAAA,EACzD;AAAA,IACE,MAAM;AAAA,IACN,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiCZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,UAAU;AA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
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/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"}
|
|
@@ -1,66 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.js","sources":["../../../../../../src/cli/commands/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;;;"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { outdent } from "outdent";
|
|
2
|
-
const ADMIN = {
|
|
3
|
-
tsconfigFile: {
|
|
4
|
-
name: "admin/tsconfig.json",
|
|
5
|
-
contents: outdent`
|
|
6
|
-
{
|
|
7
|
-
"extends": "@strapi/typescript-utils/tsconfigs/admin",
|
|
8
|
-
"include": ["./src", "./custom.d.ts"],
|
|
9
|
-
"compilerOptions": {
|
|
10
|
-
"rootDir": "../",
|
|
11
|
-
"baseUrl": ".",
|
|
12
|
-
},
|
|
13
|
-
}
|
|
14
|
-
`
|
|
15
|
-
},
|
|
16
|
-
tsconfigBuildFile: {
|
|
17
|
-
name: "admin/tsconfig.build.json",
|
|
18
|
-
contents: outdent`
|
|
19
|
-
{
|
|
20
|
-
"extends": "./tsconfig",
|
|
21
|
-
"include": ["./src", "./custom.d.ts"],
|
|
22
|
-
"exclude": ["**/*.test.ts", "**/*.test.tsx"],
|
|
23
|
-
"compilerOptions": {
|
|
24
|
-
"rootDir": "../",
|
|
25
|
-
"baseUrl": ".",
|
|
26
|
-
"outDir": "./dist",
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
`
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
const SERVER = {
|
|
33
|
-
tsconfigFile: {
|
|
34
|
-
name: "server/tsconfig.json",
|
|
35
|
-
contents: outdent`
|
|
36
|
-
{
|
|
37
|
-
"extends": "@strapi/typescript-utils/tsconfigs/server",
|
|
38
|
-
"include": ["./src"],
|
|
39
|
-
"compilerOptions": {
|
|
40
|
-
"rootDir": "../",
|
|
41
|
-
"baseUrl": ".",
|
|
42
|
-
},
|
|
43
|
-
}
|
|
44
|
-
`
|
|
45
|
-
},
|
|
46
|
-
tsconfigBuildFile: {
|
|
47
|
-
name: "server/tsconfig.build.json",
|
|
48
|
-
contents: outdent`
|
|
49
|
-
{
|
|
50
|
-
"extends": "./tsconfig",
|
|
51
|
-
"include": ["./src"],
|
|
52
|
-
"exclude": ["**/*.test.ts"],
|
|
53
|
-
"compilerOptions": {
|
|
54
|
-
"rootDir": "../",
|
|
55
|
-
"baseUrl": ".",
|
|
56
|
-
"outDir": "./dist",
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
`
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
export {
|
|
63
|
-
ADMIN as adminTsconfigFiles,
|
|
64
|
-
SERVER as serverTsconfigFiles
|
|
65
|
-
};
|
|
66
|
-
//# sourceMappingURL=typescript.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.mjs","sources":["../../../../../../src/cli/commands/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":[],"mappings":";AAQA,MAAM,QAAuB;AAAA,EAC3B,cAAc;AAAA,IACZ,MAAM;AAAA,IACN,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUZ;AAAA,EACA,mBAAmB;AAAA,IACjB,MAAM;AAAA,IACN,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYZ;AACF;AAEA,MAAM,SAAwB;AAAA,EAC5B,cAAc;AAAA,IACZ,MAAM;AAAA,IACN,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUZ;AAAA,EACA,mBAAmB;AAAA,IACjB,MAAM;AAAA,IACN,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYZ;AACF;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/plugin/init/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"link-watch.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/plugin/link-watch.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAc,aAAa,EAAE,MAAM,aAAa,CAAC;AAqF7D;;GAEG;AACH,QAAA,MAAM,OAAO,EAAE,aAOd,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const boxen = require("boxen");
|
|
4
|
-
const chalk = require("chalk");
|
|
5
|
-
const concurrently = require("concurrently");
|
|
6
|
-
const fs = require("node:fs/promises");
|
|
7
|
-
const path = require("node:path");
|
|
8
|
-
const nodemon = require("nodemon");
|
|
9
|
-
const outdent = require("outdent");
|
|
10
|
-
const helpers = require("../../utils/helpers.js");
|
|
11
|
-
const pkg = require("../../utils/pkg.js");
|
|
12
|
-
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
13
|
-
const boxen__default = /* @__PURE__ */ _interopDefault(boxen);
|
|
14
|
-
const chalk__default = /* @__PURE__ */ _interopDefault(chalk);
|
|
15
|
-
const concurrently__default = /* @__PURE__ */ _interopDefault(concurrently);
|
|
16
|
-
const fs__default = /* @__PURE__ */ _interopDefault(fs);
|
|
17
|
-
const path__default = /* @__PURE__ */ _interopDefault(path);
|
|
18
|
-
const nodemon__default = /* @__PURE__ */ _interopDefault(nodemon);
|
|
19
|
-
const action = async (_opts, _cmd, { cwd, logger }) => {
|
|
20
|
-
try {
|
|
21
|
-
const outDir = "./dist";
|
|
22
|
-
const extensions = "ts,js,png,svg,gif,jpeg,css";
|
|
23
|
-
nodemon__default.default({
|
|
24
|
-
watch: [outDir],
|
|
25
|
-
ext: extensions,
|
|
26
|
-
exec: "yalc push --changed"
|
|
27
|
-
});
|
|
28
|
-
const folder = path__default.default.join(cwd, outDir);
|
|
29
|
-
if (!await pathExists(folder)) {
|
|
30
|
-
await fs__default.default.mkdir(folder);
|
|
31
|
-
}
|
|
32
|
-
const pkg$1 = await pkg.loadPkg({ cwd, logger });
|
|
33
|
-
const pkgJson = await pkg.validatePkg({ pkg: pkg$1 });
|
|
34
|
-
concurrently__default.default(["npm run watch"]);
|
|
35
|
-
nodemon__default.default.on("start", () => {
|
|
36
|
-
logger.info(
|
|
37
|
-
outdent.outdent`
|
|
38
|
-
Watching ${outDir} for changes to files with extensions: ${extensions}
|
|
39
|
-
|
|
40
|
-
To use this package in Strapi, in a separate shell run:
|
|
41
|
-
cd /path/to/strapi/project
|
|
42
|
-
|
|
43
|
-
Then run one of the commands below based on the package manager used in that project:
|
|
44
|
-
|
|
45
|
-
## yarn
|
|
46
|
-
${chalk__default.default.greenBright(`yarn dlx yalc add --link ${pkgJson.name} && yarn install`)}
|
|
47
|
-
|
|
48
|
-
## npm
|
|
49
|
-
${chalk__default.default.greenBright(
|
|
50
|
-
`npx yalc add ${pkgJson.name} && npx yalc link ${pkgJson.name} && npm install`
|
|
51
|
-
)}
|
|
52
|
-
`.trimStart()
|
|
53
|
-
);
|
|
54
|
-
}).on("quit", () => {
|
|
55
|
-
process.exit();
|
|
56
|
-
}).on("restart", (files) => {
|
|
57
|
-
logger.info("Found changes in files:", chalk__default.default.magentaBright(files));
|
|
58
|
-
logger.info("Pushing new yalc package...");
|
|
59
|
-
});
|
|
60
|
-
} catch (err) {
|
|
61
|
-
logger.error(
|
|
62
|
-
"There seems to be an unexpected error, try again with --debug for more information \n"
|
|
63
|
-
);
|
|
64
|
-
if (err instanceof Error && err.stack) {
|
|
65
|
-
console.log(
|
|
66
|
-
chalk__default.default.red(
|
|
67
|
-
boxen__default.default(err.stack, {
|
|
68
|
-
padding: 1,
|
|
69
|
-
align: "left"
|
|
70
|
-
})
|
|
71
|
-
)
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
process.exit(1);
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
const pathExists = async (path2) => {
|
|
78
|
-
try {
|
|
79
|
-
await fs__default.default.access(path2);
|
|
80
|
-
return true;
|
|
81
|
-
} catch (error) {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
const command = ({ command: command2, ctx }) => {
|
|
86
|
-
command2.command("plugin:watch:link").description("Recompiles your plugin automatically on changes and runs yalc push --publish").option("-d, --debug", "Enable debugging mode with verbose logs", false).option("--silent", "Don't log anything", false).action((...args) => helpers.runAction("plugin:watch:link", action)(...args, ctx));
|
|
87
|
-
};
|
|
88
|
-
exports.command = command;
|
|
89
|
-
//# sourceMappingURL=link-watch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"link-watch.js","sources":["../../../../src/cli/commands/plugin/link-watch.ts"],"sourcesContent":["import boxen from 'boxen';\nimport chalk from 'chalk';\nimport concurrently from 'concurrently';\nimport fs from 'node:fs/promises';\nimport path from 'node:path';\nimport nodemon from 'nodemon';\nimport { outdent } from 'outdent';\n\nimport { runAction } from '../../utils/helpers';\nimport type { CLIContext, StrapiCommand } from '../../types';\nimport { loadPkg, validatePkg } from '../../utils/pkg';\n\ninterface ActionOptions {}\n\nconst action = async (_opts: ActionOptions, _cmd: unknown, { cwd, logger }: CLIContext) => {\n try {\n const outDir = './dist';\n const extensions = 'ts,js,png,svg,gif,jpeg,css';\n\n nodemon({\n watch: [outDir],\n ext: extensions,\n exec: 'yalc push --changed',\n });\n\n const folder = path.join(cwd, outDir);\n\n if (!(await pathExists(folder))) {\n await fs.mkdir(folder);\n }\n\n const pkg = await loadPkg({ cwd, logger });\n const pkgJson = await validatePkg({ pkg });\n\n concurrently(['npm run watch']);\n\n nodemon\n .on('start', () => {\n logger.info(\n outdent`\n Watching ${outDir} for changes to files with extensions: ${extensions}\n\n To use this package in Strapi, in a separate shell run:\n cd /path/to/strapi/project\n\n Then run one of the commands below based on the package manager used in that project:\n\n ## yarn\n ${chalk.greenBright(`yarn dlx yalc add --link ${pkgJson.name} && yarn install`)}\n\n ## npm\n ${chalk.greenBright(\n `npx yalc add ${pkgJson.name} && npx yalc link ${pkgJson.name} && npm install`\n )}\n `.trimStart()\n );\n })\n .on('quit', () => {\n process.exit();\n })\n .on('restart', (files) => {\n logger.info('Found changes in files:', chalk.magentaBright(files));\n logger.info('Pushing new yalc package...');\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\n/**\n * @internal\n */\nconst pathExists = async (path: string) => {\n try {\n await fs.access(path);\n return true;\n } catch (error) {\n return false;\n }\n};\n\n/**\n * `$ strapi plugin:watch:link`\n */\nconst command: StrapiCommand = ({ command, ctx }) => {\n command\n .command('plugin:watch:link')\n .description('Recompiles your plugin automatically on changes and runs yalc push --publish')\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:link', action)(...args, ctx));\n};\n\nexport { command };\n"],"names":["nodemon","path","fs","pkg","loadPkg","validatePkg","concurrently","outdent","chalk","boxen","command","runAction"],"mappings":";;;;;;;;;;;;;;;;;;AAcA,MAAM,SAAS,OAAO,OAAsB,MAAe,EAAE,KAAK,aAAyB;AACrF,MAAA;AACF,UAAM,SAAS;AACf,UAAM,aAAa;AAEXA,6BAAA;AAAA,MACN,OAAO,CAAC,MAAM;AAAA,MACd,KAAK;AAAA,MACL,MAAM;AAAA,IAAA,CACP;AAED,UA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