super-productivity/packages/plugin-dev/trello-issue-provider/scripts/build.js
Johannes Millan be50775c9c feat(plugins): migrate Trello issue provider to a plugin
Move the built-in Trello provider out of core into a bundled plugin
(packages/plugin-dev/trello-issue-provider), mirroring the prior
GitHub/ClickUp/Gitea/Linear migrations.

- Board selection is now a dynamic `select` config field backed by
  `loadOptions` (member + organization boards, merged) instead of the
  bespoke `trello_additional_cfg` board-picker component, which is
  deleted along with its `@case('TRELLO')` in the edit dialog.
- Credentials are sent via Trello's `Authorization: OAuth` header rather
  than `key`/`token` URL query params, so they never appear in request
  URLs or error logs (keeps the redaction from #8459 intact).
- Card attachments are surfaced as markdown links in the issue display;
  the plugin model has no attachment hook, so the previous inline
  preview / attachment-count is dropped.
- `getIssueLink` derives `https://trello.com/c/<shortLink>` directly;
  isDone maps from a card being archived (closed).
- issue-provider.reducer migrates legacy TRELLO providers to plugin
  shape on load (boardName listed first so the tooltip keeps showing
  the board name); auto-enable already covers migrated keys generically.
- i18n: the built-in config form was hard-coded English, but the
  issue-content display labels used shared translated keys. Ship all 28
  app locales — DISPLAY.* and the token-help link sourced from the
  shared F.ISSUE.ISSUE_CONTENT.* / HOW_TO_GET_A_TOKEN translations, with
  the never-translated config-field labels kept in English per locale.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 14:37:39 +02:00

67 lines
1.7 KiB
JavaScript

#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const { build } = require('esbuild');
const ROOT_DIR = path.join(__dirname, '..');
const SRC_DIR = path.join(ROOT_DIR, 'src');
const DIST_DIR = path.join(ROOT_DIR, 'dist');
const I18N_SRC = path.join(ROOT_DIR, 'i18n');
const I18N_DIST = path.join(DIST_DIR, 'i18n');
async function buildPlugin() {
console.log('Building trello-issue-provider...');
if (fs.existsSync(DIST_DIR)) {
fs.rmSync(DIST_DIR, { recursive: true });
}
fs.mkdirSync(DIST_DIR);
// Build TypeScript to IIFE bundle
await build({
entryPoints: [path.join(SRC_DIR, 'plugin.ts')],
bundle: true,
outfile: path.join(DIST_DIR, 'plugin.js'),
platform: 'browser',
target: 'es2020',
format: 'iife',
define: {
'process.env.NODE_ENV': '"production"',
},
logLevel: 'info',
minify: true,
sourcemap: false,
});
// Copy manifest.json
fs.copyFileSync(
path.join(SRC_DIR, 'manifest.json'),
path.join(DIST_DIR, 'manifest.json'),
);
// Copy icon.svg if present
const iconSrc = path.join(ROOT_DIR, 'icon.svg');
if (fs.existsSync(iconSrc)) {
fs.copyFileSync(iconSrc, path.join(DIST_DIR, 'icon.svg'));
console.log('Copied icon.svg');
}
// Copy i18n files
if (fs.existsSync(I18N_SRC)) {
fs.mkdirSync(I18N_DIST, { recursive: true });
for (const file of fs.readdirSync(I18N_SRC)) {
if (file.endsWith('.json')) {
fs.copyFileSync(path.join(I18N_SRC, file), path.join(I18N_DIST, file));
}
}
console.log('Copied i18n files');
}
console.log('Build complete!');
}
buildPlugin().catch((err) => {
console.error('Build failed:', err);
process.exit(1);
});