Files
readest/apps/readest-app/extensions/send-to-readest/scripts/zip.mjs
T
Huang Xin 4cb608be20 chore(send-to-readest): v0.2.1, zip packaging script, store submission doc (#4661)
Prep for the Chrome Web Store submission of the Send to Readest browser
extension:

- Bump manifest + package version 0.2.0 -> 0.2.1.
- Add a `pnpm zip` script (scripts/zip.mjs) that builds and packages dist/
  into a versioned, Web-Store-ready archive: manifest.json at the zip root,
  excluding webpack's `.LICENSE.txt` banners and `.DS_Store`. Ignore the
  produced `*.zip` in the extension's .gitignore.
- Add STORE-SUBMISSION.md: copy-paste dashboard answers (single purpose,
  per-permission justifications, remote-code answer, data-use disclosures,
  listing copy) pointing at the canonical privacy policy hosted at
  https://www.readest.com/send-to-readest/privacy-policy.

Verified: pnpm test:extension (51 passed), pnpm build-browser-ext, pnpm zip
(valid archive), pnpm lint clean.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 10:30:30 +02:00

40 lines
1.5 KiB
JavaScript

#!/usr/bin/env node
/**
* Package the built extension into a versioned, Chrome-Web-Store-ready zip.
*
* Invoked by `pnpm zip`, which builds first so the archive is never stale.
* The zip root holds `manifest.json` directly — the layout the Web Store
* dashboard expects — and drops the `.LICENSE.txt` banners webpack emits
* plus macOS `.DS_Store` noise.
*
* Requires the `zip` CLI (present on macOS / Linux). This is a maintainer
* packaging step, not part of the CI build.
*/
import { execFileSync } from 'node:child_process';
import { existsSync, readFileSync, rmSync, statSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
const ROOT = dirname(dirname(fileURLToPath(import.meta.url)));
const DIST = join(ROOT, 'dist');
const MANIFEST = join(DIST, 'manifest.json');
if (!existsSync(MANIFEST)) {
console.error('[zip] dist/manifest.json not found — run `pnpm build` first.');
process.exit(1);
}
const { version } = JSON.parse(readFileSync(MANIFEST, 'utf8'));
const out = join(ROOT, `send-to-readest-${version}.zip`);
if (existsSync(out)) rmSync(out);
// Zip the *contents* of dist/ (cwd: DIST) so manifest.json lands at the
// archive root rather than under a `dist/` prefix.
execFileSync('zip', ['-rq', out, '.', '-x', '*.DS_Store', '*.LICENSE.txt'], {
cwd: DIST,
stdio: 'inherit',
});
const kb = Math.round(statSync(out).size / 1024);
console.log(`[zip] send-to-readest-${version}.zip (${kb} KB) ready to upload`);