Skip to content

Commit 50921ef

Browse files
authored
feat: switch package to module type (#1472)
BREAKING CHANGE: Hooks are now distrubutes as JS built form TS with target ESNext and ESM module resolution. There is no more sense to distribute CJS version as package is ESM-only. Consequent of above - no more esm and cjs subfolders - hooks are importable from index.js or its own directory which don't have a prefix anymore, thanks to exports directive. All of below examples will lead to same result, choose any on your taste: import { useFirstMountState } from '@react-hookz/web'; import { useFirstMountState } from '@react-hookz/web/'; import { useFirstMountState } from '@react-hookz/web/useFirstMountState/'; import { useFirstMountState } from '@react-hookz/web/useFirstMountState/index.js'; Thought is seems not to have subfolder, it is only due to exports directive, in real it is @react-hookz/web/dist/useFirstMountState/index.js. Pakage uses imports directive to define path alias #root - it stays so even in distributed code, thus, some may be affected in case their bundler configured to somehow handle such alias. Those developer shoud configure import rewriter not to handle node_modules or @react-hookz/web package exclusively. Side-effect for current PR - documentation is broken, as storybook 6 is not working within ESM packages and I'm planning to switch to another domenting engine anyway.
1 parent 050d21a commit 50921ef

File tree

307 files changed

+1700
-9252
lines changed

Some content is hidden

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

307 files changed

+1700
-9252
lines changed

.eslintignore

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
.idea
22
node_modules
3-
esm
4-
cjs
3+
dist
54
coverage
6-
storybook-build
75
CHANGELOG.md
8-
!.eslintrc.js
9-
!.prettierrc.js
10-
!.storybook
6+
!.eslintrc.cjs
7+
!.prettierrc.cjs
118
!.github

.eslintrc.js renamed to .eslintrc.cjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ const commonJSRules = {
33
'unicorn/prevent-abbreviations': 'off',
44
'unicorn/no-null': 'off',
55
'unicorn/no-array-for-each': 'off',
6+
7+
'@typescript-eslint/no-meaningless-void-operator': 'off',
8+
'@typescript-eslint/no-confusing-void-expression': 'off',
69
};
710

8-
// eslint-disable-next-line unicorn/prefer-module
911
module.exports = {
1012
root: true,
1113

.github/workflows/ci-cd.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424

2525
- uses: actions/setup-node@v4
2626
with:
27-
node-version: 18
27+
node-version: 20
2828

2929
- uses: bahmutov/npm-install@v1
3030
with:
@@ -45,7 +45,7 @@ jobs:
4545

4646
- uses: actions/setup-node@v4
4747
with:
48-
node-version: 18
48+
node-version: 20
4949

5050
- uses: bahmutov/npm-install@v1
5151
with:
@@ -69,7 +69,7 @@ jobs:
6969

7070
- uses: actions/setup-node@v4
7171
with:
72-
node-version: 18
72+
node-version: 20
7373

7474
- uses: bahmutov/npm-install@v1
7575
with:
@@ -115,7 +115,7 @@ jobs:
115115

116116
- uses: actions/setup-node@v4
117117
with:
118-
node-version: 18
118+
node-version: 20
119119

120120
- uses: bahmutov/npm-install@v1
121121
with:

.github/workflows/gh-pages.yml

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

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
/.idea
22
node_modules
33
/coverage
4-
/storybook-build
5-
/cjs
6-
/esm
4+
/dist

.prettierrc.cjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const config = require('@react-hookz/eslint-config/.prettierrc.cjs');
2+
3+
module.exports = config;

.prettierrc.js

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

.storybook/main.js

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

.storybook/manager-head.html

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

.storybook/manager.js

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

0 commit comments

Comments
 (0)