Skip to content
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

Examples #7

Merged
merged 2 commits into from
Aug 31, 2023
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
7 changes: 4 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"BASE_IMG": "mcr.microsoft.com/devcontainers/typescript-node:0-18-bullseye"
}
},
"postCreateCommand": "sudo chown node:node reference-lib/node_modules",
"postCreateCommand": "sudo find . -name node_modules -exec chown node:node {} \\;",
"remoteUser": "node",
"customizations": {
"vscode": {
Expand All @@ -24,7 +24,7 @@
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"editor.formatOnSave": true,
"[typescript][json][jsonc][yaml][markdown][javascript]": {
"[typescript][typescriptreact][json][jsonc][yaml][markdown][javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll": true
Expand All @@ -39,6 +39,7 @@
},
"mounts": [
// keep node_modules in the container for speed on macos/windows
"source=${localWorkspaceFolderBasename}-reference-lib-node_modules,target=${containerWorkspaceFolder}/reference-lib/node_modules,type=volume"
"source=${localWorkspaceFolderBasename}-reference-lib-node_modules,target=${containerWorkspaceFolder}/reference-lib/node_modules,type=volume",
"source=${localWorkspaceFolderBasename}-examples-ref-browser-node_modules,target=${containerWorkspaceFolder}/examples/ref-browser/node_modules,type=volume"
]
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The repository is organized as follows:
- `reference-lib/`: This directory contains an npm package that allows for easy lookup of nginx directives
- `reference-converter/`: This directory contains a program that converts the official NGINX reference documentation from XML format to JSON.
- `tools/`: This directory contains development tools
- `examples/`: This directory contains example usage of the `reference-lib`

## Contributing

Expand Down
3 changes: 3 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# examples

These applications demonstrate potential uses of the `reference-lib`.
18 changes: 18 additions & 0 deletions examples/ref-browser/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
24 changes: 24 additions & 0 deletions examples/ref-browser/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
9 changes: 9 additions & 0 deletions examples/ref-browser/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# ref-browser

Small website to search and browse NGINX directives. This is useful for testing changes to the reference converter.

## Getting Started

- in `reference-lib`, run `npm run build` - this codebase links to that one
- `npm ci` to install dependencies
- `npn run dev` starts a local server
12 changes: 12 additions & 0 deletions examples/ref-browser/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>NGINX directive browser</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading