Skip to content

Commit 5544ac9

Browse files
authored
fix: esm exports (#263)
1 parent e032d0b commit 5544ac9

File tree

10 files changed

+2836
-2493
lines changed

10 files changed

+2836
-2493
lines changed

.github/dependabot.yml

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

.github/workflows/main.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ jobs:
1313
runs-on: ${{ matrix.os }}
1414
strategy:
1515
matrix:
16-
node: ['14.x']
16+
node: ['16.x']
1717
os: [ubuntu-latest, windows-latest, macOS-latest]
1818

1919
steps:
2020
- name: Checkout repo
21-
uses: actions/checkout@v2
21+
uses: actions/checkout@v3
2222

2323
- name: Use Node ${{ matrix.node }}
24-
uses: actions/setup-node@v1
24+
uses: actions/setup-node@v3
2525
with:
2626
node-version: ${{ matrix.node }}
2727

@@ -34,21 +34,16 @@ jobs:
3434
- name: Test
3535
run: yarn test --ci --coverage --maxWorkers=2
3636

37-
- name: Upload coverage to Codecov
38-
uses: codecov/codecov-action@v1
39-
with:
40-
token: ${{ secrets.CODECOV_TOKEN }}
41-
4237
publish-module:
4338
name: 'Publish Module to NPM on Node ${{ matrix.node }} and ${{ matrix.os }}'
4439
needs: build
4540
if: github.repository == 'jorisre/react-screen-wake-lock' && (github.ref =='refs/heads/main')
4641
runs-on: ubuntu-latest
4742
steps:
4843
- name: Checkout repository
49-
uses: actions/checkout@v2
44+
uses: actions/checkout@v3
5045
- name: 'Use Node ${{ matrix.node }}'
51-
uses: actions/setup-node@v1
46+
uses: actions/setup-node@v3
5247
with:
5348
node-version: '${{ matrix.node }}'
5449
registry-url: 'https://registry.npmjs.org/'

.prettierrc.json

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

example/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
"react-screen-wake-lock": "^3.0.0"
1212
},
1313
"devDependencies": {
14-
"@types/react": "^18.0.13",
15-
"@types/react-dom": "^18.0.5",
14+
"@types/react": "^18.2.21",
15+
"@types/react-dom": "^18.2.7",
1616
"@vitejs/plugin-react-refresh": "^1.3.1",
17-
"typescript": "^4.1.2",
18-
"vite": "^3.1.4"
17+
"typescript": "^5.2.2",
18+
"vite": "^4.4.9"
1919
},
2020
"alias": {
2121
"react": "../node_modules/react",

example/src/main.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import React from 'react';
2-
import ReactDOM from 'react-dom';
2+
import { createRoot } from 'react-dom/client';
33
import App from './App';
44
import './styles/style.css';
55
import './styles/switch.css';
66

7-
ReactDOM.render(
7+
const root = createRoot(document.getElementById('root')!);
8+
9+
root.render(
810
<React.StrictMode>
911
<App />
1012
</React.StrictMode>,
11-
document.getElementById('root')
1213
);

example/yarn.lock

Lines changed: 423 additions & 465 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@
2828
"type": "module",
2929
"source": "src/index.ts",
3030
"main": "dist/react-screen-wake-lock.cjs",
31-
"exports": "./dist/react-screen-wake-lock.esm.js",
31+
"nodule": "./dist/react-screen-wake-lock.esm.js",
32+
"exports": {
33+
"types": "./dist/index.d.ts",
34+
"require": "./dist/react-screen-wake-lock.cjs",
35+
"default": "./dist/react-screen-wake-lock.esm.js"
36+
},
3237
"umd:main": "dist/react-screen-wake-lock.umd.js",
3338
"unpkg": "dist/react-screen-wake-lock.umd.js",
3439
"typings": "dist/index.d.ts",
@@ -55,36 +60,36 @@
5560
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
5661
},
5762
"devDependencies": {
58-
"@testing-library/dom": "^9.0.0",
63+
"@testing-library/dom": "^9.3.1",
5964
"@testing-library/react": "^14.0.0",
6065
"@testing-library/react-hooks": "^8.0.1",
61-
"@types/dom-screen-wake-lock": "^1.0.0",
62-
"@types/jest": "^29.1.1",
63-
"@types/react": "^18.0.13",
64-
"@types/react-dom": "^18.0.5",
65-
"@typescript-eslint/eslint-plugin": "^5.39.0",
66-
"@typescript-eslint/parser": "^5.39.0",
67-
"eslint": "^8.24.0",
68-
"eslint-plugin-react": "^7.23.1",
66+
"@types/dom-screen-wake-lock": "^1.0.1",
67+
"@types/jest": "^29.5.4",
68+
"@types/react": "^18.2.21",
69+
"@types/react-dom": "^18.2.7",
70+
"@typescript-eslint/eslint-plugin": "^6.4.1",
71+
"@typescript-eslint/parser": "^6.4.1",
72+
"eslint": "^8.48.0",
73+
"eslint-plugin-react": "^7.33.2",
6974
"eslint-plugin-react-hooks": "^4.2.0",
70-
"eslint-plugin-testing-library": "^5.7.2",
71-
"husky": "^8.0.1",
72-
"jest": "^29.1.2",
73-
"jest-environment-jsdom": "^29.1.2",
75+
"eslint-plugin-testing-library": "^6.0.1",
76+
"husky": "^8.0.3",
77+
"jest": "^29.6.4",
78+
"jest-environment-jsdom": "^29.6.4",
7479
"jest-wake-lock-mock": "^1.1.0",
7580
"lodash": "^4.17.21",
7681
"microbundle": "^0.15.1",
7782
"nano-staged": "^0.8.0",
7883
"npm-run-all": "^4.1.5",
7984
"pinst": "^3.0.0",
80-
"prettier": "^2.2.1",
85+
"prettier": "^3.0.2",
8186
"react": "18.2.0",
8287
"react-dom": "18.2.0",
8388
"react-test-renderer": "18.2.0",
84-
"rimraf": "^4.0.4",
85-
"ts-jest": "^29.0.3",
89+
"rimraf": "^5.0.1",
90+
"ts-jest": "^29.1.1",
8691
"ts-node": "^10.9.1",
87-
"typescript": "^5.0.2"
92+
"typescript": "^5.2.2"
8893
},
8994
"nano-staged": {
9095
"*.{ts,tsx}": "eslint --fix",

prettier.config.cjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
trailingComma: 'all',
3+
tabWidth: 2,
4+
semi: true,
5+
singleQuote: true,
6+
printWidth: 100,
7+
};

renovate.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"groupName": "All",
3+
"labels": [
4+
"renovate"
5+
],
6+
"rangeStrategy": "bump",
7+
"schedule": "at any time"
8+
}

0 commit comments

Comments
 (0)