Skip to content

Commit

Permalink
feat: add dsn-parser package (#468)
Browse files Browse the repository at this point in the history
* feat: add dsn-parser package

* ci: improve filtering

* feat: add dsn-parser package

* feat: add dsn-parser package

* feat: add dsn-parser package

* feat: add dsn-parser package
  • Loading branch information
belgattitude authored Jul 16, 2023
1 parent 71f7750 commit e78d112
Show file tree
Hide file tree
Showing 38 changed files with 1,722 additions and 139 deletions.
8 changes: 8 additions & 0 deletions .changeset/wet-keys-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@httpx/dsn-parser': minor
---

Add @httpx/dsn-parser package

Moving [@soluble/cache-interop](https://github.com/soluble-io/cache-interop/tree/main/packages/dsn-parser) to the
@httpx org.
2 changes: 2 additions & 0 deletions .github/scripts/download/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
18 changes: 18 additions & 0 deletions .github/scripts/install-codecov.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

VERSION=0.6.1
PLATFORM=linux
CODECOV_BINARY_URL=https://github.com/codecov/uploader/releases/download/v${VERSION}/codecov-${PLATFORM}
OUTPUT_DIR="$(cd $(dirname $0); pwd)/download"
CACHE_FILE="${OUTPUT_DIR}/codecov-${PLATFORM}-${VERSION}"

if [ ! -f "${CACHE_FILE}" ]; then
echo "Downloading codecov binary"
curl -L "${CODECOV_BINARY_URL}" -o "${CACHE_FILE}"
chmod +x "${CACHE_FILE}"
else
echo "Using cached codecov binary at version ${VERSION}"
fi

echo "Creating a symbolic link to codecov binary"
ln -s --force "${CACHE_FILE}" "${OUTPUT_DIR}/codecov"
28 changes: 13 additions & 15 deletions .github/workflows/ci-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,40 +47,38 @@ jobs:
${{ runner.os }}-packages-cache-${{ hashFiles('**/yarn.lock') }}-
- name: 🕵️ Typecheck
run: yarn workspaces foreach -tv --from '@httpx/*' --no-private run typecheck
run: yarn workspaces foreach -tv --from 'packages/*' --no-private run typecheck

- name: 🔬 ESLint checks
if: matrix.node-version == '18.x'
run: yarn workspaces foreach -tv --from '@httpx/*' --no-private run lint
run: yarn workspaces foreach -tv --from 'packages/*' --no-private run lint

- name: 🧪 Unit tests
run: yarn workspaces foreach -tv --include '@httpx/*' --no-private run test-unit --coverage
run: yarn workspaces foreach -tv --from 'packages/*' --no-private run test-unit --coverage

- name: 🏗 Build packages
run: yarn workspaces foreach -tv --include '@httpx/*' --no-private run build
run: yarn workspaces foreach -tv --from 'packages/*' --no-private run build

- name: 📐 Check build for size-limits
if: matrix.node-version == '18.x'
run: yarn workspaces foreach -tv --include '@httpx/*' --no-private run check-size
run: yarn workspaces foreach -tv --from 'packages/*' --no-private run check-size

- name: 🛟 Check build for ecmascript compliance
if: matrix.node-version == '18.x'
run: yarn workspaces foreach -tv --include '@httpx/*' --no-private run check-dist
run: yarn workspaces foreach -tv --from 'packages/*' --no-private run check-dist

- name: 🛟 Check publishable dist (publint)
if: matrix.node-version == '18.x'
run: yarn workspaces foreach -tv --include '@httpx/*' --no-private run check-pub
run: yarn workspaces foreach -tv --from 'packages/*' --no-private run check-pub

- name: ☂️ Codecov upload
working-directory: ${{ github.workspace }}
if: matrix.node-version == '18.x'
uses: codecov/codecov-action@v3
with:
directory: ./packages/exception/coverage
#files: ./packages/http-exception/coverage/clover.xml
flags: httpx-exception-unit
fail_ci_if_error: false
verbose: false
run: |
bash .github/scripts/install-codecov.sh
yarn g:ci-coverage-upload
shell: bash

- name: 📄 Check doc can be built
if: matrix.node-version == '18.x'
run: yarn workspaces foreach -tv --include '@httpx/*' --no-private run build-doc
run: yarn workspaces foreach -tv --from 'packages/*' --no-private run build-doc
42 changes: 42 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
coverage:
range: 60..100
round: down
precision: 2

flag_management:
default_rules:
carryforward: false
individual_flags:
- name: httpx-exception-unit
paths:
- packages/exception
statuses:
- type: project
target: 95%
threshold: 1%

- name: httpx-dsn-parser-unit
paths:
- packages/dsn-parser
statuses:
- type: project
target: 95%
threshold: 1%

ignore:
- '.yarn/**/*'
- '.husky/**/*'
- 'docs/**/*'
- 'examples/**/*'
- '**/dist/**/*'

github_checks: true

comment:
layout: 'reach, diff, flags, files'
behavior: default
require_changes: false
require_base: yes
require_head: yes
branches: null
show_carryforward_flags: true
5 changes: 5 additions & 0 deletions monorepo.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
"name": "🍂 example nextjs-app",
"path": "examples/nextjs-app"
},
{
"name": "📦 @httpx/dsn-parser",
"path": "packages/dsn-parser"
},
{
"name": "📦 @httpx/exception",
"path": "packages/exception"
Expand Down Expand Up @@ -38,6 +42,7 @@
// https://github.com/Microsoft/vscode-eslint#mono-repository-setup
"eslint.workingDirectories": [
"./examples/nextjs-app",
"./packages/dsn-parser",
"./packages/exception",
]
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"g:check-pub": "yarn workspaces foreach -ptv run check-pub",
"g:check-package-dist": "yarn workspaces foreach -ptv --include '@httpx/*' run check-dist",
"g:release": "yarn g:build-packages && yarn g:check-package-dist && yarn exec changeset publish",
"g:ci-coverage-upload": "yarn workspaces foreach -tv run ci-coverage-upload",
"clean:lint": "rimraf ./.cache/eslint",
"clean:global-cache": "rimraf ./.cache",
"deps:check": "npx npm-check-updates@latest --configFileName ncurc.yml --deep",
Expand All @@ -43,7 +44,7 @@
"syncpack:check": "syncpack lint-semver-ranges --types prod,dev --source \"package.json\" --source \"packages/*/package.json\"",
"syncpack:list": "syncpack list-semver-ranges --types prod,dev --source \"package.json\" --source \"packages/*/package.json\"",
"nuke:node_modules": "rimraf --glob '**/node_modules'",
"format": "prettier --config .prettierrc.js --cache --cache-location=\".cache/prettier/monorepo.prettiercache\" --ignore-path .prettierignore \"./*.{js,cjs,mjs,ts,mts,md,mdx,json}\" --write"
"prettier:format": "prettier --config .prettierrc.js --cache --cache-location=\".cache/prettier/monorepo.prettiercache\" --ignore-path .prettierignore \"**/*.{js,cjs,mjs,ts,mts,md,mdx,json}\" --write"
},
"workspaces": [
"examples/*",
Expand Down
6 changes: 6 additions & 0 deletions packages/dsn-parser/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dist
out
build
coverage
_release

40 changes: 40 additions & 0 deletions packages/dsn-parser/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* Specific eslint rules for this workspace, learn how to compose
* @link https://github.com/belgattitude/perso/tree/main/packages/eslint-config-bases
*/

// Workaround for https://github.com/eslint/eslint/issues/3458
require('@belgattitude/eslint-config-bases/patch/modern-module-resolution');

const {
getDefaultIgnorePatterns,
} = require('@belgattitude/eslint-config-bases/helpers');

module.exports = {
root: true,
parserOptions: {
tsconfigRootDir: __dirname,
project: 'tsconfig.json',
},
ignorePatterns: [
...getDefaultIgnorePatterns(),
'**/build',
'**/.cache',
'**/dist',
'**/_release',
'.cache',
'**/docs',
],
extends: [
'@belgattitude/eslint-config-bases/typescript',
'@belgattitude/eslint-config-bases/sonar',
'@belgattitude/eslint-config-bases/regexp',
'@belgattitude/eslint-config-bases/jest',
// Apply prettier and disable incompatible rules
'@belgattitude/eslint-config-bases/prettier-plugin',
],
rules: {
'sonarjs/cognitive-complexity': ['error', 17],
},
overrides: [],
};
37 changes: 37 additions & 0 deletions packages/dsn-parser/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# dependencies
node_modules
/.pnp
.pnp.js

# production output
/dist
/build
/out

# tests
/coverage
/.nyc_output

# editor
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# os
.DS_Store

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

7 changes: 7 additions & 0 deletions packages/dsn-parser/.size-limit.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = [
{
name: 'JS',
path: ['dist/index.mjs'],
limit: '1.39KB',
},
];
1 change: 1 addition & 0 deletions packages/dsn-parser/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# @httpx/dsn-parser
21 changes: 21 additions & 0 deletions packages/dsn-parser/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021-current Sébastien Vanvelthem

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit e78d112

Please sign in to comment.