feat: 初始化

This commit is contained in:
NICE CODE BY DEV 2023-11-29 15:48:08 +08:00
commit c79df9aea1
34 changed files with 15810 additions and 0 deletions

8
.changeset/README.md Normal file
View File

@ -0,0 +1,8 @@
# Changesets
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

11
.changeset/config.json Normal file
View File

@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}

20
.dumirc.ts Normal file
View File

@ -0,0 +1,20 @@
import { defineConfig } from 'dumi';
import path from 'path';
export default defineConfig({
outputPath: 'docs-dist',
themeConfig: {
name: 'zhst前端库',
},
alias: {
'@zhst/hooks': path.join(__dirname, 'packages/demo/src'),
},
resolve: {
docDirs: ['docs'],
atomDirs: [{ type: 'demo', dir: 'packages/demo/src' }],
},
monorepoRedirect: {
srcDir: ['packages', 'src'],
peerDeps: true,
},
});

13
.editorconfig Normal file
View File

@ -0,0 +1,13 @@
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

3
.eslintrc.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = {
extends: require.resolve('@umijs/lint/dist/config/eslint'),
};

6
.fatherrc.ts Normal file
View File

@ -0,0 +1,6 @@
import { defineConfig } from 'father';
export default defineConfig({
// more father config: https://github.com/umijs/father/blob/master/docs/config.md
esm: { output: 'dist' },
});

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
node_modules
/dist
.dumi/tmp
.dumi/tmp-test
.dumi/tmp-production
.DS_Store

4
.husky/commit-msg Normal file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx commitlint --edit "${1}"

4
.husky/pre-commit Normal file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx lint-staged

2
.prettierignore Normal file
View File

@ -0,0 +1,2 @@
/dist
*.yaml

19
.prettierrc.js Normal file
View File

@ -0,0 +1,19 @@
module.exports = {
pluginSearchDirs: false,
plugins: [
require.resolve('prettier-plugin-organize-imports'),
require.resolve('prettier-plugin-packagejson'),
],
printWidth: 80,
proseWrap: 'never',
singleQuote: true,
trailingComma: 'all',
overrides: [
{
files: '*.md',
options: {
proseWrap: 'preserve',
},
},
],
};

3
.stylelintrc Normal file
View File

@ -0,0 +1,3 @@
{
"extends": "@umijs/lint/dist/config/stylelint"
}

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) dev<710328466@qq.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

40
README.md Normal file
View File

@ -0,0 +1,40 @@
# @zhst
[![NPM version](https://img.shields.io/npm/v/@zhst.svg?style=flat)](https://npmjs.org/package/@zhst)
[![NPM downloads](http://img.shields.io/npm/dm/@zhst.svg?style=flat)](https://npmjs.org/package/@zhst)
zhst 工具库合集
## Usage
TODO
## Options
TODO
## Development
```bash
# install dependencies
$ pnpm install
# develop library by docs demo
$ pnpm start
# build library source code
$ pnpm run build
# build library source code in watch mode
$ pnpm run build:watch
# build docs
$ pnpm run docs:build
# check your project for potential problems
$ pnpm run doctor
```
## LICENSE
MIT

18
docs/index.md Normal file
View File

@ -0,0 +1,18 @@
---
hero:
title: zhst
description: 前端工具库合集
actions:
- text: 快速上手
link: /
features:
- title: 快速
emoji: 💎
description: Put hello description here
- title: 高效
emoji: 🌈
description: Put world description here
- title: 先进
emoji: 🚀
description: Put ! description here
---

15
lerna.json Normal file
View File

@ -0,0 +1,15 @@
{
"version": "independent",
"packages": ["packages/*"],
"useWorkspaces": true,
"npmClient": "pnpm",
"command": {
"publish": {
"registry": "https://registry.npmjs.org/"
},
"version": {
"conventionalCommits": true,
"message": "chore(release): publish"
}
}
}

79
package.json Normal file
View File

@ -0,0 +1,79 @@
{
"name": "@zhst",
"version": "0.0.1",
"description": "zhst 工具库合集",
"license": "MIT",
"main": "src/index.ts",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "pnpm --filter=@zhst/* run build",
"build:watch": "father dev",
"dev": "dumi dev",
"docs:build": "dumi build",
"doctor": "father doctor",
"lint": "npm run lint:es && npm run lint:css",
"lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
"lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
"prepare": "husky install && dumi setup",
"prepublishOnly": "father doctor && npm run build",
"start": "npm run dev"
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"lint-staged": {
"*.{md,json}": [
"prettier --write --no-error-on-unmatched-pattern"
],
"*.{css,less}": [
"stylelint --fix",
"prettier --write"
],
"*.{js,jsx}": [
"eslint --fix",
"prettier --write"
],
"*.{ts,tsx}": [
"eslint --fix",
"prettier --parser=typescript --write"
]
},
"devDependencies": {
"@changesets/cli": "^2.27.1",
"@commitlint/cli": "^17.1.2",
"@commitlint/config-conventional": "^17.1.0",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"@umijs/lint": "^4.0.0",
"dumi": "^2.2.13",
"eslint": "^8.23.0",
"father": "^4.1.0",
"husky": "^8.0.1",
"lerna": "^8.0.0",
"lint-staged": "^13.0.3",
"prettier": "^2.7.1",
"prettier-plugin-organize-imports": "^3.0.0",
"prettier-plugin-packagejson": "^2.2.18",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"stylelint": "^14.9.1"
},
"peerDependencies": {
"react": ">=16.9.0",
"react-dom": ">=16.9.0"
},
"publishConfig": {
"access": "public",
"main": "lib/index.js",
"typings": "lib/index.d.ts"
},
"authors": [
"dev<710328466@qq.com>"
]
}

View File

@ -0,0 +1,7 @@
import { defineConfig } from 'father';
export default defineConfig({
// more father config: https://github.com/umijs/father/blob/master/docs/config.md
esm: { output: 'es' },
cjs: { output: 'lib' },
});

5
packages/hooks/es/Foo/index.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
import { type FC } from 'react';
declare const Foo: FC<{
title: string;
}>;
export default Foo;

View File

@ -0,0 +1,5 @@
import React from 'react';
let Foo = function Foo(props) {
return /*#__PURE__*/React.createElement("h4", null, "\u6D4B\u8BD5\uFF1A", props.title);
};
export default Foo;

2
packages/hooks/es/index.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
import Foo from './Foo';
export { Foo };

View File

@ -0,0 +1,2 @@
import Foo from "./Foo";
export { Foo };

5
packages/hooks/lib/Foo/index.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
import { type FC } from 'react';
declare const Foo: FC<{
title: string;
}>;
export default Foo;

View File

@ -0,0 +1,37 @@
let __create = Object.create;
let __defProp = Object.defineProperty;
let __getOwnPropDesc = Object.getOwnPropertyDescriptor;
let __getOwnPropNames = Object.getOwnPropertyNames;
let __getProtoOf = Object.getPrototypeOf;
let __hasOwnProp = Object.prototype.hasOwnProperty;
let __export = (target, all) => {
for (let name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
let __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
let __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
let __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/Foo/index.tsx
let Foo_exports = {};
__export(Foo_exports, {
default: () => Foo_default
});
module.exports = __toCommonJS(Foo_exports);
let import_react = __toESM(require("react"));
let Foo = (props) => /* @__PURE__ */ import_react.default.createElement("h4", null, "测试:", props.title);
var Foo_default = Foo;

2
packages/hooks/lib/index.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
import Foo from './Foo';
export { Foo };

View File

@ -0,0 +1,39 @@
let __create = Object.create;
let __defProp = Object.defineProperty;
let __getOwnPropDesc = Object.getOwnPropertyDescriptor;
let __getOwnPropNames = Object.getOwnPropertyNames;
let __getProtoOf = Object.getPrototypeOf;
let __hasOwnProp = Object.prototype.hasOwnProperty;
let __export = (target, all) => {
for (let name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
let __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
let __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
let __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.tsx
let src_exports = {};
__export(src_exports, {
Foo: () => import_Foo.default
});
module.exports = __toCommonJS(src_exports);
var import_Foo = __toESM(require("./Foo"));
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Foo
});

View File

@ -0,0 +1,29 @@
{
"name": "@zhst/hooks",
"version": "0.0.1",
"description": "hooks合集",
"keywords": [
"hooks"
],
"license": "ISC",
"author": "dev",
"sideEffects": [
"dist/*",
"es/**/style/*",
"lib/**/style/*",
"*.less"
],
"main": "lib/index.tsx",
"module": "es/index.js",
"typings": "es/index.d.ts",
"files": [
"es",
"lib"
],
"scripts": {
"build": "father build"
},
"publishConfig": {
"access": "public"
}
}

View File

@ -0,0 +1,10 @@
# Foo
This is an example component.
```jsx
import React from 'react';
import { Foo } from '@zhst/hooks';
export default () => <Foo title="Hello dumi!" />;
```

View File

@ -0,0 +1,5 @@
import React, { type FC } from 'react';
const Foo: FC<{ title: string }> = (props) => <h4>{props.title}</h4>;
export default Foo;

View File

@ -0,0 +1,5 @@
import Foo from './Foo'
export {
Foo
}

15362
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff

7
pnpm-workspace.yaml Normal file
View File

@ -0,0 +1,7 @@
packages:
# all packages in direct subdirs of packages/
- 'packages/*'
# all packages in subdirs of components/
- 'components/**'
# exclude packages that are inside test directories
- '!**/test/**'

15
tsconfig.json Normal file
View File

@ -0,0 +1,15 @@
{
"compilerOptions": {
"strict": true,
"declaration": true,
"skipLibCheck": true,
"esModuleInterop": true,
"jsx": "react",
"baseUrl": "./",
"paths": {
"@@/*": [".dumi/tmp/*"],
"@zhst/*": ["src/*", "*"]
}
},
"include": [".dumirc.ts", "src/**/*", "packages/**/*"]
}

1
vueuse Submodule

@ -0,0 +1 @@
Subproject commit dd00d926856e8c208d0d569c17f67d9653f2451d