Skip to content

Commit 623c322

Browse files
authored
Merge pull request #55 from anantoghosh/v2
V2
2 parents ffe5baf + d5d3f85 commit 623c322

55 files changed

Lines changed: 7231 additions & 6810 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.browserslistrc-legacy

Lines changed: 0 additions & 1 deletion
This file was deleted.

.eslintrc.json

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/workflows/node.js.yml

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,40 +5,44 @@ name: Build
55

66
on:
77
push:
8-
branches: [ '*' ]
8+
branches: ["*"]
99
pull_request:
10-
branches: [ '*' ]
10+
branches: ["*"]
1111

1212
jobs:
1313
build:
14-
1514
runs-on: ubuntu-latest
1615

1716
strategy:
1817
matrix:
19-
node-version: [20.x]
18+
node-version: [22.x]
2019
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2120

2221
steps:
23-
- uses: actions/checkout@v4
24-
- name: Use Node.js ${{ matrix.node-version }}
25-
uses: actions/setup-node@v4
26-
with:
27-
node-version: ${{ matrix.node-version }}
28-
- name: Cache .pnpm-store
29-
uses: actions/cache@v4
30-
with:
31-
path: ~/.pnpm-store
32-
key: ${{ runner.os }}-node${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
33-
- name: Install latest corepack
34-
run: npm install -g corepack@latest
35-
- name: Enable corepack
36-
run: corepack enable
37-
- run: pnpm install
38-
- run: pnpm eslint
39-
- run: pnpm test
40-
- run: pnpm build
41-
- name: Publish code coverage
42-
uses: paambaati/codeclimate-action@v3.2.0
43-
env:
44-
CC_TEST_REPORTER_ID: 7faf3080bb50c92d2efae792088aca807b6a54bafa2482384b30d163a7a28838
22+
- uses: actions/checkout@v4
23+
- name: Use Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
28+
- name: Cache .pnpm-store
29+
uses: actions/cache@v4
30+
with:
31+
path: ~/.pnpm-store
32+
key: ${{ runner.os }}-node${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
33+
34+
- name: Install latest corepack
35+
run: npm install -g corepack@latest
36+
37+
- run: corepack enable
38+
- run: pnpm install
39+
- run: pnpm lint
40+
- run: pnpm test
41+
- run: pnpm build
42+
env:
43+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
44+
45+
- name: Upload coverage reports to Codecov
46+
uses: codecov/codecov-action@v5
47+
with:
48+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/npm-publish.yml

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,46 @@ jobs:
1414
- uses: actions/checkout@v4
1515
- uses: actions/setup-node@v4
1616
with:
17-
node-version: 16
18-
- name: Install pnpm
19-
run: corepack enable
17+
node-version: 22
18+
- name: Install latest corepack
19+
run: npm install -g corepack@latest
20+
21+
- run: corepack enable
2022
- run: pnpm install
23+
- run: pnpm lint
2124
- run: pnpm test
2225
- run: pnpm build
23-
- uses: actions/upload-artifact@v3
26+
- uses: actions/upload-artifact@v4
2427
with:
2528
name: dist
2629
path: ./dist
2730

2831
publish-npm:
2932
needs: build
3033
runs-on: ubuntu-latest
34+
permissions:
35+
contents: read
36+
packages: write
37+
id-token: write
3138
steps:
3239
- uses: actions/checkout@v4
3340
- uses: actions/setup-node@v4
3441
with:
35-
node-version: 16
42+
node-version: 22
3643
registry-url: https://registry.npmjs.org/
37-
- uses: actions/download-artifact@v3
44+
- uses: actions/download-artifact@v5
3845
with:
3946
name: dist
4047
path: dist/
41-
- run: npm publish
48+
- name: Set NPM tag
49+
id: npm_tag
50+
run: |
51+
if [[ "${{ github.event.release.prerelease }}" == "true" ]]; then
52+
echo "tag=next" >> $GITHUB_OUTPUT
53+
else
54+
echo "tag=latest" >> $GITHUB_OUTPUT
55+
fi
56+
- run: npm publish --provenance --access public --tag ${{ steps.npm_tag.outputs.tag }}
4257
env:
4358
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
4459

@@ -48,18 +63,27 @@ jobs:
4863
permissions:
4964
contents: read
5065
packages: write
66+
id-token: write
5167
steps:
5268
- uses: actions/checkout@v4
5369
- uses: actions/setup-node@v4
5470
with:
55-
node-version: 16
71+
node-version: 22
5672
registry-url: https://npm.pkg.github.com/
5773
scope: "@anantoghosh"
58-
- uses: actions/download-artifact@v3
74+
- uses: actions/download-artifact@v5
5975
with:
6076
name: dist
6177
path: dist/
6278
- run: node gpr-hack.js
63-
- run: npm publish
79+
- name: Set GPR tag
80+
id: gpr_tag
81+
run: |
82+
if [[ "${{ github.event.release.prerelease }}" == "true" ]]; then
83+
echo "tag=next" >> $GITHUB_OUTPUT
84+
else
85+
echo "tag=latest" >> $GITHUB_OUTPUT
86+
fi
87+
- run: npm publish --tag ${{ steps.gpr_tag.outputs.tag }}
6488
env:
6589
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16.20.2
1+
22

.np-config.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
{
2-
"yarn": false,
3-
"contents": "dist",
42
"publish": false,
53
"branch": "main",
64
"cleanup": false,

eslint.config.mjs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { defineConfig } from "eslint/config";
2+
import js from "@eslint/js";
3+
import tseslint from "typescript-eslint";
4+
5+
export default defineConfig([
6+
js.configs.recommended,
7+
tseslint.configs.recommended,
8+
{
9+
rules: {
10+
"no-control-regex": "off",
11+
"no-constant-condition": "off",
12+
},
13+
},
14+
]);

jest.config.mjs

Lines changed: 0 additions & 11 deletions
This file was deleted.

package.json

Lines changed: 37 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
{
22
"name": "react-linkify-it",
33
"author": "Ananto Ghosh",
4-
"version": "1.0.8",
5-
"description": "A tiny and dependency free universal linking solution that turns any pattern in your text into clickable links (aka linkify). Supports i18n and emojis.",
4+
"version": "2.0.0-2",
5+
"description": "A super tiny <1KB, dependency-free, highly customizable React utility to turn any pattern in your text into clickable links or custom components. Instantly linkify URLs, emails, twitter handles, hashtags, mentions or anything else out of the box or with your own rules.",
66
"license": "MIT",
77
"type": "module",
88
"source": "src/index.tsx",
9-
"packageManager": "pnpm@8.15.9",
10-
"main": "./dist/react-linkify-it.legacy.umd.min",
9+
"packageManager": "pnpm@10.15.1+sha512.34e538c329b5553014ca8e8f4535997f96180a1d0f614339357449935350d924e22f8614682191264ec33d1462ac21561aff97f6bb18065351c162c7e8f6de67",
10+
"main": "./dist/index.cjs",
1111
"exports": {
12-
".": "./dist/react-linkify-it.esm.js",
13-
"./legacy": "./dist/react-linkify-it.legacy.umd.min",
14-
"./dist/react-linkify-it.legacy.umd.min": "./dist/react-linkify-it.legacy.umd.min"
12+
".": {
13+
"import": "./dist/index.js",
14+
"require": "./dist/index.cjs"
15+
},
16+
"./package.json": "./package.json"
1517
},
16-
"module": "./dist/react-linkify-it.esm.js",
17-
"unpkg": "./dist/react-linkify-it.legacy.umd.min.js",
18-
"types": "./dist/react-linkify-it.esm.d.ts",
18+
"module": "./dist/index.js",
19+
"types": "./dist/index.d.cts",
1920
"sideEffects": false,
2021
"files": [
2122
"dist/"
@@ -40,53 +41,47 @@
4041
"homepage": "https://github.com/anantoghosh/react-linkify-it",
4142
"scripts": {
4243
"release": "np",
43-
"build": "npm run build:latest && npm run build:legacy",
44-
"build:latest": "rollup -c",
45-
"build:legacy": "rollup -c rollup-legacy.config.js",
46-
"test": "jest --coverage",
44+
"build": "tsdown",
45+
"test": "vitest run --coverage",
46+
"lint": "eslint src/",
4747
"prettier": "prettier src/ --write"
4848
},
49+
"prettier": {
50+
"singleQuote": true
51+
},
4952
"keywords": [
5053
"react-linkify",
5154
"react",
5255
"linkify",
5356
"link",
5457
"url",
55-
"jira",
5658
"email",
5759
"twitter",
5860
"autolink",
5961
"text",
6062
"tag"
6163
],
6264
"devDependencies": {
63-
"@babel/core": "^7.22.10",
64-
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
65-
"@babel/plugin-transform-runtime": "^7.22.10",
66-
"@babel/preset-env": "^7.22.10",
67-
"@babel/preset-typescript": "^7.22.5",
68-
"@babel/runtime": "^7.22.10",
69-
"@rollup/plugin-terser": "^0.4.3",
70-
"@testing-library/jest-dom": "^5.17.0",
71-
"@testing-library/react": "^14.0.0",
72-
"@types/jest": "^27.5.2",
73-
"@types/react": "^18.2.20",
74-
"@types/testing-library__jest-dom": "^5.14.9",
75-
"@typescript-eslint/eslint-plugin": "^6.3.0",
76-
"@typescript-eslint/parser": "^6.3.0",
77-
"eslint": "^8.47.0",
78-
"eslint-plugin-tree-shaking": "^1.10.0",
79-
"jest": "^27.5.1",
80-
"np": "^8.0.4",
81-
"prettier": "^3.0.1",
82-
"react": "^18.2.0",
83-
"react-dom": "^18.2.0",
84-
"rollup": "^3.28.0",
85-
"rollup-plugin-size": "^0.3.1",
86-
"rollup-plugin-ts": "^3.4.4",
87-
"ts-jest": "^27.1.5",
88-
"tslib": "^2.6.1",
89-
"typescript": "~4.9.5"
65+
"@eslint/js": "^9.35.0",
66+
"@testing-library/dom": "^10.4.1",
67+
"@testing-library/jest-dom": "^6.8.0",
68+
"@testing-library/react": "^16.3.0",
69+
"@types/react": "^19.1.12",
70+
"@types/react-dom": "^19.1.9",
71+
"@vitest/coverage-v8": "3.2.4",
72+
"@vitest/ui": "^3.2.4",
73+
"eslint": "^9.35.0",
74+
"jsdom": "^26.1.0",
75+
"np": "^10.2.0",
76+
"prettier": "^3.6.2",
77+
"publint": "^0.3.12",
78+
"react": "^19.1.1",
79+
"react-dom": "^19.1.1",
80+
"tsdown": "^0.15.0",
81+
"tslib": "^2.8.1",
82+
"typescript": "~5.9.2",
83+
"typescript-eslint": "^8.43.0",
84+
"vitest": "^3.2.4"
9085
},
9186
"peerDependencies": {
9287
"react": "*"

0 commit comments

Comments
 (0)