diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 23c96d7..06764cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,27 +5,42 @@ on: permissions: contents: read jobs: - test: - name: Node.js ${{ matrix.node-version }} + test-node: + name: Node.js (${{ matrix.node-version }}) runs-on: ubuntu-latest strategy: matrix: node-version: - "16" - - "*" + - "latest" steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - - uses: actions/cache@v2 + - uses: oven-sh/setup-bun@v2 with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- - - run: npm ci - - run: npm test - - uses: codecov/codecov-action@v1 + bun-version: "1.2.0" + - run: bun install + - run: bun run test # runs tests with Vitest + - uses: codecov/codecov-action@v5 with: - name: Node.js ${{ matrix.node-version }} + name: Node.js (${{ matrix.node-version }}) + test-bun: + name: Bun (${{ matrix.bun-version }}) + runs-on: ubuntu-latest + strategy: + matrix: + bun-version: + - "1.2.0" + - "latest" + steps: + - uses: actions/checkout@v4 + - uses: oven-sh/setup-bun@v2 + with: + bun-version: ${{ matrix.bun-version }} + - run: bun install + - run: bun run test:bun # runs tests with Bun + - uses: codecov/codecov-action@v5 + with: + name: Bun (${{ matrix.bun-version }}) diff --git a/Readme.md b/Readme.md index 321c057..7eb35aa 100644 --- a/Readme.md +++ b/Readme.md @@ -10,8 +10,12 @@ ## Installation -``` -npm install path-to-regexp --save +Install with your choice of package manager: npm, yarn, or bun. + +```sh +npm install path-to-regexp +yarn add path-to-regexp +bun add path-to-regexp ``` ## Usage @@ -26,6 +30,8 @@ const { } = require("path-to-regexp"); ``` +This library is compatible and tested with Node.js 16+ and Bun 1.2+. + ### Parameters Parameters match arbitrary strings in a path by matching up to the end of the segment, or up to any proceeding tokens. They are defined by prefixing a colon to the parameter name (`:foo`). Parameter names can use any valid JavaScript identifier, or be double quoted to use other characters (`:"param-name"`). diff --git a/bunfig.toml b/bunfig.toml new file mode 100644 index 0000000..a581a2b --- /dev/null +++ b/bunfig.toml @@ -0,0 +1,3 @@ +[test] +coverage = true +coverageReporter = ["text", "lcov"] diff --git a/package.json b/package.json index d4b35ca..7e2ef08 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,8 @@ "prepare": "ts-scripts install && npm run build", "size": "size-limit", "specs": "ts-scripts specs", - "test": "ts-scripts test && npm run size" + "test": "ts-scripts test && npm run size", + "test:bun": "bun test && bun run size" }, "devDependencies": { "@borderless/ts-scripts": "^0.15.0",