Skip to content

Commit 7ce787e

Browse files
authored
feat: Fix encapsulation (#17)
* fix: Ensure plugin is not encapsulated. Signed-off-by: Paolo Insogna <paolo@cowtech.it>
1 parent ca91e54 commit 7ce787e

File tree

4 files changed

+1022
-808
lines changed

4 files changed

+1022
-808
lines changed

.github/workflows/publish-release.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,21 @@ jobs:
3838
version: latest
3939
- name: Install dependencies
4040
run: pnpm install --frozen-lockfile
41-
- name: Bump version and push commit
41+
- name: Bump version
42+
id: bump
43+
run: |
44+
new_version=$(pnpm version ${{ inputs.version }} --no-git-tag-version | tail -n 1)
45+
echo "version=$new_version" >> $GITHUB_OUTPUT
46+
- name: Commit version bump
4247
run: |
43-
pnpm version ${{ inputs.version }} --no-git-tag-version
4448
git config --global user.name "${{ github.actor }}"
4549
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
46-
git commit -a -m "Bumped v${{ inputs.version }}"
50+
git commit -a -m "Bumped ${{ steps.bump.outputs.version }}"
4751
git push origin HEAD:${{ github.ref }}
4852
- name: Publish new version
4953
run: |
5054
npm install npm -g
5155
npm publish --access public --tag ${{ inputs.prerelease == true && 'next' || 'latest' }}
5256
- name: Create release notes
5357
run: |
54-
npx @matteo.collina/release-notes -a ${{ secrets.GITHUB_TOKEN }} -t v${{ inputs.version }} -r ${{ github.repository }} ${{ github.event.inputs.prerelease == 'true' && '-p' || '' }} -c ${{ github.ref }}
58+
npx @matteo.collina/release-notes -a ${{ secrets.GITHUB_TOKEN }} -t ${{ steps.bump.outputs.version }} -r ${{ github.repository }} ${{ github.event.inputs.prerelease == 'true' && '-p' || '' }} -c ${{ github.ref }}

lib/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { create as createService, platformaticService, transform as serviceTransform } from '@platformatic/service'
2+
import fp from 'fastify-plugin'
23
import { defaultDlqTopic } from './definitions.js'
34
import { plugin } from './plugin.js'
45
import { schema } from './schema.js'
@@ -8,8 +9,8 @@ export async function kafkaHooks (app, stackable) {
89
await app.register(plugin, stackable)
910
}
1011

11-
export async function transform (config, schema, options) {
12-
config = await serviceTransform(config, schema, options)
12+
export async function transform (config, ...args) {
13+
config = await serviceTransform(config, ...args)
1314

1415
for (const topic of config.kafka.topics) {
1516
if (topic.dlq === true) {
@@ -21,7 +22,7 @@ export async function transform (config, schema, options) {
2122
}
2223

2324
export async function create (configOrRoot, sourceOrConfig, context) {
24-
return createService(configOrRoot, sourceOrConfig, { schema, applicationFactory: kafkaHooks, transform, ...context })
25+
return createService(configOrRoot, sourceOrConfig, { schema, applicationFactory: fp(kafkaHooks), transform, ...context })
2526
}
2627

2728
export { Generator } from './generator.js'

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@
3636
"helpers:kafka-monitor": "MAIN=true node test/fixtures/kafka-monitor.js"
3737
},
3838
"dependencies": {
39+
"@platformatic/foundation": "^3.0.2",
3940
"@platformatic/kafka": "^1.8.0",
40-
"@platformatic/foundation": "^3.0.0",
41-
"@platformatic/service": "^3.0.0",
41+
"@platformatic/service": "^3.0.2",
42+
"fastify-plugin": "^5.0.1",
4243
"http-errors-enhanced": "^3.0.2",
4344
"hwp": "^0.4.1",
4445
"undici": "^7.8.0"

0 commit comments

Comments
 (0)