Skip to content

Commit

Permalink
🔧 misc
Browse files Browse the repository at this point in the history
  • Loading branch information
frostime committed Dec 3, 2024
1 parent fab3cb5 commit c4ae739
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 8 deletions.
22 changes: 18 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
node-version: 20
registry-url: "https://registry.npmjs.org"

# Install pnpm
# Install pnpm
- name: Install pnpm
uses: pnpm/action-setup@v4
id: pnpm-install
Expand All @@ -46,11 +46,25 @@ jobs:
# Install dependencies
- name: Install dependencies
run: pnpm install
run: |
pnpm install
# 检查 typescript 是否正确安装
pnpm list typescript
# 打印当前目录
pwd
# 显示当前工作目录结构
ls -la
# Build for production, 这一步会生成一个 package.zip
# Build for production
- name: Build for production
run: pnpm build
run: |
# 显示 TypeScript 配置
cat tsconfig.json
# 执行构建并捕获所有输出
pnpm build || { echo "Build failed"; exit 1; }
# 检查构建后的文件
ls -la dist
ls -la types || true
- name: Release
uses: ncipollo/release-action@v1
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sy-query-view",
"version": "0.1.0",
"version": "1.0.0-beta1",
"type": "module",
"description": "This is a sample plugin based on vite and svelte for Siyuan (https://b3log.org/siyuan). Created with siyuan-plugin-cli v2.4.5.",
"repository": "https://github.com/frostime/sy-query-view",
Expand Down
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "sy-query-view",
"author": "frostime",
"url": "https://github.com/frostime/sy-query-view",
"version": "0.1.0",
"version": "1.0.0-beta1",
"minAppVersion": "3.0.12",
"backends": [
"windows",
Expand Down
12 changes: 10 additions & 2 deletions scripts/export-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,25 @@ import { exec } from 'child_process';
import fs from 'fs';
import path from 'path';

let outputDir = './public';

import { fileURLToPath } from 'url';

//定位当前 js 脚本所在的目录
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

// chdir 到上层 plugin.json 所在的目录
process.chdir(path.join(__dirname, '..'));
console.log(process.cwd());
// list current directory
console.log(fs.readdirSync('./'));


const tsc = `tsc --declaration --emitDeclarationOnly --skipLibCheck --target ES2022 --project tsconfig.json --outDir ./types --noEmitOnError false --stripInternal`;

await exec(tsc);

let outputDir = './public';


const fileWriter = (filepath) => {
let fd = fs.openSync(filepath, 'w');
Expand All @@ -36,6 +43,7 @@ const fileWriter = (filepath) => {
}

const readFile = (filepath) => {
filepath = path.join(__dirname, '..', filepath);
return fs.readFileSync(filepath, 'utf8');
}

Expand Down

0 comments on commit c4ae739

Please sign in to comment.