super-productivity/packages/plugin-dev/gitea-issue-provider/scripts/build.js
Johannes Millan 4c869c2e15
feat(plugins): migrate Gitea and Linear issue providers to plugins (#8204)
* feat(plugins): migrate Gitea and Linear issue providers to plugins

* feat(plugins): localize Gitea issue provider config form

Port the existing Gitea translations (F.GITEA.* + shared issue-content keys)
into the plugin's own i18n so non-English users keep localized config labels
after the plugin migration. Generated for all 28 app locales.

* docs(plugins): note Linear teamId/projectId filter is now active

The built-in Linear provider defined teamId/projectId config fields but never
passed them to the search, so they were inert. The plugin honors them as the
field labels promise; document this as a deliberate behavior change.

* test(issue): fix unknown casts in issue-provider migration spec

The spec compiled clean under the app tsconfig (which excludes *.spec.ts)
but failed CI's tsconfig.spec.json build: casting state.entities[id]
(IssueProvider | undefined) straight to Record<string, unknown> is a
TS2352 non-overlap error, and .toBe(already) on a bare literal is a
TS2345. Add the intermediate 'as unknown' so the spec type-checks.

* ci(lighthouse): raise total resource-count budget to 260

Migrating the Gitea and Linear issue providers to bundled plugins adds
two more entries to BUNDLED_PLUGIN_PATHS. Each bundled plugin is
discovered at startup, fetching its manifest.json plus icon.svg, which
pushed the Lighthouse total request count to 251, one over the previous
250 budget. The increase is an inherent, accepted consequence of the
built-in -> bundled-plugin migration (same as github/clickup); bump the
budget to 260 to reflect the new baseline with modest headroom.
2026-06-09 15:03:20 +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 gitea-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);
});