@strapi/generators 4.2.0-beta.1 → 4.2.0-beta.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,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const chalk = require('chalk');
4
- const tsUtils = require('@strapi/typescript-utils');
4
+ const { isUsingTypeScriptSync } = require('@strapi/typescript-utils');
5
5
 
6
6
  const logInstructions = (pluginName, { language }) => {
7
7
  const maxLength = ` resolve: './src/plugins/${pluginName}'`.length;
@@ -38,10 +38,18 @@ module.exports = plop => {
38
38
  name: 'pluginName',
39
39
  message: 'Plugin name',
40
40
  },
41
+ {
42
+ type: 'list',
43
+ name: 'language',
44
+ message: 'Choose your preferred language',
45
+ choices: ['Javascript', 'Typescript'],
46
+ default: 'Javascript',
47
+ },
41
48
  ],
42
49
  actions(answers) {
43
- const currentDir = process.cwd();
44
- const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';
50
+ const isTypescript = answers.language === 'Typescript';
51
+ const language = isTypescript ? 'ts' : 'js';
52
+ const projectLanguage = isUsingTypeScriptSync(process.cwd()) ? 'ts' : 'js';
45
53
 
46
54
  // TODO: Adds tsconfig & build command for TS plugins?
47
55
 
@@ -62,7 +70,7 @@ module.exports = plop => {
62
70
  path: 'plugins/{{ pluginName }}/package.json',
63
71
  templateFile: `templates/${language}/plugin-package.json.hbs`,
64
72
  },
65
- () => plop.renderString(logInstructions(answers.pluginName, { language })),
73
+ () => plop.renderString(logInstructions(answers.pluginName, { language: projectLanguage })),
66
74
  ];
67
75
  },
68
76
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/generators",
3
- "version": "4.2.0-beta.1",
3
+ "version": "4.2.0-beta.2",
4
4
  "description": "Interactive API generator.",
5
5
  "keywords": [
6
6
  "strapi",
@@ -30,8 +30,8 @@
30
30
  "main": "lib/index.js",
31
31
  "dependencies": {
32
32
  "@sindresorhus/slugify": "1.1.0",
33
- "@strapi/typescript-utils": "4.2.0-beta.1",
34
- "@strapi/utils": "4.2.0-beta.1",
33
+ "@strapi/typescript-utils": "4.2.0-beta.2",
34
+ "@strapi/utils": "4.2.0-beta.2",
35
35
  "chalk": "4.1.2",
36
36
  "fs-extra": "10.0.0",
37
37
  "node-plop": "0.26.3",
@@ -42,5 +42,5 @@
42
42
  "node": ">=12.22.0 <=16.x.x",
43
43
  "npm": ">=6.0.0"
44
44
  },
45
- "gitHead": "4fa2804f35e15ed72dfd309fb5bb1c4dba18932f"
45
+ "gitHead": "bff73257e7695d6f361c91dda8cc810a2bb70b6e"
46
46
  }