Skip to content

Commit

Permalink
chore: refactor to inner monorepo (sub repo)
Browse files Browse the repository at this point in the history
  • Loading branch information
vikiboss committed Sep 2, 2024
1 parent 0c4a261 commit 556f4d4
Show file tree
Hide file tree
Showing 670 changed files with 1,823 additions and 1,654 deletions.
13 changes: 4 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
node_modules

dist
build
plans
graph.png

.DS_Store
*.tsbuildinfo

**/docusaurus-plugin-content-docs/current
**/docusaurus-plugin-content-docs-hooks/current


dist
build
docs-dist
coverage
4 changes: 2 additions & 2 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"enabled": true
},
"files": {
"include": ["./src/**/*", "./docs/**/*", "./testing/**/*"],
"ignore": ["./src/utils/react-fast-compare.ts", "./docs/hooks.json"],
"include": ["./packages/**/*", "./docs/**/*", "./testing/**/*", "./*.ts"],
"ignore": ["./**/react-fast-compare.ts", "hooks.json", "./**/.next"],
"ignoreUnknown": true
},
"linter": {
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/en/docs/get-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function App() {
}
```

import { App } from '@/../../src/use-async-fn/demo'
import { App } from '../../../../packages/react-use/src/use-async-fn/demo'

<App />

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/zh-cn/docs/get-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function App() {
}
```

import { App } from '@/../../src/use-async-fn/demo'
import { App } from '../../../../packages/react-use/src/use-async-fn/demo'

<App />

Expand Down
7 changes: 4 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
"predev": "pnpm run update:hooks",
"dev": "rspress dev",
"prebuild": "pnpm run update:hooks",
"build": "esno ./scripts/build-documentation.ts",
"release": "esno ./scripts/release-documentation.ts",
"preview": "rspress preview"
"build": "esno ./scripts/build-docs.ts",
"release": "esno ./scripts/release-docs.ts",
"preview": "rspress preview",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@formkit/auto-animate": "^0.8.2",
Expand Down
2 changes: 1 addition & 1 deletion docs/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions docs/rspress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { defineConfig } from 'rspress/config'

import hooks from './hooks.json'
import i18n from './i18n.json'
import { locale, version } from './locale'
import { locale } from './locale'

import type { RspressPlugin } from '@rspress/shared'

Expand Down Expand Up @@ -72,14 +72,13 @@ export default defineConfig({
},
source: {
alias: {
'@shined/react-use': path.resolve(__dirname, './node_modules/@shined/react-use'),
'@/components': path.resolve(__dirname, './src/components'),
'@@': path.resolve(__dirname, './'),
'@': path.resolve(__dirname, './src'),
'@shined/react-use': path.resolve(__dirname, './node_modules/@shined/react-use'),
},
define: {
'process.env.ASSETS_PREFIX': JSON.stringify(assetsPrefix),
'process.env.IS_SODOC': JSON.stringify(process.env.IS_SODOC),
'process.env.REACT_USE_VERSION': JSON.stringify(version),
},
},
},
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/scripts/generate-hooks-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import grayMatter from 'gray-matter'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)

const hooksSrc = resolve(__dirname, '../../src')
const hooksSrc = resolve(__dirname, '../../packages/react-use/src')
const ignoredDirs = ['utils', 'use-track-ref-state', 'use-versioned-action', 'use-web-observer']

const dirents = await fs.readdir(hooksSrc, { withFileTypes: true })
Expand Down
File renamed without changes.
10 changes: 9 additions & 1 deletion docs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"lib": ["DOM", "ESNext"],
"target": "ES2020",
"resolveJsonModule": true,
"skipLibCheck": true,
"typeRoots": ["./node_modules/@types", "../packages/react-use/node_modules/@types"],
"paths": {
"@shined/react-use": ["./node_modules/@shined/react-use"],
"@/components": ["./src/components"],
Expand All @@ -13,7 +15,13 @@
"i18n": ["./i18n.json"]
}
},
"include": ["./global.d.ts", "./src/**/*", "./docs/**/*", "../src/**/demo.tsx", "../src/**/*.mdx"],
"include": [
"./global.d.ts",
"./src/**/*",
"./docs/**/*",
"../packages/react-use/src/**/demo.tsx",
"../packages/react-use/src/**/*.mdx"
],
"references": [{ "path": "./tsconfig.node.json" }],
"mdx": {
"checkMdx": true
Expand Down
2 changes: 1 addition & 1 deletion docs/tsconfig.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"target": "esnext",
"resolveJsonModule": true
},
"include": ["./scripts/**/*", "./locale.ts", "./rspress.config.ts"]
"include": ["./scripts/**/*"]
}
2 changes: 1 addition & 1 deletion examples/vite-unocss-csr/uno.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineConfig, presetUno, presetIcons, presetAttributify } from 'unocss'
import { defineConfig, presetAttributify, presetIcons, presetUno } from 'unocss'

export default defineConfig({
presets: [
Expand Down
99 changes: 13 additions & 86 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,112 +1,41 @@
{
"name": "@shined/react-use",
"name": "shined-react-use-monorepo",
"type": "module",
"private": true,
"version": "1.6.0",
"packageManager": "[email protected]",
"description": "A New Programming Paradigm to Reshape React Development.",
"author": "Viki <[email protected]> (https://github.com/vikiboss)",
"packageManager": "[email protected]",
"license": "MIT",
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": {
"import": "./dist/index.d.ts",
"require": "./dist/index.d.cts"
},
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"./package.json": "./package.json"
},
"keywords": [
"react",
"react-use",
"react-hooks",
"shined"
],
"files": [
"dist"
],
"homepage": "https://sheinsight.github.io/react-use/",
"sideEffects": false,
"repository": {
"type": "git",
"url": "git+https://github.com/sheinsight/react-use.git"
},
"bugs": "https://github.com/sheinsight/react-use/issues",
"typesVersions": {
"*": {
"*": [
"./dist/*"
]
}
},
"scripts": {
"dev": "tsup --watch",
"build": "tsup",
"lint": "biome check && oxlint && pnpm run typecheck",
"dev": "pnpm -r --filter='@shined/*' dev",
"build": "pnpm -r --filter='@shined/*' build",
"lint": "biome check && oxlint && pnpm typecheck",
"lint:fix": "biome check --write --unsafe && oxlint --fix",
"prepack": "clean-pkg-json",
"prerelease": "pnpm run lint",
"prerelease": "pnpm lint",
"release": "bumpp",
"postrelease": "pnpm run changelog && git add CHANGELOG.md && git commit -m 'chore: update changelog' && git push",
"postrelease": "pnpm changelog && git add CHANGELOG.md && git commit -m 'chore: update changelog' && git push",
"test": "vitest",
"test:ci": "pnpm run build && pnpm run lint && vitest",
"docs:dev": "pnpm run build && pnpm -C docs run dev",
"docs:build": "pnpm install && pnpm run build && pnpm -C docs run build",
"docs:release": "pnpm -C docs run release",
"test:ci": "pnpm build && pnpm lint && vitest",
"docs:dev": "pnpm build && pnpm -C docs dev",
"docs:build": "pnpm install && pnpm build && pnpm -C docs build",
"docs:release": "pnpm -C docs release",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
"typecheck": "tsc --noEmit",
"typecheck": "pnpm -r typecheck",
"prepare": "is-ci || husky"
},
"lint-staged": {
"*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": [
"biome check --write --unsafe --no-errors-on-unmatched"
]
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/",
"provenance": true
},
"peerDependenciesMeta": {
"react": {
"optional": true
},
"react-dom": {
"optional": true
},
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
},
"@types/web-bluetooth": {
"optional": true
}
},
"peerDependencies": {
"@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"@types/react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
"@types/web-bluetooth": "*",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
"devDependencies": {
"@biomejs/biome": "1.8.1",
"@shined/reactive": "^0.1.4",
"@swc/core": "^1.7.11",
"@testing-library/jest-dom": "^6.4.8",
"@testing-library/react": "^15.0.7",
"@types/node": "^20.14.15",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@types/web-bluetooth": "^0.0.20",
"bumpp": "^9.5.1",
"clean-pkg-json": "^1.2.0",
"conventional-changelog-cli": "^5.0.0",
"esno": "^4.7.0",
"husky": "^9.1.4",
Expand All @@ -116,9 +45,7 @@
"oxlint": "^0.4.4",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"tsup": "^8.2.4",
"typescript": "^5.5.4",
"unocss": "^0.59.4",
"vitest": "^2.0.5"
}
}
77 changes: 77 additions & 0 deletions packages/react-use/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"name": "@shined/react-use",
"type": "module",
"version": "1.6.0",
"description": "A New Programming Paradigm to Reshape React Development.",
"author": "Viki <[email protected]> (https://github.com/vikiboss)",
"license": "MIT",
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": {
"import": "./dist/index.d.ts",
"require": "./dist/index.d.cts"
},
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"./package.json": "./package.json"
},
"keywords": ["react", "react-use", "react-hooks", "shined"],
"files": ["dist"],
"homepage": "https://sheinsight.github.io/react-use/",
"sideEffects": false,
"repository": {
"type": "git",
"url": "git+https://github.com/sheinsight/react-use.git"
},
"bugs": "https://github.com/sheinsight/react-use/issues",
"scripts": {
"dev": "tsup --watch",
"build": "tsup",
"prepack": "clean-pkg-json",
"typecheck": "tsc --noEmit"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/",
"provenance": true
},
"peerDependenciesMeta": {
"react": {
"optional": true
},
"react-dom": {
"optional": true
},
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
},
"@types/web-bluetooth": {
"optional": true
}
},
"peerDependencies": {
"@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"@types/react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
"@types/web-bluetooth": "*",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
"devDependencies": {
"@swc/core": "^1.7.11",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@types/web-bluetooth": "^0.0.20",
"clean-pkg-json": "^1.2.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"tsup": "^8.2.4",
"typescript": "^5.5.4"
}
}
Loading

0 comments on commit 556f4d4

Please sign in to comment.