@strapi/generators 4.0.7 → 4.1.1-alpha.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/lib/plops/content-type.js +1 -1
- package/lib/plops/middleware.js +2 -9
- package/lib/plops/policy.js +2 -8
- package/lib/plops/prompts/get-destination-prompts.js +13 -4
- package/lib/plops/service.js +1 -0
- package/lib/plops/utils/get-file-path.js +5 -1
- package/lib/templates/plugin-package.json.hbs +1 -1
- package/package.json +3 -3
package/lib/plops/middleware.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const getDestinationPrompts = require('./prompts/get-destination-prompts');
|
|
4
|
+
const getFilePath = require('./utils/get-file-path');
|
|
4
5
|
|
|
5
6
|
module.exports = plop => {
|
|
6
7
|
// middleware generator
|
|
@@ -15,15 +16,7 @@ module.exports = plop => {
|
|
|
15
16
|
...getDestinationPrompts('middleware', plop.getDestBasePath(), { rootFolder: true }),
|
|
16
17
|
],
|
|
17
18
|
actions(answers) {
|
|
18
|
-
|
|
19
|
-
if (answers.destination === 'api') {
|
|
20
|
-
filePath = `api/{{ api }}`;
|
|
21
|
-
} else if (answers.destination === 'plugin') {
|
|
22
|
-
filePath = `plugins/{{ plugin }}`;
|
|
23
|
-
} else {
|
|
24
|
-
filePath = `./`;
|
|
25
|
-
}
|
|
26
|
-
|
|
19
|
+
const filePath = getFilePath(answers.destination);
|
|
27
20
|
return [
|
|
28
21
|
{
|
|
29
22
|
type: 'add',
|
package/lib/plops/policy.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const getDestinationPrompts = require('./prompts/get-destination-prompts');
|
|
4
|
+
const getFilePath = require('./utils/get-file-path');
|
|
4
5
|
|
|
5
6
|
module.exports = plop => {
|
|
6
7
|
// Policy generator
|
|
@@ -15,14 +16,7 @@ module.exports = plop => {
|
|
|
15
16
|
...getDestinationPrompts('policy', plop.getDestBasePath(), { rootFolder: true }),
|
|
16
17
|
],
|
|
17
18
|
actions(answers) {
|
|
18
|
-
|
|
19
|
-
if (answers.destination === 'api') {
|
|
20
|
-
filePath = `api/{{api}}`;
|
|
21
|
-
} else if (answers.destination === 'plugin') {
|
|
22
|
-
filePath = `plugins/{{plugin}}`;
|
|
23
|
-
} else {
|
|
24
|
-
filePath = `./`;
|
|
25
|
-
}
|
|
19
|
+
const filePath = getFilePath(answers.destination);
|
|
26
20
|
|
|
27
21
|
return [
|
|
28
22
|
{
|
|
@@ -9,10 +9,19 @@ module.exports = (action, basePath, { rootFolder = false } = {}) => {
|
|
|
9
9
|
name: 'destination',
|
|
10
10
|
message: `Where do you want to add this ${action}?`,
|
|
11
11
|
choices: [
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
...(rootFolder
|
|
13
|
+
? [
|
|
14
|
+
{
|
|
15
|
+
name: `Add ${action} to root of project`,
|
|
16
|
+
value: 'root',
|
|
17
|
+
},
|
|
18
|
+
]
|
|
19
|
+
: [
|
|
20
|
+
{
|
|
21
|
+
name: `Add ${action} to new API`,
|
|
22
|
+
value: 'new',
|
|
23
|
+
},
|
|
24
|
+
]),
|
|
16
25
|
{ name: `Add ${action} to an existing API`, value: 'api' },
|
|
17
26
|
{ name: `Add ${action} to an existing plugin`, value: 'plugin' },
|
|
18
27
|
],
|
package/lib/plops/service.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/generators",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.1-alpha.0",
|
|
4
4
|
"description": "Interactive API generator.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"strapi",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"main": "lib/index.js",
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@sindresorhus/slugify": "1.1.0",
|
|
33
|
-
"@strapi/utils": "4.0
|
|
33
|
+
"@strapi/utils": "4.1.1-alpha.0",
|
|
34
34
|
"chalk": "4.1.2",
|
|
35
35
|
"fs-extra": "10.0.0",
|
|
36
36
|
"node-plop": "0.26.3",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"node": ">=12.22.0 <=16.x.x",
|
|
42
42
|
"npm": ">=6.0.0"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "bedb04a0cc23719e4eac43e6005fe0fa3d48a9a6"
|
|
45
45
|
}
|