@meith/plugin-reference 0.7.0 → 0.9.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meith/plugin-reference",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "The reference plugin: a handler for every hook Meith fires, as documentation that runs.",
5
5
  "license": "LGPL-3.0-or-later",
6
6
  "repository": {
@@ -20,7 +20,7 @@
20
20
  "access": "public"
21
21
  },
22
22
  "dependencies": {
23
- "@meith/plugin-kit": "^0.7.0"
23
+ "@meith/plugin-kit": "^0.9.0"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "react": "^19.2.0"
package/src/index.ts CHANGED
@@ -1 +1,2 @@
1
- export { referencePlugin, RECORDED, MARK, resetRecorder } from './plugin'
1
+ export { referenceMessages } from './messages'
2
+ export { MARK, RECORDED, referencePlugin, resetRecorder } from './plugin'
@@ -0,0 +1,22 @@
1
+ {
2
+ "reference.admin.status.summary": "{greeting} — {count, plural, one {# hook seen.} other {# hooks seen.}}",
3
+ "reference.admin.status.title": "Reference plugin",
4
+ "reference.definition.description": "Exercises every documented extension point. Installed in CI, not on a board.",
5
+ "reference.definition.name": "Reference plugin",
6
+ "reference.notification.poked.body": "The reference plugin exercised the notification seam.",
7
+ "reference.notification.poked.description": "Exists to exercise the notification seam end to end.",
8
+ "reference.notification.poked.subject": "You were poked",
9
+ "reference.notification.poked.title": "The reference plugin pokes you",
10
+ "reference.page.guest": "guest",
11
+ "reference.page.title": "Reference",
12
+ "reference.page.viewer": "reference-plugin page for viewer {viewer}",
13
+ "reference.setting.apiSecret.description": "Exists to exercise the write-only secret path.",
14
+ "reference.setting.apiSecret.label": "API secret",
15
+ "reference.setting.badgeLimit.label": "Badge limit",
16
+ "reference.setting.greeting.description": "Prefixed to the footer.",
17
+ "reference.setting.greeting.label": "Greeting",
18
+ "reference.setting.mode.label": "Mode",
19
+ "reference.setting.mode.record": "Record",
20
+ "reference.setting.mode.replay": "Replay",
21
+ "reference.setting.noisy.label": "Log every hook"
22
+ }
@@ -0,0 +1,3 @@
1
+ import en from './en.json'
2
+
3
+ export const referenceMessages = { en }
package/src/plugin.tsx CHANGED
@@ -1,10 +1,12 @@
1
1
  import {
2
2
  definePlugin,
3
- REGION_NAMES,
4
3
  type PluginRegion,
5
4
  type PluginRegionContext,
5
+ REGION_NAMES,
6
6
  } from '@meith/plugin-kit'
7
7
 
8
+ import en from './messages/en.json'
9
+
8
10
  export const RECORDED: {
9
11
  hooks: { name: string; value: unknown }[]
10
12
  regions: PluginRegion[]
@@ -45,39 +47,76 @@ function contribution(region: PluginRegion) {
45
47
 
46
48
  export const referencePlugin = definePlugin({
47
49
  key: 'reference',
48
- name: 'Reference plugin',
49
- version: '0.7.0',
50
- description: 'Exercises every documented extension point. Installed in CI, not on a board.',
50
+ name: en['reference.definition.name'],
51
+ nameKey: 'reference.definition.name',
52
+ version: '0.9.0',
53
+ description: en['reference.definition.description'],
54
+ descriptionKey: 'reference.definition.description',
51
55
  apiVersion: '0',
52
56
 
53
57
  settings: [
54
- { key: 'greeting', label: 'Greeting', default: 'hello', description: 'Prefixed to the footer.' },
55
- { key: 'badge_limit', label: 'Badge limit', default: 3 },
56
- { key: 'noisy', label: 'Log every hook', default: false, advanced: true },
58
+ {
59
+ key: 'greeting',
60
+ label: en['reference.setting.greeting.label'],
61
+ labelKey: 'reference.setting.greeting.label',
62
+ default: 'hello',
63
+ description: en['reference.setting.greeting.description'],
64
+ descriptionKey: 'reference.setting.greeting.description',
65
+ },
66
+ {
67
+ key: 'badge_limit',
68
+ label: en['reference.setting.badgeLimit.label'],
69
+ labelKey: 'reference.setting.badgeLimit.label',
70
+ default: 3,
71
+ },
72
+ {
73
+ key: 'noisy',
74
+ label: en['reference.setting.noisy.label'],
75
+ labelKey: 'reference.setting.noisy.label',
76
+ default: false,
77
+ advanced: true,
78
+ },
57
79
  {
58
80
  key: 'api_secret',
59
- label: 'API secret',
81
+ label: en['reference.setting.apiSecret.label'],
82
+ labelKey: 'reference.setting.apiSecret.label',
60
83
  type: 'secret',
61
84
  env: 'REFERENCE_API_SECRET',
62
85
  required: true,
63
86
  default: '',
64
- description: 'Exists to exercise the write-only secret path.',
87
+ description: en['reference.setting.apiSecret.description'],
88
+ descriptionKey: 'reference.setting.apiSecret.description',
65
89
  },
66
90
  {
67
91
  key: 'mode',
68
- label: 'Mode',
92
+ label: en['reference.setting.mode.label'],
93
+ labelKey: 'reference.setting.mode.label',
69
94
  type: 'select',
70
95
  options: [
71
- { value: 'record', label: 'Record' },
72
- { value: 'replay', label: 'Replay' },
96
+ {
97
+ value: 'record',
98
+ label: en['reference.setting.mode.record'],
99
+ labelKey: 'reference.setting.mode.record',
100
+ },
101
+ {
102
+ value: 'replay',
103
+ label: en['reference.setting.mode.replay'],
104
+ labelKey: 'reference.setting.mode.replay',
105
+ },
73
106
  ],
74
107
  default: 'record',
75
108
  },
76
109
  ],
77
110
 
78
111
  migrations: [
79
- { id: '0001_create_table', statements: ['create table if not exists plugin_reference_note (id serial primary key)'] },
80
- { id: '0002_add_column', statements: ['alter table plugin_reference_note add column if not exists note text'] },
112
+ {
113
+ id: '0001_create_table',
114
+ statements: ['create table if not exists plugin_reference_note (id serial primary key)'],
115
+ },
116
+ {
117
+ id: '0002_add_column',
118
+ statements: ['alter table plugin_reference_note add column if not exists note text'],
119
+ },
81
120
  ],
82
121
 
83
122
  tasks: [
@@ -93,12 +132,13 @@ export const referencePlugin = definePlugin({
93
132
  adminPages: [
94
133
  {
95
134
  path: 'status',
96
- title: 'Reference plugin',
97
- render: (context) => (
98
- <p>
99
- {String(context.settings.greeting ?? 'hello')} {RECORDED.hooks.length} hooks seen.
100
- </p>
101
- ),
135
+ title: en['reference.admin.status.title'],
136
+ titleKey: 'reference.admin.status.title',
137
+ render: (context) =>
138
+ context.t.t('reference.admin.status.summary', {
139
+ greeting: String(context.settings.greeting ?? 'hello'),
140
+ count: RECORDED.hooks.length,
141
+ }),
102
142
  },
103
143
  ],
104
144
 
@@ -139,8 +179,8 @@ export const referencePlugin = definePlugin({
139
179
  await context.notify.send({
140
180
  userId: request.viewer.userId ?? 0,
141
181
  kind: 'poked',
142
- subject: 'You were poked',
143
- body: 'The reference plugin exercised the notification seam.',
182
+ subjectKey: 'reference.notification.poked.subject',
183
+ bodyKey: 'reference.notification.poked.body',
144
184
  href: '/reference',
145
185
  })
146
186
  return { kind: 'json', body: { poked: true } }
@@ -161,8 +201,10 @@ export const referencePlugin = definePlugin({
161
201
  notifications: [
162
202
  {
163
203
  key: 'poked',
164
- title: 'The reference plugin pokes you',
165
- description: 'Exists to exercise the notification seam end to end.',
204
+ title: en['reference.notification.poked.title'],
205
+ titleKey: 'reference.notification.poked.title',
206
+ description: en['reference.notification.poked.description'],
207
+ descriptionKey: 'reference.notification.poked.description',
166
208
  emailByDefault: false,
167
209
  },
168
210
  ],
@@ -170,13 +212,16 @@ export const referencePlugin = definePlugin({
170
212
  pages: [
171
213
  {
172
214
  path: '',
173
- title: 'Reference',
215
+ title: en['reference.page.title'],
216
+ titleKey: 'reference.page.title',
174
217
  access: 'anonymous',
175
218
  render: (context) => {
176
219
  RECORDED.pages.push(context.path)
177
220
  return (
178
221
  <p data-plugin={MARK}>
179
- {MARK} page for viewer {String(context.viewer.userId ?? 'guest')}
222
+ {context.t.t('reference.page.viewer', {
223
+ viewer: String(context.viewer.userId ?? context.t.t('reference.page.guest')),
224
+ })}
180
225
  </p>
181
226
  )
182
227
  },