Logseq 插件 Wrap 使用教程

Logseq 插件 Wrap 使用教程

1. 项目的目录结构及介绍

logseq-plugin-wrap/
├── github/workflows
├── public
├── .gitignore
├── .prettierrc
├── LICENSE
├── README.md
├── demo.gif
├── icon.png
├── open_settings.png
├── package.json
├── tsconfig.json
├── wmr.config.mjs
└── yarn.lock
  • github/workflows: 存放GitHub Actions的工作流配置文件。
  • public: 存放公共资源文件。
  • .gitignore: Git忽略文件配置。
  • .prettierrc: Prettier代码格式化配置。
  • LICENSE: 项目许可证。
  • README.md: 项目说明文档。
  • demo.gif: 演示动图。
  • icon.png: 插件图标。
  • open_settings.png: 设置页面图标。
  • package.json: 项目依赖和脚本配置。
  • tsconfig.json: TypeScript配置文件。
  • wmr.config.mjs: WMR配置文件。
  • yarn.lock: Yarn依赖锁定文件。

2. 项目的启动文件介绍

项目的启动文件主要是package.json中的脚本配置。以下是一些关键的脚本命令:

{
  "scripts": {
    "start": "wmr",
    "build": "wmr build",
    "serve": "wmr serve"
  }
}
  • start: 启动开发服务器。
  • build: 构建生产版本。
  • serve: 启动生产服务器。

3. 项目的配置文件介绍

package.json

package.json文件包含了项目的基本信息、依赖和脚本命令。以下是一些关键配置:

{
  "name": "logseq-plugin-wrap",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "start": "wmr",
    "build": "wmr build",
    "serve": "wmr serve"
  },
  "dependencies": {
    "wmr": "^1.0.0"
  }
}
  • name: 项目名称。
  • version: 项目版本。
  • main: 主入口文件。
  • scripts: 脚本命令。
  • dependencies: 项目依赖。

tsconfig.json

tsconfig.json文件是TypeScript的配置文件,以下是一些关键配置:

{
  "compilerOptions": {
    "target": "esnext",
    "module": "esnext",
    "moduleResolution": "node",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true
  }
}
  • compilerOptions: 编译选项。
  • target: 编译目标。
  • module: 模块系统。
  • moduleResolution: 模块解析策略。
  • strict: 严格模式。
  • esModuleInterop: 启用ES模块互操作。

wmr.config.mjs

wmr.config.mjs文件是WMR的配置文件,以下是一些关键配置:

import { defineConfig } from 'wmr';

export default defineConfig({
  plugins: [],
  alias: {
    'react': 'preact/compat',
    'react-dom': 'preact/compat'
  }
});
  • plugins: 插件配置。
  • alias: 模块别名配置。

以上是Logseq插件Wrap的基本使用教程,希望对你有所帮助。

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值