Skip to content

some cleanup in prep for open sourcing #196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/autocomplete/highlight.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getDirectives, Directive } from '@nginxinc/reference-lib'
import { getDirectives, Directive } from '@nginx/reference-lib'

/** kinds of tokens used for highlighting */
type token =
Expand Down
2 changes: 1 addition & 1 deletion examples/autocomplete/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getDirectives, Format, Directive } from '@nginxinc/reference-lib'
import { getDirectives, Format, Directive } from '@nginx/reference-lib'
type autocomplete = {
/** name of the NGINX module */
m: string
Expand Down
10 changes: 5 additions & 5 deletions examples/autocomplete/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/autocomplete/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"highlight": "mkdir -p dist && node --loader=ts-node/esm highlight.ts > dist/highlight.ts"
},
"dependencies": {
"@nginxinc/reference-lib": "file:../../reference-lib",
"@nginx/reference-lib": "file:../../reference-lib",
"@types/node": "^20.14.0",
"ts-node": "^10.9.2",
"typescript": "^5.4.5"
Expand Down
10 changes: 5 additions & 5 deletions examples/ref-browser/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/ref-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"preview": "vite preview"
},
"dependencies": {
"@nginxinc/reference-lib": "file:../../reference-lib",
"@nginx/reference-lib": "file:../../reference-lib",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.23.1"
Expand Down
2 changes: 1 addition & 1 deletion examples/ref-browser/src/Description.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from 'react'
import { Format, find } from '@nginxinc/reference-lib'
import { Format, find } from '@nginx/reference-lib'

type DescriptionProps = {
module: string
Expand Down
2 changes: 1 addition & 1 deletion examples/ref-browser/src/Directive.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Format, getDirectives } from '@nginxinc/reference-lib'
import { Format, getDirectives } from '@nginx/reference-lib'
import Description from './Description'

type Dir = {
Expand Down
2 changes: 1 addition & 1 deletion examples/ref-browser/src/Tree.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use client'
import { getDirectives } from '@nginxinc/reference-lib'
import { getDirectives } from '@nginx/reference-lib'
import { useCallback, useState } from 'react'
import { SearchBox } from './SearchBox'
import { Link } from 'react-router-dom'
Expand Down
46 changes: 19 additions & 27 deletions reference-lib/README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
# Reference Library
NGINX directive reference in Markdown and HTML format

# Installation

1. Generate a github personal access token with read:packages permission
2. Create a ~/.npmrc file with the following content
```
@nginxinc:registry=http://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=$TOKEN
```
3. Run
```bash
npm install --save @nginxinc/[email protected]
```

# Usage
1. find
```javascript
import { find, Format } from '@nginxinc/reference-lib'
const content = find('listen', undefined, Format.HTML)
```

2. getDirectives
```javascript
import { getDirectives, Format } from '@nginxinc/reference-lib'
const directive = getDirectives(Format.HTML)
```

Machine-readable NGINX directive documentation, with Markdown and HTML formats.

This library is generated from the official NGINX documentation, and intended for use in other tools that work with NGINX configuration files. This provides more accurate and up-to-date information than web scraping <https://nginx.org>.

Every time the NGINX documentation changes, this library will be updated and published with a new version number.

## Installation

`npm install --save @nginx/reference-lib`

## Usage

We export two functions (with type definitions) to navigate the documentation:

1. `getDirectives` returns a flat list of all directives in any official module
2. `find` returns a specific directive by name

See [examples](./examples) for more usage.
4 changes: 2 additions & 2 deletions reference-lib/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion reference-lib/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@nginxinc/reference-lib",
"name": "@nginx/reference-lib",
"version": "1.0.14",
"description": "",
"main": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion reference-lib/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ export default {
output: {
file: 'dist/index.js',
},
plugins: [json(), typescript()],
plugins: [json(), typescript({ outputToFilesystem: true })],
}