@verdaccio/hooks 6.0.0-6-next.36 → 6.0.0-6-next.38

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/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @verdaccio/hooks
2
2
 
3
+ ## 6.0.0-6-next.38
4
+
5
+ ### Patch Changes
6
+
7
+ - @verdaccio/core@6.0.0-6-next.68
8
+ - @verdaccio/logger@6.0.0-6-next.36
9
+
10
+ ## 6.0.0-6-next.37
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [16e38df8]
15
+ - @verdaccio/core@6.0.0-6-next.67
16
+ - @verdaccio/logger@6.0.0-6-next.35
17
+
3
18
  ## 6.0.0-6-next.36
4
19
 
5
20
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["export { handleNotify, notify, sendNotification } from './notify';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA"}
1
+ {"version":3,"file":"index.js","names":["_notify","require"],"sources":["../src/index.ts"],"sourcesContent":["export { handleNotify, notify, sendNotification } from './notify';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"notify-request.js","names":["debug","buildDebug","notifyRequest","url","options","response","fetch","body","JSON","stringify","method","headers","status","json","HTTP_STATUS","BAD_REQUEST","Error","logger","info","content","err","error","errorMessage","message"],"sources":["../src/notify-request.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport { fetch } from 'undici';\n\nimport { HTTP_STATUS } from '@verdaccio/core';\nimport { logger } from '@verdaccio/logger';\n\nconst debug = buildDebug('verdaccio:hooks:request');\n\nexport type FetchOptions = {\n body: string;\n headers?: {};\n method?: string;\n};\n\nexport async function notifyRequest(url: string, options: FetchOptions): Promise<boolean> {\n let response;\n try {\n debug('uri %o', url);\n response = await fetch(url, {\n body: JSON.stringify(options.body),\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n });\n debug('response.status %o', response.status);\n const body = await response.json();\n if (response.status >= HTTP_STATUS.BAD_REQUEST) {\n throw new Error(body);\n }\n\n logger.info(\n { content: options.body },\n 'The notification @{content} has been successfully dispatched'\n );\n return true;\n } catch (err: any) {\n debug('request error %o', err);\n logger.error(\n { errorMessage: err?.message },\n 'notify service has thrown an error: @{errorMessage}'\n );\n return false;\n }\n}\n"],"mappings":";;;;;;AAAA;AACA;AAEA;AACA;AAA2C;AAE3C,MAAMA,KAAK,GAAG,IAAAC,cAAU,EAAC,yBAAyB,CAAC;AAQ5C,eAAeC,aAAa,CAACC,GAAW,EAAEC,OAAqB,EAAoB;EACxF,IAAIC,QAAQ;EACZ,IAAI;IACFL,KAAK,CAAC,QAAQ,EAAEG,GAAG,CAAC;IACpBE,QAAQ,GAAG,MAAM,IAAAC,aAAK,EAACH,GAAG,EAAE;MAC1BI,IAAI,EAAEC,IAAI,CAACC,SAAS,CAACL,OAAO,CAACG,IAAI,CAAC;MAClCG,MAAM,EAAE,MAAM;MACdC,OAAO,EAAE;QAAE,cAAc,EAAE;MAAmB;IAChD,CAAC,CAAC;IACFX,KAAK,CAAC,qBAAqB,EAAEK,QAAQ,CAACO,MAAM,CAAC;IAC7C,MAAML,IAAI,GAAG,MAAMF,QAAQ,CAACQ,IAAI,EAAE;IAClC,IAAIR,QAAQ,CAACO,MAAM,IAAIE,iBAAW,CAACC,WAAW,EAAE;MAC9C,MAAM,IAAIC,KAAK,CAACT,IAAI,CAAC;IACvB;IAEAU,cAAM,CAACC,IAAI,CACT;MAAEC,OAAO,EAAEf,OAAO,CAACG;IAAK,CAAC,EACzB,8DAA8D,CAC/D;IACD,OAAO,IAAI;EACb,CAAC,CAAC,OAAOa,GAAQ,EAAE;IACjBpB,KAAK,CAAC,kBAAkB,EAAEoB,GAAG,CAAC;IAC9BH,cAAM,CAACI,KAAK,CACV;MAAEC,YAAY,EAAEF,GAAG,aAAHA,GAAG,uBAAHA,GAAG,CAAEG;IAAQ,CAAC,EAC9B,qDAAqD,CACtD;IACD,OAAO,KAAK;EACd;AACF"}
1
+ {"version":3,"file":"notify-request.js","names":["_debug","_interopRequireDefault","require","_undici","_core","_logger","obj","__esModule","default","debug","buildDebug","notifyRequest","url","options","response","fetch","body","JSON","stringify","method","headers","status","json","HTTP_STATUS","BAD_REQUEST","Error","logger","info","content","err","error","errorMessage","message"],"sources":["../src/notify-request.ts"],"sourcesContent":["import buildDebug from 'debug';\nimport { fetch } from 'undici';\n\nimport { HTTP_STATUS } from '@verdaccio/core';\nimport { logger } from '@verdaccio/logger';\n\nconst debug = buildDebug('verdaccio:hooks:request');\n\nexport type FetchOptions = {\n body: string;\n headers?: {};\n method?: string;\n};\n\nexport async function notifyRequest(url: string, options: FetchOptions): Promise<boolean> {\n let response;\n try {\n debug('uri %o', url);\n response = await fetch(url, {\n body: JSON.stringify(options.body),\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n });\n debug('response.status %o', response.status);\n const body = await response.json();\n if (response.status >= HTTP_STATUS.BAD_REQUEST) {\n throw new Error(body);\n }\n\n logger.info(\n { content: options.body },\n 'The notification @{content} has been successfully dispatched'\n );\n return true;\n } catch (err: any) {\n debug('request error %o', err);\n logger.error(\n { errorMessage: err?.message },\n 'notify service has thrown an error: @{errorMessage}'\n );\n return false;\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAA2C,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE3C,MAAMG,KAAK,GAAG,IAAAC,cAAU,EAAC,yBAAyB,CAAC;AAQ5C,eAAeC,aAAaA,CAACC,GAAW,EAAEC,OAAqB,EAAoB;EACxF,IAAIC,QAAQ;EACZ,IAAI;IACFL,KAAK,CAAC,QAAQ,EAAEG,GAAG,CAAC;IACpBE,QAAQ,GAAG,MAAM,IAAAC,aAAK,EAACH,GAAG,EAAE;MAC1BI,IAAI,EAAEC,IAAI,CAACC,SAAS,CAACL,OAAO,CAACG,IAAI,CAAC;MAClCG,MAAM,EAAE,MAAM;MACdC,OAAO,EAAE;QAAE,cAAc,EAAE;MAAmB;IAChD,CAAC,CAAC;IACFX,KAAK,CAAC,qBAAqB,EAAEK,QAAQ,CAACO,MAAM,CAAC;IAC7C,MAAML,IAAI,GAAG,MAAMF,QAAQ,CAACQ,IAAI,EAAE;IAClC,IAAIR,QAAQ,CAACO,MAAM,IAAIE,iBAAW,CAACC,WAAW,EAAE;MAC9C,MAAM,IAAIC,KAAK,CAACT,IAAI,CAAC;IACvB;IAEAU,cAAM,CAACC,IAAI,CACT;MAAEC,OAAO,EAAEf,OAAO,CAACG;IAAK,CAAC,EACzB,8DAA8D,CAC/D;IACD,OAAO,IAAI;EACb,CAAC,CAAC,OAAOa,GAAQ,EAAE;IACjBpB,KAAK,CAAC,kBAAkB,EAAEoB,GAAG,CAAC;IAC9BH,cAAM,CAACI,KAAK,CACV;MAAEC,YAAY,EAAEF,GAAG,aAAHA,GAAG,uBAAHA,GAAG,CAAEG;IAAQ,CAAC,EAC9B,qDAAqD,CACtD;IACD,OAAO,KAAK;EACd;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"notify.js","names":["debug","buildDebug","compileTemplate","content","metadata","Promise","resolve","reject","handler","template","Handlebars","compile","error","handleNotify","notifyEntry","remoteUser","publishedPackage","regex","name","packagePattern","RegExp","packagePatternFlags","test","publisher","options","body","JSON","stringify","headers","Array","isArray","header","map","item","Object","is","key","hasOwnProperty","endpoint","Error","notifyRequest","method","sendNotification","notify","config","isSingle","keys","includes","response","results","allSettled","keyId","catch","logger","promiseValue","value"],"sources":["../src/notify.ts"],"sourcesContent":["/* eslint-disable no-undef */\nimport buildDebug from 'debug';\nimport Handlebars from 'handlebars';\n\nimport { logger } from '@verdaccio/logger';\nimport { Config, Notification, Package, RemoteUser } from '@verdaccio/types';\n\nimport { FetchOptions, notifyRequest } from './notify-request';\n\nconst debug = buildDebug('verdaccio:hooks');\n\nexport function compileTemplate(content, metadata) {\n // FUTURE: multiple handlers\n return new Promise((resolve, reject) => {\n let handler;\n try {\n if (!handler) {\n debug('compile default template handler %o', content);\n const template: HandlebarsTemplateDelegate = Handlebars.compile(content);\n return resolve(template(metadata));\n }\n } catch (error: any) {\n debug('error template handler %o', error);\n reject(error);\n }\n });\n}\n\nexport async function handleNotify(\n metadata: Partial<Package>,\n notifyEntry,\n remoteUser: Partial<RemoteUser>,\n publishedPackage: string\n): Promise<boolean> {\n let regex;\n if (metadata.name && notifyEntry.packagePattern) {\n regex = new RegExp(notifyEntry.packagePattern, notifyEntry.packagePatternFlags || '');\n if (!regex.test(metadata.name)) {\n return false;\n }\n }\n\n let content;\n // FIXME: publisher is not part of the expected types metadata\n // @ts-ignore\n if (typeof metadata?.publisher === 'undefined' || metadata?.publisher === null) {\n // @ts-ignore\n metadata = { ...metadata, publishedPackage, publisher: { name: remoteUser.name as string } };\n debug('template metadata %o', metadata);\n content = await compileTemplate(notifyEntry.content, metadata);\n }\n\n const options: FetchOptions = {\n body: JSON.stringify(content),\n };\n\n // provides fallback support, it's accept an Object {} and Array of {}\n if (notifyEntry.headers && Array.isArray(notifyEntry.headers)) {\n const header = {};\n // FIXME: we can simplify this\n notifyEntry.headers.map(function (item): void {\n if (Object.is(item, item)) {\n for (const key in item) {\n /* eslint no-prototype-builtins: 0 */\n if (item.hasOwnProperty(key)) {\n header[key] = item[key];\n }\n }\n }\n });\n options.headers = header;\n } else if (Object.is(notifyEntry.headers, notifyEntry.headers)) {\n options.headers = notifyEntry.headers;\n }\n\n if (!notifyEntry.endpoint) {\n debug('error due endpoint is missing');\n throw new Error('missing parameter');\n }\n\n return notifyRequest(notifyEntry.endpoint, {\n method: notifyEntry.method,\n ...options,\n });\n}\n\nexport function sendNotification(\n metadata: Partial<Package>,\n notify: Notification,\n remoteUser: Partial<RemoteUser>,\n publishedPackage: string\n): Promise<boolean> {\n return handleNotify(metadata, notify, remoteUser, publishedPackage) as Promise<any>;\n}\n\nexport async function notify(\n metadata: Partial<Package>,\n config: Partial<Config>,\n remoteUser: Partial<RemoteUser>,\n publishedPackage: string\n): Promise<boolean[]> {\n debug('init send notification');\n if (config.notify) {\n const isSingle = Object.keys(config.notify).includes('method');\n if (isSingle) {\n debug('send single notification');\n try {\n const response = await sendNotification(\n metadata,\n config.notify as Notification,\n remoteUser,\n publishedPackage\n );\n return [response];\n } catch {\n debug('error on sending single notification');\n return [false];\n }\n } else {\n debug('send multiples notification');\n const results = await Promise.allSettled(\n Object.keys(config.notify).map((keyId: string) => {\n // @ts-ignore\n const item = config.notify[keyId];\n debug('send item %o', item);\n return sendNotification(metadata, item, remoteUser, publishedPackage);\n })\n ).catch((error) => {\n logger.error({ error }, 'notify request has failed: @error');\n });\n\n // @ts-ignore\n return Object.keys(results).map((promiseValue) => results[promiseValue].value);\n }\n } else {\n debug('no notifications configuration detected');\n return [false];\n }\n}\n"],"mappings":";;;;;;;;;AACA;AACA;AAEA;AAGA;AAA+D;AAP/D;;AASA,MAAMA,KAAK,GAAG,IAAAC,cAAU,EAAC,iBAAiB,CAAC;AAEpC,SAASC,eAAe,CAACC,OAAO,EAAEC,QAAQ,EAAE;EACjD;EACA,OAAO,IAAIC,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;IACtC,IAAIC,OAAO;IACX,IAAI;MACF,IAAI,CAACA,OAAO,EAAE;QACZR,KAAK,CAAC,qCAAqC,EAAEG,OAAO,CAAC;QACrD,MAAMM,QAAoC,GAAGC,mBAAU,CAACC,OAAO,CAACR,OAAO,CAAC;QACxE,OAAOG,OAAO,CAACG,QAAQ,CAACL,QAAQ,CAAC,CAAC;MACpC;IACF,CAAC,CAAC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Z7C,KAAK,CAAC,0BAA0B,CAAC;MACjC,IAAI;QACF,MAAMgD,QAAQ,GAAG,MAAMN,gBAAgB,CACrCtC,QAAQ,EACRwC,MAAM,CAACD,MAAM,EACb5B,UAAU,EACVC,gBAAgB,CACjB;QACD,OAAO,CAACgC,QAAQ,CAAC;MACnB,CAAC,CAAC,MAAM;QACNhD,KAAK,CAAC,sCAAsC,CAAC;QAC7C,OAAO,CAAC,KAAK,CAAC;MAChB;IACF,CAAC,MAAM;MACLA,KAAK,CAAC,6BAA6B,CAAC;MACpC,MAAMiD,OAAO,GAAG,MAAM5C,OAAO,CAAC6C,UAAU,CACtChB,MAAM,CAACY,IAAI,CAACF,MAAM,CAACD,MAAM,CAAC,CAACX,GAAG,CAAEmB,KAAa,IAAK;QAChD;QACA,MAAMlB,IAAI,GAAGW,MAAM,CAACD,MAAM,CAACQ,KAAK,CAAC;QACjCnD,KAAK,CAAC,cAAc,EAAEiC,IAAI,CAAC;QAC3B,OAAOS,gBAAgB,CAACtC,QAAQ,EAAE6B,IAAI,EAAElB,UAAU,EAAEC,gBAAgB,CAAC;MACvE,CAAC,CAAC,CACH,CAACoC,KAAK,CAAExC,KAAK,IAAK;QACjByC,cAAM,CAACzC,KAAK,CAAC;UAAEA;QAAM,CAAC,EAAE,mCAAmC,CAAC;MAC9D,CAAC,CAAC;;MAEF;MACA,OAAOsB,MAAM,CAACY,IAAI,CAACG,OAAO,CAAC,CAACjB,GAAG,CAAEsB,YAAY,IAAKL,OAAO,CAACK,YAAY,CAAC,CAACC,KAAK,CAAC;IAChF;EACF,CAAC,MAAM;IACLvD,KAAK,CAAC,yCAAyC,CAAC;IAChD,OAAO,CAAC,KAAK,CAAC;EAChB;AACF"}
1
+ {"version":3,"file":"notify.js","names":["_debug","_interopRequireDefault","require","_handlebars","_logger","_notifyRequest","obj","__esModule","default","debug","buildDebug","compileTemplate","content","metadata","Promise","resolve","reject","handler","template","Handlebars","compile","error","handleNotify","notifyEntry","remoteUser","publishedPackage","_metadata","_metadata2","regex","name","packagePattern","RegExp","packagePatternFlags","test","publisher","options","body","JSON","stringify","headers","Array","isArray","header","map","item","Object","is","key","hasOwnProperty","endpoint","Error","notifyRequest","method","sendNotification","notify","config","isSingle","keys","includes","response","results","allSettled","keyId","catch","logger","promiseValue","value"],"sources":["../src/notify.ts"],"sourcesContent":["/* eslint-disable no-undef */\nimport buildDebug from 'debug';\nimport Handlebars from 'handlebars';\n\nimport { logger } from '@verdaccio/logger';\nimport { Config, Notification, Package, RemoteUser } from '@verdaccio/types';\n\nimport { FetchOptions, notifyRequest } from './notify-request';\n\nconst debug = buildDebug('verdaccio:hooks');\n\nexport function compileTemplate(content, metadata) {\n // FUTURE: multiple handlers\n return new Promise((resolve, reject) => {\n let handler;\n try {\n if (!handler) {\n debug('compile default template handler %o', content);\n const template: HandlebarsTemplateDelegate = Handlebars.compile(content);\n return resolve(template(metadata));\n }\n } catch (error: any) {\n debug('error template handler %o', error);\n reject(error);\n }\n });\n}\n\nexport async function handleNotify(\n metadata: Partial<Package>,\n notifyEntry,\n remoteUser: Partial<RemoteUser>,\n publishedPackage: string\n): Promise<boolean> {\n let regex;\n if (metadata.name && notifyEntry.packagePattern) {\n regex = new RegExp(notifyEntry.packagePattern, notifyEntry.packagePatternFlags || '');\n if (!regex.test(metadata.name)) {\n return false;\n }\n }\n\n let content;\n // FIXME: publisher is not part of the expected types metadata\n // @ts-ignore\n if (typeof metadata?.publisher === 'undefined' || metadata?.publisher === null) {\n // @ts-ignore\n metadata = { ...metadata, publishedPackage, publisher: { name: remoteUser.name as string } };\n debug('template metadata %o', metadata);\n content = await compileTemplate(notifyEntry.content, metadata);\n }\n\n const options: FetchOptions = {\n body: JSON.stringify(content),\n };\n\n // provides fallback support, it's accept an Object {} and Array of {}\n if (notifyEntry.headers && Array.isArray(notifyEntry.headers)) {\n const header = {};\n // FIXME: we can simplify this\n notifyEntry.headers.map(function (item): void {\n if (Object.is(item, item)) {\n for (const key in item) {\n /* eslint no-prototype-builtins: 0 */\n if (item.hasOwnProperty(key)) {\n header[key] = item[key];\n }\n }\n }\n });\n options.headers = header;\n } else if (Object.is(notifyEntry.headers, notifyEntry.headers)) {\n options.headers = notifyEntry.headers;\n }\n\n if (!notifyEntry.endpoint) {\n debug('error due endpoint is missing');\n throw new Error('missing parameter');\n }\n\n return notifyRequest(notifyEntry.endpoint, {\n method: notifyEntry.method,\n ...options,\n });\n}\n\nexport function sendNotification(\n metadata: Partial<Package>,\n notify: Notification,\n remoteUser: Partial<RemoteUser>,\n publishedPackage: string\n): Promise<boolean> {\n return handleNotify(metadata, notify, remoteUser, publishedPackage) as Promise<any>;\n}\n\nexport async function notify(\n metadata: Partial<Package>,\n config: Partial<Config>,\n remoteUser: Partial<RemoteUser>,\n publishedPackage: string\n): Promise<boolean[]> {\n debug('init send notification');\n if (config.notify) {\n const isSingle = Object.keys(config.notify).includes('method');\n if (isSingle) {\n debug('send single notification');\n try {\n const response = await sendNotification(\n metadata,\n config.notify as Notification,\n remoteUser,\n publishedPackage\n );\n return [response];\n } catch {\n debug('error on sending single notification');\n return [false];\n }\n } else {\n debug('send multiples notification');\n const results = await Promise.allSettled(\n Object.keys(config.notify).map((keyId: string) => {\n // @ts-ignore\n const item = config.notify[keyId];\n debug('send item %o', item);\n return sendNotification(metadata, item, remoteUser, publishedPackage);\n })\n ).catch((error) => {\n logger.error({ error }, 'notify request has failed: @error');\n });\n\n // @ts-ignore\n return Object.keys(results).map((promiseValue) => results[promiseValue].value);\n }\n } else {\n debug('no notifications configuration detected');\n return [false];\n }\n}\n"],"mappings":";;;;;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAGA,IAAAG,cAAA,GAAAH,OAAA;AAA+D,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAA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gB,CAAC;MACvE,CAAC,CAAC,CACH,CAACsC,KAAK,CAAE1C,KAAK,IAAK;QACjB2C,cAAM,CAAC3C,KAAK,CAAC;UAAEA;QAAM,CAAC,EAAE,mCAAmC,CAAC;MAC9D,CAAC,CAAC;;MAEF;MACA,OAAOwB,MAAM,CAACY,IAAI,CAACG,OAAO,CAAC,CAACjB,GAAG,CAAEsB,YAAY,IAAKL,OAAO,CAACK,YAAY,CAAC,CAACC,KAAK,CAAC;IAChF;EACF,CAAC,MAAM;IACLzD,KAAK,CAAC,yCAAyC,CAAC;IAChD,OAAO,CAAC,KAAK,CAAC;EAChB;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdaccio/hooks",
3
- "version": "6.0.0-6-next.36",
3
+ "version": "6.0.0-6-next.38",
4
4
  "description": "loaders logic",
5
5
  "main": "./build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -29,8 +29,8 @@
29
29
  "node": ">=16"
30
30
  },
31
31
  "dependencies": {
32
- "@verdaccio/core": "6.0.0-6-next.66",
33
- "@verdaccio/logger": "6.0.0-6-next.34",
32
+ "@verdaccio/core": "6.0.0-6-next.68",
33
+ "@verdaccio/logger": "6.0.0-6-next.36",
34
34
  "core-js": "3.28.0",
35
35
  "debug": "4.3.4",
36
36
  "handlebars": "4.7.7",
@@ -38,9 +38,9 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/node": "16.18.10",
41
- "@verdaccio/auth": "6.0.0-6-next.45",
42
- "@verdaccio/config": "6.0.0-6-next.66",
43
- "@verdaccio/types": "11.0.0-6-next.24"
41
+ "@verdaccio/auth": "6.0.0-6-next.47",
42
+ "@verdaccio/config": "6.0.0-6-next.68",
43
+ "@verdaccio/types": "11.0.0-6-next.25"
44
44
  },
45
45
  "funding": {
46
46
  "type": "opencollective",
@@ -54,6 +54,5 @@
54
54
  "build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps",
55
55
  "watch": "pnpm build:js -- --watch",
56
56
  "build": "pnpm run build:js && pnpm run build:types"
57
- },
58
- "readme": "# @verdaccio/hooks\n\n[![backers](https://opencollective.com/verdaccio/tiers/backer/badge.svg?label=Backer&color=brightgreen)](https://opencollective.com/verdaccio)\n[![stackshare](https://img.shields.io/badge/Follow%20on-StackShare-blue.svg?logo=stackshare&style=flat)](https://stackshare.io/verdaccio)\n[![MIT](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/verdaccio/verdaccio/blob/master/LICENSE)\n[![Crowdin](https://d322cqt584bo4o.cloudfront.net/verdaccio/localized.svg)](https://crowdin.com/project/verdaccio)\n[![TODOs](https://badgen.net/https/api.tickgit.com/badgen/github.com/verdaccio/verdaccio)](https://www.tickgit.com/browse?repo=github.com/verdaccio/verdaccio)\n\n[![Twitter followers](https://img.shields.io/twitter/follow/verdaccio_npm.svg?style=social&label=Follow)](https://twitter.com/verdaccio_npm)\n[![Github](https://img.shields.io/github/stars/verdaccio/verdaccio.svg?style=social&label=Stars)](https://github.com/verdaccio/verdaccio/stargazers)\n\n## Donations\n\nVerdaccio is run by **volunteers**; nobody is working full-time on it. If you find this project to be useful and would like to support its development, consider making a donation - **your logo might end up in this readme.** 😉\n\n**[Donate](https://opencollective.com/verdaccio)** 💵👍🏻 starting from _\\$1/month_ or just one single contribution.\n\n## Report a vulnerability\n\nIf you want to report a security vulnerability, please follow the steps which we have defined for you in our [security policy](https://github.com/verdaccio/verdaccio/security/policy).\n\n## Open Collective Sponsors\n\nSupport this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/verdaccio#sponsor)]\n\n[![sponsor](https://opencollective.com/verdaccio/sponsor/0/avatar.svg)](https://opencollective.com/verdaccio/sponsor/0/website)\n[![sponsor](https://opencollective.com/verdaccio/sponsor/1/avatar.svg)](https://opencollective.com/verdaccio/sponsor/1/website)\n[![sponsor](https://opencollective.com/verdaccio/sponsor/2/avatar.svg)](https://opencollective.com/verdaccio/sponsor/2/website)\n[![sponsor](https://opencollective.com/verdaccio/sponsor/3/avatar.svg)](https://opencollective.com/verdaccio/sponsor/3/website)\n[![sponsor](https://opencollective.com/verdaccio/sponsor/4/avatar.svg)](https://opencollective.com/verdaccio/sponsor/4/website)\n[![sponsor](https://opencollective.com/verdaccio/sponsor/5/avatar.svg)](https://opencollective.com/verdaccio/sponsor/5/website)\n[![sponsor](https://opencollective.com/verdaccio/sponsor/6/avatar.svg)](https://opencollective.com/verdaccio/sponsor/6/website)\n[![sponsor](https://opencollective.com/verdaccio/sponsor/7/avatar.svg)](https://opencollective.com/verdaccio/sponsor/7/website)\n[![sponsor](https://opencollective.com/verdaccio/sponsor/8/avatar.svg)](https://opencollective.com/verdaccio/sponsor/8/website)\n[![sponsor](https://opencollective.com/verdaccio/sponsor/9/avatar.svg)](https://opencollective.com/verdaccio/sponsor/9/website)\n\n## Open Collective Backers\n\nThank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/verdaccio#backer)]\n\n[![backers](https://opencollective.com/verdaccio/backers.svg?width=890)](https://opencollective.com/verdaccio#backers)\n\n## Special Thanks\n\nThanks to the following companies to help us to achieve our goals providing free open source licenses.\n\n[![jetbrain](assets/thanks/jetbrains/logo.png)](https://www.jetbrains.com/)\n[![crowdin](assets/thanks/crowdin/logo.png)](https://crowdin.com/)\n[![balsamiq](assets/thanks/balsamiq/logo.jpg)](https://balsamiq.com/)\n\n## Contributors\n\nThis project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].\n\n[![contributors](https://opencollective.com/verdaccio/contributors.svg?width=890&button=true)](../../graphs/contributors)\n\n### FAQ / Contact / Troubleshoot\n\nIf you have any issue you can try the following options, do no desist to ask or check our issues database, perhaps someone has asked already what you are looking for.\n\n- [Blog](https://verdaccio.org/blog/)\n- [Donations](https://opencollective.com/verdaccio)\n- [Reporting an issue](https://github.com/verdaccio/verdaccio/blob/master/CONTRIBUTING.md#reporting-a-bug)\n- [Running discussions](https://github.com/verdaccio/verdaccio/issues?q=is%3Aissue+is%3Aopen+label%3Adiscuss)\n- [Chat](http://chat.verdaccio.org/)\n- [Logos](https://verdaccio.org/docs/en/logo)\n- [Docker Examples](https://github.com/verdaccio/docker-examples)\n- [FAQ](https://github.com/verdaccio/verdaccio/issues?utf8=%E2%9C%93&q=is%3Aissue%20label%3Aquestion%20)\n\n### License\n\nVerdaccio is [MIT licensed](https://github.com/verdaccio/verdaccio/blob/master/LICENSE)\n\nThe Verdaccio documentation and logos (excluding /thanks, e.g., .md, .png, .sketch) files within the /assets folder) is\n[Creative Commons licensed](https://github.com/verdaccio/verdaccio/blob/master/LICENSE-docs).\n"
57
+ }
59
58
  }