@smart-cloud/publisher-exporter 1.0.14 → 1.0.15

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.
Files changed (2) hide show
  1. package/dist/cli.js +4 -2
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {spawn}from'child_process';import {existsSync}from'fs';import o from'path';import {fileURLToPath}from'url';var c=o.dirname(fileURLToPath(import.meta.url)),i=o.resolve(c,"..");function w(){console.log(`publisher-exporter <command> [args]
2
+ import {spawn}from'child_process';import {existsSync,readFileSync}from'fs';import o from'path';import {fileURLToPath}from'url';var c=o.dirname(fileURLToPath(import.meta.url)),i=o.resolve(c,"..");function f(){try{let r=readFileSync(o.join(i,"package.json"),"utf8"),e=JSON.parse(r);if(typeof e.version=="string"&&e.version.trim())return e.version.trim()}catch{}return "unknown"}function g(){console.log(`publisher-exporter <command> [args]
3
3
 
4
4
  Commands:
5
5
  crawl Run the crawl phase
@@ -9,6 +9,7 @@ Commands:
9
9
  queue-runner Process queued jobs from runtime JSON
10
10
  prune-logs Delete archived log directories older than a retention window
11
11
  install-browsers Install Playwright Chromium into the current/shared browsers path
12
+ version Show the installed CLI version
12
13
  help Show this help
13
14
 
14
15
  Examples:
@@ -17,4 +18,5 @@ Examples:
17
18
  publisher-exporter queue-runner --runtime-dir /srv/site/runtime --max-jobs 1
18
19
  publisher-exporter prune-logs --runtime-dir /srv/site/runtime --older-than-days 30
19
20
  publisher-exporter install-browsers
20
- `);}function p(r){let e=o.join(c,`${r}.js`);if(!existsSync(e))throw new Error(`Missing CLI entrypoint: ${e}`);return e}function f(){let r=[o.join(i,"node_modules","playwright","cli.js"),o.join(i,"node_modules","playwright-core","cli.js")];for(let e of r)if(existsSync(e))return e;throw new Error("Playwright CLI was not found under this package. Run `npm install` first.")}function t(r,e){return new Promise((n,s)=>{let a=spawn(process.execPath,[r,...e],{cwd:i,env:process.env,stdio:"inherit"});a.on("error",s),a.on("close",(d,l)=>{if(l){s(new Error(`Command terminated by signal ${l}.`));return}n(d??1);});})}async function g(r){for(let e of ["crawl","deploy","invalidate"]){let n=await t(p(e),r);if(n!==0)return n}return 0}async function y(){let[r="help",...e]=process.argv.slice(2);if(["help","--help","-h"].includes(r)){w();return}if(r==="publish"){process.exitCode=await g(e);return}if(r==="install-browsers"){let n=e.length>0?e:["install","chromium"];process.exitCode=await t(f(),n);return}if(r==="crawl"||r==="deploy"||r==="invalidate"||r==="queue-runner"||r==="prune-logs"){process.exitCode=await t(p(r),e);return}throw new Error(`Unknown command: ${r}`)}y().catch(r=>{console.error(r instanceof Error?r.message:String(r)),process.exit(1);});
21
+ publisher-exporter --version
22
+ `);}function v(){console.log(f());}function p(r){let e=o.join(c,`${r}.js`);if(!existsSync(e))throw new Error(`Missing CLI entrypoint: ${e}`);return e}function y(){let r=[o.join(i,"node_modules","playwright","cli.js"),o.join(i,"node_modules","playwright-core","cli.js")];for(let e of r)if(existsSync(e))return e;throw new Error("Playwright CLI was not found under this package. Run `npm install` first.")}function t(r,e){return new Promise((n,s)=>{let a=spawn(process.execPath,[r,...e],{cwd:i,env:process.env,stdio:"inherit"});a.on("error",s),a.on("close",(d,l)=>{if(l){s(new Error(`Command terminated by signal ${l}.`));return}n(d??1);});})}async function b(r){for(let e of ["crawl","deploy","invalidate"]){let n=await t(p(e),r);if(n!==0)return n}return 0}async function x(){let[r="help",...e]=process.argv.slice(2);if(["version","--version","-v"].includes(r)){v();return}if(["help","--help","-h"].includes(r)){g();return}if(r==="publish"){process.exitCode=await b(e);return}if(r==="install-browsers"){let n=e.length>0?e:["install","chromium"];process.exitCode=await t(y(),n);return}if(r==="crawl"||r==="deploy"||r==="invalidate"||r==="queue-runner"||r==="prune-logs"){process.exitCode=await t(p(r),e);return}throw new Error(`Unknown command: ${r}`)}x().catch(r=>{console.error(r instanceof Error?r.message:String(r)),process.exit(1);});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smart-cloud/publisher-exporter",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
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.",