File tree Expand file tree Collapse file tree 9 files changed +54
-33
lines changed Expand file tree Collapse file tree 9 files changed +54
-33
lines changed Original file line number Diff line number Diff line change 1
1
{
2
- "editor.tabSize" : 2 ,
3
- "typescript.preferences.importModuleSpecifier" : " relative" ,
4
- "prettier.bracketSpacing" : false ,
5
- "editor.formatOnSave" : true ,
6
- "editor.formatOnSaveMode" : " file" ,
7
- "editor.codeActionsOnSave" : {
8
- "source.addMissingImports.ts" : " always" ,
9
- "source.fixAll.eslint" : " always" ,
10
- "source.organizeImports" : " always"
11
- },
12
- "typescript.tsdk" : " node_modules/typescript/lib"
13
- }
14
-
2
+ "editor.tabSize" : 2 ,
3
+ "typescript.preferences.importModuleSpecifier" : " relative" ,
4
+ "prettier.bracketSpacing" : false ,
5
+ "editor.formatOnSave" : true ,
6
+ "editor.formatOnSaveMode" : " file" ,
7
+ "editor.codeActionsOnSave" : {
8
+ "source.addMissingImports.ts" : " always" ,
9
+ "source.fixAll.eslint" : " always" ,
10
+ "source.organizeImports" : " always"
11
+ },
12
+ "typescript.tsdk" : " node_modules/typescript/lib"
13
+ }
Original file line number Diff line number Diff line change @@ -11,9 +11,9 @@ const en = {
11
11
success : 'Successfully imported {successful} of {total} files' ,
12
12
warning : 'Import completed with warnings: {message}' ,
13
13
complete : 'Import process failed' ,
14
- error : 'Error importing files: {message} {details}'
15
- }
16
- }
14
+ error : 'Error importing files: {message} {details}' ,
15
+ } ,
16
+ } ,
17
17
} ,
18
18
settings : {
19
19
state : {
Original file line number Diff line number Diff line change 1
1
export function removeTrailingSlash ( str : string ) {
2
- if ( typeof str == " string" && str [ str . length - 1 ] == "/" ) {
2
+ if ( typeof str == ' string' && str [ str . length - 1 ] == '/' ) {
3
3
str = str . substring ( 0 , str . length - 1 ) ;
4
4
}
5
5
return str ;
6
6
}
7
7
8
8
export function removeLeadingSlash ( str : string ) {
9
- if ( typeof str == " string" && str [ 0 ] == "/" ) {
9
+ if ( typeof str == ' string' && str [ 0 ] == '/' ) {
10
10
str = str . slice ( 1 ) ;
11
11
}
12
12
return str ;
Original file line number Diff line number Diff line change 1
- import * as pluginPkg from '../package.json' ;
2
-
3
- export const PLUGIN_ID = pluginPkg . strapi . name ;
1
+ export const PLUGIN_ID = 'imagekit' ;
Original file line number Diff line number Diff line change 3
3
"include" : [" ./src" , " ./custom.d.ts" ],
4
4
"compilerOptions" : {
5
5
"rootDir" : " ../" ,
6
- "baseUrl" : " ."
6
+ "baseUrl" : " ." ,
7
+ "resolveJsonModule" : true
7
8
}
8
9
}
Original file line number Diff line number Diff line change 23
23
" dist"
24
24
],
25
25
"scripts" : {
26
- "build" : " strapi-plugin build" ,
26
+ "prepare" : " husky install" ,
27
+ "publish:latest" : " npm publish --tag latest" ,
28
+ "publish:beta" : " npm publish --tag beta" ,
29
+ "build" : " yarn clean && strapi-plugin build" ,
30
+ "clean" : " rm -rf dist" ,
31
+ "lint" : " prettier --check ." ,
32
+ "format" : " prettier --write ." ,
27
33
"watch" : " strapi-plugin watch" ,
28
34
"watch:link" : " strapi-plugin watch:link" ,
29
35
"verify" : " strapi-plugin verify" ,
48
54
"@strapi/upload" : " ^5.13.0" ,
49
55
"@types/react" : " ^19.1.3" ,
50
56
"@types/react-dom" : " ^19.1.4" ,
57
+ "husky" : " ^9.1.7" ,
51
58
"prettier" : " ^3.5.3" ,
52
59
"react" : " ^18.3.1" ,
53
60
"react-dom" : " ^18.3.1" ,
88
95
89
96
}
90
97
],
91
- "packageManager" :
" [email protected] "
92
- }
98
+ "packageManager" :
" [email protected] " ,
99
+ "husky" : {
100
+ "hooks" : {
101
+ "pre-commit" : " yarn format"
102
+ }
103
+ }
104
+ }
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ const webhookController = ({ strapi }: { strapi: Core.Strapi }) => ({
8
8
async handleWebhook ( ctx : any ) {
9
9
try {
10
10
const { body } = ctx . request ;
11
-
11
+
12
12
// Validate the webhook payload
13
13
if ( ! body || ! body . eventType || ! body . data || ! Array . isArray ( body . data ) ) {
14
14
return ctx . badRequest ( {
@@ -17,7 +17,7 @@ const webhookController = ({ strapi }: { strapi: Core.Strapi }) => ({
17
17
details : 'The webhook payload must contain eventType and an array of data items' ,
18
18
} ) ;
19
19
}
20
-
20
+
21
21
if ( body . data . length === 0 ) {
22
22
return ctx . badRequest ( {
23
23
status : 'error' ,
@@ -27,11 +27,8 @@ const webhookController = ({ strapi }: { strapi: Core.Strapi }) => ({
27
27
}
28
28
29
29
// Process the webhook data
30
- const result = await strapi
31
- . plugin ( 'imagekit' )
32
- . service ( 'webhook' )
33
- . processWebhook ( body ) ;
34
-
30
+ const result = await strapi . plugin ( 'imagekit' ) . service ( 'webhook' ) . processWebhook ( body ) ;
31
+
35
32
// Check if we got any successful imports
36
33
if ( result && result . length > 0 ) {
37
34
// Add statistics for successful imports vs attempted imports
@@ -61,7 +58,7 @@ const webhookController = ({ strapi }: { strapi: Core.Strapi }) => ({
61
58
}
62
59
} catch ( error : any ) {
63
60
strapi . log . error ( '[ImageKit Webhook Controller] Error handling webhook:' , error ) ;
64
-
61
+
65
62
// Return a structured error response
66
63
return ctx . badRequest ( {
67
64
status : 'error' ,
Original file line number Diff line number Diff line change @@ -9,6 +9,10 @@ import { getService } from './utils/getService';
9
9
function toImageKitUrl ( src : string , settings : Settings , client : ImageKit ) : string {
10
10
const endpoint = settings . urlEndpoint ;
11
11
12
+ if ( ! endpoint ) {
13
+ return src ;
14
+ }
15
+
12
16
if ( src . startsWith ( endpoint ) ) {
13
17
return client . url ( {
14
18
src,
Original file line number Diff line number Diff line change @@ -8460,6 +8460,15 @@ __metadata:
8460
8460
languageName: node
8461
8461
linkType: hard
8462
8462
8463
+ "husky@npm:^9.1.7":
8464
+ version: 9.1.7
8465
+ resolution: "husky@npm:9.1.7"
8466
+ bin:
8467
+ husky: bin.js
8468
+ checksum: 10c0/35bb110a71086c48906aa7cd3ed4913fb913823715359d65e32e0b964cb1e255593b0ae8014a5005c66a68e6fa66c38dcfa8056dbbdfb8b0187c0ffe7ee3a58f
8469
+ languageName: node
8470
+ linkType: hard
8471
+
8463
8472
"iconv-lite@npm:0.4.13":
8464
8473
version: 0.4.13
8465
8474
resolution: "iconv-lite@npm:0.4.13"
@@ -13325,6 +13334,7 @@ __metadata:
13325
13334
"@types/react": "npm:^19.1.3"
13326
13335
"@types/react-dom": "npm:^19.1.4"
13327
13336
formik: "npm:^2.4.6"
13337
+ husky: "npm:^9.1.7"
13328
13338
imagekit: "npm:^6.0.0"
13329
13339
imagekit-media-library-widget: "npm:^2.1.1"
13330
13340
lodash: "npm:^4.17.21"
You can’t perform that action at this time.
0 commit comments