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

Print slotted content within the assigned slot #2

Merged
merged 9 commits into from
Apr 4, 2024
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
22 changes: 14 additions & 8 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: yarn install --frozen-lockfile
- run: yarn lint
- run: yarn test
- run: yarn build
node-version: 20
- uses: pnpm/action-setup@v3
with:
version: 8
- run: pnpm install --frozen-lockfile
- run: pnpm lint
- run: pnpm test
- run: pnpm build

publish-npm:
needs: build
Expand All @@ -28,10 +31,13 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
registry-url: https://registry.npmjs.org/
scope: '@quatico'
- run: yarn install --frozen-lockfile
- run: yarn publish-npm
- uses: pnpm/action-setup@v3
with:
version: 8
- run: pnpm install --frozen-lockfile
- run: pnpm publish-npm
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
20
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ A markup serializer that renders the complete DOM structure, including shadow DO
Add the `@quatico/dom-serializer` as (dev-) dependency to your project

```sh
yarn add -D @quatico/dom-serializer
pnpm add -D @quatico/dom-serializer
```

## Jest Serializer
Expand Down Expand Up @@ -81,6 +81,7 @@ The class DomSerializer provides the following `RenderOptions` to customize the
- `shadow`: Boolean to enable/disable the rendering of shadow DOM contents; defaults to true.
- `shadowDepth`: Number of showRoots to be rendered; defaults to infinity.
- `shadowRoots`: Controls how shadow roots are rendered. Defaults to "declarative".
- `slottedContent`: Controls how slotted content is rendered. Show it as referenced child or copy to the slot element. Defaults to "ignore".

## Render a DOM structure as string

Expand Down
16 changes: 8 additions & 8 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ module.exports = {
collectCoverageFrom: ["./src/**/*.{ts,tsx}"],
coverageDirectory: "coverage",
coveragePathIgnorePatterns: ["index.ts"],
globals: {
"ts-jest": {
tsconfig: "./tsconfig.test.json",
},
},
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
preset: "ts-jest",
prettierPath: null,
testEnvironment: "jsdom",
testRegex: "src/.*(test|spec)\\.(jsx?|tsx?)$",
testURL: "http://localhost/",
testEnvironmentOptions: {
url: "http://localhost/",
},
transform: {
"^.+\\.(js|jsx|ts|tsx)$": "ts-jest",
"^.+\\.(js|jsx|ts|tsx)$": [
"ts-jest",
{ tsconfig: "./tsconfig.test.json", diagnostics: false, isolatedModules: true },
],
},
transformIgnorePatterns: ["node_modules"],
resetMocks: true,
Expand Down
52 changes: 29 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,35 +31,41 @@
"build": "tsc",
"watch": "tsc --watch",
"test": "jest --verbose --coverage",
"test:update-snapshots": "yarn test -u",
"test:update-snapshots": "pnpm test -u",
"test:watch": "jest --watch",
"dist": "cross-env-shell NODE_ENV=production \"yarn clean && yarn lint && yarn license:check && yarn test && yarn build\"",
"dist": "cross-env-shell NODE_ENV=production \"pnpm clean && pnpm lint && pnpm license:check && pnpm test && pnpm build\"",
"license:check": "license-check-and-add check -f license-config.json",
"license:add": "license-check-and-add add -f license-config.json",
"license:remove": "license-check-and-add remove -f license-config.json",
"prepublishOnly": "yarn dist",
"preinstall": "npx only-allow pnpm",
"prepublishOnly": "pnpm dist",
"publish-npm": "npm publish --access public"
},
"devDependencies": {
"@types/jest": "^27.4.1",
"@types/node": "16",
"@typescript-eslint/eslint-plugin": "^5.19.0",
"@typescript-eslint/parser": "^5.19.0",
"concurrently": "7.1.0",
"@types/jest": "^29.5.12",
"@types/node": "20.12.2",
"@typescript-eslint/eslint-plugin": "^7.5.0",
"@typescript-eslint/parser": "^7.5.0",
"concurrently": "8.2.2",
"cross-env": "7.0.3",
"eslint": "^8.13.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^26.1.4",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-testing-library": "^5.3.1",
"husky": "7.0.4",
"jest": "^27.3.1",
"license-check-and-add": "4.0.2",
"lint-staged": "12.3.8",
"prettier": "2.6.2",
"rimraf": "3.0.2",
"ts-jest": "^27.1.4",
"typescript": "^4.6.3"
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-testing-library": "^6.2.0",
"husky": "9.0.11",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"license-check-and-add": "4.0.5",
"lint-staged": "15.2.2",
"prettier": "3.2.5",
"rimraf": "5.0.5",
"ts-jest": "^29.1.2",
"typescript": "^5.4.3"
},
"engines": {
"node": ">=20",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jwloka wir supporten nicht nur >= Node 20, oder?

Weil so, generieren wir den Verwendern immer eine Warning: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#engines

Unless the user has set the [engine-strict config](https://docs.npmjs.com/cli/v10/using-npm/config#engine-strict) flag, this field is advisory only and will only produce warnings when your package is installed as a dependency.

"pnpm": ">=8"
}
}
}
Loading