Skip to content

Commit

Permalink
updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
marklundin committed Jul 24, 2024
1 parent 6a26f8d commit 7292596
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# PlayCanvas Attribute Parser

This the JSDoc attribute parser used in the PlayCanvas editor. It's used to collect metadata from a script via it's jsdoc tags.
This the official JSDoc attribute parser used in the PlayCanvas editor.

It's used in the PlayCanvas Editor to collect metadata from jsdoc annotated users scripts. This allows special `@attribute` members which can surface contextual data about class members.

## A quick examples

It takes a script like this...

Expand All @@ -22,7 +26,7 @@ class Rotator extends ScriptType {
}
```

and turns it into this...
and turns it into the following data ...


```json
Expand Down Expand Up @@ -53,7 +57,7 @@ and turns it into this...
}
```

It takes the JSDocs and values and outputs the metadata in a serializable format.
JSDocs tags are parsed and values and outputs the metadata in a serializable format.

### Usage

Expand All @@ -65,12 +69,20 @@ await parser.init();
// fetch your program source {[filename: string, contents: string][]}
const scripts = await fetchScripts([...paths, './playcanvas.d.ts']);

// update the progam
parser.updateProgram(scripts)

// Parse the program, starting from the first path
const [attribute, errors] parser.parseAttributes(paths[0], scripts);
const [attribute, errors] parser.parseAttributes("./index.js");
```

### Attribute structure

You can learn more about the special tags [available here ](https://github.com/playcanvas/attribute-parser/tree/main/test/fixtures)


### Tests

We provide good coverage


0 comments on commit 7292596

Please sign in to comment.