looply-cli 0.5.10 → 0.5.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.src-hash +1 -1
- package/dist/autonomy-controller.d.ts +23 -1
- package/dist/autonomy-controller.d.ts.map +1 -1
- package/dist/autonomy-controller.js +50 -9
- package/dist/autonomy-controller.js.map +1 -1
- package/dist/autonomy-store.d.ts +33 -1
- package/dist/autonomy-store.d.ts.map +1 -1
- package/dist/autonomy-store.js +58 -8
- package/dist/autonomy-store.js.map +1 -1
- package/dist/autonomy-tick.d.ts +23 -1
- package/dist/autonomy-tick.d.ts.map +1 -1
- package/dist/autonomy-tick.js +80 -14
- package/dist/autonomy-tick.js.map +1 -1
- package/dist/bin.d.ts.map +1 -1
- package/dist/bin.js +34 -5
- package/dist/bin.js.map +1 -1
- package/dist/branch-delivery-wiring.d.ts +4 -1
- package/dist/branch-delivery-wiring.d.ts.map +1 -1
- package/dist/branch-delivery-wiring.js +39 -12
- package/dist/branch-delivery-wiring.js.map +1 -1
- package/dist/branch-delivery.d.ts +157 -8
- package/dist/branch-delivery.d.ts.map +1 -1
- package/dist/branch-delivery.js +580 -82
- package/dist/branch-delivery.js.map +1 -1
- package/dist/branch-replay.d.ts +45 -0
- package/dist/branch-replay.d.ts.map +1 -0
- package/dist/branch-replay.js +123 -0
- package/dist/branch-replay.js.map +1 -0
- package/dist/commit-ownership.d.ts +102 -0
- package/dist/commit-ownership.d.ts.map +1 -0
- package/dist/commit-ownership.js +97 -0
- package/dist/commit-ownership.js.map +1 -0
- package/dist/coordinator-state.d.ts.map +1 -1
- package/dist/coordinator-state.js +23 -1
- package/dist/coordinator-state.js.map +1 -1
- package/dist/daemon-cmd.d.ts.map +1 -1
- package/dist/daemon-cmd.js +47 -4
- package/dist/daemon-cmd.js.map +1 -1
- package/dist/deliver-cmd.d.ts +18 -0
- package/dist/deliver-cmd.d.ts.map +1 -1
- package/dist/deliver-cmd.js +71 -5
- package/dist/deliver-cmd.js.map +1 -1
- package/dist/delivery-settings-cache.d.ts +15 -1
- package/dist/delivery-settings-cache.d.ts.map +1 -1
- package/dist/delivery-settings-cache.js +31 -3
- package/dist/delivery-settings-cache.js.map +1 -1
- package/dist/environment-hold.d.ts +69 -0
- package/dist/environment-hold.d.ts.map +1 -0
- package/dist/environment-hold.js +120 -0
- package/dist/environment-hold.js.map +1 -0
- package/dist/gate.d.ts.map +1 -1
- package/dist/gate.js +15 -1
- package/dist/gate.js.map +1 -1
- package/dist/github-api.d.ts +19 -0
- package/dist/github-api.d.ts.map +1 -1
- package/dist/github-api.js +26 -0
- package/dist/github-api.js.map +1 -1
- package/dist/goal-adaptive.d.ts +1 -0
- package/dist/goal-adaptive.d.ts.map +1 -1
- package/dist/goal-adaptive.js +26 -13
- package/dist/goal-adaptive.js.map +1 -1
- package/dist/goal-compile.d.ts +37 -0
- package/dist/goal-compile.d.ts.map +1 -1
- package/dist/goal-compile.js +25 -1
- package/dist/goal-compile.js.map +1 -1
- package/dist/goal-replay.d.ts +83 -0
- package/dist/goal-replay.d.ts.map +1 -0
- package/dist/goal-replay.js +121 -0
- package/dist/goal-replay.js.map +1 -0
- package/dist/goal-reproof.d.ts +5 -0
- package/dist/goal-reproof.d.ts.map +1 -1
- package/dist/goal-reproof.js +11 -4
- package/dist/goal-reproof.js.map +1 -1
- package/dist/grant-pause.d.ts +48 -0
- package/dist/grant-pause.d.ts.map +1 -0
- package/dist/grant-pause.js +103 -0
- package/dist/grant-pause.js.map +1 -0
- package/dist/grant-reconcile.d.ts +8 -2
- package/dist/grant-reconcile.d.ts.map +1 -1
- package/dist/grant-reconcile.js +9 -2
- package/dist/grant-reconcile.js.map +1 -1
- package/dist/grant-waiting-wiring.d.ts +49 -0
- package/dist/grant-waiting-wiring.d.ts.map +1 -0
- package/dist/grant-waiting-wiring.js +77 -0
- package/dist/grant-waiting-wiring.js.map +1 -0
- package/dist/machine-run-slots.d.ts +10 -2
- package/dist/machine-run-slots.d.ts.map +1 -1
- package/dist/machine-run-slots.js +15 -4
- package/dist/machine-run-slots.js.map +1 -1
- package/dist/maintenance-cmd.d.ts +44 -0
- package/dist/maintenance-cmd.d.ts.map +1 -0
- package/dist/maintenance-cmd.js +132 -0
- package/dist/maintenance-cmd.js.map +1 -0
- package/dist/maintenance-facts.d.ts +52 -0
- package/dist/maintenance-facts.d.ts.map +1 -0
- package/dist/maintenance-facts.js +256 -0
- package/dist/maintenance-facts.js.map +1 -0
- package/dist/maintenance-tick.d.ts +51 -0
- package/dist/maintenance-tick.d.ts.map +1 -0
- package/dist/maintenance-tick.js +156 -0
- package/dist/maintenance-tick.js.map +1 -0
- package/dist/planner-timeouts.d.ts +14 -0
- package/dist/planner-timeouts.d.ts.map +1 -0
- package/dist/planner-timeouts.js +51 -0
- package/dist/planner-timeouts.js.map +1 -0
- package/dist/run-cmd.d.ts +12 -1
- package/dist/run-cmd.d.ts.map +1 -1
- package/dist/run-cmd.js +146 -10
- package/dist/run-cmd.js.map +1 -1
- package/dist/run-launcher.d.ts +3 -0
- package/dist/run-launcher.d.ts.map +1 -1
- package/dist/run-launcher.js +3 -2
- package/dist/run-launcher.js.map +1 -1
- package/dist/run-refusal-marks.d.ts +7 -1
- package/dist/run-refusal-marks.d.ts.map +1 -1
- package/dist/run-refusal-marks.js +4 -0
- package/dist/run-refusal-marks.js.map +1 -1
- package/dist/server-client.d.ts +39 -1
- package/dist/server-client.d.ts.map +1 -1
- package/dist/server-client.js +28 -0
- package/dist/server-client.js.map +1 -1
- package/dist/start-attempts.d.ts +4 -2
- package/dist/start-attempts.d.ts.map +1 -1
- package/dist/start-attempts.js +6 -1
- package/dist/start-attempts.js.map +1 -1
- package/package.json +2 -2
|
@@ -62,7 +62,7 @@ function machineRunSlots(cap, deps = {}) {
|
|
|
62
62
|
const raw = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(dir, file), 'utf8'));
|
|
63
63
|
if (typeof raw.key !== 'string' || typeof raw.pid !== 'number' || typeof raw.at !== 'string')
|
|
64
64
|
continue;
|
|
65
|
-
out.push({ file, slot: { key: raw.key, pid: raw.pid, pending: raw.pending === true, at: raw.at, ...(raw.repo === undefined ? {} : { repo: raw.repo }) } });
|
|
65
|
+
out.push({ file, slot: { key: raw.key, pid: raw.pid, pending: raw.pending === true, at: raw.at, ...(raw.repo === undefined ? {} : { repo: raw.repo }), ...(raw.maintenance === true ? { maintenance: true } : {}) } });
|
|
66
66
|
}
|
|
67
67
|
catch {
|
|
68
68
|
// A torn write is not a run. The claim that wrote it rewrites it.
|
|
@@ -89,7 +89,8 @@ function machineRunSlots(cap, deps = {}) {
|
|
|
89
89
|
return {
|
|
90
90
|
cap: limit,
|
|
91
91
|
inUse,
|
|
92
|
-
claim(key) {
|
|
92
|
+
claim(key, opts) {
|
|
93
|
+
const maintenance = opts?.maintenance === true;
|
|
93
94
|
try {
|
|
94
95
|
(0, node_fs_1.mkdirSync)(dir, { recursive: true });
|
|
95
96
|
}
|
|
@@ -115,13 +116,23 @@ function machineRunSlots(cap, deps = {}) {
|
|
|
115
116
|
if (others >= limit) {
|
|
116
117
|
return `this computer already has ${others} autonomous run(s) going across its repositories and its ceiling is ${limit} (machine.max_runs_on_machine)`;
|
|
117
118
|
}
|
|
118
|
-
|
|
119
|
+
if (maintenance) {
|
|
120
|
+
const busy = all.filter(({ slot }) => slot.key !== key && live(slot) && slot.maintenance === true).length;
|
|
121
|
+
if (busy > 0)
|
|
122
|
+
return 'another maintenance run is going on this computer; maintenance runs one at a time';
|
|
123
|
+
if (limit >= 2 && others + 1 >= limit) {
|
|
124
|
+
return `maintenance leaves the last of this computer's ${limit} run slots free for real tickets (${others} in use)`;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
write({ key, pid: me, pending: true, at: new Date(now()).toISOString(), ...(deps.repo === undefined ? {} : { repo: deps.repo }), ...(maintenance ? { maintenance: true } : {}) });
|
|
119
128
|
return null;
|
|
120
129
|
}, (why) => `the machine-wide run count could not be checked (${why})`);
|
|
121
130
|
},
|
|
122
131
|
bind(key, pid) {
|
|
123
132
|
try {
|
|
124
|
-
|
|
133
|
+
// A bound slot keeps what its claim said it was.
|
|
134
|
+
const claimed = read().find(({ slot }) => slot.key === key)?.slot.maintenance === true;
|
|
135
|
+
write({ key, pid, pending: false, at: new Date(now()).toISOString(), ...(deps.repo === undefined ? {} : { repo: deps.repo }), ...(claimed ? { maintenance: true } : {}) });
|
|
125
136
|
}
|
|
126
137
|
catch {
|
|
127
138
|
// A slot that cannot be bound expires as pending; the run goes on.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"machine-run-slots.js","sourceRoot":"","sources":["../src/machine-run-slots.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"machine-run-slots.js","sourceRoot":"","sources":["../src/machine-run-slots.ts"],"names":[],"mappings":";;;AAyEA,0CAEC;AAID,0CAwGC;AAvLD,6CAAyC;AACzC,qCAAkG;AAClG,qCAAkC;AAClC,yCAAiC;AACjC,qDAAqD;AACrD,2CAAsD;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,uEAAuE;AAC1D,QAAA,cAAc,GAAG,CAAC,GAAG,MAAM,CAAC;AAqCzC,SAAgB,eAAe,CAAC,OAAe,IAAA,iBAAO,GAAE;IACtD,OAAO,IAAA,gBAAI,EAAC,IAAI,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,MAAM,GAAG,CAAC,GAAW,EAAU,EAAE,CAAC,GAAG,IAAA,wBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC;AAE9G,SAAgB,eAAe,CAAC,GAAW,EAAE,OAA2B,EAAE;IACxE,MAAM,GAAG,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,GAAG,G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* `looply maintenance plan [--json] [--major] [--dead-code] [--min-severity <s>] [--per-week <n>]`
|
|
4
|
+
* `looply maintenance status`
|
|
5
|
+
*
|
|
6
|
+
* THE DRY RUN. Reads this repository exactly as the weekly plan does (`npm
|
|
7
|
+
* outdated`, `npm audit`, an import search) and prints the goals it would
|
|
8
|
+
* propose — one pull request each — with the packages, the links, the build
|
|
9
|
+
* notes, and how each would be delivered under this project's "When Looply
|
|
10
|
+
* finishes" setting. NOTHING is posted, created, installed or pushed.
|
|
11
|
+
*
|
|
12
|
+
* The settings are this project's own when the daemon has heard them, else the
|
|
13
|
+
* defaults switched on; the flags override either for this one look.
|
|
14
|
+
*/
|
|
15
|
+
export interface MaintenanceCmdDeps {
|
|
16
|
+
cwd: string;
|
|
17
|
+
stateDir: string;
|
|
18
|
+
gather(opts: {
|
|
19
|
+
deadCode: boolean;
|
|
20
|
+
}): Promise<PackageRootFacts[]>;
|
|
21
|
+
deliverMode(): {
|
|
22
|
+
mode: DeliverMode;
|
|
23
|
+
from: string;
|
|
24
|
+
};
|
|
25
|
+
out(line: string): void;
|
|
26
|
+
now(): number;
|
|
27
|
+
}
|
|
28
|
+
export declare function parseMaintenanceArgs(argv: readonly string[]): {
|
|
29
|
+
json: boolean;
|
|
30
|
+
overrides: Record<string, unknown>;
|
|
31
|
+
} | {
|
|
32
|
+
error: string;
|
|
33
|
+
};
|
|
34
|
+
export declare function settingsForDryRun(remote: MaintenanceSettings | null, o: Record<string, unknown>): {
|
|
35
|
+
settings: MaintenanceSettings;
|
|
36
|
+
from: string;
|
|
37
|
+
};
|
|
38
|
+
export declare function renderPlan(plan: MaintenancePlan, deliver: {
|
|
39
|
+
mode: DeliverMode;
|
|
40
|
+
from: string;
|
|
41
|
+
}, settingsFrom: string): string[];
|
|
42
|
+
export declare function maintenanceCommand(argv: readonly string[], deps: MaintenanceCmdDeps): Promise<number>;
|
|
43
|
+
export declare function nodeMaintenanceDeps(cwd: string, out: (line: string) => void): MaintenanceCmdDeps;
|
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M,GAAG,MAAM,EAAE,CAmB9H;AAED,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CA6B3G;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,kBAAkB,CAgBhG"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseMaintenanceArgs = parseMaintenanceArgs;
|
|
4
|
+
exports.settingsForDryRun = settingsForDryRun;
|
|
5
|
+
exports.renderPlan = renderPlan;
|
|
6
|
+
exports.maintenanceCommand = maintenanceCommand;
|
|
7
|
+
exports.nodeMaintenanceDeps = nodeMaintenanceDeps;
|
|
8
|
+
const node_fs_1 = require("node:fs");
|
|
9
|
+
const node_path_1 = require("node:path");
|
|
10
|
+
const core_1 = require("@looply/core");
|
|
11
|
+
const branch_delivery_1 = require("./branch-delivery");
|
|
12
|
+
const config_1 = require("./config");
|
|
13
|
+
const delivery_settings_cache_1 = require("./delivery-settings-cache");
|
|
14
|
+
const git_driver_1 = require("./git-driver");
|
|
15
|
+
const maintenance_facts_1 = require("./maintenance-facts");
|
|
16
|
+
const maintenance_tick_1 = require("./maintenance-tick");
|
|
17
|
+
function parseMaintenanceArgs(argv) {
|
|
18
|
+
const overrides = {};
|
|
19
|
+
let json = false;
|
|
20
|
+
for (let i = 0; i < argv.length; i++) {
|
|
21
|
+
const a = argv[i];
|
|
22
|
+
if (a === '--json')
|
|
23
|
+
json = true;
|
|
24
|
+
else if (a === '--major')
|
|
25
|
+
overrides['major'] = true;
|
|
26
|
+
else if (a === '--dead-code')
|
|
27
|
+
overrides['deadCode'] = true;
|
|
28
|
+
else if (a === '--min-severity') {
|
|
29
|
+
const v = argv[++i];
|
|
30
|
+
if (v === undefined || !core_1.AUDIT_SEVERITIES.includes(v))
|
|
31
|
+
return { error: `--min-severity takes one of ${core_1.AUDIT_SEVERITIES.join(', ')}` };
|
|
32
|
+
overrides['minSeverity'] = v;
|
|
33
|
+
}
|
|
34
|
+
else if (a === '--per-week') {
|
|
35
|
+
const n = Number(argv[++i]);
|
|
36
|
+
if (!Number.isInteger(n) || n < 1 || n > 20)
|
|
37
|
+
return { error: '--per-week takes a whole number 1 to 20' };
|
|
38
|
+
overrides['perWeek'] = n;
|
|
39
|
+
}
|
|
40
|
+
else
|
|
41
|
+
return { error: `unknown option ${a}` };
|
|
42
|
+
}
|
|
43
|
+
return { json, overrides };
|
|
44
|
+
}
|
|
45
|
+
function settingsForDryRun(remote, o) {
|
|
46
|
+
const base = remote ?? { ...core_1.DEFAULT_MAINTENANCE_SETTINGS, enabled: true };
|
|
47
|
+
const v = (0, core_1.validateMaintenanceSettings)({
|
|
48
|
+
...base,
|
|
49
|
+
enabled: true,
|
|
50
|
+
upgrades: { ...base.upgrades, ...(o['major'] === true ? { major: true } : {}) },
|
|
51
|
+
security: { ...base.security, ...(typeof o['minSeverity'] === 'string' ? { minSeverity: o['minSeverity'] } : {}) },
|
|
52
|
+
deadCode: { enabled: base.deadCode.enabled || o['deadCode'] === true },
|
|
53
|
+
caps: { ...base.caps, ...(typeof o['perWeek'] === 'number' ? { goalsPerWeek: o['perWeek'] } : {}) },
|
|
54
|
+
});
|
|
55
|
+
if (!v.ok)
|
|
56
|
+
throw new Error(`${v.key}: ${v.because}`);
|
|
57
|
+
return { settings: v.settings, from: remote === null ? 'the defaults (this project has not opted in yet)' : "this project's setting" };
|
|
58
|
+
}
|
|
59
|
+
function renderPlan(plan, deliver, settingsFrom) {
|
|
60
|
+
const out = [];
|
|
61
|
+
out.push(`Maintenance plan for ${plan.week} — a dry run: nothing is posted, installed or pushed.`);
|
|
62
|
+
out.push(`Settings: ${settingsFrom}. "When Looply finishes": ${deliver.mode} (${deliver.from}).`);
|
|
63
|
+
out.push('');
|
|
64
|
+
if (plan.items.length === 0)
|
|
65
|
+
out.push('Nothing to propose this week.');
|
|
66
|
+
plan.items.forEach((item, i) => {
|
|
67
|
+
const d = (0, core_1.maintenanceDeliverMode)(deliver.mode, item.maintenance);
|
|
68
|
+
out.push(`${i + 1}. ${item.title}`);
|
|
69
|
+
out.push(` goal ${item.key} · ticket type maintenance · priority -500`);
|
|
70
|
+
out.push(` pull request: "${(0, branch_delivery_1.pullTitle)(item.text)}" · delivered as ${d.mode}${d.capped ? ` (${d.capped})` : ''}`);
|
|
71
|
+
for (const line of (0, branch_delivery_1.maintenanceSection)(item.maintenance))
|
|
72
|
+
out.push(line === '' ? '' : ` ${line}`);
|
|
73
|
+
out.push('');
|
|
74
|
+
});
|
|
75
|
+
if (plan.skipped.length > 0) {
|
|
76
|
+
out.push('Not proposed:');
|
|
77
|
+
for (const s of plan.skipped)
|
|
78
|
+
out.push(` - ${s}`);
|
|
79
|
+
}
|
|
80
|
+
return out;
|
|
81
|
+
}
|
|
82
|
+
async function maintenanceCommand(argv, deps) {
|
|
83
|
+
const [sub, ...rest] = argv;
|
|
84
|
+
if (sub === 'status') {
|
|
85
|
+
const s = (0, maintenance_tick_1.readMaintenanceSettings)(deps.stateDir);
|
|
86
|
+
const st = (0, maintenance_tick_1.readMaintenanceState)(deps.stateDir);
|
|
87
|
+
deps.out(`maintenance: ${s?.enabled ? 'on' : 'off'}${s?.enabled ? ` — every ${['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'][s.schedule.weekday]} at ${String(s.schedule.hour).padStart(2, '0')}:00 UTC` : ''}`);
|
|
88
|
+
deps.out(`last plan: ${st.lastPlannedAt === null ? 'never' : `${new Date(st.lastPlannedAt).toISOString()} (${st.week}, ${st.proposed} proposed)`}`);
|
|
89
|
+
if (st.lastFailure)
|
|
90
|
+
deps.out(`last failure: ${st.lastFailure}`);
|
|
91
|
+
return 0;
|
|
92
|
+
}
|
|
93
|
+
if (sub !== 'plan') {
|
|
94
|
+
deps.out('usage: looply maintenance plan [--json] [--major] [--dead-code] [--min-severity low|moderate|high|critical] [--per-week N]');
|
|
95
|
+
deps.out(' looply maintenance status');
|
|
96
|
+
return sub === undefined || sub === '--help' ? 0 : 64;
|
|
97
|
+
}
|
|
98
|
+
const args = parseMaintenanceArgs(rest);
|
|
99
|
+
if ('error' in args) {
|
|
100
|
+
deps.out(args.error);
|
|
101
|
+
return 1;
|
|
102
|
+
}
|
|
103
|
+
const { settings, from } = settingsForDryRun((0, maintenance_tick_1.readMaintenanceSettings)(deps.stateDir), args.overrides);
|
|
104
|
+
const facts = await deps.gather({ deadCode: settings.deadCode.enabled });
|
|
105
|
+
const plan = (0, core_1.planMaintenance)({ settings, week: (0, core_1.isoWeek)(deps.now()), roots: facts });
|
|
106
|
+
if (args.json) {
|
|
107
|
+
deps.out(JSON.stringify({ settings, deliver: deps.deliverMode(), plan, facts }, null, 2));
|
|
108
|
+
return 0;
|
|
109
|
+
}
|
|
110
|
+
for (const line of renderPlan(plan, deps.deliverMode(), from))
|
|
111
|
+
deps.out(line);
|
|
112
|
+
return 0;
|
|
113
|
+
}
|
|
114
|
+
function nodeMaintenanceDeps(cwd, out) {
|
|
115
|
+
const stateDir = (0, git_driver_1.projectStateDir)(cwd);
|
|
116
|
+
let localMode;
|
|
117
|
+
try {
|
|
118
|
+
localMode = (0, config_1.parseConfig)((0, node_fs_1.readFileSync)((0, node_path_1.join)(cwd, '.looply', 'config.yaml'), 'utf8')).deliver?.mode;
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
localMode = undefined;
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
cwd,
|
|
125
|
+
stateDir,
|
|
126
|
+
gather: (o) => (0, maintenance_facts_1.gatherFacts)(cwd, o, (0, maintenance_facts_1.nodeFactsDeps)()),
|
|
127
|
+
deliverMode: () => (0, delivery_settings_cache_1.resolveDeliverMode)(localMode, stateDir),
|
|
128
|
+
out,
|
|
129
|
+
now: () => Date.now(),
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=maintenance-cmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maintenance-cmd.js","sourceRoot":"","sources":["../src/maintenance-cmd.ts"],"names":[],"mappings":";;AA6CA,oDAmBC;AAED,8CAYC;AAED,gCAmBC;AAED,gDA6BC;AAED,kDAgBC;AApJD,qCAAuC;AACvC,yCAAiC;AACjC,uCAYsB;AACtB,uDAAkE;AAClE,qCAAuC;AACvC,uEAA+D;AAC/D,6CAA+C;AAC/C,2DAAiE;AACjE,yDAAmF;AAyBnF,SAAgB,oBAAoB,CAAC,IAAuB;IAC1D,MAAM,SAAS,GAA4B,EAAE,CAAC;IAC9C,IAAI,IAAI,GAAG,KAAK,CAAC;IACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAE,CAAC;QACnB,IAAI,CAAC,KAAK,QAAQ;YAAE,IAAI,GAAG,IAAI,CAAC;aAC3B,IAAI,CAAC,KAAK,SAAS;YAAE,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;aAC/C,IAAI,CAAC,KAAK,aAAa;YAAE,SAAS,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;aACtD,IAAI,CAAC,KAAK,gBAAgB,EAAE,CAAC;YAChC,MAAM,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;YACpB,IAAI,CAAC,KAAK,SAAS,IAAI,CAAE,uBAAsC,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAAE,OAAO,EAAE,KAAK,EAAE,+BAA+B,uBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;YAC5J,SAAS,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QAC/B,CA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;QACL,GAAG;QACH,QAAQ;QACR,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,+BAAW,EAAC,GAAG,EAAE,CAAC,EAAE,IAAA,iCAAa,GAAE,CAAC;QACnD,WAAW,EAAE,GAAG,EAAE,CAAC,IAAA,4CAAkB,EAAC,SAAS,EAAE,QAAQ,CAAC;QAC1D,GAAG;QACH,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;KACtB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type PackageRootFacts } from '@looply/core';
|
|
2
|
+
/**
|
|
3
|
+
* WHAT THE WEEKLY MAINTENANCE PLAN IS MADE FROM — read from the repository on
|
|
4
|
+
* this machine, never changed.
|
|
5
|
+
*
|
|
6
|
+
* For each package root (a folder with a package.json and a lockfile; the
|
|
7
|
+
* repository root and folders up to two levels down), the package manager its
|
|
8
|
+
* lockfile names, whether it is an Expo app, `<pm> outdated` and `<pm> audit`,
|
|
9
|
+
* which installed packages ship native code, where each package's changelog is,
|
|
10
|
+
* and — when the dead-code pass is on — which dependencies nothing imports.
|
|
11
|
+
*
|
|
12
|
+
* ⚠️ READ-ONLY. `outdated` and `audit` report; nothing here installs, fixes or
|
|
13
|
+
* writes a lockfile. They do ask the npm registry, which is the point.
|
|
14
|
+
*
|
|
15
|
+
* ⚠️ npm AND pnpm ONLY, for now. A yarn or bun root is reported as such and gets
|
|
16
|
+
* no upgrade or security goals rather than a guess in another tool's words.
|
|
17
|
+
*/
|
|
18
|
+
export interface CommandResult {
|
|
19
|
+
code: number | null;
|
|
20
|
+
stdout: string;
|
|
21
|
+
stderr: string;
|
|
22
|
+
}
|
|
23
|
+
export interface FactsDeps {
|
|
24
|
+
/** Run one fixed command in `cwd`. Never given anything a repository wrote. */
|
|
25
|
+
run(command: string, args: readonly string[], cwd: string): Promise<CommandResult>;
|
|
26
|
+
readFile(path: string): string | null;
|
|
27
|
+
/** Directory entries, or [] when unreadable. */
|
|
28
|
+
list(path: string): Array<{
|
|
29
|
+
name: string;
|
|
30
|
+
dir: boolean;
|
|
31
|
+
}>;
|
|
32
|
+
exists(path: string): boolean;
|
|
33
|
+
}
|
|
34
|
+
/** Package roots: the repository root when it has a package.json, then folders up to two levels down with a package.json and a lockfile. */
|
|
35
|
+
export declare function findPackageRoots(repo: string, deps: Pick<FactsDeps, 'list' | 'exists'>): string[];
|
|
36
|
+
/** Does this installed package ship native code an Expo app must rebuild for? */
|
|
37
|
+
export declare function shipsNativeCode(pkgDir: string, deps: Pick<FactsDeps, 'exists' | 'readFile'>): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Dependencies nothing under `root` mentions by name in a quote — a plain text
|
|
40
|
+
* search, so a candidate list for a goal to CONFIRM, never a removal list.
|
|
41
|
+
*/
|
|
42
|
+
export declare function unusedDependencies(rootDir: string, pkg: Record<string, unknown>, deps: Pick<FactsDeps, 'list' | 'readFile'>): string[];
|
|
43
|
+
/** Every fact for one package root. Never throws: a tool that failed is a sentence on the root. */
|
|
44
|
+
export declare function gatherRootFacts(repo: string, root: string, opts: {
|
|
45
|
+
deadCode: boolean;
|
|
46
|
+
}, deps: FactsDeps): Promise<PackageRootFacts>;
|
|
47
|
+
export declare function gatherFacts(repo: string, opts: {
|
|
48
|
+
deadCode: boolean;
|
|
49
|
+
}, deps: FactsDeps): Promise<PackageRootFacts[]>;
|
|
50
|
+
/** The real thing: hidden, bounded, no prompts, nothing written. */
|
|
51
|
+
export declare function nodeFactsDeps(): FactsDeps;
|
|
52
|
+
//# sourceMappingURL=maintenance-facts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maintenance-facts.d.ts","sourceRoot":"","sources":["../src/maintenance-facts.ts"],"names":[],"mappings":"AAGA,OAAO,EAML,KAAK,gBAAgB,EACtB,MAAM,cAAc,CAAC;AAEtB;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,aAAa;IAC5B,IAAI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,gBAAgB,CAAC,CAgEzI;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAIzH;AAID,oEAAoE;AACpE,wBAAgB,aAAa,IAAI,SAAS,CAwDzC"}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findPackageRoots = findPackageRoots;
|
|
4
|
+
exports.shipsNativeCode = shipsNativeCode;
|
|
5
|
+
exports.unusedDependencies = unusedDependencies;
|
|
6
|
+
exports.gatherRootFacts = gatherRootFacts;
|
|
7
|
+
exports.gatherFacts = gatherFacts;
|
|
8
|
+
exports.nodeFactsDeps = nodeFactsDeps;
|
|
9
|
+
const node_child_process_1 = require("node:child_process");
|
|
10
|
+
const node_fs_1 = require("node:fs");
|
|
11
|
+
const node_path_1 = require("node:path");
|
|
12
|
+
const core_1 = require("@looply/core");
|
|
13
|
+
const LOCKFILES = ['package-lock.json', 'npm-shrinkwrap.json', 'pnpm-lock.yaml', 'yarn.lock', 'bun.lockb', 'bun.lock'];
|
|
14
|
+
const SKIP_DIRS = new Set(['node_modules', 'dist', 'build', 'coverage', 'out', 'vendor', 'android', 'ios', 'tmp', 'temp']);
|
|
15
|
+
const MAX_ROOTS = 12;
|
|
16
|
+
/** Package roots: the repository root when it has a package.json, then folders up to two levels down with a package.json and a lockfile. */
|
|
17
|
+
function findPackageRoots(repo, deps) {
|
|
18
|
+
const roots = [];
|
|
19
|
+
if (deps.exists((0, node_path_1.join)(repo, 'package.json')))
|
|
20
|
+
roots.push('.');
|
|
21
|
+
const walk = (dir, depth) => {
|
|
22
|
+
if (depth > 2 || roots.length >= MAX_ROOTS)
|
|
23
|
+
return;
|
|
24
|
+
for (const e of deps.list(dir).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
25
|
+
if (!e.dir || e.name.startsWith('.') || SKIP_DIRS.has(e.name))
|
|
26
|
+
continue;
|
|
27
|
+
const sub = (0, node_path_1.join)(dir, e.name);
|
|
28
|
+
if (deps.exists((0, node_path_1.join)(sub, 'package.json')) && LOCKFILES.some((l) => deps.exists((0, node_path_1.join)(sub, l)))) {
|
|
29
|
+
roots.push((0, node_path_1.relative)(repo, sub).split(node_path_1.sep).join('/'));
|
|
30
|
+
if (roots.length >= MAX_ROOTS)
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
walk(sub, depth + 1);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
walk(repo, 1);
|
|
37
|
+
return roots;
|
|
38
|
+
}
|
|
39
|
+
function json(text) {
|
|
40
|
+
if (text === null)
|
|
41
|
+
return null;
|
|
42
|
+
try {
|
|
43
|
+
const v = JSON.parse(text);
|
|
44
|
+
return typeof v === 'object' && v !== null && !Array.isArray(v) ? v : null;
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function depNames(pkg, field) {
|
|
51
|
+
const d = pkg[field];
|
|
52
|
+
return typeof d === 'object' && d !== null ? Object.keys(d) : [];
|
|
53
|
+
}
|
|
54
|
+
/** The first JSON value in a tool's output — npm can print a warning line before it. */
|
|
55
|
+
function jsonPart(out) {
|
|
56
|
+
const i = out.search(/[{[]/);
|
|
57
|
+
return i < 0 ? '' : out.slice(i);
|
|
58
|
+
}
|
|
59
|
+
const outdatedArgs = (pm) => pm === 'npm' ? ['outdated', '--json', '--long'] : pm === 'pnpm' ? ['outdated', '--format', 'json'] : null;
|
|
60
|
+
const auditArgs = (pm) => (pm === 'npm' ? ['audit', '--json'] : pm === 'pnpm' ? ['audit', '--json'] : null);
|
|
61
|
+
/** Does this installed package ship native code an Expo app must rebuild for? */
|
|
62
|
+
function shipsNativeCode(pkgDir, deps) {
|
|
63
|
+
if (['expo-module.config.json', 'react-native.config.js', 'android', 'ios'].some((f) => deps.exists((0, node_path_1.join)(pkgDir, f))))
|
|
64
|
+
return true;
|
|
65
|
+
const pkg = json(deps.readFile((0, node_path_1.join)(pkgDir, 'package.json')));
|
|
66
|
+
return pkg !== null && pkg['codegenConfig'] !== undefined;
|
|
67
|
+
}
|
|
68
|
+
const SOURCE = /\.(ts|tsx|js|jsx|mjs|cjs|mts|cts|vue|svelte|json|ya?ml)$/;
|
|
69
|
+
const MAX_FILES = 20_000;
|
|
70
|
+
const MAX_BYTES = 1_000_000;
|
|
71
|
+
/** Used through a config, a CLI or by convention, not by an import. Never proposed for removal. */
|
|
72
|
+
const IMPLICIT = /^(@types\/.+|typescript|ts-node|tsx|eslint.*|@eslint\/.+|@typescript-eslint\/.+|prettier.*|jest.*|ts-jest|babel-.+|@babel\/.+|vite|vitest|@vitejs\/.+|postcss.*|tailwindcss|autoprefixer|nodemon|husky|lint-staged|concurrently|cross-env|rimraf|npm-run-all.*|prisma|@prisma\/client|expo|react-native|metro.*|patch-package|dotenv-cli)$/;
|
|
73
|
+
/**
|
|
74
|
+
* Dependencies nothing under `root` mentions by name in a quote — a plain text
|
|
75
|
+
* search, so a candidate list for a goal to CONFIRM, never a removal list.
|
|
76
|
+
*/
|
|
77
|
+
function unusedDependencies(rootDir, pkg, deps) {
|
|
78
|
+
const candidates = [...depNames(pkg, 'dependencies'), ...depNames(pkg, 'devDependencies')].filter((n) => !IMPLICIT.test(n));
|
|
79
|
+
if (candidates.length === 0)
|
|
80
|
+
return [];
|
|
81
|
+
const scripts = JSON.stringify(pkg['scripts'] ?? {});
|
|
82
|
+
const remaining = new Set(candidates.filter((n) => !scripts.includes(n)));
|
|
83
|
+
let files = 0;
|
|
84
|
+
const walk = (dir) => {
|
|
85
|
+
if (remaining.size === 0 || files >= MAX_FILES)
|
|
86
|
+
return;
|
|
87
|
+
for (const e of deps.list(dir)) {
|
|
88
|
+
if (remaining.size === 0 || files >= MAX_FILES)
|
|
89
|
+
return;
|
|
90
|
+
if (e.dir) {
|
|
91
|
+
if (e.name.startsWith('.') || SKIP_DIRS.has(e.name))
|
|
92
|
+
continue;
|
|
93
|
+
walk((0, node_path_1.join)(dir, e.name));
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
if (!SOURCE.test(e.name) || e.name === 'package.json' || LOCKFILES.includes(e.name))
|
|
97
|
+
continue;
|
|
98
|
+
files += 1;
|
|
99
|
+
const text = deps.readFile((0, node_path_1.join)(dir, e.name));
|
|
100
|
+
if (text === null || text.length > MAX_BYTES)
|
|
101
|
+
continue;
|
|
102
|
+
for (const n of [...remaining]) {
|
|
103
|
+
if (text.includes(`'${n}`) || text.includes(`"${n}`) || text.includes(`\`${n}`))
|
|
104
|
+
remaining.delete(n);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
walk(rootDir);
|
|
109
|
+
return [...remaining].sort();
|
|
110
|
+
}
|
|
111
|
+
/** Every fact for one package root. Never throws: a tool that failed is a sentence on the root. */
|
|
112
|
+
async function gatherRootFacts(repo, root, opts, deps) {
|
|
113
|
+
const dir = root === '.' ? repo : (0, node_path_1.join)(repo, ...root.split('/'));
|
|
114
|
+
const pkg = json(deps.readFile((0, node_path_1.join)(dir, 'package.json'))) ?? {};
|
|
115
|
+
const lockfiles = LOCKFILES.filter((l) => deps.exists((0, node_path_1.join)(dir, l)));
|
|
116
|
+
const { pm, problem } = (0, core_1.packageManagerOf)(pkg['packageManager'], lockfiles);
|
|
117
|
+
const names = [...depNames(pkg, 'dependencies'), ...depNames(pkg, 'devDependencies')];
|
|
118
|
+
const expo = names.includes('expo');
|
|
119
|
+
const facts = {
|
|
120
|
+
root,
|
|
121
|
+
packageManager: pm,
|
|
122
|
+
packageManagerProblem: problem,
|
|
123
|
+
expo,
|
|
124
|
+
outdated: null,
|
|
125
|
+
outdatedProblem: null,
|
|
126
|
+
audit: null,
|
|
127
|
+
auditProblem: null,
|
|
128
|
+
unused: [],
|
|
129
|
+
nativePackages: [],
|
|
130
|
+
changelogs: {},
|
|
131
|
+
};
|
|
132
|
+
if (pm === null)
|
|
133
|
+
return facts;
|
|
134
|
+
const installed = deps.exists((0, node_path_1.join)(dir, 'node_modules'));
|
|
135
|
+
const oArgs = outdatedArgs(pm);
|
|
136
|
+
if (oArgs === null)
|
|
137
|
+
facts.outdatedProblem = `Looply does not read ${pm} outdated reports yet`;
|
|
138
|
+
else if (!installed)
|
|
139
|
+
facts.outdatedProblem = 'its dependencies are not installed (no node_modules), so the installed versions are unknown';
|
|
140
|
+
else {
|
|
141
|
+
const r = await deps.run(pm, oArgs, dir);
|
|
142
|
+
// `outdated` exits 1 when something is outdated; only unreadable output is a failure.
|
|
143
|
+
try {
|
|
144
|
+
// Nothing outdated is `{}`; no JSON at all is a failure, not "nothing to do".
|
|
145
|
+
const body = jsonPart(r.stdout);
|
|
146
|
+
if (body === '')
|
|
147
|
+
throw new Error('no report');
|
|
148
|
+
facts.outdated = (0, core_1.parseOutdatedJson)(body);
|
|
149
|
+
}
|
|
150
|
+
catch {
|
|
151
|
+
facts.outdatedProblem = `${pm} outdated failed (exit ${r.code}): ${(r.stderr || r.stdout).trim().split(/\r?\n/)[0] ?? ''}`.slice(0, 300);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const aArgs = auditArgs(pm);
|
|
155
|
+
if (aArgs === null)
|
|
156
|
+
facts.auditProblem = `Looply does not read ${pm} audit reports yet`;
|
|
157
|
+
else {
|
|
158
|
+
const r = await deps.run(pm, aArgs, dir);
|
|
159
|
+
try {
|
|
160
|
+
const body = jsonPart(r.stdout);
|
|
161
|
+
if (body === '')
|
|
162
|
+
throw new Error('no report');
|
|
163
|
+
const raw = json(body);
|
|
164
|
+
if (raw !== null && raw['error'] !== undefined)
|
|
165
|
+
throw new Error(JSON.stringify(raw['error']).slice(0, 200));
|
|
166
|
+
facts.audit = (0, core_1.parseAuditJson)(body, names);
|
|
167
|
+
}
|
|
168
|
+
catch (e) {
|
|
169
|
+
facts.auditProblem = `${pm} audit failed (exit ${r.code}): ${e.message || (r.stderr || '').trim().split(/\r?\n/)[0] || ''}`.slice(0, 300);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (installed) {
|
|
173
|
+
for (const o of facts.outdated ?? []) {
|
|
174
|
+
const p = json(deps.readFile((0, node_path_1.join)(dir, 'node_modules', ...o.name.split('/'), 'package.json')));
|
|
175
|
+
const url = p === null ? null : (0, core_1.changelogUrlOf)(p['repository']);
|
|
176
|
+
if (url !== null)
|
|
177
|
+
facts.changelogs[o.name] = url;
|
|
178
|
+
}
|
|
179
|
+
if (expo)
|
|
180
|
+
facts.nativePackages = names.filter((n) => shipsNativeCode((0, node_path_1.join)(dir, 'node_modules', ...n.split('/')), deps)).sort();
|
|
181
|
+
}
|
|
182
|
+
if (opts.deadCode)
|
|
183
|
+
facts.unused = unusedDependencies(dir, pkg, deps);
|
|
184
|
+
return facts;
|
|
185
|
+
}
|
|
186
|
+
async function gatherFacts(repo, opts, deps) {
|
|
187
|
+
const out = [];
|
|
188
|
+
for (const root of findPackageRoots(repo, deps))
|
|
189
|
+
out.push(await gatherRootFacts(repo, root, opts, deps));
|
|
190
|
+
return out;
|
|
191
|
+
}
|
|
192
|
+
const RUN_TIMEOUT_MS = 3 * 60_000;
|
|
193
|
+
/** The real thing: hidden, bounded, no prompts, nothing written. */
|
|
194
|
+
function nodeFactsDeps() {
|
|
195
|
+
return {
|
|
196
|
+
run: (command, args, cwd) => new Promise((resolve) => {
|
|
197
|
+
let stdout = '';
|
|
198
|
+
let stderr = '';
|
|
199
|
+
let settled = false;
|
|
200
|
+
const done = (r) => {
|
|
201
|
+
if (settled)
|
|
202
|
+
return;
|
|
203
|
+
settled = true;
|
|
204
|
+
clearTimeout(timer);
|
|
205
|
+
resolve(r);
|
|
206
|
+
};
|
|
207
|
+
// A `.cmd` on Windows needs the shell; every argument here is a fixed word from this file.
|
|
208
|
+
const child = (0, node_child_process_1.spawn)(command, [...args], {
|
|
209
|
+
cwd,
|
|
210
|
+
shell: process.platform === 'win32',
|
|
211
|
+
windowsHide: true,
|
|
212
|
+
env: { ...process.env, NO_UPDATE_NOTIFIER: '1', npm_config_update_notifier: 'false', COREPACK_ENABLE_DOWNLOAD_PROMPT: '0' },
|
|
213
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
214
|
+
});
|
|
215
|
+
const timer = setTimeout(() => {
|
|
216
|
+
child.kill();
|
|
217
|
+
done({ code: null, stdout, stderr: `${stderr}\ntimed out after ${RUN_TIMEOUT_MS / 1000}s` });
|
|
218
|
+
}, RUN_TIMEOUT_MS);
|
|
219
|
+
child.stdout.on('data', (b) => {
|
|
220
|
+
if (stdout.length < 20_000_000)
|
|
221
|
+
stdout += b.toString('utf8');
|
|
222
|
+
});
|
|
223
|
+
child.stderr.on('data', (b) => {
|
|
224
|
+
if (stderr.length < 100_000)
|
|
225
|
+
stderr += b.toString('utf8');
|
|
226
|
+
});
|
|
227
|
+
child.on('error', (e) => done({ code: null, stdout, stderr: e.message }));
|
|
228
|
+
child.on('close', (code) => done({ code, stdout, stderr }));
|
|
229
|
+
}),
|
|
230
|
+
readFile: (path) => {
|
|
231
|
+
try {
|
|
232
|
+
return (0, node_fs_1.readFileSync)(path, 'utf8');
|
|
233
|
+
}
|
|
234
|
+
catch {
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
list: (path) => {
|
|
239
|
+
try {
|
|
240
|
+
return (0, node_fs_1.readdirSync)(path, { withFileTypes: true }).map((d) => ({ name: d.name, dir: d.isDirectory() }));
|
|
241
|
+
}
|
|
242
|
+
catch {
|
|
243
|
+
return [];
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
exists: (path) => {
|
|
247
|
+
try {
|
|
248
|
+
return (0, node_fs_1.existsSync)(path) && ((0, node_fs_1.statSync)(path).isFile() || (0, node_fs_1.statSync)(path).isDirectory());
|
|
249
|
+
}
|
|
250
|
+
catch {
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
//# sourceMappingURL=maintenance-facts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maintenance-facts.js","sourceRoot":"","sources":["../src/maintenance-facts.ts"],"names":[],"mappings":";;AAiDA,4CAiBC;AA4BD,0CAIC;AAYD,gDA0BC;AAGD,0CAgEC;AAED,kCAIC;AAKD,sCAwDC;AA9QD,2DAA2C;AAC3C,qCAA0E;AAC1E,yCAAgD;AAChD,uCAOsB;AAkCtB,MAAM,SAAS,GAAG,CAAC,mBAAmB,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;AACvH,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;AAC3H,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB,4IAA4I;AAC5I,SAAgB,gBAAgB,CAAC,IAAY,EAAE,IAAwC;IACrF,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,IAAI,CAAC,MAAM,CAAC,IAAA,gBAAI,EAAC,IAAI,EAAE,cAAc,CAAC,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7D,MAAM,IAAI,GAAG,CAAC,GAAW,EAAE,KAAa,EAAQ,EAAE;QAChD,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,SAAS;YAAE,OAAO;QACnD,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aA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