@strapi/generators 4.2.0-beta.3 → 4.3.0-beta.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/lib/files/ts/plugin/server/bootstrap.ts +3 -1
- package/lib/files/ts/plugin/server/controllers/my-controller.ts.hbs +3 -1
- package/lib/files/ts/plugin/server/destroy.ts +3 -1
- package/lib/files/ts/plugin/server/register.ts +3 -1
- package/lib/files/ts/plugin/server/services/my-service.ts +3 -1
- package/lib/files/ts/plugin/tsconfig.json +1 -1
- package/lib/index.js +1 -1
- package/lib/plops/plugin.js +8 -3
- package/lib/templates/js/plugin-package.json.hbs +1 -1
- package/lib/templates/js/single-type-routes.js.hbs +3 -1
- package/lib/templates/ts/collection-type-routes.ts.hbs +1 -1
- package/lib/templates/ts/middleware.js.hbs +3 -1
- package/package.json +5 -5
package/lib/index.js
CHANGED
|
@@ -7,7 +7,7 @@ const nodePlop = require('node-plop');
|
|
|
7
7
|
/**
|
|
8
8
|
* Starts the Plop CLI programmatically
|
|
9
9
|
*/
|
|
10
|
-
const runCLI =
|
|
10
|
+
const runCLI = () => {
|
|
11
11
|
Plop.launch({ configPath: join(__dirname, 'plopfile.js') }, env =>
|
|
12
12
|
run({ ...env, dest: join(process.cwd(), 'src') }, undefined, true)
|
|
13
13
|
);
|
package/lib/plops/plugin.js
CHANGED
|
@@ -6,6 +6,11 @@ const { isKebabCase, toKebabCase } = require('@strapi/utils');
|
|
|
6
6
|
|
|
7
7
|
const validateInput = require('./utils/validate-input');
|
|
8
8
|
|
|
9
|
+
const LANGUAGES = {
|
|
10
|
+
javascript: 'JavaScript',
|
|
11
|
+
typescript: 'TypeScript',
|
|
12
|
+
};
|
|
13
|
+
|
|
9
14
|
const logInstructions = (pluginName, { language }) => {
|
|
10
15
|
const maxLength = ` resolve: './src/plugins/${pluginName}'`.length;
|
|
11
16
|
const separator = Array(maxLength)
|
|
@@ -46,12 +51,12 @@ module.exports = plop => {
|
|
|
46
51
|
type: 'list',
|
|
47
52
|
name: 'language',
|
|
48
53
|
message: 'Choose your preferred language',
|
|
49
|
-
choices:
|
|
50
|
-
default:
|
|
54
|
+
choices: Object.values(LANGUAGES),
|
|
55
|
+
default: LANGUAGES.javascript,
|
|
51
56
|
},
|
|
52
57
|
],
|
|
53
58
|
actions(answers) {
|
|
54
|
-
const isTypescript = answers.language ===
|
|
59
|
+
const isTypescript = answers.language === LANGUAGES.typescript;
|
|
55
60
|
const language = isTypescript ? 'ts' : 'js';
|
|
56
61
|
const projectLanguage = isUsingTypeScriptSync(process.cwd()) ? 'ts' : 'js';
|
|
57
62
|
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
* `{{ name }}` middleware.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import '@strapi/strapi';
|
|
6
|
+
|
|
7
|
+
export default (config, { strapi }: { strapi: Strapi }) => {
|
|
6
8
|
// Add your own logic here.
|
|
7
9
|
return async (ctx, next) => {
|
|
8
10
|
strapi.log.info('In {{ name }} middleware.');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/generators",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0-beta.1",
|
|
4
4
|
"description": "Interactive API generator.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"strapi",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"main": "lib/index.js",
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@sindresorhus/slugify": "1.1.0",
|
|
33
|
-
"@strapi/typescript-utils": "4.
|
|
34
|
-
"@strapi/utils": "4.
|
|
33
|
+
"@strapi/typescript-utils": "4.3.0-beta.1",
|
|
34
|
+
"@strapi/utils": "4.3.0-beta.1",
|
|
35
35
|
"chalk": "4.1.2",
|
|
36
36
|
"fs-extra": "10.0.0",
|
|
37
37
|
"node-plop": "0.26.3",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"pluralize": "8.0.0"
|
|
40
40
|
},
|
|
41
41
|
"engines": {
|
|
42
|
-
"node": ">=
|
|
42
|
+
"node": ">=14.19.1 <=16.x.x",
|
|
43
43
|
"npm": ">=6.0.0"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "9d6555398960c39159d66bb4eea3bcb0362e37e3"
|
|
46
46
|
}
|