Skip to content

Commit

Permalink
fix: forgot publish licence (#531)
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode authored Sep 20, 2024
1 parent bb8268e commit 3c3c2a9
Show file tree
Hide file tree
Showing 15 changed files with 923 additions and 632 deletions.
31 changes: 0 additions & 31 deletions .github/workflows/announce.yml

This file was deleted.

16 changes: 0 additions & 16 deletions .github/workflows/auto-author-assign.yml

This file was deleted.

14 changes: 0 additions & 14 deletions .github/workflows/auto-label.yml

This file was deleted.

11 changes: 0 additions & 11 deletions .github/workflows/auto-remove-label.yml

This file was deleted.

26 changes: 24 additions & 2 deletions .github/workflows/auto-approve.yml → .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 🤖 Auto approve validation
name: 🤖 PR validation
on: pull_request

env:
Expand Down Expand Up @@ -41,6 +41,28 @@ jobs:
with:
token: ${{ secrets.TAIGA_FAMILY_BOT_PAT }}

label-when-approved:
name: Label when approved
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.7
- uses: taiga-family/ci/actions/setup/variables@v1.80.0
- uses: taiga-family/ci/actions/auto/label-when-approved@v1.80.0
with:
approvals: 1
token: ${{ secrets.GITHUB_TOKEN }}

assign-author:
name: PR author as an assignee
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.7
- uses: taiga-family/ci/actions/setup/variables@v1.80.0
- uses: toshimaru/auto-author-assign@v2.1.1
if: env.IS_OWNER_MODE == 'true'
with:
repo-token: ${{ secrets.TAIGA_FAMILY_BOT_PAT }}

concurrency:
group: auto-approve-${{ github.head_ref }}
group: pr-${{ github.head_ref }}
cancel-in-progress: true
31 changes: 19 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,14 @@ on:
- projects/ng-dompurify/**
workflow_dispatch:
inputs:
forcePush:
type: boolean
required: false
description: --force-publish package
mode:
type: choice
description: force package to be versioned (depend --force-publish)
required: false
default: minor
description: Bump version as requested
required: true
options:
- patch
- minor
- patch
- major
- prepatch

jobs:
release:
Expand All @@ -31,10 +25,23 @@ jobs:
- uses: taiga-family/ci/actions/run/release-it@v1.80.0
with:
ref: ${{ github.ref }}
githubToken: ${{ secrets.TAIGA_FAMILY_BOT_PAT }}
npmToken: ${{ secrets.TAIGA_UI_SCOPE_NPM_TOKEN }}
forcePush: ${{ github.event.inputs.forcePush }}
mode: ${{ github.event.inputs.mode }}
npmToken: ${{ secrets.NPM_TOKEN }}
githubToken: ${{ secrets.TAIGA_FAMILY_BOT_PAT }}

- id: info
run: |
echo "version=v$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
echo "name=$(node -p "require('./package.json').name")" >> $GITHUB_OUTPUT
- name: Announce to Telegram
uses: taiga-family/ci/actions/messenger/telegram/announce@v1.80.0
with:
chatId: ${{ secrets.TAIGA_TELEGRAM_CHAT_ID }}
topicId: ${{ secrets.TAIGA_TELEGRAM_CHAT_THREAD_ID }}
token: ${{ secrets.TAIGA_TELEGRAM_BOT_TOKEN }}
version: ${{ steps.info.outputs.version }}
textLink: ${{ steps.info.outputs.name }}

concurrency:
group: release-${{ github.workflow }}-${{ github.ref }}
Expand Down
1 change: 1 addition & 0 deletions .release-it.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('@taiga-ui/release-it-config');
29 changes: 0 additions & 29 deletions .release-it.json

This file was deleted.

179 changes: 179 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,185 @@

[![npm bundle size](https://img.shields.io/bundlephobia/minzip/@taiga-ui/dompurify)](https://bundlephobia.com/result?p=@taiga-ui/dompurify)
[![npm version](https://img.shields.io/npm/v/@taiga-ui/dompurify.svg?style=flat-square)](https://npmjs.com/package/@taiga-ui/dompurify)
[![code style: @tinkoff/linters](https://img.shields.io/badge/code%20style-%40tinkoff%2Flinters-blue?style=flat-square)](https://github.com/taiga-family/linters)

> This library implements `DOMPurify` as Angular `Sanitizer` or `Pipe`. It delegates sanitizing to `DOMPurify` and
> supports the same configuration. See [DOMPurify](https://github.com/cure53/DOMPurify).
Read more about Sanitization in Angular and how ng-dompurify works in
[this article](https://medium.com/angular-in-depth/warning-sanitizing-html-stripped-some-content-and-how-to-deal-with-it-properly-10ff77012d5a).

## Install

```
npm install @taiga-ui/dompurify
```

If you do not have `dompurify` in your package, install also:

```
npm install dompurify
npm install --save-dev @types/dompurify
```

## How to use

Either use pipe to sanitize your content when binding to `[innerHTML]` or use `NgDompurifySanitizer` service manually.

```typescript
import {NgDompurifyModule} from '@taiga-ui/dompurify';

@NgModule({
imports: [NgDompurifyModule],
})
export class MyModule {}
```

As a pipe:

```html
<div [innerHtml]="value | dompurify"></div>
```

As a service:

```typescript
import {SecurityContext} from '@angular/core';
import {NgDompurifySanitizer} from '@taiga-ui/dompurify';

@Component({})
export class MyComponent {
constructor(private readonly dompurifySanitizer: NgDompurifySanitizer) {}

purify(value: string): string {
return this.dompurifySanitizer.sanitize(SecurityContext.HTML, value);
}
}
```

You can also substitute Angular `Sanitizer` with `DOMPurify` so it is automatically used all the time:

```typescript
import {NgModule, Sanitizer} from '@angular/core';
import {NgDompurifySanitizer} from '@taiga-ui/dompurify';
// ...

@NgModule({
// ...
providers: [
{
provide: Sanitizer,
useClass: NgDompurifySanitizer,
},
],
// ...
})
export class AppModule {}
```

## Configuring

Config for `NgDompurifySanitizer` or `NgDompurifyDomSanitizer` can be provided using token `DOMPURIFY_CONFIG`.
`NgDompurifyPipe` supports passing DOMPurify config as an argument to override config from DI.

```typescript
import {NgModule, Sanitizer} from '@angular/core';
import {NgDompurifySanitizer, DOMPURIFY_CONFIG} from '@taiga-ui/dompurify';
// ...

@NgModule({
// ...
providers: [
{
provide: Sanitizer,
useClass: NgDompurifySanitizer,
},
{
provide: DOMPURIFY_CONFIG,
useValue: {FORBID_ATTR: ['id']},
},
],
// ...
})
export class AppModule {}
```

## CSS sanitization

DOMPurify does not support sanitizing CSS. Angular starting version 10 dropped CSS sanitation as something that presents
no threat in supported browsers. You can still provide a handler to sanitize CSS rules values upon binding if you want
to:

```typescript
import {NgModule, Sanitizer} from '@angular/core';
import {NgDompurifySanitizer, SANITIZE_STYLE} from '@taiga-ui/dompurify';

@NgModule({
// ...
providers: [
{
provide: Sanitizer,
useClass: NgDompurifySanitizer,
},
{
provide: SANITIZE_STYLE,
useValue: yourImplementation, // <---
},
],
// ...
})
export class AppModule {}
```

## Hooks

DOMPurify supports various hooks. You can provide them using `DOMPURIFY_HOOKS` token:

```typescript
import {NgModule, Sanitizer} from '@angular/core';
import {NgDompurifySanitizer, DOMPURIFY_HOOKS, SANITIZE_STYLE} from '@taiga-ui/dompurify';

@NgModule({
// ...
providers: [
{
provide: Sanitizer,
useClass: NgDompurifySanitizer,
},
{
provide: SANITIZE_STYLE,
useValue: yourImplementation,
},
{
provide: DOMPURIFY_HOOKS,
useValue: [
{
name: 'beforeSanitizeAttributes',
hook: (node: Element) => {
node.removeAttribute('id');
},
},
],
},
],
// ...
})
export class AppModule {}
```

## Maintained

**@taiga-ui/dompurify** is a part of [Taiga UI](https://github.com/taiga-family/taiga-ui) libraries family which is
backed and used by a large enterprise. This means you can rely on timely support and continuous development.

## License

🆓 Feel free to use our library in your commercial and private applications

All **@taiga-ui/dompurify** packages are covered by [Apache 2.0](/LICENSE)

Read more about this license [here](https://choosealicense.com/licenses/apache-2.0/)

## Demo

You can see live demo here: https://stackblitz.com/github/taiga-family/ng-dompurify/tree/master/projects/demo
Loading

0 comments on commit 3c3c2a9

Please sign in to comment.