Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoKam committed Sep 1, 2023
0 parents commit 481c535
Show file tree
Hide file tree
Showing 30 changed files with 9,277 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -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)
14 changes: 14 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": [],
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"updateInternalDependents": "always"
}
}
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 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

[Makefile]
indent_style = tab
21 changes: 21 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
extends: '@orca-fe',
settings: {
'import/resolver': {
alias: {
map: [['@orca-fe/vite-plugin-react-convention-routes', './packages/vite-plugin-react-convention-routes/src']],
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json'],
},
},
},
rules: {
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }],
'@typescript-eslint/consistent-type-exports': ['error'],
'max-len': ['error', 160],
'react/jsx-max-depth': ['off'],
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
},
};
22 changes: 22 additions & 0 deletions .fatherrc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { defineConfig } from 'father';

export default defineConfig({
esm: {
output: 'es',
targets: { chrome: 49 },
},
cjs: {
output: 'lib',
transformer: 'babel',
targets: { ie: 11 },
extraBabelPlugins: [
[
'babel-plugin-import',
{
libraryName: 'antd',
style: true,
},
],
],
},
});
30 changes: 30 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: Publish

on:
push:
branches:
- master

jobs:
replace-package-json-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- name: install dependencies
run: |
npm i pnpm -g
pnpm i
- name: publish
run: npm run pub:only
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
33 changes: 33 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/npm-debug.log*
/yarn-error.log
#/yarn.lock
/package-lock.json

# production
/dist
#/docs-dist

# misc
.DS_Store

# umi
.dumi/tmp
.dumi/tmp-test
.dumi/tmp-production
.env.local

# ide
/.vscode
/.idea

/docs-dist/
/packages/*/lib/
/packages/*/es/
/packages/*/esm/
/packages/*/dist/
/packages/*/node_modules/

4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run lint-staged
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
registry=https://registry.npmmirror.com/
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
**/*.svg
**/*.ejs
**/*.html
**/*.less
package.json
.umi
.umi-production
.umi-test
11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"singleQuote": true,
"trailingComma": "all",
"printWidth": 150,
"overrides": [
{
"files": ".prettierrc",
"options": { "parser": "json" }
}
]
}
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Monorepo template

多模块项目模板

## 如何添加模块

参考 `packages/demo-comp` 示例模块的结构,在 `packages` 目录下添加新模块。

### 注意事项

- 模块的 `package.json` 中的 `name` 字段,请修改为你的模块名称,且和目录名称保持一致(参考 demo-comp 的结构)。
-`.dumirc.ts` 文件中的 `resolve.atomDirs` 中,参考 demo-comp,添加新的文档目录入口。
-`.dumirc.ts` 文件中的 `alias` 中,添加你的 `组件名称``代码路径` 的映射,以便 `dumi` 识别。
-`tsconfig.json` 中的 `compilerOptions.paths` 中,添加你的 `组件名称``代码路径` 的映射,以便 `TypeScript` 插件识别。注意,根目录下的 `tsconfig.json` 以及你的目录下的 `tsconfig.json` 都需要添加。
-`.eslintrc.cjs` 中的 `settings``'import/resolver'.alias.map` 中,添加你的 `组件名称``代码路径` 的映射,以便 `eslint` 插件识别。

## 编写代码

`packages/组件名/src` 目录下编写你的代码。并通过 `src/index` 导出你的组件内容。

## 编写文档

`packages/组件名/docs/index.md` 目录下编写你的文档。如需要多语言支持,请命名为 `index.zh-CN.md``index.en.md` 等。

## 编写测试用例

`packages/组件名/__tests__` 目录下编写你的测试用例。参考 `jest` 的书写规范即可。

## 版本管理

当你添加/修改了某个组件代码后,准备更新版本时(先不要提交代码),执行 `npm run c` 调用 `changesets`

`changesets` 会自动检测你的代码变更,并指引你选择需要变更版本的模块。当选择完毕后,`changesets` 会帮助你修改 `package.json` 中的版本号,并自动生成 `CHANGELOG.md`

当你检查版本号生成无误后,就可以提交代码,由流水线执行编译并发布组件和文档。
13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
5 changes: 5 additions & 0 deletions jest.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};
58 changes: 58 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"private": true,
"name": "monorepo-template",
"description": "monorepo template",
"version": "1.0.0",
"type": "module",
"scripts": {
"start": "vite",
"docs:build": "vite build",
"docs:serve": "http-server docs-dist --spa",
"build": "npm run pub:only && npm run docs:build",
"deploy": "npm run docs:build && npm run docs:deploy",
"c": "changeset && changeset version",
"pub:only": "npm run test && changeset publish",
"pub": "npm run pub:only && git push",
"prettier": "prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"",
"lint-staged": "lint-staged",
"test": "pnpm --filter=@orca-fe/* run test ",
"postinstall": "husky install"
},
"lint-staged": {
"*.{js,jsx,less,md,json}": [
"prettier --write"
],
"*.ts?(x)": [
"prettier --parser=typescript --write",
"eslint --fix"
]
},
"dependencies": {
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"@vitejs/plugin-react": "^4.0.3",
"eslint": "^8.45.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"vite": "^4.4.5",
"@changesets/cli": "^2.26.1",
"@types/react-router": "^5.1.20",
"father": "^4.2.2",
"husky": "^8.0.3",
"lint-staged": "^13.2.2",
"prettier": "^2.8.8",
"ts-jest": "^29.1.0",
"tslib": "^2.5.2",
"typescript": "^5.1.3",
"@orca-fe/eslint-config": "^2.3.3",
"@types/jest": "^29.5.2",
"@types/node": "^18.16.16",
"cross-env": "^7.0.3",
"jest": "^29.5.0",
"ts-node": "^10.9.1"
}
}
5 changes: 5 additions & 0 deletions packages/vite-plugin-react-convention-routes/.fatherrc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { defineConfig } from 'father';

export default defineConfig({
extends: '../../.fatherrc.ts',
});
21 changes: 21 additions & 0 deletions packages/vite-plugin-react-convention-routes/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 NicoKam

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.
1 change: 1 addition & 0 deletions packages/vite-plugin-react-convention-routes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# `@orca-fe/pdf-transformer`
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

describe('@orca-fe/vite-plugin-react-convention-routes', () => {
it('needs tests', () => {});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('../../jest.config.cjs');
42 changes: 42 additions & 0 deletions packages/vite-plugin-react-convention-routes/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "@orca-fe/vite-plugin-react-convention-routes",
"version": "0.0.1",
"description": "Demo component descriptions.",
"keywords": [
"react",
"component"
],
"author": "NicoKam",
"license": "MIT",
"types": "es/index.d.ts",
"module": "es/index.js",
"main": "lib/index.js",
"files": [
"dist",
"es",
"lib"
],
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git"
},
"scripts": {
"build": "father build",
"prepublishOnly": "npm run build",
"test": "jest --passWithNoTests",
"clear": "rimraf lib es"
},
"dependencies": {
"tslib": "^2.5.2"
},
"peerDependencies": {
"react": ">=16.8.0",
"react-dom": ">=16.8.0"
},
"devDependencies": {
"@types/react": "^18.2.7",
"jss": "^10.10.0"
}
}
1 change: 1 addition & 0 deletions packages/vite-plugin-react-convention-routes/src/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default () => <div>I am DemoComp</div>;
9 changes: 9 additions & 0 deletions packages/vite-plugin-react-convention-routes/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@orca-fe/vite-plugin-react-convention-routes": ["./src"]
}
}
}
Loading

0 comments on commit 481c535

Please sign in to comment.