Skip to content

Commit f6eca1f

Browse files
committed
build: 📦 添加 NPM 发包
1 parent d200d01 commit f6eca1f

26 files changed

Lines changed: 895 additions & 191 deletions

.github/workflows/publish-lib.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Publish Library
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- '@xiaohuohumax/*'
8+
9+
permissions:
10+
id-token: write
11+
12+
jobs:
13+
publish:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout Repo
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Creating .npmrc
22+
run: |
23+
cat << EOF > "$HOME/.npmrc"
24+
//registry.npmjs.org/:_authToken=$NPM_TOKEN
25+
EOF
26+
env:
27+
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
28+
29+
- name: Install pnpm
30+
uses: pnpm/action-setup@v3
31+
32+
- name: Set node version to 20
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: 20
36+
registry-url: https://registry.npmjs.org/
37+
cache: pnpm
38+
39+
- name: Install
40+
run: pnpm install --frozen-lockfile
41+
42+
- name: Publish Library
43+
id: changesets
44+
uses: changesets/action@v1
45+
with:
46+
createGithubReleases: false
47+
publish: pnpm release
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
51+
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
node_modules
2+
dist
3+
!/dist

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
## 📦 封装工具
2020

21-
| 名称 | 功能 | 使用 |
22-
| ------------------------------------------------------ | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
23-
| [zip-downloader](./apps/libs/zip-downloader/README.md) | 资源下载器(下载资源、Zip 压缩、下载到本地) | [🐒Greasy Fork](https://greasyfork.org/zh-CN/scripts/559087) \| [🐱Script Cat](https://scriptcat.org/zh-CN/script-show-page/4893) |
24-
| [xpath-selector](./apps/libs/xpath-selector/README.md) | 一个 XPath 选择器库,快速获取节点数据 | [🐒Greasy Fork](https://greasyfork.org/zh-CN/scripts/559142) \| [🐱Script Cat](https://scriptcat.org/zh-CN/script-show-page/4900) |
21+
| 名称 | 功能 | 使用 |
22+
| ------------------------------------------------- | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
23+
| [zip-downloader](./libs/zip-downloader/README.md) | 资源下载器(下载资源、Zip 压缩、下载到本地) | [🐒Greasy Fork](https://greasyfork.org/zh-CN/scripts/559087) \| [🐱Script Cat](https://scriptcat.org/zh-CN/script-show-page/4893) |
24+
| [xpath-selector](./libs/xpath-selector/README.md) | 一个 XPath 选择器库,快速获取节点数据 | [🐒Greasy Fork](https://greasyfork.org/zh-CN/scripts/559142) \| [🐱Script Cat](https://scriptcat.org/zh-CN/script-show-page/4900) |

apps/libs/xpath-selector/tsconfig.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

apps/libs/xpath-selector/vite.config.ts

Lines changed: 0 additions & 30 deletions
This file was deleted.

apps/libs/zip-downloader/tsconfig.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

apps/libs/zip-downloader/vite.config.ts

Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
// ==UserScript==
2-
// @name DXPath Selector 一个 XPath 选择器库,快速获取节点数据
3-
// @namespace xiaohuohumax/userscripts/xpath-selector
4-
// @version 1.0.2
5-
// @author xiaohuohumax
6-
// @description XPath Selector -- 一个 XPath 选择器库,快速获取节点数据
7-
// @license MIT
8-
// ==/UserScript==
9-
101
var xpathSelector = function() {
112
"use strict";
123
function t$2(t2, s2, r2, i2) {
Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
// ==UserScript==
2-
// @name Zip Downloader 资源下载器(下载资源、Zip 压缩、下载到本地)
3-
// @namespace xiaohuohumax/userscripts/zip-downloader
4-
// @version 2.0.0
5-
// @author xiaohuohumax
6-
// @description Zip Downloader -- 资源下载器(下载资源、Zip 压缩、下载到本地)
7-
// @license MIT
8-
// ==/UserScript==
9-
101
var zipDownloader = function() {
112
"use strict";var __defProp = Object.defineProperty;
123
var __typeError = (msg) => {
@@ -4620,7 +4611,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
46204611
return bitFlag;
46214612
}
46224613
try {
4623-
configure({ baseURI: _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("zip-downloader.js", document.baseURI).href });
4614+
configure({ baseURI: _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index.lib.js", document.baseURI).href });
46244615
} catch {
46254616
}
46264617
const A = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# xpath-selector
1+
# @xiaohuohumax/xpath-selector
22

33
## 1.0.2
44

0 commit comments

Comments
 (0)