@r_masseater/vite-plus-adopt 0.24.4 → 0.26.0
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/README.md +1 -0
- package/dist/cli.mjs +18 -13
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +13 -1
- package/dist/index.mjs.map +1 -0
- package/dist/{vpa-tyPVfXod.mjs → run-checks-Bes6B97f.mjs} +59 -36
- package/dist/run-checks-Bes6B97f.mjs.map +1 -0
- package/package.json +3 -3
- package/dist/vpa-tyPVfXod.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -43,6 +43,7 @@ export default defineConfig({
|
|
|
43
43
|
`import type {} from "@r_masseater/vite-plus-adopt"` types the keys vpa reads (`commitlint`, `dependencyRules`, `fallow`, `h56m`, `skills`, `textlint` and `tools`) on `defineConfig`.
|
|
44
44
|
textlint checks the Markdown files Git tracks. To check other files too, list their globs (`files`) and the settings for them in `textlint.sources`. `presets` work there as well.
|
|
45
45
|
`filterModules` takes textlint filter rules as modules, such as `{ comments: commentsFilter }`, and `filters: { comments: true }` turns one on, so the repository does not have to install them for textlint to find them. With `reportUnusedDirectives: true`, a `textlint-disable` comment that hides no message is an error. The check lints a file with a disable comment a second time without the filters.
|
|
46
|
+
`pluginModules` takes textlint plugins as modules in the same way, and `plugins: { name: true }` turns one on. A plugin given this way parses its extensions before the built-in Markdown and text plugins do.
|
|
46
47
|
|
|
47
48
|
Write the Git hooks like this.
|
|
48
49
|
|
package/dist/cli.mjs
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as
|
|
3
|
-
import { Effect,
|
|
2
|
+
import { a as stagedSecrets, c as runCi, d as checkPushedRefs, i as lintMessageText, l as version, r as lintMessageFile, s as prepare, t as runAllChecks } from "./run-checks-Bes6B97f.mjs";
|
|
3
|
+
import { Effect, Option, Path } from "effect";
|
|
4
|
+
import { hookFlags } from "@r_masseater/masseater-utils/hook-flags";
|
|
4
5
|
import { runMain } from "@r_masseater/masseater-utils/node-main";
|
|
5
|
-
|
|
6
|
-
/** @internal */
|
|
7
|
-
const runCli = (program) => {
|
|
8
|
-
runMain("vpa")(program);
|
|
9
|
-
};
|
|
6
|
+
import { Command } from "effect/cli";
|
|
10
7
|
// src/app/cli.ts
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
const switched = (on, hook) => Option.liftPredicate(hook, () => on);
|
|
9
|
+
const hookOf = (input) => Option.firstSomeOf([
|
|
10
|
+
switched(input.prepare, prepare),
|
|
11
|
+
switched(input.staged, stagedSecrets),
|
|
12
|
+
switched(input.prePush, checkPushedRefs),
|
|
13
|
+
input.commitMsg.pipe(Option.map(lintMessageFile)),
|
|
14
|
+
input.message.pipe(Option.map(lintMessageText))
|
|
15
|
+
]).pipe(Option.getOrElse(() => runAllChecks));
|
|
16
|
+
const inRepository = Effect.fn("inRepository")(function* inRepository(hook) {
|
|
17
|
+
return yield* hook((yield* Path.Path).resolve("."));
|
|
18
|
+
});
|
|
19
|
+
const ci = Command.make("ci", {}, () => inRepository(runCi)).pipe(Command.withDescription("Puts the shared setup action into every job and workflow that runs vp, and drops the hand-written Actions caches"));
|
|
20
|
+
const vpa = Command.make("vpa", hookFlags, (input) => inRepository(hookOf(input))).pipe(Command.withDescription("Runs every check configured in vite.config.ts"), Command.withSubcommands([ci]));
|
|
21
|
+
runMain("vpa")(Command.run(vpa, { version }));
|
|
17
22
|
export {};
|
|
18
23
|
|
|
19
24
|
//# sourceMappingURL=cli.mjs.map
|
package/dist/cli.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.mjs","names":[],"sources":["../src/app/
|
|
1
|
+
{"version":3,"file":"cli.mjs","names":["manifest.version"],"sources":["../src/app/cli.ts"],"sourcesContent":["import { hookFlags } from \"@r_masseater/masseater-utils/hook-flags\";\nimport { runMain } from \"@r_masseater/masseater-utils/node-main\";\nimport manifest from \"@r_masseater/vite-plus-adopt/package.json\" with { type: \"json\" };\nimport { Effect, Option, Path } from \"effect\";\nimport { Command } from \"effect/cli\";\n\nimport { checkPushedRefs } from \"#/features/check-pushed-refs/index.ts\";\nimport { runCi } from \"#/features/sync-ci/index.ts\";\n\nimport { lintMessageFile, lintMessageText, stagedSecrets } from \"./hooks.ts\";\nimport { prepare } from \"./prepare.ts\";\nimport { runAllChecks } from \"./run-checks.ts\";\n\ninterface HookInput {\n readonly prepare: boolean;\n readonly staged: boolean;\n readonly prePush: boolean;\n readonly commitMsg: Option.Option<string>;\n readonly message: Option.Option<string>;\n}\n\ntype Hook = typeof runAllChecks;\n\nconst switched = (on: boolean, hook: Hook): Option.Option<Hook> =>\n Option.liftPredicate(hook, () => on);\n\nconst hookOf = (input: HookInput): Hook =>\n Option.firstSomeOf([\n switched(input.prepare, prepare),\n switched(input.staged, stagedSecrets),\n switched(input.prePush, checkPushedRefs),\n input.commitMsg.pipe(Option.map(lintMessageFile)),\n input.message.pipe(Option.map(lintMessageText)),\n ]).pipe(Option.getOrElse((): Hook => runAllChecks));\n\nconst inRepository = Effect.fn(\"inRepository\")(function* inRepository(hook: Hook) {\n const path = yield* Path.Path;\n return yield* hook(path.resolve(\".\"));\n});\n\nconst ci = Command.make(\"ci\", {}, () => inRepository(runCi)).pipe(\n Command.withDescription(\n \"Puts the shared setup action into every job and workflow that runs vp, and drops the hand-written Actions caches\",\n ),\n);\n\nconst vpa = Command.make(\"vpa\", hookFlags, (input) => inRepository(hookOf(input))).pipe(\n Command.withDescription(\"Runs every check configured in vite.config.ts\"),\n Command.withSubcommands([ci]),\n);\n\nrunMain(\"vpa\")(Command.run(vpa, { version: manifest.version }));\n"],"mappings":";;;;;;;AAuBA,MAAM,YAAY,IAAa,SAC7B,OAAO,cAAc,YAAY,EAAE;AAErC,MAAM,UAAU,UACd,OAAO,YAAY;CACjB,SAAS,MAAM,SAAS,OAAO;CAC/B,SAAS,MAAM,QAAQ,aAAa;CACpC,SAAS,MAAM,SAAS,eAAe;CACvC,MAAM,UAAU,KAAK,OAAO,IAAI,eAAe,CAAC;CAChD,MAAM,QAAQ,KAAK,OAAO,IAAI,eAAe,CAAC;AAChD,CAAC,CAAC,CAAC,KAAK,OAAO,gBAAsB,YAAY,CAAC;AAEpD,MAAM,eAAe,OAAO,GAAG,cAAc,CAAC,CAAC,UAAU,aAAa,MAAY;CAEhF,OAAO,OAAO,MAAK,OADC,KAAK,KAAA,CACD,QAAQ,GAAG,CAAC;AACtC,CAAC;AAED,MAAM,KAAK,QAAQ,KAAK,MAAM,CAAC,SAAS,aAAa,KAAK,CAAC,CAAC,CAAC,KAC3D,QAAQ,gBACN,kHACF,CACF;AAEA,MAAM,MAAM,QAAQ,KAAK,OAAO,YAAY,UAAU,aAAa,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,KACjF,QAAQ,gBAAgB,+CAA+C,GACvE,QAAQ,gBAAgB,CAAC,EAAE,CAAC,CAC9B;AAEA,QAAQ,KAAK,CAAC,CAAC,QAAQ,IAAI,KAAK,EAAWA,QAAiB,CAAC,CAAC"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect, FileSystem, Path, PlatformError, Schema, Stdio } from "effect";
|
|
2
2
|
import { ChildProcessSpawner } from "effect/process";
|
|
3
3
|
import { TextlintRcConfig } from "@textlint/config-loader";
|
|
4
|
-
import { TextlintKernelFilterRule, TextlintKernelRule } from "@textlint/kernel";
|
|
4
|
+
import { TextlintKernelFilterRule, TextlintKernelPlugin, TextlintKernelRule } from "@textlint/kernel";
|
|
5
5
|
import { H56mConfig } from "@r_masseater/h56m";
|
|
6
6
|
import { DependencySection } from "@r_masseater/masseater-utils/kestrion";
|
|
7
7
|
import { UserConfig } from "@commitlint/types";
|
|
@@ -42,6 +42,7 @@ interface TextlintConfig extends TextlintRcConfig {
|
|
|
42
42
|
readonly ignores?: readonly string[];
|
|
43
43
|
readonly presets?: Readonly<Record<string, TextlintPreset>>;
|
|
44
44
|
readonly filterModules?: Readonly<Record<string, TextlintKernelFilterRule["rule"]>>;
|
|
45
|
+
readonly pluginModules?: Readonly<Record<string, TextlintKernelPlugin["plugin"]>>;
|
|
45
46
|
readonly reportUnusedDirectives?: boolean;
|
|
46
47
|
readonly sources?: readonly TextlintSource[];
|
|
47
48
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { f as loadViteConfig, n as HOOKS, o as usage, p as VpToolsError, t as runAllChecks, u as findCiDrift } from "./run-checks-Bes6B97f.mjs";
|
|
2
|
+
import { Array, Function, Option, Record, pipe } from "effect";
|
|
3
|
+
/** @internal */
|
|
4
|
+
const runVpa = Function.dual(2, (root, args) => pipe(args, Array.match({
|
|
5
|
+
onEmpty: () => runAllChecks(root),
|
|
6
|
+
onNonEmpty: ([flag, ...rest]) => pipe(Record.get(HOOKS, flag), Option.match({
|
|
7
|
+
onNone: () => usage,
|
|
8
|
+
onSome: (hook) => hook(root, rest)
|
|
9
|
+
}))
|
|
10
|
+
})));
|
|
11
|
+
export { VpToolsError, findCiDrift, loadViteConfig, runVpa };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["Fn","Arr","Rec"],"sources":["../src/app/vpa.ts"],"sourcesContent":["import { Option, Array as Arr, Record as Rec, pipe, Function as Fn } from \"effect\";\n\nimport type { CommandEffect } from \"#/shared/lib/command.ts\";\n\nimport { HOOKS, usage } from \"./hooks.ts\";\nimport { runAllChecks } from \"./run-checks.ts\";\n\nconst DATA_FIRST_ARITY = 2;\n\n/** @internal */\nexport const runVpa: {\n (args: readonly string[]): (root: string) => CommandEffect;\n (root: string, args: readonly string[]): CommandEffect;\n} = Fn.dual(DATA_FIRST_ARITY, (root: string, args: readonly string[]): CommandEffect =>\n pipe(\n args,\n Arr.match({\n onEmpty: () => runAllChecks(root),\n onNonEmpty: ([flag, ...rest]) =>\n pipe(\n Rec.get(HOOKS, flag),\n Option.match({ onNone: () => usage, onSome: (hook) => hook(root, rest) }),\n ),\n }),\n ),\n);\n"],"mappings":";;;AAUA,MAAa,SAGTA,SAAG,KAAK,IAAmB,MAAc,SAC3C,KACE,MACAC,MAAI,MAAM;CACR,eAAe,aAAa,IAAI;CAChC,aAAa,CAAC,MAAM,GAAG,UACrB,KACEC,OAAI,IAAI,OAAO,IAAI,GACnB,OAAO,MAAM;EAAE,cAAc;EAAO,SAAS,SAAS,KAAK,MAAM,IAAI;CAAE,CAAC,CAC1E;AACJ,CAAC,CACH,CACF"}
|
|
@@ -126,9 +126,9 @@ const withSection = Function.dual(2, (key, run) => (context) => pipe(Option.from
|
|
|
126
126
|
onSome: (section) => Effect.asSome(run(section, context))
|
|
127
127
|
})));
|
|
128
128
|
// src/shared/lib/git.ts
|
|
129
|
-
const DATA_FIRST_ARITY$
|
|
129
|
+
const DATA_FIRST_ARITY$6 = 2;
|
|
130
130
|
/** @internal */
|
|
131
|
-
const listGitFiles = Function.dual(DATA_FIRST_ARITY$
|
|
131
|
+
const listGitFiles = Function.dual(DATA_FIRST_ARITY$6, (root, pathspecs) => Effect.gen(function* list() {
|
|
132
132
|
const output = yield* (yield* ChildProcessSpawner.ChildProcessSpawner).string(ChildProcess.make("git", [
|
|
133
133
|
"-c",
|
|
134
134
|
"core.quotePath=false",
|
|
@@ -142,7 +142,7 @@ const listGitFiles = Function.dual(DATA_FIRST_ARITY$7, (root, pathspecs) => Effe
|
|
|
142
142
|
return pipe(String$1.split(output, "\0"), Array.filter(String$1.isNonEmpty));
|
|
143
143
|
}));
|
|
144
144
|
/** @internal */
|
|
145
|
-
const listCommitMessages = Function.dual(DATA_FIRST_ARITY$
|
|
145
|
+
const listCommitMessages = Function.dual(DATA_FIRST_ARITY$6, (root, range) => Effect.gen(function* messages() {
|
|
146
146
|
const output = yield* (yield* ChildProcessSpawner.ChildProcessSpawner).string(ChildProcess.make("git", [
|
|
147
147
|
"log",
|
|
148
148
|
"-z",
|
|
@@ -180,13 +180,33 @@ const filterRulesOf = ({ config, wrap }) => {
|
|
|
180
180
|
options: pipe(Record.get(settings, name), Option.filter(isRuleOptions), Option.getOrElse(() => true))
|
|
181
181
|
})));
|
|
182
182
|
};
|
|
183
|
+
const isNames = (plugins) => Array.isArray(plugins);
|
|
184
|
+
const pluginSettingsOf = (plugins) => {
|
|
185
|
+
if (isNames(plugins)) return Record.fromIterableWith(plugins, (name) => [name, true]);
|
|
186
|
+
return plugins;
|
|
187
|
+
};
|
|
188
|
+
/** @internal */
|
|
189
|
+
const pluginsOf = (config) => {
|
|
190
|
+
const settings = pluginSettingsOf(config.plugins ?? {});
|
|
191
|
+
return pipe(Record.toEntries(config.pluginModules ?? {}), Array.flatMap(([name, plugin]) => pipe(Record.get(settings, name), Option.filter(Boolean), Option.map((setting) => ({
|
|
192
|
+
pluginId: name,
|
|
193
|
+
plugin,
|
|
194
|
+
options: pipe(Option.liftPredicate(setting, Predicate.isReadonlyObject), Option.getOrElse(() => true))
|
|
195
|
+
})), Option.toArray)));
|
|
196
|
+
};
|
|
197
|
+
const withoutModules = (plugins, modules) => {
|
|
198
|
+
const isModule = (name) => Record.has(modules, name);
|
|
199
|
+
if (isNames(plugins)) return pipe(plugins, Array.filter((name) => !isModule(name)));
|
|
200
|
+
return pipe(plugins, Record.filter((_setting, name) => !isModule(name)));
|
|
201
|
+
};
|
|
183
202
|
/** @internal */
|
|
184
203
|
const rawConfigOf = (config) => {
|
|
185
|
-
const { ignores: _ignores, presets = {}, filterModules = {}, reportUnusedDirectives: _report, sources: _sources, ...rawConfig } = config;
|
|
204
|
+
const { ignores: _ignores, presets = {}, filterModules = {}, pluginModules = {}, reportUnusedDirectives: _report, sources: _sources, ...rawConfig } = config;
|
|
186
205
|
return {
|
|
187
206
|
...rawConfig,
|
|
188
207
|
rules: pipe(rawConfig.rules ?? {}, Record.filter((_setting, name) => !Record.has(presets, name))),
|
|
189
|
-
filters: pipe(rawConfig.filters ?? {}, Record.filter((_setting, name) => !Record.has(filterModules, name)))
|
|
208
|
+
filters: pipe(rawConfig.filters ?? {}, Record.filter((_setting, name) => !Record.has(filterModules, name))),
|
|
209
|
+
plugins: withoutModules(rawConfig.plugins ?? {}, pluginModules)
|
|
190
210
|
};
|
|
191
211
|
};
|
|
192
212
|
// src/features/check-text/model/textlint-descriptor.ts
|
|
@@ -206,7 +226,11 @@ const descriptorOf = ({ root, config, wrap }) => Effect.gen(function* descriptor
|
|
|
206
226
|
config,
|
|
207
227
|
wrap
|
|
208
228
|
})],
|
|
209
|
-
plugins: [
|
|
229
|
+
plugins: [
|
|
230
|
+
...pluginsOf(config),
|
|
231
|
+
...builtIn.plugin.toKernelPluginsFormat(),
|
|
232
|
+
...plugins
|
|
233
|
+
],
|
|
210
234
|
configBaseDir: root
|
|
211
235
|
});
|
|
212
236
|
});
|
|
@@ -315,11 +339,12 @@ const mergeReports = (reports) => ({
|
|
|
315
339
|
/** @internal */
|
|
316
340
|
const textlintCheck = withSection("textlint", (config, { root }) => {
|
|
317
341
|
const markdown = markdownFiles(root, config.ignores).pipe(Effect.flatMap((files) => lintTexts(config, root, files)));
|
|
318
|
-
const { presets = {}, filterModules = {}, reportUnusedDirectives = false } = config;
|
|
342
|
+
const { presets = {}, filterModules = {}, pluginModules = {}, reportUnusedDirectives = false } = config;
|
|
319
343
|
const sources = pipe(config.sources ?? [], Array.map(({ files, ...source }) => Effect.flatMap(sourceFiles(root, files), (listed) => lintTexts({
|
|
320
344
|
...source,
|
|
321
345
|
presets,
|
|
322
346
|
filterModules,
|
|
347
|
+
pluginModules,
|
|
323
348
|
reportUnusedDirectives
|
|
324
349
|
}, root, listed))));
|
|
325
350
|
return Effect.all([markdown, ...sources], { concurrency: 1 }).pipe(Effect.map(mergeReports));
|
|
@@ -327,7 +352,7 @@ const textlintCheck = withSection("textlint", (config, { root }) => {
|
|
|
327
352
|
/** @internal */
|
|
328
353
|
const commitlintCheck = withSection("commitlint", (config, { root, range }) => listCommitMessages(root, range).pipe(Effect.flatMap((messages) => lintCommitMessages(config, root, messages))));
|
|
329
354
|
// src/features/scan-secrets/model/secret-checks.ts
|
|
330
|
-
const DATA_FIRST_ARITY$
|
|
355
|
+
const DATA_FIRST_ARITY$5 = 2;
|
|
331
356
|
const SUCCESS$1 = 0;
|
|
332
357
|
const RANGE = "..";
|
|
333
358
|
const HEAD = "HEAD";
|
|
@@ -378,7 +403,7 @@ const scan = (config, root, source) => Effect.gen(function* scanSource() {
|
|
|
378
403
|
/** @internal */
|
|
379
404
|
const h56mCheck = withSection("h56m", (config, { root, range }) => lacksHistory(root).pipe(Effect.flatMap((partial) => scan(config, root, sourceOf(partial, range)))));
|
|
380
405
|
/** @internal */
|
|
381
|
-
const scanStagedSecrets = Function.dual(DATA_FIRST_ARITY$
|
|
406
|
+
const scanStagedSecrets = Function.dual(DATA_FIRST_ARITY$5, (config, root) => scan(config, root, { type: "staged" }));
|
|
382
407
|
/** @internal */
|
|
383
408
|
const writeTo = Function.dual(2, (sink, text) => Effect.gen(function* write() {
|
|
384
409
|
const stdio = yield* Stdio.Stdio;
|
|
@@ -891,7 +916,7 @@ const syncCi = (root) => planned(root).pipe(Effect.flatMap(({ changes }) => Effe
|
|
|
891
916
|
})));
|
|
892
917
|
// package.json
|
|
893
918
|
var name = "@r_masseater/vite-plus-adopt";
|
|
894
|
-
var version = "0.
|
|
919
|
+
var version = "0.26.0";
|
|
895
920
|
// src/features/sync-ci/model/installed-version.ts
|
|
896
921
|
const RANGE_PREFIX = /^[\^~]/u;
|
|
897
922
|
const pnpm$1 = attempt("pnpm");
|
|
@@ -1458,7 +1483,7 @@ const unpackArchive = (target) => (bytes) => placeAtomically(target, (staging) =
|
|
|
1458
1483
|
}));
|
|
1459
1484
|
// src/features/install-tools/model/install-one.ts
|
|
1460
1485
|
const SHORT_HASH = 12;
|
|
1461
|
-
const DATA_FIRST_ARITY$
|
|
1486
|
+
const DATA_FIRST_ARITY$2 = 3;
|
|
1462
1487
|
const START = 0;
|
|
1463
1488
|
const SEPARATOR$1 = "/";
|
|
1464
1489
|
const directoryFor = (cache, { name, version, platform }, sha256) => Effect.gen(function* directory() {
|
|
@@ -1472,7 +1497,7 @@ const alreadyInstalled = (cache, planned, locked) => Effect.gen(function* lookup
|
|
|
1472
1497
|
return Option.liftPredicate(directory, () => present);
|
|
1473
1498
|
});
|
|
1474
1499
|
/** @internal */
|
|
1475
|
-
const installOne = Function.dual(DATA_FIRST_ARITY$
|
|
1500
|
+
const installOne = Function.dual(DATA_FIRST_ARITY$2, (cache, lock, planned) => Effect.gen(function* install() {
|
|
1476
1501
|
const locked = Record.get(lock, planned.url);
|
|
1477
1502
|
const cached = yield* alreadyInstalled(cache, planned, locked);
|
|
1478
1503
|
if (Option.isSome(cached)) return {
|
|
@@ -1527,7 +1552,7 @@ const writeLock = (root) => (lock) => Effect.gen(function* write() {
|
|
|
1527
1552
|
// src/features/install-tools/model/plan.ts
|
|
1528
1553
|
const SEPARATOR = "/";
|
|
1529
1554
|
const PLACEHOLDER = "{version}";
|
|
1530
|
-
const DATA_FIRST_ARITY$
|
|
1555
|
+
const DATA_FIRST_ARITY$1 = 2;
|
|
1531
1556
|
const withVersion = (version) => (template) => String$1.replaceAll(PLACEHOLDER, version)(template);
|
|
1532
1557
|
const defaultBase = (name) => Option.liftPredicate(`https://github.com/${name}/releases/download/v${PLACEHOLDER}`, () => String$1.includes(SEPARATOR)(name));
|
|
1533
1558
|
const binsOf = (name, bin) => Option.getOrElse(Option.fromNullishOr(bin), () => [pipe(String$1.split(SEPARATOR)(name), Array.last, Option.getOrElse(() => name))]);
|
|
@@ -1546,7 +1571,7 @@ const planOne = (platform) => ([name, source]) => {
|
|
|
1546
1571
|
});
|
|
1547
1572
|
};
|
|
1548
1573
|
/** @internal */
|
|
1549
|
-
const planTools = Function.dual(DATA_FIRST_ARITY$
|
|
1574
|
+
const planTools = Function.dual(DATA_FIRST_ARITY$1, (section, platform) => pipe(Record.toEntries(section), Effect.forEach(planOne(platform), { concurrency: 1 }), Effect.map(Array.getSomes)));
|
|
1550
1575
|
// src/features/install-tools/model/section.ts
|
|
1551
1576
|
const DISABLED = [
|
|
1552
1577
|
"false",
|
|
@@ -1622,24 +1647,30 @@ const USAGE = pipe([
|
|
|
1622
1647
|
], Array.join("\n"));
|
|
1623
1648
|
/** @internal */
|
|
1624
1649
|
const usage = Effect.fail(checksFailed(USAGE));
|
|
1650
|
+
/** @internal */
|
|
1625
1651
|
const stagedSecrets = (root) => loadSection(root, "h56m").pipe(Effect.flatMap((config) => scanStagedSecrets(config, root)), Effect.flatMap(finish));
|
|
1626
|
-
const lintMessage = (toMessage) => (root
|
|
1652
|
+
const lintMessage = (toMessage) => (argument) => (root) => Effect.gen(function* lintGiven() {
|
|
1653
|
+
const message = yield* toMessage(argument);
|
|
1654
|
+
const config = yield* loadSection(root, "commitlint");
|
|
1655
|
+
const report = yield* lintCommitMessages(config, root, [message]);
|
|
1656
|
+
return yield* finish(report);
|
|
1657
|
+
});
|
|
1658
|
+
const readMessage = (file) => FileSystem.FileSystem.pipe(Effect.flatMap((fs) => fs.readFileString(file)));
|
|
1659
|
+
/** @internal */
|
|
1660
|
+
const lintMessageFile = lintMessage(readMessage);
|
|
1661
|
+
/** @internal */
|
|
1662
|
+
const lintMessageText = lintMessage(Effect.succeed);
|
|
1663
|
+
const withArgument = (hook) => (root, rest) => pipe(Array.head(rest), Option.match({
|
|
1627
1664
|
onNone: () => usage,
|
|
1628
|
-
onSome: (argument) =>
|
|
1629
|
-
const message = yield* toMessage(argument);
|
|
1630
|
-
const config = yield* loadSection(root, "commitlint");
|
|
1631
|
-
const report = yield* lintCommitMessages(config, root, [message]);
|
|
1632
|
-
return yield* finish(report);
|
|
1633
|
-
})
|
|
1665
|
+
onSome: (argument) => hook(argument)(root)
|
|
1634
1666
|
}));
|
|
1635
|
-
const readMessage = (file) => FileSystem.FileSystem.pipe(Effect.flatMap((fs) => fs.readFileString(file)));
|
|
1636
1667
|
/** @internal */
|
|
1637
1668
|
const HOOKS = {
|
|
1638
1669
|
ci: runCi,
|
|
1639
1670
|
"--prepare": prepare,
|
|
1640
1671
|
"--staged": stagedSecrets,
|
|
1641
|
-
"--commit-msg":
|
|
1642
|
-
"--message":
|
|
1672
|
+
"--commit-msg": withArgument(lintMessageFile),
|
|
1673
|
+
"--message": withArgument(lintMessageText),
|
|
1643
1674
|
"--pre-push": checkPushedRefs
|
|
1644
1675
|
};
|
|
1645
1676
|
// src/shared/lib/workspace.ts
|
|
@@ -1672,7 +1703,7 @@ const listDependencies = (root) => Effect.gen(function* list() {
|
|
|
1672
1703
|
return pipe(Array.sort(listed, byFile), Array.flatMap(({ dependencies }) => dependencies));
|
|
1673
1704
|
});
|
|
1674
1705
|
// src/features/check-repository/model/dependency-rules.ts
|
|
1675
|
-
const DATA_FIRST_ARITY
|
|
1706
|
+
const DATA_FIRST_ARITY = 2;
|
|
1676
1707
|
const SINGLE = 1;
|
|
1677
1708
|
const bannedBy = (dependencies) => ([reason, globs]) => {
|
|
1678
1709
|
const isBanned = (name) => pipe(globs, Array.some((glob) => minimatch(name, glob)));
|
|
@@ -1717,7 +1748,7 @@ const comparedDependencies = (rules, dependencies) => {
|
|
|
1717
1748
|
const isExact = inWorkspaces(exactGlobs(rules));
|
|
1718
1749
|
return pipe(dependencies, Array.filter(({ specifier }) => !String$1.startsWith("workspace:")(specifier)), Array.filter(Predicate.not(isExact)));
|
|
1719
1750
|
};
|
|
1720
|
-
const checkDependencies = Function.dual(DATA_FIRST_ARITY
|
|
1751
|
+
const checkDependencies = Function.dual(DATA_FIRST_ARITY, (rules, dependencies) => [
|
|
1721
1752
|
...bannedProblems(rules, dependencies),
|
|
1722
1753
|
...exactProblems(rules, dependencies),
|
|
1723
1754
|
...versionProblems(rules, comparedDependencies(rules, dependencies))
|
|
@@ -1883,14 +1914,6 @@ const runAllChecks = (root) => Effect.gen(function* all() {
|
|
|
1883
1914
|
onNonEmpty: (failed) => Effect.fail(checksFailed(`Failed: ${Array.join(failed, ", ")}`))
|
|
1884
1915
|
}));
|
|
1885
1916
|
});
|
|
1886
|
-
|
|
1887
|
-
const runVpa = Function.dual(2, (root, args) => pipe(args, Array.match({
|
|
1888
|
-
onEmpty: () => runAllChecks(root),
|
|
1889
|
-
onNonEmpty: ([flag, ...rest]) => pipe(Record.get(HOOKS, flag), Option.match({
|
|
1890
|
-
onNone: () => usage,
|
|
1891
|
-
onSome: (hook) => hook(root, rest)
|
|
1892
|
-
}))
|
|
1893
|
-
})));
|
|
1894
|
-
export { VpToolsError as i, findCiDrift as n, loadViteConfig as r, runVpa as t };
|
|
1917
|
+
export { stagedSecrets as a, runCi as c, checkPushedRefs as d, loadViteConfig as f, lintMessageText as i, version as l, HOOKS as n, usage as o, VpToolsError as p, lintMessageFile as r, prepare as s, runAllChecks as t, findCiDrift as u };
|
|
1895
1918
|
|
|
1896
|
-
//# sourceMappingURL=
|
|
1919
|
+
//# sourceMappingURL=run-checks-Bes6B97f.mjs.map
|