@strapi/generators 4.1.3 → 4.1.4-alpha.2

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.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const validateInput = require('../utils/validate-input');
3
+ const validateAttributeInput = require('../utils/validate-attribute-input');
4
4
 
5
5
  const DEFAULT_TYPES = [
6
6
  // advanced types
@@ -50,7 +50,7 @@ module.exports = async inquirer => {
50
50
  type: 'input',
51
51
  name: 'attributeName',
52
52
  message: 'Name of attribute',
53
- validate: input => validateInput(input),
53
+ validate: input => validateAttributeInput(input),
54
54
  },
55
55
  {
56
56
  type: 'list',
@@ -72,7 +72,10 @@ module.exports = async inquirer => {
72
72
  type: 'list',
73
73
  name: 'multiple',
74
74
  message: 'Choose media type',
75
- choices: [{ name: 'Multiple', value: true }, { name: 'Single', value: false }],
75
+ choices: [
76
+ { name: 'Multiple', value: true },
77
+ { name: 'Single', value: false },
78
+ ],
76
79
  },
77
80
  {
78
81
  type: 'confirm',
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ module.exports = input => {
4
+ const regex = /^[A-Za-z-|_]+$/g;
5
+
6
+ if (!input) {
7
+ return 'You must provide an input';
8
+ }
9
+
10
+ return regex.test(input) || "Please use only letters, '-', '_', and no spaces";
11
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/generators",
3
- "version": "4.1.3",
3
+ "version": "4.1.4-alpha.2",
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.1.3",
33
+ "@strapi/utils": "4.1.4-alpha.2",
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": "8549f5aca34f2a72bb477a1b305260f39f271f4e"
44
+ "gitHead": "067d31a116cd5d31a0160073a09ade55ea4c95a9"
45
45
  }