diff --git a/README.md b/README.md index 3cfaeab..2c1ccfb 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,18 @@ A parser for robots.txt files. ## Installation _TODO_ + +## Usage + +Use the `parse` function to convert a robots.txt string into a parse tree. + +```ts +import { parse } from "robots-parser"; + +const res = await fetch("https://www.google.com/robots.txt"); +const robotsTxt = await res.text(); + +const parseTree = parse(robotsTxt); + +console.log(JSON.stringify(parseTree)); +``` diff --git a/package.json b/package.json index a2a33a1..0f5c50a 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "robots-parser", "version": "1.0.0", "type": "module", + "exports": "./index.ts", "description": "Parser for robots.txt", "scripts": { "build": "tsc", diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..bf89bd9 --- /dev/null +++ b/src/index.ts @@ -0,0 +1 @@ +export { parse } from "./parser.js";