Skip to content

Commit

Permalink
Reflect 9.0 (#80)
Browse files Browse the repository at this point in the history
* Enforce 23.1.0

* Remove /ssr and delete /scope

* Fix build and commits

* Separate public types from sources

* Use dist version of the package

* Make public types work

* Make build work

* Fix type-tests resolving

* Enforce prior build for code tests

* Use vitest

* Remove jest

* remove jest

* Add attw and publint into ci

* Fix package issues

* Fix type paths

* Fix resolved path

* Rewrite types for reflect method

* Rewrite createReflect types

* Bump react

* Bump react types

* Add another type level edge case

* Restore some of the variant types

* Restore variant types

* generalize bind usage

* Make `list` types work

* Add JSDoc notation

* Use public typings in tests directly

* Simplify source typings

* Add basic type test for createReflect

* Improve types

* Enable skipLibCheck in type tests

There are a lot of strange stuff in @types/react 🤷

* Improve type inference for callbacks

* Add tests for scoped callbacks

* Support arbitary callback feature

* Add tests for callback in mapItem

* Support scopeBind callbacks in mapItem

* Document fork api auto-compatibility

* Document fork api auto compatibility in `list`

* Fix docs view

* Add types for fromTag helper

* Fix example

* implement fromTag

* Remove unsued expect error directive

* Document `fromTag`

* Create types for useUnit config

* Fix weird gitignore

* Implement `useUnitConfig` field

* Do not generate d.mts

* Improve wording

* fix json formatting

* Add more type-tests

* Revert to use React.FC type again

For some reason, on a real test in Next.js project, the (props: ...) => React.ReactNode type is not compatible in some cases

* Add note in the code about type inference
  • Loading branch information
AlexandrHoroshih authored Dec 19, 2023
1 parent 31c696a commit a45711e
Show file tree
Hide file tree
Showing 45 changed files with 2,793 additions and 3,549 deletions.
5 changes: 3 additions & 2 deletions .config/tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"compilerOptions": {
"target": "es6",
"target": "ESNext",
"module": "es2015",
"strict": true,
"lib": ["dom", "dom.iterable", "esnext"],
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"jsx": "react",
"esModuleInterop": true,
"types": ["vitest/globals"],
"strictNullChecks": true
},
"include": ["../src"],
"exclude": ["../typings", "../**/*.test.tsx"]
"exclude": ["../typings"]
}
5 changes: 2 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ jobs:
- name: Build
run: pnpm build

- name: Build test
run: pnpm test:code:build

- name: Run tests
run: pnpm test
env:
CI: true
- name: Validate package
run: pnpm validate:dist
8 changes: 1 addition & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.DS_Store
node_modules
.vscode

yarn-error.log

Expand All @@ -12,12 +13,5 @@ yarn-error.log

effector-reflect-*
.idea
core/
./index.*
./ssr.*
./scope.*js
./scope.*map
./scope.d.ts
./reflect.*
docs/.next
docs/out
2 changes: 1 addition & 1 deletion babel.config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"presets": ["@babel/preset-env", "@babel/preset-typescript", "@babel/preset-react"],
"presets": ["@babel/preset-typescript", "@babel/preset-react"],
"plugins": ["@babel/plugin-transform-runtime"]
}
13 changes: 11 additions & 2 deletions build.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import fs from 'node:fs/promises';

/* eslint-disable no-undef */
import prettyMs from 'pretty-ms';
import { rollup } from 'rollup';
import 'zx/globals';

import configs from './rollup.config.cjs';

await fs.mkdir('./dist', { recursive: true });

await measure(`public-typings → ./dist/`, `copied in`, async () => {
await fs.copyFile('./public-types/reflect.d.ts', './dist/index.d.ts');

// `@effector/reflect/scope` types - this export is deprecated
await fs.copyFile('./public-types/reflect.d.ts', './dist/scope.d.ts');
});

for (const config of configs) {
await measure(
`${config.input}${config.output.file ?? config.output.dir}`,
Expand Down
220 changes: 0 additions & 220 deletions dist-test/no-ssr/create-reflect.test.tsx

This file was deleted.

Loading

0 comments on commit a45711e

Please sign in to comment.