@strapi/generators 4.2.0-beta.3 → 4.3.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.
@@ -1,3 +1,5 @@
1
- export default ({ strapi }) => {
1
+ import '@strapi/strapi';
2
+
3
+ export default ({ strapi }: { strapi: Strapi }) => {
2
4
  // bootstrap phase
3
5
  };
@@ -1,4 +1,6 @@
1
- export default ({ strapi }) => ({
1
+ import '@strapi/strapi';
2
+
3
+ export default ({ strapi }: { strapi: Strapi }) => ({
2
4
  index(ctx) {
3
5
  ctx.body = strapi
4
6
  .plugin('{{ pluginName }}')
@@ -1,3 +1,5 @@
1
- export default ({ strapi }) => {
1
+ import '@strapi/strapi';
2
+
3
+ export default ({ strapi }: { strapi: Strapi }) => {
2
4
  // destroy phase
3
5
  };
@@ -1,3 +1,5 @@
1
- export default ({ strapi }) => {
1
+ import '@strapi/strapi';
2
+
3
+ export default ({ strapi }: { strapi: Strapi }) => {
2
4
  // registeration phase
3
5
  };
@@ -1,4 +1,6 @@
1
- export default ({ strapi }) => ({
1
+ import '@strapi/strapi';
2
+
3
+ export default ({ strapi }: { strapi: Strapi }) => ({
2
4
  getWelcomeMessage() {
3
5
  return 'Welcome to Strapi 🚀';
4
6
  },
@@ -1,5 +1,5 @@
1
1
  {
2
- "extends": "@strapi/typescript-utils/lib/configs/server",
2
+ "extends": "@strapi/typescript-utils/tsconfigs/server",
3
3
 
4
4
  "compilerOptions": {
5
5
  "outDir": "dist",
package/lib/index.js CHANGED
@@ -7,7 +7,7 @@ const nodePlop = require('node-plop');
7
7
  /**
8
8
  * Starts the Plop CLI programmatically
9
9
  */
10
- const runCLI = async () => {
10
+ const runCLI = () => {
11
11
  Plop.launch({ configPath: join(__dirname, 'plopfile.js') }, env =>
12
12
  run({ ...env, dest: join(process.cwd(), 'src') }, undefined, true)
13
13
  );
@@ -6,6 +6,11 @@ const { isKebabCase, toKebabCase } = require('@strapi/utils');
6
6
 
7
7
  const validateInput = require('./utils/validate-input');
8
8
 
9
+ const LANGUAGES = {
10
+ javascript: 'JavaScript',
11
+ typescript: 'TypeScript',
12
+ };
13
+
9
14
  const logInstructions = (pluginName, { language }) => {
10
15
  const maxLength = ` resolve: './src/plugins/${pluginName}'`.length;
11
16
  const separator = Array(maxLength)
@@ -46,12 +51,12 @@ module.exports = plop => {
46
51
  type: 'list',
47
52
  name: 'language',
48
53
  message: 'Choose your preferred language',
49
- choices: ['Javascript', 'Typescript'],
50
- default: 'Javascript',
54
+ choices: Object.values(LANGUAGES),
55
+ default: LANGUAGES.javascript,
51
56
  },
52
57
  ],
53
58
  actions(answers) {
54
- const isTypescript = answers.language === 'Typescript';
59
+ const isTypescript = answers.language === LANGUAGES.typescript;
55
60
  const language = isTypescript ? 'ts' : 'js';
56
61
  const projectLanguage = isUsingTypeScriptSync(process.cwd()) ? 'ts' : 'js';
57
62
 
@@ -18,7 +18,7 @@
18
18
  }
19
19
  ],
20
20
  "engines": {
21
- "node": ">=12.x.x <=16.x.x",
21
+ "node": ">=14.19.1 <=16.x.x",
22
22
  "npm": ">=6.0.0"
23
23
  },
24
24
  "license": "MIT"
@@ -1,4 +1,6 @@
1
- export default {
1
+ 'use strict';
2
+
3
+ module.exports = {
2
4
  routes: [
3
5
  {
4
6
  method: 'GET',
@@ -1,4 +1,4 @@
1
- module.exports = {
1
+ export default {
2
2
  routes: [
3
3
  {
4
4
  method: 'GET',
@@ -2,7 +2,9 @@
2
2
  * `{{ name }}` middleware.
3
3
  */
4
4
 
5
- export default (config, { strapi }) => {
5
+ import '@strapi/strapi';
6
+
7
+ export default (config, { strapi }: { strapi: Strapi }) => {
6
8
  // Add your own logic here.
7
9
  return async (ctx, next) => {
8
10
  strapi.log.info('In {{ name }} middleware.');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/generators",
3
- "version": "4.2.0-beta.3",
3
+ "version": "4.3.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-beta.3",
34
- "@strapi/utils": "4.2.0-beta.3",
33
+ "@strapi/typescript-utils": "4.3.0-beta.1",
34
+ "@strapi/utils": "4.3.0-beta.1",
35
35
  "chalk": "4.1.2",
36
36
  "fs-extra": "10.0.0",
37
37
  "node-plop": "0.26.3",
@@ -39,8 +39,8 @@
39
39
  "pluralize": "8.0.0"
40
40
  },
41
41
  "engines": {
42
- "node": ">=12.22.0 <=16.x.x",
42
+ "node": ">=14.19.1 <=16.x.x",
43
43
  "npm": ">=6.0.0"
44
44
  },
45
- "gitHead": "c4addbad6ecbc8ef7633bbba3806f3b0a2ae5f49"
45
+ "gitHead": "9d6555398960c39159d66bb4eea3bcb0362e37e3"
46
46
  }