super-productivity/packages/plugin-dev/doc-mode/scripts/deploy.js
Johannes Millan 3443bcacd0 refactor(plugins): rename document-mode to doc-mode
Renames the bundled plugin's id (`document-mode` → `doc-mode`), display
name (`Document Mode (Alpha)` → `Doc Mode (Alpha)`), package name,
directory, and asset path. No migration: the plugin has never been
published, so there is no on-disk user data to preserve.

Touched everywhere the id was hardcoded:
- Plugin manifest, package.json, build/deploy/test scripts, log prefixes
- Host BUNDLED_PLUGIN_PATHS entry (src/app/plugins/plugin.service.ts)
- Host comments and test fixtures (plugin-hooks, plugin-persistence-key,
  plugin-persistence.model, conflict-resolution.service.spec)
- E2E spec filenames + PLUGIN_ID constant + label assertions
- build-all.js plugin orchestrator
- build/release-notes.md user-facing entry

Test pass: 88/88 plugin specs, 8/8 plugin-hooks, 132/132
conflict-resolution, 15/15 plugin-persistence-key.util.
Bundle redeployed to src/assets/bundled-plugins/doc-mode (gitignored).

The old `src/assets/bundled-plugins/document-mode/` dir is gitignored and
left on disk after this commit; the host loader no longer references it,
so it's inert. Remove with `rm -rf src/assets/bundled-plugins/document-mode`.
2026-05-27 16:48:59 +02:00

39 lines
1 KiB
JavaScript

#!/usr/bin/env node
/* eslint-disable @typescript-eslint/no-require-imports */
const fs = require('fs');
const path = require('path');
const ROOT_DIR = path.join(__dirname, '..');
const DIST_DIR = path.join(ROOT_DIR, 'dist');
const TARGET_DIR = path.join(
ROOT_DIR,
'..',
'..',
'..',
'src',
'assets',
'bundled-plugins',
'doc-mode',
);
// editor.js is inlined into index.html, so it doesn't need to be deployed.
const FILES = ['manifest.json', 'plugin.js', 'index.html', 'icon.svg'];
if (!fs.existsSync(DIST_DIR)) {
console.error('Error: dist directory not found. Run "npm run build" first.');
process.exit(1);
}
if (!fs.existsSync(TARGET_DIR)) {
fs.mkdirSync(TARGET_DIR, { recursive: true });
}
for (const file of FILES) {
const src = path.join(DIST_DIR, file);
const dest = path.join(TARGET_DIR, file);
if (fs.existsSync(src)) {
fs.copyFileSync(src, dest);
console.log(`✓ Copied ${file}`);
} else {
console.warn(`${file} not found in dist`);
}
}
console.log(`\n✅ Deployed to ${TARGET_DIR}`);