-
Notifications
You must be signed in to change notification settings - Fork 0
Initial commit. #1
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
Changes from 2 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
07208b6
Initial commit.
BigBlueHat baff14f
Fully license using REUSEv3 spec.
BigBlueHat 9634412
Apply suggestions from code review
BigBlueHat 3b2ad1f
Upgrade eslint; reconfig; tweak code.
BigBlueHat 2743dd1
Unignore package-lock.json.
BigBlueHat 7c8d525
Upgrade all the things to latest.
BigBlueHat 4cd13a4
Fix URL alteration bug.
BigBlueHat afa394d
Add linting action.
BigBlueHat 593abec
Add previous/next icons to header nav.
BigBlueHat 3419848
Convert to TOML for Reuse.
BigBlueHat 112546e
Release v0.1.0.
BigBlueHat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # EditorConfig is awesome: https://EditorConfig.org | ||
|
|
||
| # top-most EditorConfig file | ||
| root = true | ||
|
|
||
| # Unix-style newlines with a newline ending every file | ||
| [*] | ||
| end_of_line = lf | ||
| insert_final_newline = true | ||
| trim_trailing_whitespace = true | ||
| indent_style = space | ||
| indent_size = 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| module.exports = { | ||
| root: true, | ||
| parserOptions: { | ||
| // this is required for dynamic import() and top-level await | ||
| ecmaVersion: 2022, | ||
| sourceType: 'module' | ||
| }, | ||
| env: { | ||
| node: true | ||
| }, | ||
| extends: [ | ||
| 'digitalbazaar' | ||
| ], | ||
| ignorePatterns: ['node_modules/'] | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,130 +1,3 @@ | ||
| # Logs | ||
| logs | ||
| *.log | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
| lerna-debug.log* | ||
| .pnpm-debug.log* | ||
|
|
||
| # Diagnostic reports (https://nodejs.org/api/report.html) | ||
| report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
|
||
| # Runtime data | ||
| pids | ||
| *.pid | ||
| *.seed | ||
| *.pid.lock | ||
|
|
||
| # Directory for instrumented libs generated by jscoverage/JSCover | ||
| lib-cov | ||
|
|
||
| # Coverage directory used by tools like istanbul | ||
| coverage | ||
| *.lcov | ||
|
|
||
| # nyc test coverage | ||
| .nyc_output | ||
|
|
||
| # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
| .grunt | ||
|
|
||
| # Bower dependency directory (https://bower.io/) | ||
| bower_components | ||
|
|
||
| # node-waf configuration | ||
| .lock-wscript | ||
|
|
||
| # Compiled binary addons (https://nodejs.org/api/addons.html) | ||
| build/Release | ||
|
|
||
| # Dependency directories | ||
| node_modules/ | ||
| jspm_packages/ | ||
|
|
||
| # Snowpack dependency directory (https://snowpack.dev/) | ||
| web_modules/ | ||
|
|
||
| # TypeScript cache | ||
| *.tsbuildinfo | ||
|
|
||
| # Optional npm cache directory | ||
| .npm | ||
|
|
||
| # Optional eslint cache | ||
| .eslintcache | ||
|
|
||
| # Optional stylelint cache | ||
| .stylelintcache | ||
|
|
||
| # Microbundle cache | ||
| .rpt2_cache/ | ||
| .rts2_cache_cjs/ | ||
| .rts2_cache_es/ | ||
| .rts2_cache_umd/ | ||
|
|
||
| # Optional REPL history | ||
| .node_repl_history | ||
|
|
||
| # Output of 'npm pack' | ||
| *.tgz | ||
|
|
||
| # Yarn Integrity file | ||
| .yarn-integrity | ||
|
|
||
| # dotenv environment variable files | ||
| .env | ||
| .env.development.local | ||
| .env.test.local | ||
| .env.production.local | ||
| .env.local | ||
|
|
||
| # parcel-bundler cache (https://parceljs.org/) | ||
| .cache | ||
| .parcel-cache | ||
|
|
||
| # Next.js build output | ||
| .next | ||
| out | ||
|
|
||
| # Nuxt.js build / generate output | ||
| .nuxt | ||
| dist | ||
|
|
||
| # Gatsby files | ||
| .cache/ | ||
| # Comment in the public line in if your project uses Gatsby and not Next.js | ||
| # https://nextjs.org/blog/next-9-1#public-directory-support | ||
| # public | ||
|
|
||
| # vuepress build output | ||
| .vuepress/dist | ||
|
|
||
| # vuepress v2.x temp and cache directory | ||
| .temp | ||
| .cache | ||
|
|
||
| # Docusaurus cache and generated files | ||
| .docusaurus | ||
|
|
||
| # Serverless directories | ||
| .serverless/ | ||
|
|
||
| # FuseBox cache | ||
| .fusebox/ | ||
|
|
||
| # DynamoDB Local files | ||
| .dynamodb/ | ||
|
|
||
| # TernJS port file | ||
| .tern-port | ||
|
|
||
| # Stores VSCode versions used for testing VSCode extensions | ||
| .vscode-test | ||
|
|
||
| # yarn v2 | ||
| .yarn/cache | ||
| .yarn/unplugged | ||
| .yarn/build-state.yml | ||
| .yarn/install-state.gz | ||
| .pnp.* | ||
| node_modules/ | ||
| package-lock.json | ||
BigBlueHat marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ | ||
| Upstream-Contact: Digital Bazaar, Inc. <support@digitalbazaar.com> | ||
|
|
||
| Files: *.md .editorconfig .eslintrc.cjs .gitignore package.json | ||
| Copyright: 2012-2024 Digital Bazaar, Inc. | ||
| License: BSD-3-Clause |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| Copyright (c) <year> <owner>. | ||
|
|
||
| Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
|
||
| 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
|
||
| 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
|
||
| 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | ||
|
|
||
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,15 @@ | ||
| # w3c-api-browser | ||
| # w3c-api-browser | ||
|
|
||
| Browse the [W3C API](https://api.w3.org/doc) in your browser! | ||
|
|
||
| ## Usage | ||
|
|
||
| ```sh | ||
| $ npm i | ||
| $ npm run server | ||
BigBlueHat marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| $ # Listening on http://localhost:8080 | ||
BigBlueHat marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
| ## License | ||
|
|
||
| [BSD-3-Clause](LICENSE) Copyright 2024 Digital Bazaar, Inc. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| /*! | ||
| * Copyright 2024 Digital Bazaar, Inc. | ||
| * | ||
| * SPDX-License-Identifier: BSD-3-Clause | ||
| */ | ||
| import EleventyFetch from '@11ty/eleventy-fetch'; | ||
|
|
||
| const apiBaseUrl = 'https://api.w3.org'; | ||
|
|
||
| // TODO: support more editors via configuration or commandline argument | ||
| // Manu Sporny's W3C ID | ||
| const editorId = 'hhvask30a7co0gs0gcsgosgkowws0k4'; | ||
|
|
||
| const specs = await EleventyFetch( | ||
| // eslint-disable-next-line max-len | ||
| `${apiBaseUrl}/users/${editorId}/specifications?embed=true`, | ||
| { | ||
| duration: '1d', | ||
| type: 'json' | ||
| }); | ||
| const {specifications} = specs._embedded; | ||
|
|
||
| let csv = `"${['Title', 'First Date', 'Latest Date', 'Latest Status', | ||
| 'Series Version', 'Short Link', 'Editors'].join('","')}"\n`; | ||
| const rows = await Promise.all(specifications.map(async spec => { | ||
| // gather editor info | ||
| const rv = await EleventyFetch( | ||
| `${spec._links['latest-version'].href}/editors?embed=true`, | ||
| { | ||
| duration: '1d', | ||
| type: 'json' | ||
| }); | ||
| const editors = rv?._embedded?.editors || []; | ||
| const row = []; | ||
| row.push( | ||
| spec.title, | ||
| spec._links['first-version'].href.split('/').at(-1) | ||
| .replace(/([0-9]{4})([0-9]{2})([0-9]{2})/, '$1-$2-$3'), | ||
| spec._links['latest-version'].href.split('/').at(-1) | ||
| .replace(/([0-9]{4})([0-9]{2})([0-9]{2})/, '$1-$2-$3'), | ||
| spec._links['latest-version'].title, | ||
| spec['series-version'], | ||
| spec.shortlink, | ||
| editors.map(editor => editor.name).join(', ') | ||
| ); | ||
| return `"${row.join('","')}"`; | ||
| })); | ||
| csv += rows.join('\n'); | ||
| console.log(csv); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| /*! | ||
| * Copyright 2024 Digital Bazaar, Inc. | ||
| * | ||
| * SPDX-License-Identifier: BSD-3-Clause | ||
| */ | ||
| import {Application} from '@curveball/core'; | ||
| import browser from '@curveball/browser'; | ||
|
|
||
| // MUST not end in a trailing slash and will be stripped in response bodies for | ||
| // to facilitate local browsing. | ||
| const apiBaseUrl = 'https://api.w3.org'; | ||
| const title = 'W3C API'; | ||
|
|
||
| // port for this browser app to listen on | ||
| const port = 8080; | ||
|
|
||
| const app = new Application(); | ||
| app.use(browser({title})); | ||
| app.use(async ctx => { | ||
| console.dir(ctx.request.requestTarget); | ||
| if(ctx.request.requestTarget === '/') { | ||
| // adding a home page response with some navigation | ||
| ctx.response.body = { | ||
| _links: { | ||
| groups: { | ||
| href: '/groups', | ||
| title: 'List Groups' | ||
| }, | ||
| specifications: { | ||
| href: '/specifications', | ||
| title: 'List Specifications' | ||
| }, | ||
| 'code-repository': { | ||
| href: 'https://github.com/digitalbazaar/w3c-api-browser' | ||
| }, | ||
| alternate: [ | ||
| { | ||
| href: 'https://api.w3.org/doc', | ||
| type: 'text/html', | ||
| title: 'W3C API Docs' | ||
| }, | ||
| { | ||
| href: 'https://api.w3.org/doc.json', | ||
| type: 'application/json', | ||
| title: 'W3C API Swagger' | ||
| } | ||
| ] | ||
| } | ||
| }; | ||
| } else { | ||
| const resp = await fetch( | ||
| `${apiBaseUrl}${ctx.request.requestTarget}?embed=true`, { | ||
| headers: { | ||
| Accept: 'application/json' | ||
| } | ||
| } | ||
| ); | ||
| const rv = await resp.json(); | ||
| const localhosted = JSON.stringify(rv).replaceAll(apiBaseUrl, ''); | ||
| ctx.response.body = localhosted; | ||
| ctx.response.type = 'application/hal+json'; | ||
| } | ||
| }); | ||
| app.listen(port); | ||
| console.log(`Listening on http://localhost:${port}`); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| { | ||
| "name": "w3c-api-browser", | ||
| "version": "0.0.0", | ||
| "description": "Browse the W3C API (HAL) output.", | ||
| "type": "module", | ||
| "main": "index.js", | ||
| "scripts": { | ||
| "serve": "node index.js", | ||
BigBlueHat marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "test": "echo \"Error: no test specified\" && exit 1", | ||
| "lint": "eslint \"**/*.{js,cjs}\"" | ||
BigBlueHat marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }, | ||
| "keywords": [ | ||
| "w3c", | ||
| "api", | ||
| "hal" | ||
| ], | ||
| "author": "Digital Bazaar, Inc.", | ||
| "license": "BSD-3-Clause", | ||
| "dependencies": { | ||
| "@11ty/eleventy-fetch": "^4.0.1", | ||
| "@curveball/browser": "^1.1.1", | ||
| "@curveball/core": "^1.0.0", | ||
| "@curveball/validator": "^1.0.0", | ||
| "eslint": "^8.45.0", | ||
| "eslint-config-digitalbazaar": "^5.0.1" | ||
BigBlueHat marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.