Skip to content

Commit

Permalink
feat: first blood, should just work
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed Jul 27, 2022
1 parent c19fa56 commit 244858a
Show file tree
Hide file tree
Showing 22 changed files with 2,534 additions and 2,832 deletions.
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"changelog": [
"@changesets/changelog-github",
{
"repo": "un-ts/lib-boilerplate"
"repo": "un-ts/domiso"
}
],
"commit": false,
Expand Down
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ dist
lib
CHANGELOG.md
/pnpm-lock.yaml
!/.github
!/.*.cjs
9 changes: 9 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
{
"root": true,
"extends": "@1stg",
"rules": {
"unicorn/template-indent": "off"
},
"overrides": [
{
"files": ".github/*.yml",
"rules": {
"unicorn/filename-case": "off"
}
},
{
"files": "docs/**/*.tsx",
"rules": {
Expand Down
25 changes: 0 additions & 25 deletions .github/workflows/pkg-size.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
Expand All @@ -35,8 +35,8 @@ jobs:
with:
publish: pnpm release
version: pnpm run version
commit: 'chore: release lib-boilerplate'
title: 'chore: release lib-boilerplate'
commit: 'chore: release domiso'
title: 'chore: release domiso'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
32 changes: 32 additions & 0 deletions .github/workflows/size-limit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Size Limit

on:
pull_request:
branches:
- main

jobs:
size-limit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: latest

- name: Setup Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16
cache: pnpm

- name: Install Dependencies
run: pnpm i

- uses: andresz1/size-limit-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
skip_step: install
script: pnpm size-limit --json
1 change: 1 addition & 0 deletions .github/workflows/vercel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
# eslint-disable-next-line yml/no-empty-mapping-value
pull_request:

jobs:
Expand Down
4 changes: 0 additions & 4 deletions .npmrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,15 @@ auto-install-peers=true
enable-pre-post-scripts=true
public-hoist-pattern[]=@1stg/*
public-hoist-pattern[]=@commitlint/*
public-hoist-pattern[]=@jest/types
public-hoist-pattern[]=@pkgr/*
public-hoist-pattern[]=@types/*
public-hoist-pattern[]=cross-env
public-hoist-pattern[]=core-js
public-hoist-pattern[]=*eslint*
public-hoist-pattern[]=*/loader
public-hoist-pattern[]=*-loader
public-hoist-pattern[]=jest
public-hoist-pattern[]=lint-staged
public-hoist-pattern[]=npm-run-all
public-hoist-pattern[]=*prettier*
public-hoist-pattern[]=simple-git-hooks
public-hoist-pattern[]=*stylelint*
public-hoist-pattern[]=tslib
strict-peer-dependencies=false
1 change: 1 addition & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ lib
LICENSE
*.json
*.log
*.patch
*.yaml
*.yml
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# lib-boilerplate
# domiso

[![GitHub Actions](https://github.com/un-ts/lib-boilerplate/workflows/CI/badge.svg)](https://github.com/un-ts/lib-boilerplate/actions/workflows/ci.yml)
[![Codecov](https://img.shields.io/codecov/c/github/un-ts/lib-boilerplate.svg)](https://codecov.io/gh/un-ts/lib-boilerplate)
[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/un-ts/lib-boilerplate.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/un-ts/lib-boilerplate/context:javascript)
[![type-coverage](https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&prefix=%E2%89%A5&suffix=%&query=$.typeCoverage.atLeast&uri=https%3A%2F%2Fraw.githubusercontent.com%2Fux-ts%2Flib-boilerplate%2Fmain%2Fpackage.json)](https://github.com/plantain-00/type-coverage)
[![npm](https://img.shields.io/npm/v/lib-boilerplate.svg)](https://www.npmjs.com/package/lib-boilerplate)
[![GitHub Release](https://img.shields.io/github/release/un-ts/lib-boilerplate)](https://github.com/un-ts/lib-boilerplate/releases)
[![GitHub Actions](https://github.com/un-ts/domiso/workflows/CI/badge.svg)](https://github.com/un-ts/domiso/actions/workflows/ci.yml)
[![Codecov](https://img.shields.io/codecov/c/github/un-ts/domiso.svg)](https://codecov.io/gh/un-ts/domiso)
[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/un-ts/domiso.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/un-ts/domiso/context:javascript)
[![type-coverage](https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&prefix=%E2%89%A5&suffix=%&query=$.typeCoverage.atLeast&uri=https%3A%2F%2Fraw.githubusercontent.com%2Fun-ts%2Fdomiso%2Fmain%2Fpackage.json)](https://github.com/plantain-00/type-coverage)
[![npm](https://img.shields.io/npm/v/domiso.svg)](https://www.npmjs.com/package/domiso)
[![GitHub Release](https://img.shields.io/github/release/un-ts/domiso)](https://github.com/un-ts/domiso/releases)

[![Conventional Commits](https://img.shields.io/badge/conventional%20commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![Code Style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![changesets](https://img.shields.io/badge/maintained%20with-changesets-176de3.svg)](https://github.com/atlassian/changesets)

A simple library boilerplate.
Dom sanitizer based on browser native DOMParser

## TOC <!-- omit in toc -->

Expand All @@ -31,21 +31,22 @@ A simple library boilerplate.

```sh
# pnpm
pnpm add lib-boilerplate
pnpm add domiso

# yarn
yarn add lib-boilerplate
yarn add domiso

# npm
npm i lib-boilerplate
npm i domiso
```

### API

```js
import echo from 'lib-boilerplate'
import { sanitize, sanitizeSvg } from 'domiso'

echo()
sanitize(`<!-- HTML content -->`)
sanitizeSvg(`<svg>SVG content</svg>`)
```

## Sponsors
Expand Down
17 changes: 17 additions & 0 deletions auto-imports.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Generated by 'unplugin-auto-import'
export {}
declare global {
const afterAll: typeof import('vitest')['afterAll']
const afterEach: typeof import('vitest')['afterEach']
const assert: typeof import('vitest')['assert']
const beforeAll: typeof import('vitest')['beforeAll']
const beforeEach: typeof import('vitest')['beforeEach']
const chai: typeof import('vitest')['chai']
const describe: typeof import('vitest')['describe']
const expect: typeof import('vitest')['expect']
const it: typeof import('vitest')['it']
const suite: typeof import('vitest')['suite']
const test: typeof import('vitest')['test']
const vi: typeof import('vitest')['vi']
const vitest: typeof import('vitest')['vitest']
}
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "lib-boilerplate-docs",
"name": "domiso-docs",
"type": "commonjs",
"description": "A simple library boilerplate."
}
21 changes: 0 additions & 21 deletions jest.config.ts

This file was deleted.

52 changes: 32 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "lib-boilerplate",
"version": "0.0.2",
"name": "domiso",
"version": "0.0.0",
"type": "module",
"description": "A simple library boilerplate.",
"repository": "git+https://github.com/un-ts/lib-boilerplate.git",
"description": "Dom sanitizer based on browser native DOMParser",
"repository": "git+https://github.com/un-ts/domiso.git",
"author": "JounQin (https://www.1stG.me) <[email protected]>",
"donate": {
"recipients": [
Expand Down Expand Up @@ -38,7 +38,7 @@
},
"funding": "https://opencollective.com/unts",
"license": "MIT",
"packageManager": "pnpm@7.5.1",
"packageManager": "pnpm@7.6.0",
"engines": {
"node": "^12.20.0 || ^14.18.0 || >=16.0.0"
},
Expand All @@ -60,38 +60,39 @@
"postversion": "pnpm i --no-frozen-lockfile",
"prepare": "simple-git-hooks",
"prerelease": "pnpm build",
"prevercel-build": "pnpm build",
"release": "changeset publish",
"serve": "sirv dist -s",
"test": "jest",
"test": "vitest run --coverage",
"typecov": "type-coverage",
"vercel-build": "w -e docs -p --publicPath /",
"version": "changeset version"
},
"dependencies": {
"tslib": "^2.4.0"
},
"devDependencies": {
"@1stg/app-config": "^6.1.3",
"@1stg/lib-config": "^9.0.0",
"@changesets/changelog-github": "^0.4.5",
"@changesets/cli": "^2.23.2",
"@pkgr/webpack": "^3.1.2",
"@1stg/app-config": "^6.1.5",
"@1stg/lib-config": "^9.0.2",
"@changesets/changelog-github": "^0.4.6",
"@changesets/cli": "^2.24.1",
"@pkgr/webpack": "^3.2.0",
"@pkgr/webpack-mdx": "^2.0.3",
"@types/jest": "^28.1.6",
"@size-limit/preset-small-lib": "^7.0.8",
"@types/mdx": "^2.0.2",
"@types/node": "^18.0.5",
"@types/node": "^18.6.1",
"@types/react": "^18.0.15",
"@types/react-dom": "^18.0.6",
"@types/web": "^0.0.69",
"@types/web": "^0.0.70",
"c8": "^7.12.0",
"domiso": "link:.",
"github-markdown-css": "^5.1.0",
"jsdom": "^20.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.3.0",
"sirv-cli": "^2.0.2",
"ts-jest": "^28.0.7",
"size-limit": "^7.0.8",
"type-coverage": "^2.22.0",
"typescript": "^4.7.4"
"typescript": "^4.7.4",
"unplugin-auto-import": "^0.10.1",
"vitest": "^0.19.1"
},
"publishConfig": {
"main": "./lib/index.cjs",
Expand All @@ -103,6 +104,17 @@
},
"types": "./lib/index.d.ts"
},
"pnpm": {
"patchedDependencies": {
"[email protected]": "patches/[email protected]"
}
},
"size-limit": [
{
"path": "lib/index.js",
"limit": "300B"
}
],
"typeCoverage": {
"atLeast": 100,
"cache": true,
Expand Down
Loading

0 comments on commit 244858a

Please sign in to comment.