mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-17 16:46:31 +03:00
Build: ship the launcher instead of bundling the JS engine
readSourceFiles no longer copies cli/engine into the skill; the scripts
payload is the launcher (executable bit preserved through dist, plugin/, and
universal.zip), impeccable.cmd, VERSION (synced from ENGINE_VERSION on every
build), the page JS, and command-metadata.json. Hook manifests call
`<scripts>/impeccable hook` behind an existence guard (Codex adds a
commandWindows sibling calling impeccable.cmd; Cursor runs hook-before-edit;
GitHub keeps the git rev-parse form; Grok mirrors Claude); the Node probe and
systemMessage notice are gone. build:release fetches the pinned engine for
every target (lenient) and stages bin/<os-arch>/ into the dist skill copies
after root harness dirs and plugin/ were synced, so git-delivered trees stay
launcher-only. The detection-rule count check reads the vendored
extension/detector/antipatterns.json and is skipped when absent.
build:browser is a stub; the codex prefix rewrite leaves
`{{scripts_path}}/impeccable` alone.
Prepared with AI assistance (Claude Code).
This commit is contained in:
@@ -1,49 +1,12 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Generates cli/engine/detect-antipatterns-browser.js
|
||||
* by concatenating the browser-safe detector modules and wrapping them in an IIFE.
|
||||
* The in-page detector bundle is no longer built here. It is produced by the
|
||||
* engine repo (the WASM rule core plus a thin DOM adapter) and vendored under
|
||||
* extension/detector/ by `bun run build:extension`.
|
||||
*
|
||||
* Run: node scripts/build-browser-detector.js
|
||||
* This stub keeps `bun run build:browser` a no-op so package scripts and CI
|
||||
* steps that still call it do not break.
|
||||
*/
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { bundleBrowserDetectorModules } from './lib/browser-detector-bundle.js';
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const ROOT = path.resolve(__dirname, '..');
|
||||
|
||||
const OUTPUT = path.join(ROOT, 'cli/engine/detect-antipatterns-browser.js');
|
||||
const SITE_OUTPUT = path.join(ROOT, 'site/public/js/detect-antipatterns-browser.js');
|
||||
|
||||
const code = bundleBrowserDetectorModules(ROOT);
|
||||
|
||||
const output = `/**
|
||||
* Anti-Pattern Browser Detector for Impeccable
|
||||
* Copyright (c) 2026 Paul Bakaus
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* GENERATED -- do not edit. Source: cli/engine/browser/injected/index.mjs
|
||||
* Rebuild: node scripts/build-browser-detector.js
|
||||
*
|
||||
* Usage: <script src="detect-antipatterns-browser.js"></script>
|
||||
* Re-scan: window.impeccableScan()
|
||||
*/
|
||||
(function () {
|
||||
if (typeof window === 'undefined') return;
|
||||
${code}
|
||||
})();
|
||||
`;
|
||||
|
||||
fs.writeFileSync(OUTPUT, output);
|
||||
console.log(`Generated ${path.relative(ROOT, OUTPUT)} (${(output.length / 1024).toFixed(1)} KB)`);
|
||||
|
||||
// The site consumes this bundle from its own repo. Only mirror it when that
|
||||
// checkout is present, so a build here never recreates a stray `site/` tree.
|
||||
if (fs.existsSync(path.dirname(path.dirname(SITE_OUTPUT)))) {
|
||||
fs.mkdirSync(path.dirname(SITE_OUTPUT), { recursive: true });
|
||||
fs.writeFileSync(SITE_OUTPUT, output);
|
||||
console.log(`Generated ${path.relative(ROOT, SITE_OUTPUT)} (${(output.length / 1024).toFixed(1)} KB)`);
|
||||
}
|
||||
console.log('build:browser: the in-page bundle is produced by the engine repo; vendored under extension/detector by build:extension.');
|
||||
process.exit(0);
|
||||
|
||||
Reference in New Issue
Block a user