super-productivity/packages/plugin-dev/azure-devops-issue-provider/scripts/build.js
Johannes Millan 933b274afe
feat(plugins): migrate Azure DevOps issue provider to a plugin (#8509)
* fix(plainspace): don't tint claim-list link icon with accent color

* feat(plugins): migrate Azure DevOps issue provider to a plugin

Move the built-in Azure DevOps provider out of core into a bundled plugin
(packages/plugin-dev/azure-devops-issue-provider), mirroring the prior
GitHub/ClickUp/Gitea/Linear/Trello migrations.

- Read-only provider: WIQL search + backlog import (scope all / created-by-me
  / assigned-to-me), two-step work-item fetch, getById with description.
- PAT auth via HTTP Basic (empty username); allowPrivateNetwork enabled so
  self-hosted Azure DevOps Server hosts keep working.
- getIssueLink builds the work-item URL from host + project + id without a
  request; isDone maps (pullOnly) from Closed/Done/Removed/Resolved states.
- issue-provider.reducer migrates legacy AZURE_DEVOPS providers to plugin
  shape on load (project listed first so the tooltip/initials keep showing
  the project); auto-enable already covers migrated keys generically.
- AZURE_DEVOPS moves from BuiltInIssueProviderKey to MigratedIssueProviderKey;
  the synced issueProviderKey union member is preserved for forward-compat.
- i18n: ported the translated F.AZURE_DEVOPS.FORM.* config labels (de/en/uk
  localized, English fallback elsewhere) and shared issue-content display
  labels to all 28 app locales.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* refactor(plugins): tidy Azure DevOps plugin issue field mapping

Post-review cleanup of the field mappers (no behavior change for the
common case, and closer to the Linear/Gitea reference plugins):

- mapReduced no longer emits a redundant `state` field; the typed `status`
  already drives the search-list done indicator (is-issue-done), and dropping
  `state` keeps isDone unset on add-from-search — matching the built-in, which
  never set isDone in getAddTaskData.
- mapIssue keeps `state` as the single canonical status field (used by
  issueDisplay, the isDone fieldMapping and extractSyncValues) and no longer
  duplicates it as `status`; the display row now points at `state`.
- Compute the work-item summary once per mapper instead of twice.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* refactor(plugins): remove dead Azure DevOps form i18n keys after plugin migration

The built-in Azure DevOps config form was deleted in the plugin migration,
so the F.AZURE_DEVOPS.FORM.* keys in t.const.ts and the app locale files
(en/de/uk) are now unreferenced. The plugin ships its own bundled i18n.
Removing them matches the GitHub/Trello/Linear/ClickUp migration cleanup.

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-20 13:06:45 +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 azure-devops-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);
});