@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.
@@ -73,7 +73,7 @@ module.exports = plop => {
73
73
  }
74
74
 
75
75
  if (answer.attributeType === 'media') {
76
- val.allowedTypes = ['images', 'files', 'videos'];
76
+ val.allowedTypes = ['images', 'files', 'videos', 'audios'];
77
77
  val.multiple = answer.multiple;
78
78
  }
79
79
 
@@ -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
- let filePath;
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',
@@ -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
- let filePath;
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
- name: `Add ${action} to ${rootFolder ? 'root of project' : 'new API'}`,
14
- value: 'new',
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
  ],
@@ -17,6 +17,7 @@ module.exports = plop => {
17
17
  ],
18
18
  actions(answers) {
19
19
  const filePath = getFilePath(answers.destination);
20
+
20
21
  return [
21
22
  {
22
23
  type: 'add',
@@ -6,7 +6,11 @@ module.exports = destination => {
6
6
  }
7
7
 
8
8
  if (destination === 'plugin') {
9
- return `plugins/{{ plugin }}`;
9
+ return `plugins/{{ plugin }}/server`;
10
+ }
11
+
12
+ if (destination === 'root') {
13
+ return './';
10
14
  }
11
15
 
12
16
  return `api/{{ id }}`;
@@ -17,7 +17,7 @@
17
17
  }
18
18
  ],
19
19
  "engines": {
20
- "node": ">=12.x. <=16.x.x",
20
+ "node": ">=12.x.x <=16.x.x",
21
21
  "npm": ">=6.0.0"
22
22
  },
23
23
  "license": "MIT"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/generators",
3
- "version": "4.0.7",
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.7",
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": "af0cba8c5b2ba7b371523e8f55413ef0fce98e1e"
44
+ "gitHead": "bedb04a0cc23719e4eac43e6005fe0fa3d48a9a6"
45
45
  }