22 Commits

Author SHA1 Message Date
windychen cde9795307 chore: 更新小版本 1.1.7 → 1.1.8,CI 新增 Gitea 推送
Node.js Build / build (push) Successful in 9s
2026-07-16 14:26:25 +08:00
windychen 54c2fc1de8 chore: 更新小版本 1.1.6 → 1.1.7,添加 repository 字段关联 Gitea
Node.js Build / build (push) Successful in 9s
2026-07-16 14:23:00 +08:00
windychen 52cf3c36ea chore: 更新小版本 1.1.5 → 1.1.6
Node.js Build / build (push) Successful in 6s
2026-07-16 14:13:42 +08:00
windychen f27b9690df chore: workflow 仅当提交信息含 chore+版本+更新 时触发
Node.js Build / build (push) Successful in 9s
2026-07-16 14:12:23 +08:00
windychen 4ee2bc52b1 chore: 更新小版本 1.1.4 → 1.1.5
Node.js Build / build (push) Successful in 8s
2026-07-16 14:09:28 +08:00
windychen 84c4cd96da chore: 钉钉通知增加发布结果详情(skip/publish/fail) 2026-07-16 14:09:28 +08:00
windychen 2ca0093ae6 Revert "test: 真正的语法错误,测试CI失败通知" 2026-07-16 14:09:28 +08:00
windychen 0c3670f710 test: 真正的语法错误,测试CI失败通知 2026-07-16 14:09:28 +08:00
windychen a0a912828c test: 故意引入语法错误,测试CI失败通知 2026-07-16 14:09:28 +08:00
windychen ce8c36ae0f chore: Publish 步骤增加版本去重检查 + 钉钉通知 2026-07-16 14:09:28 +08:00
windychen cacb5fae5c chore: 更新小版本 2026-07-16 14:09:28 +08:00
windychen c16694f390 fix: 修复浏览器引入时better-sqlite3依赖引发的报错 2026-07-16 14:09:28 +08:00
windychen 7faf2928eb chore: 更新小版本 2026-07-16 14:09:28 +08:00
windychen 9468f51c2a docs: 更新 README.md 2026-07-16 14:09:28 +08:00
windychen 94969d412f chore: 修正包名单词问题 2026-07-16 14:09:28 +08:00
windychen0 4c113be4f0 chore: 尝试去除 actions/checkout 的无效步骤 2026-07-16 14:09:28 +08:00
windychen0 7de6bcdeed chore: 尝试去除 actions/checkout 的无效步骤 2026-07-16 14:09:28 +08:00
windychen0 9e95a75ce1 chore: 尝试去除 actions/checkout 的无效步骤 2026-07-16 14:09:28 +08:00
windychen0 560ab99d2d chore: 尝试去除 actions/checkout 的无效步骤 2026-07-16 14:09:28 +08:00
windychen0 ce90016b0f fix(ai): 修复引入node模块导致的打包问题 2026-07-16 14:09:28 +08:00
windychen0 27c5d9f5b9 chore: 更新功能版本 2026-07-16 14:09:28 +08:00
windychen0 bf4fb2d643 feat(ai)(storage): 添加nodejs环境下的sqlite存储支持,调用方法与浏览器环境下保存一致 2026-07-16 14:09:28 +08:00
5 changed files with 115 additions and 29 deletions
+73 -7
View File
@@ -3,15 +3,18 @@ name: Node.js Build
on: on:
push: push:
branches: ["main", "master"] branches: ["main", "master"]
pull_request:
branches: ["main", "master"]
jobs: jobs:
build: build:
runs-on: docker # 匹配你 runner 的标签 if: contains(github.event.head_commit.message, 'chore') && contains(github.event.head_commit.message, '版本') && contains(github.event.head_commit.message, '更新')
runs-on: docker
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 run: |
git init
git remote add origin http://gitea:3000/windychen/windyChenUtils.git
git fetch --depth 1 origin ${{ github.sha }}
git checkout ${{ github.sha }}
- name: Setup npm for Verdaccio - name: Setup npm for Verdaccio
run: | run: |
@@ -19,10 +22,73 @@ jobs:
npm config set //verdaccio:4873/:_authToken ${{ secrets.NPM_TOKEN }} npm config set //verdaccio:4873/:_authToken ${{ secrets.NPM_TOKEN }}
- name: Install dependencies - name: Install dependencies
run: npm i --registry http://verdaccio:4873/ # 或 npm install run: npm i --registry http://verdaccio:4873/
- name: Run build - name: Run build
run: npm run build run: npm run build
- name: Publish package - name: Publish to Verdaccio
run: npm publish id: publish-verdaccio
run: |
VERSION=$(node -p "require('./package.json').version")
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://verdaccio:4873/windychen-utils/$VERSION)
if [ "$HTTP_CODE" = "200" ]; then
echo "Verdaccio: version $VERSION already exists, skipping."
echo "Verdaccio|skipped|版本 ${VERSION} 已存在" > /tmp/publish_result.txt
else
if npm publish 2>&1; then
echo "Verdaccio|published|已发布 v${VERSION}" > /tmp/publish_result.txt
else
echo "Verdaccio|failed|发布失败" > /tmp/publish_result.txt
exit 1
fi
fi
- name: Publish to Gitea
id: publish-gitea
run: |
npm config set //gitea:3000/api/packages/windychen/npm/:_authToken ${{ secrets.NPM_GITEA_TOKEN }}
VERSION=$(node -p "require('./package.json').version")
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://gitea:3000/api/packages/windychen/npm/windychen-utils/$VERSION)
if [ "$HTTP_CODE" = "200" ]; then
echo "Gitea: version $VERSION already exists, skipping."
echo "Gitea|skipped|版本 ${VERSION} 已存在" >> /tmp/publish_result.txt
else
if npm publish --registry http://gitea:3000/api/packages/windychen/npm/ 2>&1; then
echo "Gitea|published|已发布 v${VERSION}" >> /tmp/publish_result.txt
else
echo "Gitea|failed|发布失败" >> /tmp/publish_result.txt
exit 1
fi
fi
- name: Notify DingTalk
if: always()
run: |
STATUS="${{ job.status }}"
VERSION=$(node -p "require('./package.json').version")
VERD_LINE="⚠️ Verdaccio: 未执行"
GITEA_LINE="⚠️ Gitea: 未执行"
if [ -f /tmp/publish_result.txt ]; then
while IFS='|' read -r TARGET ICON DETAIL; do
case "$ICON" in
published) EMOJI="📦" ;;
skipped) EMOJI="⏭️" ;;
failed) EMOJI="❌" ;;
*) EMOJI="⚠️" ;;
esac
LINE="${EMOJI} ${TARGET}: ${DETAIL}"
case "$TARGET" in
Verdaccio) VERD_LINE="$LINE" ;;
Gitea) GITEA_LINE="$LINE" ;;
esac
done < /tmp/publish_result.txt
fi
if [ "$STATUS" = "success" ]; then
TITLE="✅ windychen-utils v${VERSION} 构建完成 chen-fnos"
else
TITLE="❌ windychen-utils v${VERSION} 构建失败 chen-fnos"
fi
curl -s -X POST "https://oapi.dingtalk.com/robot/send?access_token=${{ secrets.DINGDING_TOKEN }}" \
-H "Content-Type: application/json" \
-d "{\"msgtype\":\"markdown\",\"markdown\":{\"title\":\"${TITLE}\",\"text\":\"## ${TITLE}\n\n${VERD_LINE}\n${GITEA_LINE}\n\n- 仓库: windychen/windyChenUtils\n- 分支: ${{ github.ref_name }}\n- 提交: ${{ github.sha }}\"}}"
+4 -4
View File
@@ -5,7 +5,7 @@
## 安装 ## 安装
```bash ```bash
npm install windychen-untils npm install windychen-utils
``` ```
## 使用 ## 使用
@@ -13,7 +13,7 @@ npm install windychen-untils
### Node.js / Bun.js ### Node.js / Bun.js
```javascript ```javascript
require('windychen-untils'); require('windychen-utils');
// Object 扩展 // Object 扩展
const obj = { a: { b: { c: 1 } } }; const obj = { a: { b: { c: 1 } } };
@@ -33,7 +33,7 @@ obj.setPro('x.y.z', 'hello');
### ES Module ### ES Module
```javascript ```javascript
import from 'windychen-untils/dist/windychen-utils.esm.js'; import from 'windychen-utils/dist/windychen-utils.esm.js';
``` ```
## API 参考 ## API 参考
@@ -80,7 +80,7 @@ arr.findPro(item => item.id > 1);
- 仅支持 localStorage → 使用 `ILocalStorage`(内存缓存) - 仅支持 localStorage → 使用 `ILocalStorage`(内存缓存)
```javascript ```javascript
import storage from 'windychen-untils'; import storage from 'windychen-utils';
await storage.set('key', { data: 123 }); await storage.set('key', { data: 123 });
await storage.get('key', null); // { data: 123 } await storage.get('key', null); // { data: 123 }
+6 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "windychen-untils", "name": "windychen-utils",
"version": "1.1.1", "version": "1.1.8",
"main": "dist/windychen-utils.cjs.js", "main": "dist/windychen-utils.cjs.js",
"module": "dist/windychen-utils.esm.js", "module": "dist/windychen-utils.esm.js",
"browser": "dist/windychen-utils.js", "browser": "dist/windychen-utils.js",
@@ -15,6 +15,10 @@
"author": "windychen", "author": "windychen",
"license": "ISC", "license": "ISC",
"description": "", "description": "",
"repository": {
"type": "git",
"url": "http://gitea.windychen00n.work/windychen/windyChenUtils.git"
},
"devDependencies": { "devDependencies": {
"webpack": "^5.90.0", "webpack": "^5.90.0",
"webpack-cli": "^5.1.4" "webpack-cli": "^5.1.4"
+3 -3
View File
@@ -241,9 +241,9 @@ class MemoryStorage {
* @private * @private
*/ */
var _SqliteStorageClass = function () { var _SqliteStorageClass = function () {
var Database = require("better-sqlite3"); var Database = require(/* webpackIgnore: true */ "better-sqlite3");
var pathModule = require("path"); var pathModule = require(/* webpackIgnore: true */ "path");
var fs = require("fs"); var fs = require(/* webpackIgnore: true */ "fs");
return class SqliteStorage { return class SqliteStorage {
/** /**
+29 -13
View File
@@ -1,26 +1,41 @@
const path = require('path'); const path = require("path");
const nodeExternalModules = ["better-sqlite3"];
const commonConfig = {
externals: {
"better-sqlite3": "commonjs2 better-sqlite3",
},
resolve: {
fallback: {
fs: false,
path: false,
util: false,
},
},
};
const configs = { const configs = {
cjs: { cjs: {
output: { output: {
path: path.resolve(__dirname, 'dist'), path: path.resolve(__dirname, "dist"),
filename: 'windychen-utils.cjs.js', filename: "windychen-utils.cjs.js",
libraryTarget: 'commonjs2', libraryTarget: "commonjs2",
}, },
}, },
esm: { esm: {
experiments: { outputModule: true }, experiments: { outputModule: true },
output: { output: {
path: path.resolve(__dirname, 'dist'), path: path.resolve(__dirname, "dist"),
filename: 'windychen-utils.esm.js', filename: "windychen-utils.esm.js",
libraryTarget: 'module', libraryTarget: "module",
}, },
}, },
umd: { umd: {
output: { output: {
path: path.resolve(__dirname, 'dist'), path: path.resolve(__dirname, "dist"),
filename: 'windychen-utils.js', filename: "windychen-utils.js",
library: { name: 'WindychenUtils', type: 'umd', export: 'default' }, library: { name: "WindychenUtils", type: "umd", export: "default" },
}, },
}, },
}; };
@@ -28,10 +43,11 @@ const configs = {
module.exports = (env = {}) => { module.exports = (env = {}) => {
const format = env.format; const format = env.format;
if (!format || format === 'all') { if (!format || format === "all") {
return Object.keys(configs).map((key) => ({ return Object.keys(configs).map((key) => ({
name: key, name: key,
entry: './index.js', entry: "./index.js",
...commonConfig,
...configs[key], ...configs[key],
})); }));
} }
@@ -40,5 +56,5 @@ module.exports = (env = {}) => {
throw new Error(`不支持的格式: ${format},可选值: cjs, esm, umd`); throw new Error(`不支持的格式: ${format},可选值: cjs, esm, umd`);
} }
return { entry: './index.js', ...configs[format] }; return { entry: "./index.js", ...commonConfig, ...configs[format] };
}; };