@smart-cloud/publisher-exporter 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -1
- package/package.json +1 -4
- package/scripts/queue-runner-cron.sh +0 -63
package/README.md
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
It is designed to run outside WordPress. The WordPress plugin only manages runtime config, queue state, and logs.
|
|
6
6
|
|
|
7
|
+
Package page: https://www.npmjs.com/package/@smart-cloud/publisher-exporter
|
|
8
|
+
|
|
7
9
|
## Install
|
|
8
10
|
|
|
9
11
|
Global install:
|
|
@@ -95,7 +97,23 @@ LOG_PATH=/mnt/site/logs
|
|
|
95
97
|
* * * * * /usr/bin/flock -n /tmp/static-publisher.cron.lock publisher-exporter queue-runner --runtime-dir "$RUNTIME_PATH" --max-jobs 1 >> "$LOG_PATH/queue-runner-cron.log" 2>&1
|
|
96
98
|
```
|
|
97
99
|
|
|
98
|
-
If you want a
|
|
100
|
+
If you do not want a version-pinned NVM path in crontab, create a stable user launcher in `~/bin` and put that directory first in `PATH`:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
mkdir -p "$HOME/bin"
|
|
104
|
+
cat > "$HOME/bin/publisher-exporter" <<'EOF'
|
|
105
|
+
#!/usr/bin/env bash
|
|
106
|
+
set -euo pipefail
|
|
107
|
+
export HOME=/home/<runner-user>
|
|
108
|
+
export NVM_DIR="$HOME/.nvm"
|
|
109
|
+
. "$NVM_DIR/nvm.sh"
|
|
110
|
+
nvm use default >/dev/null
|
|
111
|
+
exec "$(npm prefix -g)/bin/publisher-exporter" "$@"
|
|
112
|
+
EOF
|
|
113
|
+
chmod +x "$HOME/bin/publisher-exporter"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
If cron already sets the correct `HOME`, remove the explicit `export HOME=...` line from the wrapper. A plain symlink to `~/.nvm/versions/node/vX.Y.Z/bin/publisher-exporter` will break after upgrades. Prefer this small launcher, or enable an NVM-managed `current` symlink and link against that stable path.
|
|
99
117
|
|
|
100
118
|
After each finished, failed, or stopped job, queue-runner copies the exporter-generated working logs into `"<logDir>/archive/<timestamp-command-jobId-status>/"` and includes a `job.json` summary plus the latest `current-progress.json` snapshot when available. The live root log files remain the current working set and may be overwritten by the next job.
|
|
101
119
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smart-cloud/publisher-exporter",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Headless Playwright static publisher for WordPress/Elementor sites with sitemap-only page discovery, strict asset capture, escaped URL rewrite, structured logs, and targeted retry modes.",
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"dist",
|
|
12
|
-
"scripts/queue-runner-cron.sh",
|
|
13
12
|
"publisher.config.example.json",
|
|
14
13
|
"README.md",
|
|
15
14
|
"package.json"
|
|
@@ -24,7 +23,6 @@
|
|
|
24
23
|
"scripts": {
|
|
25
24
|
"prune": "npm ci --omit=dev",
|
|
26
25
|
"build": "tsup --config tsup.config.ts",
|
|
27
|
-
"build:runtime-zip": "node ./scripts/build-runtime-zip.mjs",
|
|
28
26
|
"check": "tsc -p tsconfig.json --noEmit",
|
|
29
27
|
"lint": "eslint 'src/**/*.ts' --report-unused-disable-directives --max-warnings 0",
|
|
30
28
|
"crawl": "node dist/crawl.js",
|
|
@@ -36,7 +34,6 @@
|
|
|
36
34
|
"logs:prune": "node dist/prune-logs.js",
|
|
37
35
|
"queue:run": "node dist/queue-runner.js",
|
|
38
36
|
"queue:drain": "node dist/queue-runner.js --max-jobs=100",
|
|
39
|
-
"queue:cron": "bash ./scripts/queue-runner-cron.sh",
|
|
40
37
|
"publish:site": "npm run build && npm run crawl && npm run deploy && npm run invalidate",
|
|
41
38
|
"install:browsers": "playwright install chromium",
|
|
42
39
|
"release:npm": "WPSUITE_PREMIUM=true npm run build && npm publish --access=public"
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
RUNTIME_DIR="${STATIC_PUBLISHER_RUNTIME_DIR:-${1:-}}"
|
|
5
|
-
MAX_JOBS="${STATIC_PUBLISHER_MAX_JOBS:-${2:-1}}"
|
|
6
|
-
PACKAGE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
7
|
-
CONFIG_PATH="${PUBLISHER_CONFIG:-$RUNTIME_DIR/config.json}"
|
|
8
|
-
|
|
9
|
-
if [[ -z "$RUNTIME_DIR" ]]; then
|
|
10
|
-
echo "Missing runtime dir. Provide arg1 or STATIC_PUBLISHER_RUNTIME_DIR." >&2
|
|
11
|
-
exit 2
|
|
12
|
-
fi
|
|
13
|
-
|
|
14
|
-
resolve_node_bin() {
|
|
15
|
-
if [[ -n "${NODE_BIN:-}" && -x "${NODE_BIN}" ]]; then
|
|
16
|
-
printf '%s\n' "$NODE_BIN"
|
|
17
|
-
return 0
|
|
18
|
-
fi
|
|
19
|
-
|
|
20
|
-
if command -v node >/dev/null 2>&1; then
|
|
21
|
-
command -v node
|
|
22
|
-
return 0
|
|
23
|
-
fi
|
|
24
|
-
|
|
25
|
-
if [[ -n "${NVM_DIR:-}" && -s "${NVM_DIR}/nvm.sh" ]]; then
|
|
26
|
-
# shellcheck source=/dev/null
|
|
27
|
-
. "${NVM_DIR}/nvm.sh"
|
|
28
|
-
elif [[ -s "$HOME/.nvm/nvm.sh" ]]; then
|
|
29
|
-
# shellcheck source=/dev/null
|
|
30
|
-
. "$HOME/.nvm/nvm.sh"
|
|
31
|
-
fi
|
|
32
|
-
|
|
33
|
-
if command -v node >/dev/null 2>&1; then
|
|
34
|
-
command -v node
|
|
35
|
-
return 0
|
|
36
|
-
fi
|
|
37
|
-
|
|
38
|
-
local candidate
|
|
39
|
-
for candidate in \
|
|
40
|
-
"/usr/bin/node" \
|
|
41
|
-
"/usr/local/bin/node" \
|
|
42
|
-
"$HOME/.nvm/versions/node/current/bin/node"; do
|
|
43
|
-
if [[ -x "$candidate" ]]; then
|
|
44
|
-
printf '%s\n' "$candidate"
|
|
45
|
-
return 0
|
|
46
|
-
fi
|
|
47
|
-
done
|
|
48
|
-
|
|
49
|
-
return 1
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
NODE_CMD="$(resolve_node_bin || true)"
|
|
53
|
-
if [[ -z "$NODE_CMD" ]]; then
|
|
54
|
-
echo "node binary not found in cron environment. Set NODE_BIN or NVM_DIR in crontab." >&2
|
|
55
|
-
echo "PATH=$PATH" >&2
|
|
56
|
-
exit 127
|
|
57
|
-
fi
|
|
58
|
-
|
|
59
|
-
exec "$NODE_CMD" "$PACKAGE_DIR/dist/cli.js" queue-runner \
|
|
60
|
-
--runtime-dir "$RUNTIME_DIR" \
|
|
61
|
-
--exporter-dir "$PACKAGE_DIR" \
|
|
62
|
-
--config "$CONFIG_PATH" \
|
|
63
|
-
--max-jobs "$MAX_JOBS"
|