@strapi/generators 4.2.0-alpha.9 → 4.2.0-beta.1
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.
- package/lib/files/js/plugin/admin/src/pluginId.js +2 -2
- package/lib/files/ts/plugin/strapi-server.js +1 -1
- package/lib/files/ts/plugin/tsconfig.json +25 -0
- package/lib/plops/api.js +1 -1
- package/lib/plops/content-type.js +1 -1
- package/lib/plops/controller.js +1 -1
- package/lib/plops/middleware.js +1 -1
- package/lib/plops/plugin.js +4 -2
- package/lib/plops/policy.js +1 -1
- package/lib/plops/service.js +1 -1
- package/lib/templates/ts/plugin-package.json.hbs +8 -0
- package/package.json +4 -4
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@strapi/typescript-utils/lib/configs/server",
|
|
3
|
+
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"outDir": "dist",
|
|
6
|
+
"rootDir": "."
|
|
7
|
+
},
|
|
8
|
+
|
|
9
|
+
"include": [
|
|
10
|
+
// Include the root directory
|
|
11
|
+
"server",
|
|
12
|
+
// Force the JSON files in the src folder to be included
|
|
13
|
+
"server/**/*.json"
|
|
14
|
+
],
|
|
15
|
+
|
|
16
|
+
"exclude": [
|
|
17
|
+
"node_modules/",
|
|
18
|
+
"dist/",
|
|
19
|
+
|
|
20
|
+
// Do not include admin files in the server compilation
|
|
21
|
+
"admin/",
|
|
22
|
+
// Do not include test files
|
|
23
|
+
"**/*.test.ts"
|
|
24
|
+
]
|
|
25
|
+
}
|
package/lib/plops/api.js
CHANGED
|
@@ -49,7 +49,7 @@ module.exports = plop => {
|
|
|
49
49
|
actions(answers) {
|
|
50
50
|
const filePath = answers.isPluginApi && answers.plugin ? 'plugins/{{plugin}}' : 'api/{{id}}';
|
|
51
51
|
const currentDir = process.cwd();
|
|
52
|
-
const language = tsUtils.
|
|
52
|
+
const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';
|
|
53
53
|
|
|
54
54
|
const baseActions = [
|
|
55
55
|
{
|
|
@@ -83,7 +83,7 @@ module.exports = plop => {
|
|
|
83
83
|
|
|
84
84
|
const filePath = getFilePath(answers.destination);
|
|
85
85
|
const currentDir = process.cwd();
|
|
86
|
-
const language = tsUtils.
|
|
86
|
+
const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';
|
|
87
87
|
|
|
88
88
|
const baseActions = [
|
|
89
89
|
{
|
package/lib/plops/controller.js
CHANGED
|
@@ -22,7 +22,7 @@ module.exports = plop => {
|
|
|
22
22
|
actions(answers) {
|
|
23
23
|
const filePath = getFilePath(answers.destination);
|
|
24
24
|
const currentDir = process.cwd();
|
|
25
|
-
const language = tsUtils.
|
|
25
|
+
const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';
|
|
26
26
|
|
|
27
27
|
return [
|
|
28
28
|
{
|
package/lib/plops/middleware.js
CHANGED
|
@@ -20,7 +20,7 @@ module.exports = plop => {
|
|
|
20
20
|
actions(answers) {
|
|
21
21
|
const filePath = getFilePath(answers.destination);
|
|
22
22
|
const currentDir = process.cwd();
|
|
23
|
-
const language = tsUtils.
|
|
23
|
+
const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';
|
|
24
24
|
|
|
25
25
|
return [
|
|
26
26
|
{
|
package/lib/plops/plugin.js
CHANGED
|
@@ -9,12 +9,14 @@ const logInstructions = (pluginName, { language }) => {
|
|
|
9
9
|
.fill('─')
|
|
10
10
|
.join('');
|
|
11
11
|
|
|
12
|
+
const exportInstruction = language === 'js' ? 'module.exports =' : 'export default';
|
|
13
|
+
|
|
12
14
|
return `
|
|
13
15
|
You can now enable your plugin by adding the following in ${chalk.yellow(
|
|
14
16
|
`./config/plugins.${language}`
|
|
15
17
|
)}
|
|
16
18
|
${separator}
|
|
17
|
-
|
|
19
|
+
${exportInstruction} {
|
|
18
20
|
${chalk.gray('// ...')}
|
|
19
21
|
${chalk.green(`'${pluginName}'`)}: {
|
|
20
22
|
enabled: ${chalk.yellow(true)},
|
|
@@ -39,7 +41,7 @@ module.exports = plop => {
|
|
|
39
41
|
],
|
|
40
42
|
actions(answers) {
|
|
41
43
|
const currentDir = process.cwd();
|
|
42
|
-
const language = tsUtils.
|
|
44
|
+
const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';
|
|
43
45
|
|
|
44
46
|
// TODO: Adds tsconfig & build command for TS plugins?
|
|
45
47
|
|
package/lib/plops/policy.js
CHANGED
|
@@ -20,7 +20,7 @@ module.exports = plop => {
|
|
|
20
20
|
actions(answers) {
|
|
21
21
|
const filePath = getFilePath(answers.destination);
|
|
22
22
|
const currentDir = process.cwd();
|
|
23
|
-
const language = tsUtils.
|
|
23
|
+
const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';
|
|
24
24
|
|
|
25
25
|
return [
|
|
26
26
|
{
|
package/lib/plops/service.js
CHANGED
|
@@ -20,7 +20,7 @@ module.exports = plop => {
|
|
|
20
20
|
actions(answers) {
|
|
21
21
|
const filePath = getFilePath(answers.destination);
|
|
22
22
|
const currentDir = process.cwd();
|
|
23
|
-
const language = tsUtils.
|
|
23
|
+
const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';
|
|
24
24
|
|
|
25
25
|
return [
|
|
26
26
|
{
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
"kind": "plugin"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {},
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"typescript": "4.6.3",
|
|
13
|
+
"@strapi/strapi": "4.1.8"
|
|
14
|
+
},
|
|
11
15
|
"author": {
|
|
12
16
|
"name": "A Strapi developer"
|
|
13
17
|
},
|
|
@@ -20,5 +24,9 @@
|
|
|
20
24
|
"node": ">=12.x.x <=16.x.x",
|
|
21
25
|
"npm": ">=6.0.0"
|
|
22
26
|
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"develop": "tsc -w",
|
|
29
|
+
"build": "tsc"
|
|
30
|
+
},
|
|
23
31
|
"license": "MIT"
|
|
24
32
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/generators",
|
|
3
|
-
"version": "4.2.0-
|
|
3
|
+
"version": "4.2.0-beta.1",
|
|
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-
|
|
34
|
-
"@strapi/utils": "4.2.0-
|
|
33
|
+
"@strapi/typescript-utils": "4.2.0-beta.1",
|
|
34
|
+
"@strapi/utils": "4.2.0-beta.1",
|
|
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": "
|
|
45
|
+
"gitHead": "4fa2804f35e15ed72dfd309fb5bb1c4dba18932f"
|
|
46
46
|
}
|