Skip to content

Commit 3979b82

Browse files
authored
Merge pull request #545 from zeromq/docs [skip ci]
2 parents e299e2a + e2a0d4e commit 3979b82

File tree

6 files changed

+119
-30
lines changed

6 files changed

+119
-30
lines changed

.github/workflows/CI.yml

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ jobs:
8181
path: |
8282
./node_modules/
8383
./build/
84-
key: "cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-ZMQ_VERSION:${{ matrix.zmq_version }}-Node:${{ matrix.node_version }}-${{ hashFiles('./package.json') }}"
84+
key: "cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-Node:${{ matrix.node_version }}-${{ hashFiles('./package.json') }}"
8585
restore-keys: |
86-
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-ZMQ_VERSION:${{ matrix.zmq_version }}-Node:${{ matrix.node_version }}-"
86+
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-Node:${{ matrix.node_version }}-"
8787
8888
- name: Setup Cpp
8989
if: ${{ !matrix.docker }}
@@ -160,3 +160,71 @@ jobs:
160160
run: |
161161
pnpm run clean
162162
pnpm run test
163+
164+
Docs:
165+
if: "startsWith(github.ref, 'refs/tags/') && !contains(github.event.head_commit.message, '[skip ci]')"
166+
runs-on: ubuntu-22.04
167+
strategy:
168+
fail-fast: false
169+
matrix:
170+
os:
171+
- ubuntu-22.04
172+
node_version:
173+
- 18
174+
node_arch:
175+
- x64
176+
cpp_arch:
177+
- x64
178+
ARCH:
179+
- x64
180+
zmq_draft:
181+
- false
182+
env:
183+
ZMQ_DRAFT: ${{ matrix.zmq_draft }}
184+
ZMQ_SHARED: false
185+
ARCH: ${{ matrix.ARCH }}
186+
187+
steps:
188+
- uses: actions/checkout@v3
189+
190+
- name: Cache
191+
uses: actions/cache@v3
192+
with:
193+
path: |
194+
./node_modules/
195+
./build/
196+
key: "cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-Node:${{ matrix.node_version }}-${{ hashFiles('./package.json') }}"
197+
restore-keys: |
198+
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-Node:${{ matrix.node_version }}-"
199+
200+
- name: Setup Cpp
201+
uses: aminya/setup-cpp@v1
202+
with:
203+
cmake: true
204+
architecture: ${{ matrix.cpp_arch }}
205+
206+
- uses: pnpm/[email protected]
207+
with:
208+
version: 7
209+
210+
- name: Install Node
211+
uses: actions/setup-node@v3
212+
with:
213+
node-version: ${{ matrix.node_version }}
214+
architecture: ${{ matrix.node_arch }}
215+
cache: "pnpm"
216+
217+
- name: Build Documentation
218+
if: "${{ contains(matrix.os, 'ubuntu') && !matrix.docker }}"
219+
run: |
220+
pnpm install
221+
pnpm run build.doc
222+
223+
- name: Deploy Documentation
224+
if: "${{ contains(matrix.os, 'ubuntu') && !matrix.docker }}"
225+
uses: Cecilapp/GitHub-Pages-deploy@v3
226+
with:
227+
build_dir: docs
228+
branch: gh-pages
229+
env:
230+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

package.json

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
},
1919
"dependencies": {
2020
"@aminya/node-gyp-build": "4.5.0-aminya.4",
21+
"cross-env": "^7.0.3",
2122
"node-addon-api": "^5.0.0",
2223
"shelljs": "^0.8.5",
23-
"shx": "^0.3.4",
24-
"cross-env": "^7.0.3"
24+
"shx": "^0.3.4"
2525
},
2626
"devDependencies": {
2727
"@gnd/typedoc": "^0.15.0-0",
@@ -52,6 +52,11 @@
5252
"weak-napi": "^2.0.2",
5353
"which": "^3.0.0"
5454
},
55+
"pnpm": {
56+
"overrides": {
57+
"typescript": "~4.9.3"
58+
}
59+
},
5560
"engines": {
5661
"node": ">= 10.2"
5762
},
@@ -72,10 +77,11 @@
7277
"install": "(shx test -f ./script/build.js || run-s build.js) && cross-env npm_config_build_from_source=true node-gyp-build",
7378
"clean": "shx rm -rf ./build ./lib/ ./prebuilds ./script/*.js ./script/*.js.map ./script/*.d.ts ./script/*.tsbuildinfo",
7479
"clean.temp": "shx rm -rf ./tmp && shx mkdir -p ./tmp && shx touch ./tmp/.gitkeep",
75-
"build.library": "tsc -p ./src/tsconfig.json && downlevel-dts ./lib ./lib/ts3.7 --to=3.7",
80+
"build.library.compat": "shx rm -rf ./lib/ts3.7 && downlevel-dts ./lib ./lib/ts3.7 --to=3.7",
81+
"build.library": "tsc -p ./src/tsconfig.json && run-s build.library.compat",
7682
"build.script": "tsc -p ./script/tsconfig.json",
7783
"build.js": "run-p build.script build.library",
78-
"build.doc": "typedoc --out docs --name zeromq.js --excludeProtected --excludePrivate --excludeNotExported --excludeExternals --externalPattern 'src/+(draft|native|compat).ts' --tsconfig tsconfig-build.json --mode file",
84+
"build.doc": "typedoc --options ./typedoc.json --tsconfig ./tsconfig.docs.json",
7985
"prebuild": "run-s build.js && node ./script/prebuild.js",
8086
"build.native": "node-gyp configure --release && node-gyp build --release",
8187
"build.native.debug": "cross-env CMAKE_BUILD_TYPE=Debug node-gyp configure --debug && cross-env CMAKE_BUILD_TYPE=Debug node-gyp build --debug",
@@ -89,7 +95,7 @@
8995
"lint": "run-p lint.eslint lint.clang-format",
9096
"lint-test": "run-s lint-test.eslint",
9197
"bench": "node --expose-gc test/bench",
92-
"prepublishOnly": "shx rm -rf ./lib && pnpm run build.js"
98+
"prepublishOnly": "pnpm run build.js"
9399
},
94100
"keywords": [
95101
"zeromq",

pnpm-lock.yaml

Lines changed: 5 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tsconfig-build.json

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

tsconfig.docs.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"incremental": false,
5+
"paths": {
6+
"zeromq": [
7+
"./src/index.ts"
8+
]
9+
}
10+
}
11+
}

typedoc.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"$schema": "https://typedoc.org/schema.json",
3+
"name": "zeromq.js",
4+
"entryPoints": [
5+
"./src/index.ts"
6+
],
7+
"tsconfig": " ./tsconfig.docs.json",
8+
"out": "docs",
9+
"excludePrivate": true,
10+
"excludeNotExported": true,
11+
"excludeExternals": true,
12+
"exclude": [
13+
"script/**/*",
14+
"test/**/*",
15+
"examples/**/*",
16+
"src/+(draft|native|compat).ts",
17+
"src/errors.ts",
18+
"src/util.ts"
19+
],
20+
"pretty": false,
21+
"githubPages": true
22+
}

0 commit comments

Comments
 (0)