Skip to content

Commit

Permalink
describe-package: fix examples (#837)
Browse files Browse the repository at this point in the history
* describe-package: fix an error case parsing examples

* versions: [email protected] [email protected]
  • Loading branch information
josephjclark authored Dec 4, 2024
1 parent 82afe62 commit c2aedec
Show file tree
Hide file tree
Showing 19 changed files with 81 additions and 17 deletions.
7 changes: 7 additions & 0 deletions examples/dts-inspector/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# dts-inspector

## 1.0.21

### Patch Changes

- Updated dependencies [ddda182]
- @openfn/describe-package@0.1.3

## 1.0.20

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/dts-inspector/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dts-inspector",
"version": "1.0.20",
"version": "1.0.21",
"description": "",
"main": "index.js",
"type": "module",
Expand Down
6 changes: 6 additions & 0 deletions integration-tests/execute/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @openfn/integration-tests-execute

## 1.0.10

### Patch Changes

- @openfn/compiler@0.4.1

## 1.0.9

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/execute/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@openfn/integration-tests-execute",
"private": true,
"version": "1.0.9",
"version": "1.0.10",
"description": "Job execution tests",
"author": "Open Function Group <[email protected]>",
"license": "ISC",
Expand Down
8 changes: 8 additions & 0 deletions integration-tests/worker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @openfn/integration-tests-worker

## 1.0.68

### Patch Changes

- @openfn/engine-multi@1.4.4
- @openfn/lightning-mock@2.0.25
- @openfn/ws-worker@1.8.5

## 1.0.67

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/worker/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@openfn/integration-tests-worker",
"private": true,
"version": "1.0.67",
"version": "1.0.68",
"description": "Lightning WOrker integration tests",
"author": "Open Function Group <[email protected]>",
"license": "ISC",
Expand Down
8 changes: 8 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @openfn/cli

## 1.8.11

### Patch Changes

- Updated dependencies [ddda182]
- @openfn/describe-package@0.1.3
- @openfn/compiler@0.4.1

## 1.8.10

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/cli",
"version": "1.8.10",
"version": "1.8.11",
"description": "CLI devtools for the openfn toolchain.",
"engines": {
"node": ">=18",
Expand Down
7 changes: 7 additions & 0 deletions packages/compiler/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @openfn/compiler

## 0.4.1

### Patch Changes

- Updated dependencies [ddda182]
- @openfn/describe-package@0.1.3

## 0.4.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/compiler",
"version": "0.4.0",
"version": "0.4.1",
"description": "Compiler and language tooling for openfn jobs.",
"author": "Open Function Group <[email protected]>",
"license": "ISC",
Expand Down
6 changes: 6 additions & 0 deletions packages/describe-package/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @openfn/describe-package

## 0.1.3

### Patch Changes

- ddda182: Fix an issue which causes malformed examples to throw an error

## 0.1.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/describe-package/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/describe-package",
"version": "0.1.2",
"version": "0.1.3",
"description": "Utilities to inspect an npm package.",
"author": "Open Function Group <[email protected]>",
"license": "ISC",
Expand Down
20 changes: 12 additions & 8 deletions packages/describe-package/src/describe-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,19 @@ const describeFunction = (
parameters: symbol.parameters.map((p) => describeParameter(project, p)),
magic: symbol.jsDocTags.some((tag) => tag.tagName.escapedText === 'magic'),
isOperation: false,
examples: symbol.examples.map((eg: string) => {
if (eg.startsWith('<caption>')) {
let [caption, code] = eg.split('</caption>');
caption = caption.replace('<caption>', '');
examples: symbol.examples
// Some cases can produce non-string examples
// Ie if an @{link} declaration is inside a caption, which breaks parsing (for some reason)
.filter((eg) => typeof eg === 'string')
.map((eg: string) => {
if (eg.startsWith('<caption>')) {
let [caption, code] = eg.split('</caption>');
caption = caption.replace('<caption>', '');

return { caption: caption.trim(), code: code.trim() };
}
return { code: eg.trim() };
}),
return { caption: caption.trim(), code: code.trim() };
}
return { code: eg.trim() };
}),
};
};

Expand Down
6 changes: 6 additions & 0 deletions packages/engine-multi/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# engine-multi

## 1.4.4

### Patch Changes

- @openfn/compiler@0.4.1

## 1.4.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/engine-multi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/engine-multi",
"version": "1.4.3",
"version": "1.4.4",
"description": "Multi-process runtime engine",
"main": "dist/index.js",
"type": "module",
Expand Down
6 changes: 6 additions & 0 deletions packages/lightning-mock/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @openfn/lightning-mock

## 2.0.25

### Patch Changes

- @openfn/engine-multi@1.4.4

## 2.0.24

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/lightning-mock/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/lightning-mock",
"version": "2.0.24",
"version": "2.0.25",
"private": true,
"description": "A mock Lightning server",
"main": "dist/index.js",
Expand Down
6 changes: 6 additions & 0 deletions packages/ws-worker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# ws-worker

## 1.8.5

### Patch Changes

- @openfn/engine-multi@1.4.4

## 1.8.4

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ws-worker/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/ws-worker",
"version": "1.8.4",
"version": "1.8.5",
"description": "A Websocket Worker to connect Lightning to a Runtime Engine",
"main": "dist/index.js",
"type": "module",
Expand Down

0 comments on commit c2aedec

Please sign in to comment.