Skip to content

Commit

Permalink
build: update infra (#93)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: this package is now pure ESM
  • Loading branch information
ikatyang committed Jul 9, 2023
1 parent d239ad5 commit 2326539
Show file tree
Hide file tree
Showing 36 changed files with 2,536 additions and 4,891 deletions.
2 changes: 0 additions & 2 deletions .gitattributes

This file was deleted.

13 changes: 13 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: setup
description: setup
runs:
using: composite
steps:
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
cache: pnpm
node-version: '18'
registry-url: 'https://registry.npmjs.org'
- run: pnpm install
shell: bash
16 changes: 16 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
on:
push:
tags:
- v*

jobs:
publish:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- run: pnpm publish --no-git-checks --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
29 changes: 29 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
on:
push:
branches:
- master
- release-*
pull_request:
branches:
- master
- release-*

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- run: pnpm run lint
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- run: pnpm run build
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- run: pnpm run test
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
coverage/
lib/
node_modules/
/.vscode/
/coverage/
/lib/
/node_modules/
Empty file removed .npmignore
Empty file.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/pnpm-lock.yaml
3 changes: 3 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
arrowParens: avoid
semi: false
singleQuote: true
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

6 changes: 6 additions & 0 deletions .versionrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"preset": "angular",
"scripts": {
"postchangelog": "prettier --write CHANGELOG.md"
}
}
27 changes: 10 additions & 17 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,41 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

<a name="1.2.2"></a>
## [1.2.2](https://github.com/ikatyang/regexp-util/compare/v1.2.1...v1.2.2) (2018-03-21)

## [1.2.2](https://github.com/ikatyang/regexp-util/compare/v1.2.1...v1.2.2) (2018-03-21)

### Bug Fixes

* **charset:** union with central overlap ([#26](https://github.com/ikatyang/regexp-util/issues/26)) ([d44823e](https://github.com/ikatyang/regexp-util/commit/d44823e))


- **charset:** union with central overlap ([#26](https://github.com/ikatyang/regexp-util/issues/26)) ([d44823e](https://github.com/ikatyang/regexp-util/commit/d44823e))

<a name="1.2.1"></a>
## [1.2.1](https://github.com/ikatyang/regexp-util/compare/v1.2.0...v1.2.1) (2018-03-20)

## [1.2.1](https://github.com/ikatyang/regexp-util/compare/v1.2.0...v1.2.1) (2018-03-20)

### Bug Fixes

* **charset:** subtraction with multi central overlap ([#25](https://github.com/ikatyang/regexp-util/issues/25)) ([f6595ef](https://github.com/ikatyang/regexp-util/commit/f6595ef))


- **charset:** subtraction with multi central overlap ([#25](https://github.com/ikatyang/regexp-util/issues/25)) ([f6595ef](https://github.com/ikatyang/regexp-util/commit/f6595ef))

<a name="1.2.0"></a>
# [1.2.0](https://github.com/ikatyang/regexp-util/compare/v1.1.0...v1.2.0) (2018-02-09)

# [1.2.0](https://github.com/ikatyang/regexp-util/compare/v1.1.0...v1.2.0) (2018-02-09)

### Features

* **charset:** support surrogate pair ([#8](https://github.com/ikatyang/regexp-util/issues/8)) ([024764a](https://github.com/ikatyang/regexp-util/commit/024764a))


- **charset:** support surrogate pair ([#8](https://github.com/ikatyang/regexp-util/issues/8)) ([024764a](https://github.com/ikatyang/regexp-util/commit/024764a))

<a name="1.1.0"></a>
# [1.1.0](https://github.com/ikatyang/regexp-util/compare/v1.0.0...v1.1.0) (2018-02-05)

# [1.1.0](https://github.com/ikatyang/regexp-util/compare/v1.0.0...v1.1.0) (2018-02-05)

### Features

* **charset:** throw on invalid unicode code point ([#6](https://github.com/ikatyang/regexp-util/issues/6)) ([b412982](https://github.com/ikatyang/regexp-util/commit/b412982))


- **charset:** throw on invalid unicode code point ([#6](https://github.com/ikatyang/regexp-util/issues/6)) ([b412982](https://github.com/ikatyang/regexp-util/commit/b412982))

<a name="1.0.0"></a>

# 1.0.0 (2018-02-05)

### Features

* initial implementation
- initial implementation
46 changes: 21 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# regexp-util

[![npm](https://img.shields.io/npm/v/regexp-util.svg)](https://www.npmjs.com/package/regexp-util)
[![build](https://img.shields.io/travis/ikatyang/regexp-util/master.svg)](https://travis-ci.org/ikatyang/regexp-util/builds)
[![coverage](https://img.shields.io/codecov/c/github/ikatyang/regexp-util/master.svg)](https://codecov.io/gh/ikatyang/regexp-util)
[![build](https://img.shields.io/github/actions/workflow/status/ikatyang/regexp-util/test.yml)](https://github.com/ikatyang/regexp-util/actions?query=branch%3Amaster)

utilities for generating regular expression

Expand All @@ -11,24 +10,21 @@ utilities for generating regular expression
## Install

```sh
# using npm
npm install --save regexp-util

# using yarn
yarn add regexp-util
npm install regexp-util
```

## Usage

```ts
const util = require('regexp-util');
import { charset } from 'regexp-util'

const regex = util.charset(['a', 'g']) // a ~ g
const regex = util
.charset(['a', 'g']) // a ~ g
.subtract(['c', 'e'])
.toRegExp();
.toRegExp()

const aResult = 'a'.test(regex); //=> true
const dResult = 'd'.test(regex); //=> false
const aResult = 'a'.test(regex) //=> true
const dResult = 'd'.test(regex) //=> false
```

## API
Expand All @@ -37,9 +33,9 @@ const dResult = 'd'.test(regex); //=> false

```ts
declare abstract class Base {
isEmpty(): boolean;
toString(): string;
toRegExp(flags?: string): RegExp;
isEmpty(): boolean
toString(): string
toRegExp(flags?: string): RegExp
}
```

Expand All @@ -51,29 +47,29 @@ declare type CharsetInput =
| string // char
| number // codepoint
| [string, string] // char: start to end (inclusive)
| [number, number]; // codepoint: start to end (inclusive)
declare const charset: (...inputs: CharsetInput[]) => Charset;
| [number, number] // codepoint: start to end (inclusive)

declare function charset(...inputs: CharsetInput[]): Charset

declare class Charset extends Base {
constructor(...inputs: CharsetInput[]);
union(...inputs: CharsetInput[]): Charset;
subtract(...inputs: CharsetInput[]): Charset;
intersect(...inputs: CharsetInput[]): Charset;
constructor(...inputs: CharsetInput[])
union(...inputs: CharsetInput[]): Charset
subtract(...inputs: CharsetInput[]): Charset
intersect(...inputs: CharsetInput[]): Charset
}
```

## Development

```sh
# lint
yarn run lint
pnpm run lint

# build
yarn run build
pnpm run build

# test
yarn run test
pnpm run test
```

## License
Expand Down
18 changes: 0 additions & 18 deletions jest.config.js

This file was deleted.

40 changes: 15 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "regexp-util",
"type": "module",
"version": "1.2.2",
"description": "utilities for generating regular expression",
"keywords": [
"regex"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
"exports": "./lib/index.js",
"repository": "https://github.com/ikatyang/regexp-util",
"homepage": "https://github.com/ikatyang/regexp-util#readme",
"author": {
Expand All @@ -16,38 +16,28 @@
},
"license": "MIT",
"scripts": {
"prepublish": "yarn run build",
"lint": "tslint -p ./tsconfig.json --type-check",
"test": "jest",
"prebuild": "rm -rf ./lib",
"prepack": "pnpm run build",
"lint": "prettier --check .",
"test": "vitest",
"build": "tsc -p ./tsconfig.build.json",
"release": "standard-version"
},
"dependencies": {
"tslib": "^1.9.0"
"tslib": "^2.6.0"
},
"devDependencies": {
"@types/jest": "21.1.10",
"codecov": "3.7.1",
"jest": "21.2.1",
"prettier": "1.11.1",
"prettier-config-ikatyang": "1.1.1",
"standard-version": "4.4.0",
"ts-jest": "21.2.4",
"tslint": "5.14.0",
"tslint-config-ikatyang": "2.5.1",
"tslint-config-prettier": "1.18.0",
"tslint-plugin-prettier": "1.3.0",
"typescript": "2.9.2"
},
"resolutions": {
"**/har-validator": "5.1.0",
"**/tough-cookie": "2.4.3"
"@vitest/coverage-v8": "0.33.0",
"prettier": "3.0.0",
"standard-version": "9.5.0",
"typescript": "5.1.6",
"vite": "4.4.2",
"vitest": "0.33.0"
},
"engines": {
"node": ">= 4"
"node": ">=16"
},
"files": [
"/lib/**/*"
]
],
"packageManager": "pnpm@8.6.6"
}
Loading

0 comments on commit 2326539

Please sign in to comment.