Problem: the hexagonal refactor churns the backend tree for nine more phases; the UI delivery stack (web/ SPA, cmd/desktop Wails wrapper, compose/web image) must move to its own repo first so doc/layout rewrites land once on a backend-only tree. Change: - New repo git.hubris.network/dtoro/oikos-web (v0.33.0): web/, desktop/ (updateURL repointed to oikos-web releases), compose/, own CI (web + desktop jobs), own deploy script (CI-green gate, TOCTOU guard, version-tagged images, prune-to-3), own webhook receiver on :9798 + launchd unit, own compose project publishing the same 8091:80. - Cutover executed on mac-mini in order: oikos stack's web service stopped+removed, oikos-web project brought up on 8091; outer Caddy untouched (targets the published port) — serving + Authentik flow + /wails 404 quirk verified post-cutover. - Stripped from oikos: web/, cmd/desktop/, compose/web/, desktop CI workflow, ci.yml web job, Makefile ui/desktop/desktop-package/install targets, the compose web service, oikos-web from deploy.sh's fallback prune list; wails + go-keyring dropped from go.mod, vendor synced. - README / CONTRIBUTING / AGENTS.md / .agents dev+operations docs now point at the new repo; mbse + mascot design docs carry a path note. Risk: production SPA serving depends on the new pipeline now; rollback is versioned-image re-up of the old web service from a pre-split checkout (port 8091). Desktop builds installed before the split still check dtoro/oikos releases — one manual reinstall, noted in the oikos-web release notes. Verification: go vet, make test (race), make generate-check, golangci (no new findings; baseline down 400→365); post-cutover curls — localhost:8091 200, /wails/runtime.js 404, outer Caddy 302 Authentik.
146 lines
4.1 KiB
JavaScript
146 lines
4.1 KiB
JavaScript
/**
|
|
* @fileoverview `ExtractedConfig` class.
|
|
*
|
|
* `ExtractedConfig` class expresses a final configuration for a specific file.
|
|
*
|
|
* It provides one method.
|
|
*
|
|
* - `toCompatibleObjectAsConfigFileContent()`
|
|
* Convert this configuration to the compatible object as the content of
|
|
* config files. It converts the loaded parser and plugins to strings.
|
|
* `CLIEngine#getConfigForFile(filePath)` method uses this method.
|
|
*
|
|
* `ConfigArray#extractConfig(filePath)` creates a `ExtractedConfig` instance.
|
|
*
|
|
* @author Toru Nagashima <https://github.com/mysticatea>
|
|
*/
|
|
|
|
import { IgnorePattern } from "./ignore-pattern.js";
|
|
|
|
// For VSCode intellisense
|
|
/** @typedef {import("../../shared/types").ConfigData} ConfigData */
|
|
/** @typedef {import("../../shared/types").GlobalConf} GlobalConf */
|
|
/** @typedef {import("../../shared/types").SeverityConf} SeverityConf */
|
|
/** @typedef {import("./config-dependency").DependentParser} DependentParser */
|
|
/** @typedef {import("./config-dependency").DependentPlugin} DependentPlugin */
|
|
|
|
/**
|
|
* Check if `xs` starts with `ys`.
|
|
* @template T
|
|
* @param {T[]} xs The array to check.
|
|
* @param {T[]} ys The array that may be the first part of `xs`.
|
|
* @returns {boolean} `true` if `xs` starts with `ys`.
|
|
*/
|
|
function startsWith(xs, ys) {
|
|
return xs.length >= ys.length && ys.every((y, i) => y === xs[i]);
|
|
}
|
|
|
|
/**
|
|
* The class for extracted config data.
|
|
*/
|
|
class ExtractedConfig {
|
|
constructor() {
|
|
|
|
/**
|
|
* The config name what `noInlineConfig` setting came from.
|
|
* @type {string}
|
|
*/
|
|
this.configNameOfNoInlineConfig = "";
|
|
|
|
/**
|
|
* Environments.
|
|
* @type {Record<string, boolean>}
|
|
*/
|
|
this.env = {};
|
|
|
|
/**
|
|
* Global variables.
|
|
* @type {Record<string, GlobalConf>}
|
|
*/
|
|
this.globals = {};
|
|
|
|
/**
|
|
* The glob patterns that ignore to lint.
|
|
* @type {(((filePath:string, dot?:boolean) => boolean) & { basePath:string; patterns:string[] }) | undefined}
|
|
*/
|
|
this.ignores = void 0;
|
|
|
|
/**
|
|
* The flag that disables directive comments.
|
|
* @type {boolean|undefined}
|
|
*/
|
|
this.noInlineConfig = void 0;
|
|
|
|
/**
|
|
* Parser definition.
|
|
* @type {DependentParser|null}
|
|
*/
|
|
this.parser = null;
|
|
|
|
/**
|
|
* Options for the parser.
|
|
* @type {Object}
|
|
*/
|
|
this.parserOptions = {};
|
|
|
|
/**
|
|
* Plugin definitions.
|
|
* @type {Record<string, DependentPlugin>}
|
|
*/
|
|
this.plugins = {};
|
|
|
|
/**
|
|
* Processor ID.
|
|
* @type {string|null}
|
|
*/
|
|
this.processor = null;
|
|
|
|
/**
|
|
* The flag that reports unused `eslint-disable` directive comments.
|
|
* @type {boolean|undefined}
|
|
*/
|
|
this.reportUnusedDisableDirectives = void 0;
|
|
|
|
/**
|
|
* Rule settings.
|
|
* @type {Record<string, [SeverityConf, ...any[]]>}
|
|
*/
|
|
this.rules = {};
|
|
|
|
/**
|
|
* Shared settings.
|
|
* @type {Object}
|
|
*/
|
|
this.settings = {};
|
|
}
|
|
|
|
/**
|
|
* Convert this config to the compatible object as a config file content.
|
|
* @returns {ConfigData} The converted object.
|
|
*/
|
|
toCompatibleObjectAsConfigFileContent() {
|
|
const {
|
|
/* eslint-disable no-unused-vars -- needed to make `config` correct */
|
|
configNameOfNoInlineConfig: _ignore1,
|
|
processor: _ignore2,
|
|
/* eslint-enable no-unused-vars -- needed to make `config` correct */
|
|
ignores,
|
|
...config
|
|
} = this;
|
|
|
|
config.parser = config.parser && config.parser.filePath;
|
|
config.plugins = Object.keys(config.plugins).filter(Boolean).reverse();
|
|
config.ignorePatterns = ignores ? ignores.patterns : [];
|
|
|
|
// Strip the default patterns from `ignorePatterns`.
|
|
if (startsWith(config.ignorePatterns, IgnorePattern.DefaultPatterns)) {
|
|
config.ignorePatterns =
|
|
config.ignorePatterns.slice(IgnorePattern.DefaultPatterns.length);
|
|
}
|
|
|
|
return config;
|
|
}
|
|
}
|
|
|
|
export { ExtractedConfig };
|