mirror of
https://github.com/strapi/strapi.git
synced 2025-12-03 18:42:47 +00:00
only ask about generating a ts Plugin in a javascript project
This commit is contained in:
parent
adce607d00
commit
c49d681b18
@ -27,6 +27,14 @@ ${separator}
|
||||
};
|
||||
|
||||
module.exports = (plop) => {
|
||||
const currentDir = process.cwd();
|
||||
const typescriptPrompt = tsUtils.isUsingTypeScriptSync(currentDir) ? [] : [{
|
||||
type: 'list',
|
||||
name: 'isTypescript',
|
||||
message: 'Choose your preferred language',
|
||||
choices: ['Javascript', 'Typescript'],
|
||||
default: 'Javascript',
|
||||
}];
|
||||
// Plugin generator
|
||||
plop.setGenerator('plugin', {
|
||||
description: 'Generate a basic plugin',
|
||||
@ -36,17 +44,10 @@ module.exports = (plop) => {
|
||||
name: 'pluginName',
|
||||
message: 'Plugin name',
|
||||
},
|
||||
{
|
||||
type: 'list',
|
||||
name: 'isTypescript',
|
||||
message: 'Choose your preferred language',
|
||||
choices: ['Javascript', 'Typescript'],
|
||||
default: 'Javascript',
|
||||
},
|
||||
...typescriptPrompt
|
||||
],
|
||||
actions(answers) {
|
||||
const currentDir = process.cwd();
|
||||
const isTypescript = answers.isTypescript === 'Typescript';
|
||||
const isTypescript = answers?.isTypescript === 'Typescript';
|
||||
const language = tsUtils.isUsingTypeScriptSync(currentDir) || isTypescript ? 'ts' : 'js';
|
||||
|
||||
// TODO: Adds tsconfig & build command for TS plugins?
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user