@linyjs/plugin-docs 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +97 -0
- package/docs/api-reference/index.md +341 -0
- package/docs/best-practices/error-handling.md +462 -0
- package/docs/best-practices/naming-conventions.md +495 -0
- package/docs/best-practices/performance.md +532 -0
- package/docs/best-practices/security.md +620 -0
- package/docs/faq.md +323 -0
- package/docs/getting-started/first-plugin.md +358 -0
- package/docs/getting-started/installation.md +244 -0
- package/docs/getting-started/quick-start.md +174 -0
- package/docs/guides/client-module.md +598 -0
- package/docs/guides/data-persistence.md +536 -0
- package/docs/guides/permissions.md +440 -0
- package/docs/guides/server-module.md +371 -0
- package/docs/guides/ui-slots.md +475 -0
- package/docs/migration/v0-to-v1.md +354 -0
- package/examples/analytics-plugin/README.md +416 -0
- package/examples/analytics-plugin/dist/client/index.d.ts +36 -0
- package/examples/analytics-plugin/dist/client/index.js +173 -0
- package/examples/analytics-plugin/dist/index.d.ts +64 -0
- package/examples/analytics-plugin/dist/index.js +72 -0
- package/examples/analytics-plugin/dist/server/index.d.ts +119 -0
- package/examples/analytics-plugin/dist/server/index.js +313 -0
- package/examples/analytics-plugin/package.json +28 -0
- package/examples/analytics-plugin/src/client/index.tsx +410 -0
- package/examples/analytics-plugin/src/index.ts +71 -0
- package/examples/analytics-plugin/src/server/index.ts +348 -0
- package/examples/analytics-plugin/tsconfig.json +21 -0
- package/examples/blog-plugin/README.md +316 -0
- package/examples/blog-plugin/dist/client/index.d.ts +22 -0
- package/examples/blog-plugin/dist/client/index.js +197 -0
- package/examples/blog-plugin/dist/server/index.d.ts +5 -0
- package/examples/blog-plugin/dist/server/index.js +220 -0
- package/examples/blog-plugin/package.json +24 -0
- package/examples/blog-plugin/src/client/index.tsx +405 -0
- package/examples/blog-plugin/src/server/index.ts +240 -0
- package/examples/blog-plugin/tsconfig.json +16 -0
- package/examples/hello-world/README.md +101 -0
- package/examples/hello-world/dist/client/index.d.ts +5 -0
- package/examples/hello-world/dist/client/index.js +80 -0
- package/examples/hello-world/dist/server/index.d.ts +5 -0
- package/examples/hello-world/dist/server/index.js +38 -0
- package/examples/hello-world/node_modules/.package-lock.json +61 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/HOOKS_USAGE.md +281 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/IMPLEMENTATION_SUMMARY.md +166 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/QUICK_REFERENCE.md +130 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/README.md +214 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/package.json +26 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/src/application.ts +50 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/src/comparison-example.tsx +229 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/src/di.ts +127 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/src/domain.ts +52 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/src/hooks-example.tsx +275 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/src/hooks.ts +175 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/src/index.ts +87 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/src/interfaces.ts +117 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/src/router.ts +49 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/tsconfig.json +10 -0
- package/examples/hello-world/node_modules/@linyjs/server-module-interface/package.json +21 -0
- package/examples/hello-world/node_modules/@linyjs/server-module-interface/src/application.ts +21 -0
- package/examples/hello-world/node_modules/@linyjs/server-module-interface/src/di.ts +127 -0
- package/examples/hello-world/node_modules/@linyjs/server-module-interface/src/domain.ts +75 -0
- package/examples/hello-world/node_modules/@linyjs/server-module-interface/src/index.ts +55 -0
- package/examples/hello-world/node_modules/@linyjs/server-module-interface/src/interfaces.ts +58 -0
- package/examples/hello-world/node_modules/@linyjs/server-module-interface/tsconfig.json +8 -0
- package/examples/hello-world/node_modules/@types/react/LICENSE +21 -0
- package/examples/hello-world/node_modules/@types/react/README.md +15 -0
- package/examples/hello-world/node_modules/@types/react/canary.d.ts +129 -0
- package/examples/hello-world/node_modules/@types/react/compiler-runtime.d.ts +4 -0
- package/examples/hello-world/node_modules/@types/react/experimental.d.ts +184 -0
- package/examples/hello-world/node_modules/@types/react/global.d.ts +166 -0
- package/examples/hello-world/node_modules/@types/react/index.d.ts +4369 -0
- package/examples/hello-world/node_modules/@types/react/jsx-dev-runtime.d.ts +33 -0
- package/examples/hello-world/node_modules/@types/react/jsx-runtime.d.ts +24 -0
- package/examples/hello-world/node_modules/@types/react/package.json +210 -0
- package/examples/hello-world/node_modules/@types/react/ts5.0/canary.d.ts +129 -0
- package/examples/hello-world/node_modules/@types/react/ts5.0/experimental.d.ts +184 -0
- package/examples/hello-world/node_modules/@types/react/ts5.0/global.d.ts +166 -0
- package/examples/hello-world/node_modules/@types/react/ts5.0/index.d.ts +4356 -0
- package/examples/hello-world/node_modules/@types/react/ts5.0/jsx-dev-runtime.d.ts +33 -0
- package/examples/hello-world/node_modules/@types/react/ts5.0/jsx-runtime.d.ts +24 -0
- package/examples/hello-world/node_modules/csstype/LICENSE +19 -0
- package/examples/hello-world/node_modules/csstype/README.md +291 -0
- package/examples/hello-world/node_modules/csstype/index.d.ts +22569 -0
- package/examples/hello-world/node_modules/csstype/index.js.flow +6863 -0
- package/examples/hello-world/node_modules/csstype/package.json +70 -0
- package/examples/hello-world/node_modules/react/LICENSE +21 -0
- package/examples/hello-world/node_modules/react/README.md +37 -0
- package/examples/hello-world/node_modules/react/cjs/react-compiler-runtime.development.js +24 -0
- package/examples/hello-world/node_modules/react/cjs/react-compiler-runtime.production.js +16 -0
- package/examples/hello-world/node_modules/react/cjs/react-compiler-runtime.profiling.js +16 -0
- package/examples/hello-world/node_modules/react/cjs/react-jsx-dev-runtime.development.js +338 -0
- package/examples/hello-world/node_modules/react/cjs/react-jsx-dev-runtime.production.js +14 -0
- package/examples/hello-world/node_modules/react/cjs/react-jsx-dev-runtime.profiling.js +14 -0
- package/examples/hello-world/node_modules/react/cjs/react-jsx-dev-runtime.react-server.development.js +370 -0
- package/examples/hello-world/node_modules/react/cjs/react-jsx-dev-runtime.react-server.production.js +40 -0
- package/examples/hello-world/node_modules/react/cjs/react-jsx-runtime.development.js +352 -0
- package/examples/hello-world/node_modules/react/cjs/react-jsx-runtime.production.js +34 -0
- package/examples/hello-world/node_modules/react/cjs/react-jsx-runtime.profiling.js +34 -0
- package/examples/hello-world/node_modules/react/cjs/react-jsx-runtime.react-server.development.js +370 -0
- package/examples/hello-world/node_modules/react/cjs/react-jsx-runtime.react-server.production.js +40 -0
- package/examples/hello-world/node_modules/react/cjs/react.development.js +1284 -0
- package/examples/hello-world/node_modules/react/cjs/react.production.js +542 -0
- package/examples/hello-world/node_modules/react/cjs/react.react-server.development.js +848 -0
- package/examples/hello-world/node_modules/react/cjs/react.react-server.production.js +423 -0
- package/examples/hello-world/node_modules/react/compiler-runtime.js +14 -0
- package/examples/hello-world/node_modules/react/index.js +7 -0
- package/examples/hello-world/node_modules/react/jsx-dev-runtime.js +7 -0
- package/examples/hello-world/node_modules/react/jsx-dev-runtime.react-server.js +7 -0
- package/examples/hello-world/node_modules/react/jsx-runtime.js +7 -0
- package/examples/hello-world/node_modules/react/jsx-runtime.react-server.js +7 -0
- package/examples/hello-world/node_modules/react/package.json +51 -0
- package/examples/hello-world/node_modules/react/react.react-server.js +7 -0
- package/examples/hello-world/node_modules/typescript/LICENSE.txt +55 -0
- package/examples/hello-world/node_modules/typescript/README.md +50 -0
- package/examples/hello-world/node_modules/typescript/SECURITY.md +41 -0
- package/examples/hello-world/node_modules/typescript/ThirdPartyNoticeText.txt +193 -0
- package/examples/hello-world/node_modules/typescript/bin/tsc +2 -0
- package/examples/hello-world/node_modules/typescript/bin/tsserver +2 -0
- package/examples/hello-world/node_modules/typescript/lib/_tsc.js +133818 -0
- package/examples/hello-world/node_modules/typescript/lib/_tsserver.js +659 -0
- package/examples/hello-world/node_modules/typescript/lib/_typingsInstaller.js +222 -0
- package/examples/hello-world/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +2122 -0
- package/examples/hello-world/node_modules/typescript/lib/de/diagnosticMessages.generated.json +2122 -0
- package/examples/hello-world/node_modules/typescript/lib/es/diagnosticMessages.generated.json +2122 -0
- package/examples/hello-world/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +2122 -0
- package/examples/hello-world/node_modules/typescript/lib/it/diagnosticMessages.generated.json +2122 -0
- package/examples/hello-world/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +2122 -0
- package/examples/hello-world/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +2122 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.d.ts +22 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.decorators.d.ts +384 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.decorators.legacy.d.ts +22 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +41 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.dom.d.ts +39429 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.dom.iterable.d.ts +571 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2015.collection.d.ts +147 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2015.core.d.ts +597 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2015.d.ts +28 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2015.generator.d.ts +77 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2015.iterable.d.ts +605 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2015.promise.d.ts +81 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2015.proxy.d.ts +128 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2015.reflect.d.ts +144 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2015.symbol.d.ts +46 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +326 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2016.array.include.d.ts +116 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2016.d.ts +21 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2016.full.d.ts +23 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2016.intl.d.ts +31 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts +21 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2017.d.ts +26 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2017.date.d.ts +31 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2017.full.d.ts +23 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2017.intl.d.ts +44 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2017.object.d.ts +49 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +135 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2017.string.d.ts +45 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +53 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +77 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +53 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2018.d.ts +24 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2018.full.d.ts +24 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2018.intl.d.ts +83 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2018.promise.d.ts +30 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2018.regexp.d.ts +37 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2019.array.d.ts +79 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2019.d.ts +24 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2019.full.d.ts +24 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2019.intl.d.ts +23 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2019.object.d.ts +33 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2019.string.d.ts +37 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2019.symbol.d.ts +24 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2020.bigint.d.ts +765 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2020.d.ts +27 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2020.date.d.ts +42 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2020.full.d.ts +24 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2020.intl.d.ts +474 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2020.number.d.ts +28 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2020.promise.d.ts +47 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +99 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2020.string.d.ts +44 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +41 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2021.d.ts +23 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2021.full.d.ts +24 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2021.intl.d.ts +166 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2021.promise.d.ts +48 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2021.string.d.ts +33 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2021.weakref.d.ts +78 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2022.array.d.ts +121 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2022.d.ts +25 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2022.error.d.ts +75 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2022.full.d.ts +24 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2022.intl.d.ts +145 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2022.object.d.ts +26 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2022.regexp.d.ts +39 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2022.string.d.ts +25 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2023.array.d.ts +924 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2023.collection.d.ts +21 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2023.d.ts +22 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2023.full.d.ts +24 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2023.intl.d.ts +56 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts +65 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2024.collection.d.ts +29 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2024.d.ts +26 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2024.full.d.ts +24 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2024.object.d.ts +29 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2024.promise.d.ts +35 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2024.regexp.d.ts +25 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts +68 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2024.string.d.ts +29 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es5.d.ts +4601 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es6.d.ts +23 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.esnext.array.d.ts +35 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.esnext.collection.d.ts +96 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.esnext.d.ts +29 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.esnext.decorators.d.ts +28 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.esnext.disposable.d.ts +193 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.esnext.error.d.ts +24 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.esnext.float16.d.ts +445 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.esnext.full.d.ts +24 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.esnext.intl.d.ts +21 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.esnext.iterator.d.ts +148 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.esnext.promise.d.ts +34 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts +25 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.scripthost.d.ts +322 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +41 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.webworker.d.ts +13150 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +23 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.webworker.iterable.d.ts +340 -0
- package/examples/hello-world/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +2122 -0
- package/examples/hello-world/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +2122 -0
- package/examples/hello-world/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +2122 -0
- package/examples/hello-world/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +2122 -0
- package/examples/hello-world/node_modules/typescript/lib/tsc.js +8 -0
- package/examples/hello-world/node_modules/typescript/lib/tsserver.js +8 -0
- package/examples/hello-world/node_modules/typescript/lib/tsserverlibrary.d.ts +17 -0
- package/examples/hello-world/node_modules/typescript/lib/tsserverlibrary.js +21 -0
- package/examples/hello-world/node_modules/typescript/lib/typesMap.json +497 -0
- package/examples/hello-world/node_modules/typescript/lib/typescript.d.ts +11437 -0
- package/examples/hello-world/node_modules/typescript/lib/typescript.js +200276 -0
- package/examples/hello-world/node_modules/typescript/lib/typingsInstaller.js +8 -0
- package/examples/hello-world/node_modules/typescript/lib/watchGuard.js +53 -0
- package/examples/hello-world/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +2122 -0
- package/examples/hello-world/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +2122 -0
- package/examples/hello-world/node_modules/typescript/package.json +120 -0
- package/examples/hello-world/package-lock.json +74 -0
- package/examples/hello-world/package.json +23 -0
- package/examples/hello-world/src/client/index.tsx +110 -0
- package/examples/hello-world/src/server/index.ts +42 -0
- package/examples/hello-world/tsconfig.json +16 -0
- package/package.json +42 -0
- package/src/cli.ts +321 -0
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
# 安装指南
|
|
2
|
+
|
|
3
|
+
本指南将帮助你正确安装和配置 linyjs 框架及插件开发环境。
|
|
4
|
+
|
|
5
|
+
## 前置要求
|
|
6
|
+
|
|
7
|
+
在开始之前,请确保你的系统已安装以下软件:
|
|
8
|
+
|
|
9
|
+
- **Node.js** >= 18.0 ([下载地址](https://nodejs.org/))
|
|
10
|
+
- **npm** >= 9.0 (通常随 Node.js 一起安装)
|
|
11
|
+
- **Git** (用于版本控制)
|
|
12
|
+
|
|
13
|
+
### 验证安装
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# 检查 Node.js 版本
|
|
17
|
+
node --version
|
|
18
|
+
# 应显示: v18.x.x 或更高
|
|
19
|
+
|
|
20
|
+
# 检查 npm 版本
|
|
21
|
+
npm --version
|
|
22
|
+
# 应显示: 9.x.x 或更高
|
|
23
|
+
|
|
24
|
+
# 检查 Git
|
|
25
|
+
git --version
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## 安装 linyjs 核心包
|
|
29
|
+
|
|
30
|
+
linyjs 框架由多个 NPM 包组成。根据你的需求,可以选择性安装:
|
|
31
|
+
|
|
32
|
+
### 1. 安装接口包(必需)
|
|
33
|
+
|
|
34
|
+
这些包定义了插件开发的接口规范:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install @linyjs/server-module-interface
|
|
38
|
+
npm install @linyjs/client-module-interface
|
|
39
|
+
npm install @linyjs/ui-slots-interface
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 2. 安装 CLI 工具(推荐)
|
|
43
|
+
|
|
44
|
+
CLI 工具提供零配置的插件打包功能:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# 全局安装
|
|
48
|
+
npm install -g @linyjs/cli
|
|
49
|
+
|
|
50
|
+
# 或在项目中使用
|
|
51
|
+
npx @linyjs/cli <command>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 3. 安装文档包(推荐)
|
|
55
|
+
|
|
56
|
+
文档包包含完整的教程和示例:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npm install @linyjs/plugin-docs
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
安装后,文档位于 `node_modules/@linyjs/plugin-docs/docs/`。
|
|
63
|
+
|
|
64
|
+
### 4. 安装其他可选包
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# MongoDB 服务(数据持久化)
|
|
68
|
+
npm install @linyjs/mongodb
|
|
69
|
+
|
|
70
|
+
# 权限管理
|
|
71
|
+
npm install @linyjs/permission
|
|
72
|
+
|
|
73
|
+
# 管理后台
|
|
74
|
+
npm install @linyjs/admin
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## 初始化插件项目
|
|
78
|
+
|
|
79
|
+
### 方法 1: 使用 CLI 工具(推荐)
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# 创建新项目
|
|
83
|
+
npx @linyjs/cli init my-plugin
|
|
84
|
+
|
|
85
|
+
# 进入项目目录
|
|
86
|
+
cd my-plugin
|
|
87
|
+
|
|
88
|
+
# 安装依赖
|
|
89
|
+
npm install
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 方法 2: 手动创建
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# 创建项目目录
|
|
96
|
+
mkdir my-plugin && cd my-plugin
|
|
97
|
+
|
|
98
|
+
# 初始化 npm
|
|
99
|
+
npm init -y
|
|
100
|
+
|
|
101
|
+
# 安装依赖
|
|
102
|
+
npm install @linyjs/server-module-interface @linyjs/client-module-interface react
|
|
103
|
+
npm install -D typescript @types/react
|
|
104
|
+
|
|
105
|
+
# 创建 TypeScript 配置
|
|
106
|
+
cat > tsconfig.json << 'EOF'
|
|
107
|
+
{
|
|
108
|
+
"compilerOptions": {
|
|
109
|
+
"target": "ES2020",
|
|
110
|
+
"module": "ESNext",
|
|
111
|
+
"lib": ["ES2020", "DOM"],
|
|
112
|
+
"jsx": "react-jsx",
|
|
113
|
+
"declaration": true,
|
|
114
|
+
"outDir": "./dist",
|
|
115
|
+
"rootDir": "./src",
|
|
116
|
+
"strict": true,
|
|
117
|
+
"esModuleInterop": true,
|
|
118
|
+
"skipLibCheck": true,
|
|
119
|
+
"moduleResolution": "node"
|
|
120
|
+
},
|
|
121
|
+
"include": ["src/**/*"]
|
|
122
|
+
}
|
|
123
|
+
EOF
|
|
124
|
+
|
|
125
|
+
# 创建目录结构
|
|
126
|
+
mkdir -p src/{server,client}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## 配置开发环境
|
|
130
|
+
|
|
131
|
+
### VS Code 推荐扩展
|
|
132
|
+
|
|
133
|
+
- **TypeScript and JavaScript Language Features** (内置)
|
|
134
|
+
- **ESLint** - 代码质量检查
|
|
135
|
+
- **Prettier** - 代码格式化
|
|
136
|
+
- **React Developer Tools** - React 调试
|
|
137
|
+
|
|
138
|
+
### ESLint 配置(可选)
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
npm install -D eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
创建 `.eslintrc.json`:
|
|
145
|
+
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"parser": "@typescript-eslint/parser",
|
|
149
|
+
"plugins": ["@typescript-eslint"],
|
|
150
|
+
"extends": [
|
|
151
|
+
"eslint:recommended",
|
|
152
|
+
"plugin:@typescript-eslint/recommended"
|
|
153
|
+
],
|
|
154
|
+
"rules": {
|
|
155
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
156
|
+
"@typescript-eslint/no-explicit-any": "warn"
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## 验证安装
|
|
162
|
+
|
|
163
|
+
创建一个简单的测试文件来验证安装是否正确:
|
|
164
|
+
|
|
165
|
+
**src/server/test.ts:**
|
|
166
|
+
|
|
167
|
+
```typescript
|
|
168
|
+
import type { IModule } from '@linyjs/server-module-interface';
|
|
169
|
+
|
|
170
|
+
console.log('✓ Server module interface imported successfully');
|
|
171
|
+
|
|
172
|
+
export const testModule: IModule = {
|
|
173
|
+
name: 'test',
|
|
174
|
+
serviceDefs: []
|
|
175
|
+
};
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**src/client/test.tsx:**
|
|
179
|
+
|
|
180
|
+
```typescript
|
|
181
|
+
import type { IModule } from '@linyjs/client-module-interface';
|
|
182
|
+
import React from 'react';
|
|
183
|
+
|
|
184
|
+
console.log('✓ Client module interface imported successfully');
|
|
185
|
+
|
|
186
|
+
export const testModule: IModule = {
|
|
187
|
+
name: 'test',
|
|
188
|
+
serviceDefs: []
|
|
189
|
+
};
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
编译测试:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
npx tsc
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
如果编译成功且无错误,说明安装正确!
|
|
199
|
+
|
|
200
|
+
## 常见问题
|
|
201
|
+
|
|
202
|
+
### Q: 安装时遇到权限错误?
|
|
203
|
+
|
|
204
|
+
**A:** 尝试使用 `sudo`(macOS/Linux)或以管理员身份运行命令提示符(Windows):
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
sudo npm install -g @linyjs/cli
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
或者配置 npm 使用用户目录:
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
npm config set prefix ~/.npm-global
|
|
214
|
+
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
|
|
215
|
+
source ~/.bashrc
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Q: TypeScript 编译错误?
|
|
219
|
+
|
|
220
|
+
**A:** 确保安装了正确的 TypeScript 版本:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
npm install -D typescript@^5.7.0
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Q: 如何更新到最新版本?
|
|
227
|
+
|
|
228
|
+
**A:** 使用 npm update:
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
npm update @linyjs/server-module-interface
|
|
232
|
+
npm update @linyjs/client-module-interface
|
|
233
|
+
npm update @linyjs/cli
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## 下一步
|
|
237
|
+
|
|
238
|
+
- 🎯 阅读 [快速开始](./quick-start.md) 创建你的第一个插件
|
|
239
|
+
- 📖 查看 [第一个插件教程](./first-plugin.md) 深入学习
|
|
240
|
+
- 💡 浏览 [示例项目](../../examples/) 获取完整代码参考
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
**上一篇**: [快速开始](./quick-start.md) | **下一篇**: [第一个插件教程](./first-plugin.md)
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# 快速开始
|
|
2
|
+
|
|
3
|
+
## 📖 导航目录
|
|
4
|
+
|
|
5
|
+
- [快速开始](./quick-start.md) - 本文档
|
|
6
|
+
- [安装指南](./installation.md) - 详细安装说明
|
|
7
|
+
- [第一个插件教程](./first-plugin.md) - 深入学习插件开发
|
|
8
|
+
|
|
9
|
+
## 相关文档
|
|
10
|
+
|
|
11
|
+
- [服务端模块开发](../guides/server-module.md)
|
|
12
|
+
- [客户端模块开发](../guides/client-module.md)
|
|
13
|
+
- [创建示例项目](../../examples/hello-world/)
|
|
14
|
+
|
|
15
|
+
## 5分钟创建你的第一个 linyjs 插件
|
|
16
|
+
|
|
17
|
+
本教程将带你从零开始,在5分钟内创建一个简单的 "Hello World" 插件。
|
|
18
|
+
|
|
19
|
+
### 前置要求
|
|
20
|
+
|
|
21
|
+
- Node.js >= 18.0
|
|
22
|
+
- npm 或 yarn
|
|
23
|
+
- 基本的 TypeScript 和 React 知识
|
|
24
|
+
|
|
25
|
+
### 步骤 1: 初始化项目
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# 创建项目目录
|
|
29
|
+
mkdir hello-plugin && cd hello-plugin
|
|
30
|
+
|
|
31
|
+
# 初始化 npm 项目
|
|
32
|
+
npm init -y
|
|
33
|
+
|
|
34
|
+
# 安装依赖
|
|
35
|
+
npm install @linyjs/server-module-interface @linyjs/client-module-interface react
|
|
36
|
+
npm install -D typescript @types/react
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 步骤 2: 创建项目结构
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
hello-plugin/
|
|
43
|
+
├── package.json
|
|
44
|
+
├── tsconfig.json
|
|
45
|
+
└── src/
|
|
46
|
+
├── server/
|
|
47
|
+
│ └── index.ts # 服务端入口
|
|
48
|
+
└── client/
|
|
49
|
+
└── index.tsx # 客户端入口
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**创建 tsconfig.json:**
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"compilerOptions": {
|
|
57
|
+
"target": "ES2020",
|
|
58
|
+
"module": "ESNext",
|
|
59
|
+
"lib": ["ES2020", "DOM"],
|
|
60
|
+
"jsx": "react-jsx",
|
|
61
|
+
"declaration": true,
|
|
62
|
+
"outDir": "./dist",
|
|
63
|
+
"rootDir": "./src",
|
|
64
|
+
"strict": true,
|
|
65
|
+
"esModuleInterop": true,
|
|
66
|
+
"skipLibCheck": true,
|
|
67
|
+
"moduleResolution": "node"
|
|
68
|
+
},
|
|
69
|
+
"include": ["src/**/*"]
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 步骤 3: 编写服务端代码
|
|
74
|
+
|
|
75
|
+
创建 `src/server/index.ts`:
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
import type { IModule } from '@linyjs/server-module-interface';
|
|
79
|
+
|
|
80
|
+
class HelloController {
|
|
81
|
+
getRoutes() {
|
|
82
|
+
return [{
|
|
83
|
+
method: 'GET' as const,
|
|
84
|
+
path: '/api/hello',
|
|
85
|
+
middlewares: [],
|
|
86
|
+
responseType: 'json' as const,
|
|
87
|
+
handler: async () => {
|
|
88
|
+
return { message: 'Hello from plugin!' };
|
|
89
|
+
}
|
|
90
|
+
}];
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export const helloServerModule: IModule = {
|
|
95
|
+
name: 'helloServer',
|
|
96
|
+
serviceDefs: [{
|
|
97
|
+
serviceTag: 'helloController',
|
|
98
|
+
serviceImpl: HelloController,
|
|
99
|
+
meta: { usageType: 'controller' }
|
|
100
|
+
}]
|
|
101
|
+
};
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 步骤 4: 编写客户端代码
|
|
105
|
+
|
|
106
|
+
创建 `src/client/index.tsx`:
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
import type { IModule } from '@linyjs/client-module-interface';
|
|
110
|
+
import React from 'react';
|
|
111
|
+
|
|
112
|
+
function HelloPage() {
|
|
113
|
+
return (
|
|
114
|
+
<div style={{ padding: '20px' }}>
|
|
115
|
+
<h1>Hello from Plugin!</h1>
|
|
116
|
+
<p>This is your first linyjs plugin.</p>
|
|
117
|
+
</div>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export const helloClientModule: IModule = {
|
|
122
|
+
name: 'helloClient',
|
|
123
|
+
serviceDefs: [{
|
|
124
|
+
serviceTag: 'helloRoute',
|
|
125
|
+
serviceImpl: class {
|
|
126
|
+
basePath = '/hello';
|
|
127
|
+
getRoutes() {
|
|
128
|
+
return [{
|
|
129
|
+
path: '/',
|
|
130
|
+
component: HelloPage,
|
|
131
|
+
key: 'hello-page',
|
|
132
|
+
meta: { title: 'Hello' }
|
|
133
|
+
}];
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
meta: { usageType: 'route' }
|
|
137
|
+
}]
|
|
138
|
+
};
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### 步骤 5: 构建和打包
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# 编译 TypeScript
|
|
145
|
+
npx tsc
|
|
146
|
+
|
|
147
|
+
# 使用 CLI 打包为 .mpk 文件
|
|
148
|
+
npx @linyjs/cli pack
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
你会得到 `hello-plugin.mpk` 文件!
|
|
152
|
+
|
|
153
|
+
### 步骤 6: 测试插件
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
# 将插件复制到 extensions 目录
|
|
157
|
+
cp hello-plugin.mpk /path/to/linyjs/packages/ssr/extensions/
|
|
158
|
+
|
|
159
|
+
# 启动 SSR 服务器
|
|
160
|
+
cd /path/to/linyjs/packages/ssr
|
|
161
|
+
npx tsx src/demo/dev-server-with-pkg.tsx
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
访问 `http://localhost:3000/hello` 查看你的插件!
|
|
165
|
+
|
|
166
|
+
### 下一步
|
|
167
|
+
|
|
168
|
+
- 📖 阅读 [安装指南](./installation.md) 了解详细的安装步骤
|
|
169
|
+
- 🎯 查看 [第一个插件教程](./first-plugin.md) 深入学习插件开发
|
|
170
|
+
- 💡 浏览 [示例项目](../../examples/) 获取完整代码参考
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
**上一篇**: [返回目录](../README.md) | **下一篇**: [安装指南](./installation.md)
|