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

switch to pure ESM #176

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 0 additions & 3 deletions .browserslistrc

This file was deleted.

3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended"
"plugin:react-hooks/recommended",
"plugin:react/jsx-runtime"
],
"parserOptions": {
"ecmaVersion": 2020,
Expand Down
41 changes: 30 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,40 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: macos-latest

steps:
- uses: actions/checkout@v4
- name: Use Node.js v16
uses: actions/setup-node@v4

- uses: actions/setup-node@v4
with:
node-version: latest

- uses: pnpm/action-setup@v2
with:
node-version: 16
- name: yarn install, build, and test
version: 8
run_install: false

- shell: bash
run: |
yarn --frozen-lockfile
yarn typecheck
yarn build
yarn test --ci --coverage
yarn lint
bash <(curl -s https://codecov.io/bash) -t ${{ secrets.CODECOV_TOKEN }}
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- uses: actions/cache@v3
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- run: pnpm install --frozen-lockfile

- run: |
pnpm build
pnpm test
pnpm lint
env:
CI: true

- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
4 changes: 0 additions & 4 deletions .husky/pre-commit

This file was deleted.

2 changes: 2 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{
"bracketSpacing": false,
"singleAttributePerLine": true,
"singleQuote": true
}
16 changes: 0 additions & 16 deletions .size-snapshot.json

This file was deleted.

10 changes: 0 additions & 10 deletions .storybook/main.js

This file was deleted.

20 changes: 20 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type {StorybookConfig} from '@storybook/react-vite';

const config: StorybookConfig = {
stories: ['../stories/**/*.stories.tsx'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-onboarding',
'@storybook/addon-interactions',
],
framework: {
name: '@storybook/react-vite',
options: {},
},
docs: {
autodocs: 'tag',
},
};

export default config;
3 changes: 0 additions & 3 deletions .storybook/preview.js

This file was deleted.

15 changes: 15 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type {Preview} from '@storybook/react';

const preview: Preview = {
parameters: {
actions: {argTypesRegex: '^on[A-Z].*'},
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
};

export default preview;
8 changes: 0 additions & 8 deletions babel.config.json

This file was deleted.

99 changes: 42 additions & 57 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-popper-tooltip",
"version": "4.4.2",
"version": "5.0.0",
"description": "React tooltip library built around react-popper",
"author": "Mohsin Ul Haq <mohsinulhaq01@gmail.com>",
"license": "MIT",
Expand All @@ -16,10 +16,12 @@
"react-tooltip",
"react-popper"
],
"main": "dist/cjs/react-popper-tooltip.js",
"module": "dist/esm/react-popper-tooltip.js",
"browser": "dist/esm/react-popper-tooltip.js",
"typings": "dist/index.d.ts",
"type": "module",
"engines": {
"node": ">=16"
},
"exports": "./dist/main.js",
"typings": "dist/main.d.ts",
"style": "dist/styles.css",
"files": [
"dist"
Expand All @@ -28,73 +30,56 @@
"dist/styles.css"
],
"scripts": {
"build": "rm -rf dist && rollup -c && cp src/styles.css dist && yarn tsc && rm -rf compiled",
"prepare": "husky install && yarn typecheck && yarn build && yarn test && yarn lint-staged",
"prettier": "prettier --write src/**/*.{ts,tsx}",
"typecheck": "tsc --noEmit",
"build": "rm -rf dist && tsup src/main.ts --format esm --dts --sourcemap",
"prepare": "husky install",
"prettier": "prettier --write \"{src,tests,examples}**/*.{ts,tsx}\"",
"lint": "eslint \"{src,tests,examples}**/*.{ts,tsx}\"",
"start": "rollup -c -w",
"test": "jest --env=jsdom tests",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook"
},
"jest": {
"modulePathIgnorePatterns": [
"<rootDir>/examples/"
],
"setupFilesAfterEnv": [
"@testing-library/jest-dom/extend-expect"
]
"test": "vitest --globals --dom -w false --coverage",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
},
"lint-staged": {
"**/*.(ts|tsx)": [
"yarn lint --fix"
]
},
"peerDependencies": {
"react": ">=16.6.0",
"react-dom": ">=16.6.0"
"react": ">=16.14.0",
"react-dom": ">=16.14.0"
},
"dependencies": {
"@babel/runtime": "^7.18.3",
"@popperjs/core": "^2.11.5",
"@popperjs/core": "^2.11.8",
"react-popper": "^2.3.0"
},
"devDependencies": {
"@babel/core": "^7.18.5",
"@babel/plugin-transform-runtime": "^7.18.5",
"@babel/preset-env": "^7.18.2",
"@babel/preset-react": "^7.17.12",
"@babel/preset-typescript": "^7.17.12",
"@storybook/addon-actions": "^6.5.9",
"@storybook/addon-essentials": "^6.5.9",
"@storybook/addon-links": "^6.5.9",
"@storybook/react": "^6.5.9",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^14.2.1",
"@types/jest": "^28.1.3",
"@types/react": "^18.0.14",
"@types/react-dom": "^18.0.5",
"@typescript-eslint/eslint-plugin": "^5.29.0",
"@typescript-eslint/parser": "^5.29.0",
"babel-loader": "^8.2.5",
"eslint": "^8.18.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.30.1",
"@storybook/addon-essentials": "^7.5.3",
"@storybook/addon-interactions": "^7.5.3",
"@storybook/addon-links": "^7.5.3",
"@storybook/addon-onboarding": "^1.0.8",
"@storybook/blocks": "^7.5.3",
"@storybook/react": "^7.5.3",
"@storybook/react-vite": "^7.5.3",
"@storybook/testing-library": "^0.2.2",
"@testing-library/jest-dom": "^6.1.4",
"@testing-library/react": "^12",
"@testing-library/user-event": "^14.5.1",
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.15",
"@typescript-eslint/eslint-plugin": "^6.11.0",
"@vitest/coverage-v8": "^1.0.0-beta.4",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"husky": "^8.0.1",
"jest": "^28.1.1",
"jest-environment-jsdom": "^28.1.1",
"lint-staged": "^13.0.3",
"prettier": "^2.7.1",
"happy-dom": "^12.10.3",
"husky": "^8.0.3",
"lint-staged": "^15.1.0",
"prettier": "^3.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rollup": "^2.75.7",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-size-snapshot": "^0.12.0",
"typescript": "^4.7.4"
"storybook": "^7.5.3",
"tsup": "^8.0.0",
"typescript": "^5.2.2",
"vitest": "^1.0.0-beta.5"
}
}
Loading