Skip to content

Commit 7e6d83a

Browse files
committed
Add frontmatter to JestHelpers output
1 parent 5257e40 commit 7e6d83a

File tree

3 files changed

+15
-32
lines changed

3 files changed

+15
-32
lines changed

dwertheimer.JestHelpers/CHANGELOG.md

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,5 @@
44

55
See Plugin [README](https://github.com/NotePlan/plugins/blob/main/dwertheimer.JestHelpers/README.md) for details on available commands and use case.
66

7-
## [x.x.x] - yyyy-mm-dd (githubUserName)
8-
9-
### Added
10-
List what has been added. If nothing has been changed, this section can be removed.
11-
12-
### Changed
13-
List what has changed. If nothing has been changed, this section can be removed.
14-
15-
### Removed
16-
List what has removed. If nothing has been removed, this section can be removed.
17-
18-
## Changelog
19-
20-
All notable changes to this project will be documented in this file.
21-
22-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
23-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
24-
25-
## Plugin Versioning Uses Semver
26-
27-
All NotePlan plugins follow `semver` versioning. For details, please refer to [semver website](https://semver.org/)
7+
## [1.0.0] - 2025-07-22 (dwertheimer)
8+
- Added frontmatterAttributes, frontmatterTypes, linkedItems, and datedTodos to the output of the `outputEditorJson` command

dwertheimer.JestHelpers/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"COMMENT": "Details on these fields: https://help.noteplan.co/article/67-create-command-bar-plugins",
66
"macOS.minVersion": "10.13.0",
77
"noteplan.minAppVersion": "3.4.0",
8-
"plugin.version": "0.1.0",
8+
"plugin.version": "1.0.0",
99
"plugin.description": "Plugin for helping to create Jest/Mocks",
1010
"plugin.author": "dwertheimer",
1111
"plugin.dependencies": [],

dwertheimer.JestHelpers/src/NPPluginMain.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ export async function generateMock(incoming: ?string = ''): Promise<void> {
150150
// createMockClass(pl[0].commands[0], 'PluginCommandObjectMock')
151151

152152
const name = await getInput('What is the name of the mock?')
153-
// console.log(this[name])
153+
154154
if (name && this[name]) createMockOutput(this[name], name)
155155
else console.log(`No object for ${name || ''}`)
156156
} catch (error) {
@@ -195,7 +195,16 @@ export function getNotePlan(): any {
195195
export function outputEditorJson() {
196196
try {
197197
const e = Editor
198-
const nObj = { title: e.title, filename: e.filename, type: e.type, paragraphs: [] }
198+
const nObj = {
199+
title: e.title,
200+
filename: e.filename,
201+
type: e.type,
202+
paragraphs: [],
203+
frontmatterAttributes: e.frontmatterAttributes,
204+
frontmatterTypes: e.frontmatterTypes,
205+
linkedItems: e.linkedItems,
206+
datedTodos: e.datedTodos,
207+
}
199208
nObj.paragraphs = e.paragraphs.map((p) => ({
200209
content: p.content,
201210
rawContent: p.rawContent,
@@ -209,18 +218,11 @@ export function outputEditorJson() {
209218
}))
210219
console.log(`--- Editor ---`)
211220
console.log(JSON.stringify(nObj, null, 2))
212-
clo(Editor.frontmatterAttributes, `Editor.frontmatterAttributes `)
213-
clo(Editor.note?.frontmatterAttributes, `Editor.note.frontmatterAttributes `)
214-
clo(Editor.frontmatterTypes, `Editor.frontmatterTypes `)
215-
clo(Editor.note?.frontmatterTypes, `Editor.note.frontmatterTypes `)
216-
clo(Editor.linkedItems, `Editor.linkedItems `)
217-
clo(Editor.note?.linkedItems, `Editor.note.linkedItems `)
218-
clo(Editor.datedTodos, `Editor.datedTodos `)
219-
clo(Editor.note?.datedTodos, `Editor.note.datedTodos `)
220221

221222
console.log(`--- /Editor ---`)
222223
console.log(`--- For debugging paras ---`)
223224
nObj.paragraphs.forEach((p) => console.log(`[${p.lineIndex}]: type=${p.type} content="${p.content}" heading:"${p.heading}"`))
225+
return {}
224226
} catch (error) {
225227
logError(pluginJson, JSON.stringify(error))
226228
}

0 commit comments

Comments
 (0)