@strapi/generators 4.6.1 → 4.6.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.
@@ -5,7 +5,7 @@
5
5
  */
6
6
 
7
7
  import React from 'react';
8
- import Puzzle from '@strapi/icons/Puzzle';
8
+ import { Puzzle } from '@strapi/icons';
9
9
 
10
10
  const PluginIcon = () => <Puzzle />;
11
11
 
@@ -4,7 +4,7 @@
4
4
  *
5
5
  */
6
6
 
7
- import React, { useEffect, useRef } from 'react';
7
+ import { useEffect, useRef } from 'react';
8
8
  import pluginId from '../../pluginId';
9
9
 
10
10
  type InitializerProps = {
@@ -7,6 +7,6 @@
7
7
  import React from 'react';
8
8
  import { Puzzle } from '@strapi/icons';
9
9
 
10
- const PluginIcon: React.VoidFunctionComponent = () => <Puzzle />;
10
+ const PluginIcon = () => <Puzzle />;
11
11
 
12
12
  export default PluginIcon;
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
1
  import { prefixPluginTranslations } from '@strapi/helper-plugin';
2
+
3
3
  import pluginPkg from '../../package.json';
4
4
  import pluginId from './pluginId';
5
5
  import Initializer from './components/Initializer';
@@ -8,7 +8,7 @@ import PluginIcon from './components/PluginIcon';
8
8
  const name = pluginPkg.strapi.name;
9
9
 
10
10
  export default {
11
- register(app) {
11
+ register(app: any) {
12
12
  app.addMenuLink({
13
13
  to: `/plugins/${pluginId}`,
14
14
  icon: PluginIcon,
@@ -39,12 +39,13 @@ export default {
39
39
  app.registerPlugin(plugin);
40
40
  },
41
41
 
42
- bootstrap(app) {},
43
- async registerTrads(app) {
42
+ bootstrap(app: any) {},
43
+
44
+ async registerTrads(app: any) {
44
45
  const { locales } = app;
45
46
 
46
47
  const importedTrads = await Promise.all(
47
- locales.map(locale => {
48
+ (locales as any[]).map((locale) => {
48
49
  return import(`./translations/${locale}.json`)
49
50
  .then(({ default: data }) => {
50
51
  return {
@@ -11,7 +11,7 @@ import { NotFound } from '@strapi/helper-plugin';
11
11
  import pluginId from '../../pluginId';
12
12
  import HomePage from '../HomePage';
13
13
 
14
- const App: React.VoidFunctionComponent = () => {
14
+ const App = () => {
15
15
  return (
16
16
  <div>
17
17
  <Switch>
@@ -7,7 +7,7 @@
7
7
  import React from 'react';
8
8
  import pluginId from '../../pluginId';
9
9
 
10
- const HomePage: React.VoidFunctionComponent = () => {
10
+ const HomePage = () => {
11
11
  return (
12
12
  <div>
13
13
  <h1>{pluginId}&apos;s HomePage</h1>
@@ -0,0 +1,5 @@
1
+ declare module '@strapi/design-system/*';
2
+ declare module '@strapi/design-system';
3
+ declare module '@strapi/icons';
4
+ declare module '@strapi/icons/*';
5
+ declare module '@strapi/helper-plugin';
@@ -1,24 +1,19 @@
1
1
  {
2
- "extends": "@strapi/typescript-utils/tsconfigs/server",
2
+ "extends": "@strapi/typescript-utils/tsconfigs/admin",
3
3
 
4
4
  "compilerOptions": {
5
- "outDir": "dist",
6
- "rootDir": "."
5
+ "target": "ESNext",
6
+ "strict": true
7
7
  },
8
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
- ],
9
+ "include": ["admin", "custom.d.ts"],
15
10
 
16
11
  "exclude": [
17
12
  "node_modules/",
18
13
  "dist/",
19
14
 
20
- // Do not include admin files in the server compilation
21
- "admin/",
15
+ // Do not include server files in the server compilation
16
+ "server/",
22
17
  // Do not include test files
23
18
  "**/*.test.ts"
24
19
  ]
@@ -0,0 +1,25 @@
1
+ {
2
+ "extends": "@strapi/typescript-utils/tsconfigs/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
+ }
@@ -8,7 +8,24 @@
8
8
  "kind": "plugin",
9
9
  "displayName": "{{titleCase pluginName }}"
10
10
  },
11
- "dependencies": {},
11
+ "dependencies": {
12
+ "@strapi/design-system": "^1.6.3",
13
+ "@strapi/helper-plugin": "^4.6.0",
14
+ "@strapi/icons": "^1.6.3",
15
+ "prop-types": "^15.7.2"
16
+ },
17
+ "devDependencies": {
18
+ "react": "^17.0.2",
19
+ "react-dom": "^17.0.2",
20
+ "react-router-dom": "^5.3.4",
21
+ "styled-components": "^5.3.6"
22
+ },
23
+ "peerDependencies": {
24
+ "react": "^17.0.2",
25
+ "react-dom": "^17.0.2",
26
+ "react-router-dom": "^5.3.4",
27
+ "styled-components": "^5.3.6"
28
+ },
12
29
  "author": {
13
30
  "name": "A Strapi developer"
14
31
  },
@@ -8,11 +8,29 @@
8
8
  "kind": "plugin"
9
9
  },
10
10
  "dependencies": {
11
- "@strapi/icons": "^1.3.1"
11
+ "@strapi/design-system": "^1.6.3",
12
+ "@strapi/helper-plugin": "^4.6.0",
13
+ "@strapi/icons": "^1.6.3",
14
+ "prop-types": "^15.7.2"
12
15
  },
13
16
  "devDependencies": {
17
+ "@strapi/typescript-utils": "^4.6.0",
18
+ "@types/react": "^17.0.53",
19
+ "@types/react-dom": "^17.0.18",
20
+ "@types/react-router-dom": "^5.3.3",
21
+ "@types/styled-components": "^5.1.26",
22
+ "react": "^17.0.2",
23
+ "react-dom": "^17.0.2",
24
+ "react-router-dom": "^5.3.4",
25
+ "styled-components": "^5.3.6",
14
26
  "typescript": "4.6.3"
15
27
  },
28
+ "peerDependencies": {
29
+ "react": "^17.0.2",
30
+ "react-dom": "^17.0.2",
31
+ "react-router-dom": "^5.3.4",
32
+ "styled-components": "^5.3.6"
33
+ },
16
34
  "author": {
17
35
  "name": "A Strapi developer"
18
36
  },
@@ -26,8 +44,8 @@
26
44
  "npm": ">=6.0.0"
27
45
  },
28
46
  "scripts": {
29
- "develop": "tsc -w",
30
- "build": "tsc"
47
+ "develop": "tsc -p tsconfig.server.json -w",
48
+ "build": "tsc -p tsconfig.server.json"
31
49
  },
32
50
  "license": "MIT"
33
51
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/generators",
3
- "version": "4.6.1",
3
+ "version": "4.6.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.6.1",
34
- "@strapi/utils": "4.6.1",
33
+ "@strapi/typescript-utils": "4.6.2",
34
+ "@strapi/utils": "4.6.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": ">=14.19.1 <=18.x.x",
43
43
  "npm": ">=6.0.0"
44
44
  },
45
- "gitHead": "17a7845e3d453ea2e7911bda6ec25ed196dd5f16"
45
+ "gitHead": "bae505f44c3a779905f6b8dbc0c497e24d9eabfb"
46
46
  }
@@ -1,42 +0,0 @@
1
- /**
2
- * axios with a custom config.
3
- */
4
-
5
- import axios from 'axios';
6
- import { auth, wrapAxiosInstance } from '@strapi/helper-plugin';
7
-
8
- const instance = axios.create({
9
- baseURL: process.env.STRAPI_ADMIN_BACKEND_URL,
10
- });
11
-
12
- instance.interceptors.request.use(
13
- async (config) => {
14
- config.headers = {
15
- Authorization: `Bearer ${auth.getToken()}`,
16
- Accept: 'application/json',
17
- 'Content-Type': 'application/json',
18
- };
19
-
20
- return config;
21
- },
22
- (error) => {
23
- Promise.reject(error);
24
- }
25
- );
26
-
27
- instance.interceptors.response.use(
28
- (response) => response,
29
- (error) => {
30
- // whatever you want to do with the error
31
- if (error.response?.status === 401) {
32
- auth.clearAppStorage();
33
- window.location.reload();
34
- }
35
-
36
- throw error;
37
- }
38
- );
39
-
40
- const wrapper = wrapAxiosInstance(instance);
41
-
42
- export default wrapper;
@@ -1,42 +0,0 @@
1
- /**
2
- * axios with a custom config.
3
- */
4
-
5
- import axios from 'axios';
6
- import { auth, wrapAxiosInstance } from '@strapi/helper-plugin';
7
-
8
- const instance = axios.create({
9
- baseURL: process.env.STRAPI_ADMIN_BACKEND_URL,
10
- });
11
-
12
- instance.interceptors.request.use(
13
- async (config) => {
14
- config.headers = {
15
- Authorization: `Bearer ${auth.getToken()}`,
16
- Accept: 'application/json',
17
- 'Content-Type': 'application/json',
18
- };
19
-
20
- return config;
21
- },
22
- (error) => {
23
- Promise.reject(error);
24
- }
25
- );
26
-
27
- instance.interceptors.response.use(
28
- (response) => response,
29
- (error) => {
30
- // whatever you want to do with the error
31
- if (error.response?.status === 401) {
32
- auth.clearAppStorage();
33
- window.location.reload();
34
- }
35
-
36
- throw error;
37
- }
38
- );
39
-
40
- const wrapper = wrapAxiosInstance(instance);
41
-
42
- export default wrapper;