Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Commit

Permalink
refactor: deps
Browse files Browse the repository at this point in the history
1. feat(react-hook): add `useSetState` plugin
2. refactor(lodash-pro): deps
3. fix(react-locale): bump

release
  • Loading branch information
hemengke1997 committed Feb 4, 2024
1 parent 0b55942 commit 0aad45d
Show file tree
Hide file tree
Showing 43 changed files with 1,093 additions and 780 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ dist
.idea
.DS_Store
.turbo
.tsup
1 change: 0 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
strict-peer-dependencies=false
auto-install-peers=true
link-workspace-packages=false
registry=https://registry.npmjs.org/
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
| Package | Desc |
| ------------------------- | ------------------------------------ |
| @minko-fe/axios-pro | Like axios but pro |
| @minko-fe/client-logger | Colorful logger in browser |
| @minko-fe/html-transform | Vite transform-html logic |
| @minko-fe/lodash-pro | More than lodash |
| @minko-fe/postcss-config | Common postcss config |
Expand Down
11 changes: 4 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
"lint": "turbo lint --concurrency=12 --filter=\"./packages/*\" --ignore=\"playground/**\"",
"test": "turbo test --concurrency=12 --filter=\"./packages/*\" --ignore=\"playground/**\" ",
"create": "tsx scripts/createLib",
"prepare": "npx only-allow pnpm",
"clean": "rimraf node_modules & pnpm -r --parallel --filter \"./packages/*\"clean",
"taze": "taze -I -r -w",
"up": "pnpm update --i --L",
"bump": "changeset",
Expand All @@ -29,9 +27,9 @@
"devDependencies": {
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.1",
"@minko-fe/eslint-config": "latest",
"@minko-fe/eslint-config": "^2.0.9",
"@minko-fe/lodash-pro": "latest",
"@minko-fe/tsconfig": "latest",
"@minko-fe/tsconfig": "^2.0.7",
"@testing-library/react": "^14.0.0",
"@types/fs-extra": "^11.0.1",
"@types/node": "^18.17.15",
Expand All @@ -42,14 +40,13 @@
"chokidar": "^3.5.3",
"conventional-changelog-cli": "^2.2.2",
"esbuild": "^0.17.19",
"eslint": "^8.52.0",
"eslint": "^8.56.0",
"fs-extra": "^11.1.1",
"get-tsconfig": "^4.7.0",
"joycon": "^3.1.1",
"jsdom": "^22.1.0",
"jsonc-simple-parser": "^3.0.0",
"picocolors": "^1.0.0",
"pnpm": "^8.7.5",
"prompts": "^2.4.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand All @@ -58,7 +55,7 @@
"taze": "^0.9.2",
"tiny-glob": "^0.2.9",
"tsup": "^6.7.0",
"tsx": "^3.12.9",
"tsx": "^4.7.0",
"turbo": "^1.12.2",
"typescript": "^5.2.2",
"validate-npm-package-name": "^5.0.0",
Expand Down
7 changes: 7 additions & 0 deletions packages/axios-pro/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @minko-fe/axios-pro

## 0.1.18

### Patch Changes

- Updated dependencies []:
- @minko-fe/lodash-pro@0.2.0

## 0.1.17

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/axios-pro/__tests__/basic.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import nock from 'nock'
import { AxiosPro, ContentTypeEnum, type CreateAxiosOptions, type RequestOptions, type Result } from '../src'
import { AxiosPro, CONTENT_TYPE, type CreateAxiosOptions, type RequestOptions, type Result } from '../src'

const API_URL = 'http://api.example.com'

Expand All @@ -12,7 +12,7 @@ describe('AxiosPro', () => {
beforeEach(() => {
axiosOptions = {
timeout: 30 * 1000,
headers: { 'Content-Type': ContentTypeEnum.JSON },
headers: { 'Content-Type': CONTENT_TYPE.JSON },
}

requestOptions = {
Expand Down
2 changes: 1 addition & 1 deletion packages/axios-pro/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@minko-fe/axios-pro",
"version": "0.1.17",
"version": "0.1.18",
"description": "axios-pro",
"type": "module",
"keywords": [
Expand Down
7 changes: 7 additions & 0 deletions packages/flexible-pro/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @minko-fe/flexible-pro

## 0.1.18

### Patch Changes

- Updated dependencies []:
- @minko-fe/lodash-pro@0.2.0

## 0.1.17

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/flexible-pro/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@minko-fe/flexible-pro",
"version": "0.1.17",
"version": "0.1.18",
"description": "flexible-pro",
"type": "module",
"keywords": [
Expand Down
6 changes: 6 additions & 0 deletions packages/lodash-pro/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @minko-fe/lodash-pro

## 0.2.0

### Minor Changes

- refactor deps

## 0.1.17

### Patch Changes
Expand Down
11 changes: 6 additions & 5 deletions packages/lodash-pro/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@minko-fe/lodash-pro",
"version": "0.1.17",
"version": "0.2.0",
"description": "lodash-pro",
"type": "module",
"keywords": [
Expand Down Expand Up @@ -28,18 +28,19 @@
}
},
"scripts": {
"dev": "rimraf dist && tsx scripts/dev",
"build": "rimraf dist && tsx scripts/build",
"dev": "tsx scripts/dev",
"build": "tsx scripts/build",
"release": "pnpm run build && pnpm publish --access public",
"test": "vitest --run",
"lint": "eslint .",
"clean": "rimraf node_modules",
"up": "taze -I -w"
},
"dependencies": {
"@types/lodash-es": "^4.17.9",
"@types/lodash-es": "^4.17.9"
},
"devDependencies": {
"deepmerge": "^4.3.1",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21"
}
}
9 changes: 5 additions & 4 deletions packages/lodash-pro/scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ import { build } from '~scripts/build'
import tsupConfig from './tsup.config'

build({
dts: false,
format: ['cjs'],
...tsupConfig('cjs'),
...tsupConfig,
dts: false,
})

build({
dts: {
banner: '/// <reference types="lodash-es" />',
banner: '/// <reference types="lodash-es" />\n',
resolve: ['deepmerge'],
},
format: ['esm'],
...tsupConfig('esm'),
...tsupConfig,
})
40 changes: 4 additions & 36 deletions packages/lodash-pro/scripts/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,5 @@
import { type Plugin } from 'esbuild'
import { type Format, type Options } from 'tsup'
import { type Options } from 'tsup'

function escapeRegExp(str: string) {
return str.replaceAll(/[$()*+.?[\\\]^{|}]/g, '\\$&')
}

function alias(options: Record<string, string>, format: Format): Plugin {
const aliases = Object.keys(options)
const re = new RegExp(`^(${aliases.map((x) => escapeRegExp(x)).join('|')})$`)

return {
name: 'alias',
setup(build) {
build.onResolve({ filter: re }, (args) => {
return {
path: format === 'cjs' ? options[args.path] : args.path,
external: true,
sideEffects: false,
}
})
},
}
}

export default (format: Format) =>
({
noExternal: ['lodash', 'lodash-es'],
esbuildPlugins: [
alias(
{
'lodash-es': 'lodash',
},
format,
),
],
}) as Options
export default {
noExternal: ['lodash-es'],
} as Options
3 changes: 2 additions & 1 deletion packages/lodash-pro/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ export { isPromise } from './isPromise'
export { isRegExp } from './isRegExp'
export { isString } from './isString'
export { isUndefined } from './isUndefined'
export { KeyCode } from './keycode'
export { noop } from './noop'
export { strategyPattern } from './strategyPattern'
export { timeRange } from './timeRange'
// eslint-disable-next-line perfectionist/sort-exports
export { KeyCode } from './keycode'
7 changes: 7 additions & 0 deletions packages/postcss-config/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @minko-fe/postcss-config

## 0.1.18

### Patch Changes

- Updated dependencies []:
- @minko-fe/lodash-pro@0.2.0

## 0.1.17

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@minko-fe/postcss-config",
"version": "0.1.17",
"version": "0.1.18",
"description": "postcss-config",
"type": "module",
"keywords": [
Expand Down
8 changes: 8 additions & 0 deletions packages/react-component/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @minko-fe/react-component

## 0.1.18

### Patch Changes

- Updated dependencies []:
- @minko-fe/react-hook@0.2.0
- @minko-fe/lodash-pro@0.2.0

## 0.1.17

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/react-component/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@minko-fe/react-component",
"version": "0.1.17",
"version": "0.1.18",
"description": "react-component",
"type": "module",
"keywords": [
Expand Down
12 changes: 12 additions & 0 deletions packages/react-hook/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @minko-fe/react-hook

## 0.2.0

### Minor Changes

- add `useSetState` plugin
refactor deps

### Patch Changes

- Updated dependencies []:
- @minko-fe/lodash-pro@0.2.0

## 0.1.17

### Patch Changes
Expand Down
14 changes: 4 additions & 10 deletions packages/react-hook/__tests__/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
// @vitest-environment jsdom

import { act, renderHook } from '@testing-library/react'
import { describe, expect, test } from 'vitest'
import { describe, expect } from 'vitest'
import { useControlledState } from '../src/useControlledState'
import { useStrictInput } from '../src/useStrictInput'

describe('condition', () => {
test('test', () => {
expect(1).toBe(1)
})
})

describe('useControlledState', () => {
it('should be return default value', () => {
const { result } = renderHook(() =>
Expand Down Expand Up @@ -58,7 +52,7 @@ describe('useControlledState', () => {
expect(val).toBe('controlled')
})

it('should not be callback onchange that is not controlled state', () => {
it('should change', () => {
let val = ''
const { result } = renderHook(() =>
useControlledState({
Expand All @@ -72,10 +66,10 @@ describe('useControlledState', () => {
const [, setValue] = result.current

act(() => {
setValue('controlled')
setValue('changed')
})

expect(val).toBe('')
expect(val).toBe('changed')
})
})

Expand Down
16 changes: 8 additions & 8 deletions packages/react-hook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@minko-fe/react-hook",
"version": "0.1.17",
"version": "0.2.0",
"description": "react-hook",
"type": "module",
"keywords": [
Expand Down Expand Up @@ -40,8 +40,8 @@
}
},
"scripts": {
"dev": "rimraf dist && tsx scripts/dev",
"build": "rimraf dist && tsx scripts/build",
"dev": "tsx scripts/dev",
"build": "tsx scripts/build",
"release": "pnpm run build && pnpm publish --access public",
"test": "vitest --run",
"lint": "eslint .",
Expand All @@ -58,14 +58,14 @@
}
},
"dependencies": {
"@minko-fe/lodash-pro": "workspace:*",
"ahooks": "^3.7.8",
"query-string": "7.1.3",
"react-use": "^17.4.0"
"@minko-fe/lodash-pro": "workspace:*"
},
"devDependencies": {
"ahooks": "^3.7.8",
"query-string": "7.1.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.15.0"
"react-router-dom": "^6.15.0",
"react-use": "^17.4.0"
}
}
3 changes: 3 additions & 0 deletions packages/react-hook/scripts/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ export default {
index: 'src/index.ts',
useUrlState: 'src/useUrlState.ts',
},
dts: {
resolve: true,
},
} as Options
Loading

0 comments on commit 0aad45d

Please sign in to comment.