diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..82133fe --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +# https://editorconfig.org/ + +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{cjs,js,json,jsonld,mjs,yaml,yml}] +indent_style = space +indent_size = 2 diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index a941733..0000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,15 +0,0 @@ -module.exports = { - root: true, - env: { - node: true - }, - extends: [ - 'digitalbazaar', - 'digitalbazaar/jsdoc', - 'digitalbazaar/module' - ], - ignorePatterns: ['node_modules/'], - rules: { - 'unicorn/prefer-node-protocol': 'error' - } -}; diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 2205bb0..e066cc1 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -1,34 +1,39 @@ -name: Bedrock Node.js CI +name: Main CI on: [push] +permissions: {} + jobs: lint: runs-on: ubuntu-latest timeout-minutes: 10 strategy: matrix: - node-version: [22.x] + node-version: [24.x] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 + with: + persist-credentials: false - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: node-version: ${{ matrix.node-version }} - run: npm install - name: Run eslint run: npm run lint test-node: - needs: [lint] runs-on: ubuntu-latest timeout-minutes: 10 strategy: matrix: - node-version: [20.x, 22.x] + node-version: [20.x, 22.x, 24.x] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 + with: + persist-credentials: false - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: node-version: ${{ matrix.node-version }} - run: | @@ -39,16 +44,17 @@ jobs: cd test npm test coverage: - needs: [test-node] runs-on: ubuntu-latest timeout-minutes: 10 strategy: matrix: - node-version: [22.x] + node-version: [24.x] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 + with: + persist-credentials: false - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: node-version: ${{ matrix.node-version }} - run: | diff --git a/.gitignore b/.gitignore index 8c61364..bfcb0e6 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,4 @@ TAGS coverage node_modules reports -package-lock.json \ No newline at end of file +package-lock.json diff --git a/.npmrc b/.npmrc index e9ee3cb..521a9f7 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1 @@ -legacy-peer-deps=true \ No newline at end of file +legacy-peer-deps=true diff --git a/LICENSE.md b/LICENSE.md index 91c3522..9ce42bc 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,8 +1,7 @@ Bedrock Non-Commercial License v1.0 =================================== -Copyright (c) 2011-2021 Digital Bazaar, Inc. -All rights reserved. +Copyright (c) 2011-2026 Digital Bazaar, Inc. Summary ======= diff --git a/README.md b/README.md index 6af8cc8..1638c31 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,10 @@ TBD ## Install -- Node.js 20+ is required. +This software requires and supports maintained recent versions of Node.js. +Updates may remove support for older unmaintained platform versions. Please use +dependency version lock files and testing to ensure compatibility with this +software. ### NPM @@ -51,11 +54,11 @@ Describe configuration, usage. ## Contribute -See [the contribute file](https://github.com/digitalbazaar/bedrock/blob/master/CONTRIBUTING.md)! +See [the contributing file](https://github.com/digitalbazaar/bedrock/blob/master/CONTRIBUTING.md). PRs accepted. -If editing the Readme, please conform to the +If editing README.md, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification. ## Commercial Support diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..1ea616b --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,16 @@ +import config from '@digitalbazaar/eslint-config/node-recommended'; + +export default [ + ...config, + { + files: [ + 'test/mocha/**/*.js' + ], + languageOptions: { + globals: { + // @bedrock/test global + assertNoError: true + } + } + } +]; diff --git a/lib/config.js b/lib/config.js index 2791170..d116af4 100644 --- a/lib/config.js +++ b/lib/config.js @@ -1,5 +1,5 @@ /*! - * Copyright (c) 2025 Digital Bazaar, Inc. All rights reserved. + * Copyright (c) 2026 Digital Bazaar, Inc. */ import * as bedrock from '@bedrock/core'; const {config} = bedrock; diff --git a/lib/http.js b/lib/http.js index adca06a..7195c55 100644 --- a/lib/http.js +++ b/lib/http.js @@ -1,10 +1,10 @@ /*! - * Copyright (c) 2025 Digital Bazaar, Inc. All rights reserved. + * Copyright (c) 2026 Digital Bazaar, Inc. */ import * as bedrock from '@bedrock/core'; import {asyncHandler} from '@bedrock/express'; -import {example} from '../schemas/bedrock-template.js'; import {namespace} from './config.js'; +import {postExample} from '../schemas/bedrock-template.js'; import {createValidateMiddleware as validate} from '@bedrock/validation'; const {util: {BedrockError}} = bedrock; @@ -15,7 +15,7 @@ bedrock.events.on('bedrock-express.configure.routes', app => { app.post( routes.basePath, - validate({bodySchema: example}), + validate({bodySchema: postExample()}), asyncHandler(async (/*req, res*/) => { throw new BedrockError( 'Not implemented.', { diff --git a/lib/index.js b/lib/index.js index bcfaf5e..0d0106a 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,5 +1,5 @@ /*! - * Copyright (c) 2025 Digital Bazaar, Inc. All rights reserved. + * Copyright (c) 2026 Digital Bazaar, Inc. */ import '@bedrock/express'; diff --git a/lib/logger.js b/lib/logger.js index 1abd08c..2b069be 100644 --- a/lib/logger.js +++ b/lib/logger.js @@ -1,5 +1,5 @@ /*! - * Copyright (c) 2025 Digital Bazaar, Inc. All rights reserved. + * Copyright (c) 2026 Digital Bazaar, Inc. */ import {loggers} from '@bedrock/core'; import {namespace} from './config.js'; diff --git a/package.json b/package.json index 401e6f4..774661a 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "schemas/**/*.js" ], "scripts": { + "test": "cd test && npm run test", "lint": "eslint ." }, "repository": { @@ -29,17 +30,15 @@ "homepage": "https://github.com/digitalbazaar/bedrock-module-template-http", "peerDependencies": { "@bedrock/core": "^6.3.0", - "@bedrock/express": "^8.3.2", + "@bedrock/express": "^8.6.0", "@bedrock/validation": "^7.1.1" }, "directories": { "lib": "./lib" }, "devDependencies": { - "eslint": "^8.57.1", - "eslint-config-digitalbazaar": "^5.2.0", - "eslint-plugin-jsdoc": "^51.4.1", - "eslint-plugin-unicorn": "^56.0.1" + "@digitalbazaar/eslint-config": "^8.0.1", + "eslint": "^9.39.4" }, "engines": { "node": ">=20" diff --git a/schemas/bedrock-template.js b/schemas/bedrock-template.js index 39b661a..68706c4 100644 --- a/schemas/bedrock-template.js +++ b/schemas/bedrock-template.js @@ -1,14 +1,16 @@ /*! - * Copyright (c) 2025 Digital Bazaar, Inc. All rights reserved. + * Copyright (c) 2026 Digital Bazaar, Inc. */ import {schemas} from '@bedrock/validation'; -export const example = { - title: 'Example', - type: 'object', - required: ['id'], - additionalProperties: false, - properties: { - id: schemas.identifier() - } -}; +export function postExample() { + return { + title: 'Post Example', + type: 'object', + required: ['id'], + additionalProperties: false, + properties: { + id: schemas.identifier() + } + }; +} diff --git a/test/mocha/.eslintrc.cjs b/test/mocha/.eslintrc.cjs deleted file mode 100644 index b679b05..0000000 --- a/test/mocha/.eslintrc.cjs +++ /dev/null @@ -1,9 +0,0 @@ -module.exports = { - env: { - mocha: true - }, - globals: { - assertNoError: true, - should: true - } -} \ No newline at end of file diff --git a/test/mocha/10-api.js b/test/mocha/10-api.js index 8735aae..d2ca2da 100644 --- a/test/mocha/10-api.js +++ b/test/mocha/10-api.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 Digital Bazaar, Inc. All rights reserved. + * Copyright (c) 2026 Digital Bazaar, Inc. */ describe('api', () => { it('should work'); diff --git a/test/package.json b/test/package.json index 6ea7fb7..b4999b1 100644 --- a/test/package.json +++ b/test/package.json @@ -11,14 +11,14 @@ }, "dependencies": { "@bedrock/core": "^6.3.0", - "@bedrock/express": "^8.3.2", + "@bedrock/express": "^8.6.0", "@bedrock/https-agent": "^4.1.0", "@bedrock/module-template-http": "file:..", "@bedrock/server": "^5.1.0", - "@bedrock/test": "^8.2.0", + "@bedrock/test": "^9.0.0", "@bedrock/validation": "^7.1.1", - "c8": "^10.1.3", - "cross-env": "^7.0.3" + "c8": "^11.0.0", + "cross-env": "^10.1.0" }, "c8": { "excludeNodeModules": false, diff --git a/test/test.config.js b/test/test.config.js index d871495..b94f321 100644 --- a/test/test.config.js +++ b/test/test.config.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 Digital Bazaar, Inc. All rights reserved.. + * Copyright (c) 2026 Digital Bazaar, Inc. */ import {config} from '@bedrock/core'; import path from 'node:path'; diff --git a/test/test.js b/test/test.js index 1c8ac8e..01c5c31 100644 --- a/test/test.js +++ b/test/test.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 Digital Bazaar, Inc. All rights reserved. + * Copyright (c) 2026 Digital Bazaar, Inc. */ import * as bedrock from '@bedrock/core'; import '@bedrock/https-agent';