mirror of
https://github.com/strapi/strapi.git
synced 2025-09-19 13:31:34 +00:00
fix(CLI-Generator): ♻️ validate plugin/middleware/policy during generation and do not allow empty names
This commit is contained in:
parent
f4311d5d31
commit
73c86d7d60
@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const getDestinationPrompts = require('./prompts/get-destination-prompts');
|
const getDestinationPrompts = require('./prompts/get-destination-prompts');
|
||||||
|
const validateInput = require('./utils/validate-input');
|
||||||
|
|
||||||
module.exports = plop => {
|
module.exports = plop => {
|
||||||
// middleware generator
|
// middleware generator
|
||||||
@ -11,6 +12,7 @@ module.exports = plop => {
|
|||||||
type: 'input',
|
type: 'input',
|
||||||
name: 'name',
|
name: 'name',
|
||||||
message: 'Middleware name',
|
message: 'Middleware name',
|
||||||
|
validate: input => validateInput(input),
|
||||||
},
|
},
|
||||||
...getDestinationPrompts('middleware', plop.getDestBasePath(), { rootFolder: true }),
|
...getDestinationPrompts('middleware', plop.getDestBasePath(), { rootFolder: true }),
|
||||||
],
|
],
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const chalk = require('chalk');
|
const chalk = require('chalk');
|
||||||
|
const validateInput = require('./utils/validate-input');
|
||||||
|
|
||||||
const logInstructions = pluginName => {
|
const logInstructions = pluginName => {
|
||||||
const maxLength = ` resolve: './src/plugins/${pluginName}'`.length;
|
const maxLength = ` resolve: './src/plugins/${pluginName}'`.length;
|
||||||
@ -32,6 +33,7 @@ module.exports = plop => {
|
|||||||
type: 'input',
|
type: 'input',
|
||||||
name: 'pluginName',
|
name: 'pluginName',
|
||||||
message: 'Plugin name',
|
message: 'Plugin name',
|
||||||
|
validate: input => validateInput(input),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
actions(answers) {
|
actions(answers) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const getDestinationPrompts = require('./prompts/get-destination-prompts');
|
const getDestinationPrompts = require('./prompts/get-destination-prompts');
|
||||||
|
const validateInput = require('./utils/validate-input');
|
||||||
|
|
||||||
module.exports = plop => {
|
module.exports = plop => {
|
||||||
// Policy generator
|
// Policy generator
|
||||||
@ -11,6 +12,7 @@ module.exports = plop => {
|
|||||||
type: 'input',
|
type: 'input',
|
||||||
name: 'id',
|
name: 'id',
|
||||||
message: 'Policy name',
|
message: 'Policy name',
|
||||||
|
validate: input => validateInput(input),
|
||||||
},
|
},
|
||||||
...getDestinationPrompts('policy', plop.getDestBasePath(), { rootFolder: true }),
|
...getDestinationPrompts('policy', plop.getDestBasePath(), { rootFolder: true }),
|
||||||
],
|
],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user