rattail 2.0.9 → 2.1.1

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.
@@ -1,12 +1,22 @@
1
+ //#region src/general/isArray.ts
2
+ function isArray(val) {
3
+ return Array.isArray(val);
4
+ }
5
+ //#endregion
1
6
  //#region src/general/isFunction.ts
2
7
  function isFunction(val) {
3
8
  return typeof val === "function";
4
9
  }
5
10
  //#endregion
11
+ //#region src/general/isString.ts
12
+ function isString(val) {
13
+ return typeof val === "string";
14
+ }
15
+ //#endregion
6
16
  //#region src/function/callOrReturn.ts
7
17
  function callOrReturn(fnOrValue, ...args) {
8
18
  if (isFunction(fnOrValue)) return fnOrValue(...args);
9
19
  return fnOrValue;
10
20
  }
11
21
  //#endregion
12
- export { isFunction as n, callOrReturn as t };
22
+ export { isArray as i, isString as n, isFunction as r, callOrReturn as t };
@@ -1 +1 @@
1
- export { };
1
+ export {}
package/dist/cli/bin.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import { a as hook, c as clean, d as getConfig, l as changelog, n as publish, r as lockfileCheck, s as commitLint, t as release, u as api } from "../release-CFAOWQEE.mjs";
2
3
  import { Command } from "commander";
3
4
  import fs from "node:fs";
4
5
  import { dirname, resolve } from "node:path";
@@ -11,21 +12,16 @@ function getCliVersion() {
11
12
  //#region src/cli/bin.ts
12
13
  const program = new Command();
13
14
  program.version(getCliVersion());
14
- program.command("clean").description("Remove files and directories").argument("[patterns...]").action(async (patterns) => {
15
- const { clean } = await import("../clean-ChrJ3VXV.mjs").then((n) => n.n);
15
+ program.command("clean").description("Remove files and directories").argument("[patterns...]").action((patterns) => {
16
16
  return clean(patterns.length ? patterns : void 0);
17
17
  });
18
- program.command("api").description("Generate API modules from OpenAPI/Swagger schema").action(async () => {
19
- const { api } = await import("../api-BZphli-u.mjs").then((n) => n.n);
18
+ program.command("api").description("Generate API modules from OpenAPI/Swagger schema").action(() => {
20
19
  return api();
21
20
  });
22
- program.command("hook").description("Install git hooks from config").action(async () => {
23
- const { hook } = await import("../hook-e3tLJA2D.mjs").then((n) => n.r);
21
+ program.command("hook").description("Install git hooks from config").action(() => {
24
22
  return hook();
25
23
  });
26
24
  program.command("release").description("Release all packages and generate changelogs").option("-t, --npmTag <tag>", "npm dist-tag (e.g. beta, next)").option("-r, --remote <remote>", "Git remote name for pushing").option("--skip-npm-publish", "Skip npm publish").option("--skip-changelog", "Skip changelog generation").option("--skip-git-tag", "Skip git tag").option("-c, --check-remote-version", "Skip publish if the current version already exists on npm").action(async (options) => {
27
- const { getConfig } = await import("../config-CpH0B9DB.mjs").then((n) => n.t);
28
- const { release } = await import("../release-CtpGDUcn.mjs").then((n) => n.n);
29
25
  return release({
30
26
  ...(await getConfig()).release ?? {},
31
27
  ...options.npmTag != null ? { npmTag: options.npmTag } : {},
@@ -37,8 +33,6 @@ program.command("release").description("Release all packages and generate change
37
33
  });
38
34
  });
39
35
  program.command("publish").description("Publish workspace packages to npm (pnpm recursive publish)").option("-c, --checkRemoteVersion", "Skip publish if the current version already exists on npm").option("-t, --npmTag <tag>", "npm dist-tag (e.g. beta, next); ignored when --pre-release is set").option("--pre-release", "Publish with alpha dist-tag").action(async (options) => {
40
- const { getConfig } = await import("../config-CpH0B9DB.mjs").then((n) => n.t);
41
- const { publish } = await import("../publish-C86CKyEw.mjs").then((n) => n.n);
42
36
  return publish({
43
37
  ...(await getConfig()).publish ?? {},
44
38
  ...options.checkRemoteVersion ? { checkRemoteVersion: true } : {},
@@ -46,16 +40,13 @@ program.command("publish").description("Publish workspace packages to npm (pnpm
46
40
  ...options.preRelease ? { preRelease: true } : {}
47
41
  });
48
42
  });
49
- program.command("changelog").description("Generate changelog").action(async () => {
50
- const { changelog } = await import("../changelog-CbLZqT8o.mjs").then((n) => n.n);
43
+ program.command("changelog").description("Generate changelog").action(() => {
51
44
  return changelog();
52
45
  });
53
- program.command("commit-lint").description("Lint commit message").argument("<commitMessagePath>", "Git commit message path").action(async (commitMessagePath) => {
54
- const { commitLint } = await import("../commitLint-eVcRXbbH.mjs").then((n) => n.n);
46
+ program.command("commit-lint").description("Lint commit message").argument("<commitMessagePath>", "Git commit message path").action((commitMessagePath) => {
55
47
  return commitLint({ commitMessagePath });
56
48
  });
57
- program.command("lockfile-check").description("Check if lockfile has been updated and auto-install dependencies").option("-m, --packageManager <manager>", "Package manager (npm, yarn, pnpm)").option("-s, --skipInstall", "Skip install dependencies when lockfile changed").action(async (options) => {
58
- const { lockfileCheck } = await import("../lockfileCheck-DKW6MKdC.mjs").then((n) => n.n);
49
+ program.command("lockfile-check").description("Check if lockfile has been updated and auto-install dependencies").option("-m, --packageManager <manager>", "Package manager (npm, yarn, pnpm)").option("-s, --skipInstall", "Skip install dependencies when lockfile changed").action((options) => {
59
50
  return lockfileCheck(options);
60
51
  });
61
52
  program.parse();
@@ -1,7 +1,6 @@
1
- import { t as HookConfig } from "../config-DSUWeyjT.mjs";
1
+ import { t as HookConfig } from "../config-B21-n_bR.mjs";
2
2
  import { GenerateOptions } from "api-farmer";
3
3
  import { ChangelogOptions, CommitLintCommandOptions, LockfileCheckOptions, PublishCommandOptions, ReleaseCommandOptions } from "@varlet/release";
4
-
5
4
  //#region src/cli/clean.d.ts
6
5
  declare function clean(patterns?: string[]): Promise<void>;
7
6
  //#endregion
@@ -1,9 +1,2 @@
1
- import { t as clean } from "../clean-ChrJ3VXV.mjs";
2
- import { t as api } from "../api-BZphli-u.mjs";
3
- import { i as writeHooks, n as hook, t as getHooksDir } from "../hook-e3tLJA2D.mjs";
4
- import { t as release } from "../release-CtpGDUcn.mjs";
5
- import { t as publish } from "../publish-C86CKyEw.mjs";
6
- import { t as changelog } from "../changelog-CbLZqT8o.mjs";
7
- import { t as commitLint } from "../commitLint-eVcRXbbH.mjs";
8
- import { t as lockfileCheck } from "../lockfileCheck-DKW6MKdC.mjs";
1
+ import { a as hook, c as clean, i as getHooksDir, l as changelog, n as publish, o as writeHooks, r as lockfileCheck, s as commitLint, t as release, u as api } from "../release-CFAOWQEE.mjs";
9
2
  export { api, changelog, clean, commitLint, getHooksDir, hook, lockfileCheck, publish, release, writeHooks };
@@ -1,6 +1,5 @@
1
1
  import { GenerateOptions } from "api-farmer";
2
2
  import { ChangelogOptions, PublishCommandOptions, ReleaseCommandOptions } from "@varlet/release";
3
-
4
3
  //#region src/cli/config.d.ts
5
4
  type GitHook = 'applypatch-msg' | 'pre-applypatch' | 'post-applypatch' | 'pre-commit' | 'pre-merge-commit' | 'prepare-commit-msg' | 'commit-msg' | 'post-commit' | 'pre-rebase' | 'post-checkout' | 'post-merge' | 'pre-push' | 'pre-auto-gc' | 'post-rewrite';
6
5
  type HookConfig = Partial<Record<GitHook, string[]>>;
package/dist/index.d.mts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { v4 as uuid, v6 as uuidV6 } from "uuid";
2
2
  import mitt from "mitt";
3
3
  export * from "mitt";
4
-
5
4
  //#region src/array/at.d.ts
6
5
  declare function at<T>(arr: T[], index: number): T | undefined;
7
6
  //#endregion
@@ -80,12 +79,12 @@ declare function omitBy<T extends object>(object: T, fn: (value: any, key: keyof
80
79
  //#endregion
81
80
  //#region src/object/deriveKey.d.ts
82
81
  type DeriveKeyMap<T extends object> = Partial<Record<keyof T, PropertyKey>>;
83
- type DeriveKeyResult<T extends object, M extends DeriveKeyMap<T>> = T & { [K in keyof M as M[K] extends PropertyKey ? M[K] : never]: K extends keyof T ? T[K] : never };
82
+ type DeriveKeyResult<T extends object, M extends DeriveKeyMap<T>> = T & { [K in keyof M as M[K] extends PropertyKey ? M[K] : never]: K extends keyof T ? T[K] : never; };
84
83
  declare function deriveKey<T extends object, M extends DeriveKeyMap<T>>(object: T, mapping: M): DeriveKeyResult<T, M>;
85
84
  //#endregion
86
85
  //#region src/object/rekey.d.ts
87
86
  type RekeyMap<T extends object> = Partial<Record<keyof T, PropertyKey>>;
88
- type RekeyResult<T extends object, M extends RekeyMap<T>> = Omit<T, keyof M> & { [K in keyof M as M[K] extends PropertyKey ? M[K] : never]: K extends keyof T ? T[K] : never };
87
+ type RekeyResult<T extends object, M extends RekeyMap<T>> = Omit<T, keyof M> & { [K in keyof M as M[K] extends PropertyKey ? M[K] : never]: K extends keyof T ? T[K] : never; };
89
88
  declare function rekey<T extends object, M extends RekeyMap<T>>(object: T, mapping: M): RekeyResult<T, M>;
90
89
  //#endregion
91
90
  //#region src/object/mapObject.d.ts
@@ -107,9 +106,6 @@ declare function objectKeys<T extends object>(object: T): `${keyof T & string}`[
107
106
  //#endregion
108
107
  //#region src/object/objectEntries.d.ts
109
108
  declare function objectEntries<T extends object>(object: T): [keyof T & string, T[keyof T & string]][];
110
- declare namespace index_d_exports$1 {
111
- export { mitt, uuid, uuidV6 };
112
- }
113
109
  //#endregion
114
110
  //#region src/util/cancelAnimationFrame.d.ts
115
111
  declare function cancelAnimationFrame(handle: number): void;
@@ -214,13 +210,13 @@ type EnumOfNormalizeToOption<V> = V extends {
214
210
  description?: EnumOfStringOrGetter;
215
211
  };
216
212
  type EnumOfResolvedField<V> = V extends ((...args: any[]) => infer R) ? R : V;
217
- type EnumOfResolvedOption<O> = O extends unknown ? { [K in keyof O]: EnumOfResolvedField<O[K]> } : never;
213
+ type EnumOfResolvedOption<O> = O extends unknown ? { [K in keyof O]: EnumOfResolvedField<O[K]>; } : never;
218
214
  type EnumOfExtractOptionShape<T extends Record<string, EnumOfConfigValue>> = EnumOfResolvedOption<EnumOfNormalizeToOption<ValueOf<T>>>;
219
215
  type EnumOfExtractValues<T extends object> = { [P in keyof T]: T[P] extends {
220
216
  value: infer V;
221
- } ? V : T[P] };
222
- type EnumOfKeyForValue<T extends object, V> = { [K in keyof T]: EnumOfExtractValues<T>[K] extends V ? (V extends EnumOfExtractValues<T>[K] ? K : never) : never }[keyof T];
223
- type EnumOfOptionForValue<T extends Record<string, EnumOfConfigValue>, Value> = Value extends infer V ? EnumOfKeyForValue<T, V> extends keyof T ? EnumOfResolvedOption<EnumOfNormalizeToOption<T[EnumOfKeyForValue<T, V>]>> : EnumOfExtractOptionShape<T> : never;
217
+ } ? V : T[P]; };
218
+ type EnumOfKeyForValue<T extends object, V> = { [K in keyof T]: EnumOfExtractValues<T>[K] extends V ? (V extends EnumOfExtractValues<T>[K] ? K : never) : never; }[keyof T];
219
+ type EnumOfOptionForValue<T extends Record<string, EnumOfConfigValue>, Value> = Value extends (infer V) ? EnumOfKeyForValue<T, V> extends keyof T ? EnumOfResolvedOption<EnumOfNormalizeToOption<T[EnumOfKeyForValue<T, V>]>> : EnumOfExtractOptionShape<T> : never;
224
220
  type EnumOfResultMethods<V, T extends Record<string, EnumOfConfigValue>> = {
225
221
  values(): V[];
226
222
  label(v: V): string;
@@ -241,10 +237,7 @@ interface MotionOptions {
241
237
  from: number;
242
238
  to: number;
243
239
  duration?: number;
244
- frame?: ({
245
- value,
246
- done
247
- }: {
240
+ frame?: ({ value, done }: {
248
241
  value: number;
249
242
  done: boolean;
250
243
  }) => void;
@@ -484,12 +477,7 @@ interface MaskStringOptions {
484
477
  mask?: string;
485
478
  maskLength?: number;
486
479
  }
487
- declare function maskString(text: string, {
488
- prefix,
489
- suffix,
490
- mask,
491
- maskLength
492
- }?: MaskStringOptions): string;
480
+ declare function maskString(text: string, { prefix, suffix, mask, maskLength }?: MaskStringOptions): string;
493
481
  //#endregion
494
482
  //#region src/string/camelize.d.ts
495
483
  declare function camelize(s: string): string;
@@ -579,8 +567,5 @@ declare function floor(val: number, precision?: number): number;
579
567
  //#endregion
580
568
  //#region src/math/ceil.d.ts
581
569
  declare function ceil(val: number, precision?: number): number;
582
- declare namespace index_d_exports {
583
- export { BEM, ClassName, Classes, CookieAttributes, CookieStorage, CreateCacheManagerOptions, DurationContext, EnumOf, EnumOfConfigValue, EnumOfExtractOptionShape, EnumOfExtractValues, EnumOfKeyForValue, EnumOfNormalizeToOption, EnumOfOptionForValue, EnumOfResolvedField, EnumOfResolvedOption, EnumOfResult, EnumOfResultMethods, EnumOfStringOrGetter, EnumOfValue, EnumOfValueObject, MaskStringOptions, Motion, MotionOptions, MotionState, NOOP, NavigationTarget, PromiseWithResolvers, Storage, assert, at, baseRound, buildNavigationUrl, call, callOrReturn, camelize, cancelAnimationFrame, ceil, chunk, clamp, clampArrayRange, classes, cloneDeep, cloneDeepWith, copyText, createCacheManager, createCookieStorage, createNamespaceFn, createStorage, debounce, delay, deriveKey, difference, differenceWith, doubleRaf, download, duration, ensurePrefix, ensureSuffix, enumOf, find, floor, genNumberKey, genStringKey, getAllParentScroller, getGlobalThis, getParentScroller, getRect, getScrollLeft, getScrollTop, getStyle, groupBy, hasDuplicates, hasDuplicatesBy, hasOwn, inBrowser, inMobile, inViewport, intersection, intersectionWith, isArray, isArrayBuffer, isBlob, isBoolean, isDOMException, isDataView, isDate, isEmpty, isEmptyPlainObject, isEqual, isEqualWith, isError, isFile, isFunction, isMap, isNonEmptyArray, isNullish, isNumber, isNumeric, isObject, isPlainObject, isPrimitive, isPromise, isRegExp, isSet, isString, isSymbol, isTruthy, isTypedArray, isWeakMap, isWeakSet, isWindow, kebabCase, localStorage, lowerFirst, mapObject, maskString, maxBy, mean, meanBy, merge, mergeWith, minBy, mitt, motion, navigation, normalizeToArray, objectEntries, objectKeys, objectToString, omit, omitBy, once, pascalCase, pick, pickBy, prettyJSONObject, preventDefault, promiseWithResolvers, raf, randomColor, randomNumber, randomString, rekey, removeArrayBlank, removeArrayEmpty, removeItem, removeItemBy, removeItemsBy, requestAnimationFrame, round, sample, sessionStorage, set, shuffle, slash, sum, sumBy, sumHash, supportTouch, throttle, times, toArrayBuffer, toDataURL, toNumber, toRawType, toText, toTypeString, toggleItem, tryAsyncCall, tryCall, tryParseJSON, uniq, uniqBy, upperFirst, uuid, uuidV6, xor, xorWith };
584
- }
585
570
  //#endregion
586
571
  export { BEM, ClassName, Classes, CookieAttributes, CookieStorage, CreateCacheManagerOptions, DurationContext, EnumOf, EnumOfConfigValue, EnumOfExtractOptionShape, EnumOfExtractValues, EnumOfKeyForValue, EnumOfNormalizeToOption, EnumOfOptionForValue, EnumOfResolvedField, EnumOfResolvedOption, EnumOfResult, EnumOfResultMethods, EnumOfStringOrGetter, EnumOfValue, EnumOfValueObject, MaskStringOptions, Motion, MotionOptions, MotionState, NOOP, NavigationTarget, PromiseWithResolvers, Storage, assert, at, baseRound, buildNavigationUrl, call, callOrReturn, camelize, cancelAnimationFrame, ceil, chunk, clamp, clampArrayRange, classes, cloneDeep, cloneDeepWith, copyText, createCacheManager, createCookieStorage, createNamespaceFn, createStorage, debounce, delay, deriveKey, difference, differenceWith, doubleRaf, download, duration, ensurePrefix, ensureSuffix, enumOf, find, floor, genNumberKey, genStringKey, getAllParentScroller, getGlobalThis, getParentScroller, getRect, getScrollLeft, getScrollTop, getStyle, groupBy, hasDuplicates, hasDuplicatesBy, hasOwn, inBrowser, inMobile, inViewport, intersection, intersectionWith, isArray, isArrayBuffer, isBlob, isBoolean, isDOMException, isDataView, isDate, isEmpty, isEmptyPlainObject, isEqual, isEqualWith, isError, isFile, isFunction, isMap, isNonEmptyArray, isNullish, isNumber, isNumeric, isObject, isPlainObject, isPrimitive, isPromise, isRegExp, isSet, isString, isSymbol, isTruthy, isTypedArray, isWeakMap, isWeakSet, isWindow, kebabCase, localStorage, lowerFirst, mapObject, maskString, maxBy, mean, meanBy, merge, mergeWith, minBy, mitt, motion, navigation, normalizeToArray, objectEntries, objectKeys, objectToString, omit, omitBy, once, pascalCase, pick, pickBy, prettyJSONObject, preventDefault, promiseWithResolvers, raf, randomColor, randomNumber, randomString, rekey, removeArrayBlank, removeArrayEmpty, removeItem, removeItemBy, removeItemsBy, requestAnimationFrame, round, sample, sessionStorage, set, shuffle, slash, sum, sumBy, sumHash, supportTouch, throttle, times, toArrayBuffer, toDataURL, toNumber, toRawType, toText, toTypeString, toggleItem, tryAsyncCall, tryCall, tryParseJSON, uniq, uniqBy, upperFirst, uuid, uuidV6, xor, xorWith };
package/dist/index.mjs CHANGED
@@ -1,5 +1,4 @@
1
- import { n as isArray, t as isString } from "./isString-eoLxw4CX.mjs";
2
- import { n as isFunction, t as callOrReturn } from "./callOrReturn-MpTzoGlG.mjs";
1
+ import { i as isArray, n as isString, r as isFunction, t as callOrReturn } from "./callOrReturn-Kvk3rYZJ.mjs";
3
2
  import { v4 as uuid, v6 as uuidV6 } from "uuid";
4
3
  import mitt from "mitt";
5
4
  import Cookie from "js-cookie";
@@ -0,0 +1,81 @@
1
+ import { i as isArray, n as isString, t as callOrReturn } from "./callOrReturn-Kvk3rYZJ.mjs";
2
+ import { generate } from "api-farmer";
3
+ import { loadConfig } from "unconfig";
4
+ import { changelog, commitLint, lockfileCheck, publish, release } from "@varlet/release";
5
+ import { rimraf } from "rimraf";
6
+ import { execSync } from "node:child_process";
7
+ import fs from "node:fs";
8
+ import { dirname, resolve } from "node:path";
9
+ //#region src/cli/config.ts
10
+ async function getConfig() {
11
+ const { config } = await loadConfig({ sources: [{
12
+ files: "vite.config",
13
+ async rewrite(config) {
14
+ return (await callOrReturn(config))?.rattail;
15
+ }
16
+ }] });
17
+ return config ?? {};
18
+ }
19
+ //#endregion
20
+ //#region src/cli/api.ts
21
+ async function api(config) {
22
+ await generate(config ?? (await getConfig()).api ?? {});
23
+ }
24
+ //#endregion
25
+ //#region src/cli/changelog.ts
26
+ async function changelog$1(config) {
27
+ await changelog(config ?? (await getConfig()).changelog ?? {});
28
+ }
29
+ //#endregion
30
+ //#region src/cli/clean.ts
31
+ function resolveCleanPatterns(clean) {
32
+ if (!clean) return [];
33
+ if (isString(clean)) return [clean];
34
+ if (isArray(clean)) return clean;
35
+ return clean.patterns ?? [];
36
+ }
37
+ async function clean(patterns) {
38
+ await rimraf(patterns ?? resolveCleanPatterns((await getConfig()).clean), { glob: true });
39
+ }
40
+ //#endregion
41
+ //#region src/cli/commitLint.ts
42
+ function commitLint$1(options) {
43
+ commitLint(options);
44
+ }
45
+ //#endregion
46
+ //#region src/cli/hook.ts
47
+ function getHooksDir() {
48
+ try {
49
+ const hooksPath = execSync("git config core.hooksPath", { encoding: "utf-8" }).trim();
50
+ return resolve(process.cwd(), dirname(hooksPath));
51
+ } catch {
52
+ throw new Error("core.hooksPath is not set. Run \"vp config --hooks-dir <dir>\" first.");
53
+ }
54
+ }
55
+ function writeHooks(hookConfig, hooksDir) {
56
+ const resolvedDir = hooksDir ?? getHooksDir();
57
+ for (const [hookName, commands] of Object.entries(hookConfig)) {
58
+ const hookFile = resolve(resolvedDir, hookName);
59
+ fs.writeFileSync(hookFile, commands.join("\n") + "\n");
60
+ }
61
+ }
62
+ async function hook() {
63
+ writeHooks((await getConfig()).hook ?? {});
64
+ }
65
+ //#endregion
66
+ //#region src/cli/lockfileCheck.ts
67
+ async function lockfileCheck$1(options) {
68
+ await lockfileCheck(options);
69
+ }
70
+ //#endregion
71
+ //#region src/cli/publish.ts
72
+ async function publish$1(config) {
73
+ await publish(config ?? (await getConfig()).publish ?? {});
74
+ }
75
+ //#endregion
76
+ //#region src/cli/release.ts
77
+ async function release$1(config) {
78
+ await release(config ?? (await getConfig()).release ?? {});
79
+ }
80
+ //#endregion
81
+ export { hook as a, clean as c, getConfig as d, getHooksDir as i, changelog$1 as l, publish$1 as n, writeHooks as o, lockfileCheck$1 as r, commitLint$1 as s, release$1 as t, api as u };
@@ -1,27 +1,70 @@
1
- import { n as RattailConfig, t as HookConfig } from "../config-DSUWeyjT.mjs";
1
+ import { n as RattailConfig, t as HookConfig } from "../config-B21-n_bR.mjs";
2
2
  import { ConfigEnv, UserConfig } from "vite-plus";
3
- import { CreateVueConfigOptions, DummyRule, FmtOptions, LintOptions, LintOptionsVue, OxlintConfig, OxlintOverride, StagedConfig, fmt, lint, staged } from "@configurajs/vite-plus";
4
-
3
+ import { OxfmtConfig } from "oxfmt";
4
+ import { DummyRule, OxlintConfig, OxlintOverride } from "oxlint";
5
5
  //#region src/vite-plus/index.d.ts
6
+ interface CreateVueConfigOptions {
7
+ version?: 2 | 3;
8
+ }
9
+ type LintOptionsVue = Partial<Pick<CreateVueConfigOptions, 'version'>>;
10
+ type StagedConfig = Record<string, string | string[]>;
11
+ interface FmtOptions {
12
+ /**
13
+ * Ignore file patterns
14
+ */
15
+ ignores?: string[];
16
+ }
17
+ interface LintOptions {
18
+ /**
19
+ * Enable TypeScript support
20
+ * @default true
21
+ */
22
+ ts?: boolean;
23
+ /**
24
+ * Enable Vue support, version 3 by default
25
+ * @default true
26
+ */
27
+ vue?: boolean | LintOptionsVue;
28
+ /**
29
+ * Enable React support
30
+ * @default false
31
+ */
32
+ react?: boolean;
33
+ /**
34
+ * Enable Vitest support
35
+ * @default true
36
+ */
37
+ vitest?: boolean;
38
+ /**
39
+ * Custom rules
40
+ */
41
+ rules?: Record<string, DummyRule>;
42
+ /**
43
+ * Ignore file patterns
44
+ */
45
+ ignores?: string[];
46
+ /**
47
+ * Additional overrides
48
+ */
49
+ overrides?: OxlintOverride[];
50
+ }
51
+ declare function lint(options?: LintOptions): OxlintConfig;
52
+ declare function staged(): StagedConfig;
53
+ declare function fmt(options?: FmtOptions): OxfmtConfig;
6
54
  type RattailUserConfig = UserConfig & {
7
55
  rattail?: RattailConfig;
8
56
  };
9
57
  type RattailUserConfigFn = (env: ConfigEnv) => RattailUserConfig | Promise<RattailUserConfig>;
10
58
  type RattailUserConfigExport = RattailUserConfig | Promise<RattailUserConfig> | RattailUserConfigFn;
11
59
  declare function defineConfig(config: RattailUserConfigExport): RattailUserConfig;
12
- declare function clean({
13
- patterns
14
- }?: {
60
+ declare function clean({ patterns }?: {
15
61
  patterns?: string[];
16
62
  }): {
17
63
  patterns: string[];
18
64
  };
19
- declare function hook({
20
- commitLint,
21
- lockfileCheck
22
- }?: {
65
+ declare function hook({ commitLint, lockfileCheck }?: {
23
66
  commitLint?: boolean;
24
67
  lockfileCheck?: boolean;
25
68
  }): HookConfig;
26
69
  //#endregion
27
- export { type CreateVueConfigOptions, type DummyRule, type FmtOptions, type HookConfig, type LintOptions, type LintOptionsVue, type OxlintConfig, type OxlintOverride, type RattailConfig, RattailUserConfig, RattailUserConfigExport, RattailUserConfigFn, type StagedConfig, clean, defineConfig, fmt, hook, lint, staged };
70
+ export { CreateVueConfigOptions, type DummyRule, FmtOptions, type HookConfig, LintOptions, LintOptionsVue, type OxlintConfig, type OxlintOverride, type RattailConfig, RattailUserConfig, RattailUserConfigExport, RattailUserConfigFn, StagedConfig, clean, defineConfig, fmt, hook, lint, staged };
@@ -1,6 +1,390 @@
1
1
  import { defineConfig as defineConfig$1 } from "vite-plus";
2
- import { fmt, lint, staged } from "@configurajs/vite-plus";
3
2
  //#region src/vite-plus/index.ts
3
+ const DEFAULT_IGNORES = [
4
+ "**/node_modules",
5
+ "**/dist",
6
+ "**/package-lock.json",
7
+ "**/yarn.lock",
8
+ "**/pnpm-lock.yaml",
9
+ "**/bun.lockb",
10
+ "**/output",
11
+ "**/coverage",
12
+ "**/temp",
13
+ "**/.temp",
14
+ "**/tmp",
15
+ "**/.tmp",
16
+ "**/.history",
17
+ "**/.vitepress/cache",
18
+ "**/.nuxt",
19
+ "**/.next",
20
+ "**/.svelte-kit",
21
+ "**/.vercel",
22
+ "**/.changeset",
23
+ "**/.idea",
24
+ "**/.vscode",
25
+ "**/.cache",
26
+ "**/.output",
27
+ "**/.vite-inspect",
28
+ "**/.yarn",
29
+ "**/vite.config.*.timestamp-*",
30
+ "**/CHANGELOG*.md",
31
+ "**/*.min.*",
32
+ "**/LICENSE*",
33
+ "**/__snapshots__",
34
+ "**/auto-import?(s).d.ts",
35
+ "**/components.d.ts",
36
+ "**/.vite-hooks/**"
37
+ ];
38
+ function createIgnoresConfig(ignores = []) {
39
+ return [...DEFAULT_IGNORES, ...ignores];
40
+ }
41
+ function createJsConfig() {
42
+ return {
43
+ plugins: [
44
+ "eslint",
45
+ "oxc",
46
+ "unicorn",
47
+ "import"
48
+ ],
49
+ categories: { correctness: "off" },
50
+ env: {
51
+ browser: true,
52
+ node: true,
53
+ es2024: true
54
+ },
55
+ rules: {
56
+ "constructor-super": "error",
57
+ "for-direction": "error",
58
+ "no-async-promise-executor": "error",
59
+ "no-caller": "error",
60
+ "no-class-assign": "error",
61
+ "no-compare-neg-zero": "error",
62
+ "no-cond-assign": "error",
63
+ "no-const-assign": "error",
64
+ "no-constant-binary-expression": "error",
65
+ "no-constant-condition": "error",
66
+ "no-control-regex": "error",
67
+ "no-debugger": "error",
68
+ "no-delete-var": "error",
69
+ "no-dupe-class-members": "error",
70
+ "no-dupe-else-if": "error",
71
+ "no-dupe-keys": "error",
72
+ "no-duplicate-case": "error",
73
+ "no-empty": ["error", { allowEmptyCatch: true }],
74
+ "no-empty-character-class": "error",
75
+ "no-empty-pattern": "error",
76
+ "no-empty-static-block": "error",
77
+ "no-eval": "error",
78
+ "no-ex-assign": "error",
79
+ "no-extra-boolean-cast": "error",
80
+ "no-func-assign": "error",
81
+ "no-global-assign": "error",
82
+ "no-import-assign": "error",
83
+ "no-invalid-regexp": "error",
84
+ "no-irregular-whitespace": "error",
85
+ "no-iterator": "error",
86
+ "no-loss-of-precision": "error",
87
+ "no-misleading-character-class": "error",
88
+ "no-new-native-nonconstructor": "error",
89
+ "no-nonoctal-decimal-escape": "error",
90
+ "no-obj-calls": "error",
91
+ "no-self-assign": "error",
92
+ "no-setter-return": "error",
93
+ "no-sparse-arrays": "error",
94
+ "no-this-before-super": "error",
95
+ "no-unassigned-vars": "error",
96
+ "no-unsafe-finally": "error",
97
+ "no-unsafe-negation": "error",
98
+ "no-unsafe-optional-chaining": "error",
99
+ "no-unused-expressions": ["error", {
100
+ allowShortCircuit: true,
101
+ allowTaggedTemplates: true,
102
+ allowTernary: true
103
+ }],
104
+ "no-unused-labels": "error",
105
+ "no-unused-private-class-members": "error",
106
+ "no-unused-vars": ["error", {
107
+ args: "none",
108
+ caughtErrors: "none",
109
+ ignoreRestSiblings: true,
110
+ vars: "all"
111
+ }],
112
+ "no-useless-backreference": "error",
113
+ "no-useless-catch": "error",
114
+ "no-useless-escape": "error",
115
+ "no-useless-rename": "error",
116
+ "no-with": "error",
117
+ "require-yield": "error",
118
+ "use-isnan": "error",
119
+ "valid-typeof": "error",
120
+ eqeqeq: [
121
+ "error",
122
+ "always",
123
+ { null: "ignore" }
124
+ ],
125
+ curly: "error",
126
+ yoda: "error",
127
+ "default-param-last": "error",
128
+ "prefer-const": "error",
129
+ "prefer-rest-params": "error",
130
+ "require-await": "error",
131
+ "symbol-description": "error",
132
+ "oxc/bad-array-method-on-arguments": "error",
133
+ "oxc/bad-char-at-comparison": "error",
134
+ "oxc/bad-comparison-sequence": "error",
135
+ "oxc/bad-min-max-func": "error",
136
+ "oxc/bad-object-literal-comparison": "error",
137
+ "oxc/bad-replace-all-arg": "error",
138
+ "oxc/const-comparisons": "error",
139
+ "oxc/double-comparisons": "error",
140
+ "oxc/erasing-op": "error",
141
+ "oxc/missing-throw": "error",
142
+ "oxc/number-arg-out-of-range": "error",
143
+ "oxc/only-used-in-recursion": "error",
144
+ "oxc/uninvoked-array-callback": "error",
145
+ "unicorn/no-await-in-promise-methods": "error",
146
+ "unicorn/no-empty-file": "error",
147
+ "unicorn/no-invalid-fetch-options": "error",
148
+ "unicorn/no-invalid-remove-event-listener": "error",
149
+ "unicorn/no-new-array": "error",
150
+ "unicorn/no-single-promise-in-promise-methods": "error",
151
+ "unicorn/no-unnecessary-await": "error",
152
+ "unicorn/no-useless-fallback-in-spread": "error",
153
+ "unicorn/no-useless-length-check": "error",
154
+ "unicorn/no-useless-spread": "error",
155
+ "unicorn/prefer-set-size": "error",
156
+ "unicorn/prefer-string-starts-ends-with": "error",
157
+ "import/default": "error",
158
+ "import/namespace": "error",
159
+ "import/first": "error",
160
+ "import/no-duplicates": "error",
161
+ "import/no-mutable-exports": "error",
162
+ "import/no-self-import": "error"
163
+ }
164
+ };
165
+ }
166
+ function createTsConfig(exts = []) {
167
+ return {
168
+ plugins: ["typescript"],
169
+ overrides: [{
170
+ files: [
171
+ "**/*.?([cm])ts",
172
+ "**/*.?([cm])tsx",
173
+ ...exts.map((ext) => `**/*.${ext}`)
174
+ ],
175
+ rules: {
176
+ "no-unused-expressions": "off",
177
+ "no-unused-vars": "off",
178
+ "no-redeclare": "off",
179
+ "no-undef": "off",
180
+ "no-var": "error",
181
+ "prefer-const": "error",
182
+ "prefer-rest-params": "error",
183
+ "prefer-spread": "error",
184
+ "typescript/await-thenable": "error",
185
+ "typescript/no-array-constructor": "error",
186
+ "typescript/no-array-delete": "error",
187
+ "typescript/no-base-to-string": "error",
188
+ "typescript/no-duplicate-enum-values": "error",
189
+ "typescript/no-duplicate-type-constituents": "error",
190
+ "typescript/no-extra-non-null-assertion": "error",
191
+ "typescript/no-floating-promises": "error",
192
+ "typescript/no-for-in-array": "error",
193
+ "typescript/no-implied-eval": "error",
194
+ "typescript/no-meaningless-void-operator": "error",
195
+ "typescript/no-misused-new": "error",
196
+ "typescript/no-namespace": "error",
197
+ "typescript/no-non-null-asserted-optional-chain": "error",
198
+ "typescript/no-redundant-type-constituents": "error",
199
+ "typescript/no-require-imports": "error",
200
+ "typescript/no-this-alias": "error",
201
+ "typescript/no-unnecessary-parameter-property-assignment": "error",
202
+ "typescript/no-unnecessary-type-constraint": "error",
203
+ "typescript/no-unsafe-declaration-merging": "error",
204
+ "typescript/no-unsafe-function-type": "error",
205
+ "typescript/no-unsafe-unary-minus": "error",
206
+ "typescript/no-useless-empty-export": "error",
207
+ "typescript/no-wrapper-object-types": "error",
208
+ "typescript/prefer-as-const": "error",
209
+ "typescript/prefer-namespace-keyword": "error",
210
+ "typescript/prefer-string-starts-ends-with": "error",
211
+ "typescript/restrict-template-expressions": "error",
212
+ "typescript/ban-ts-comment": ["error", { "ts-expect-error": "allow-with-description" }],
213
+ "typescript/no-non-null-asserted-nullish-coalescing": "error",
214
+ "typescript/no-useless-constructor": "error",
215
+ "typescript/prefer-literal-enum-member": "error",
216
+ "typescript/unified-signatures": "error",
217
+ "typescript/no-unused-expressions": ["error", {
218
+ allowShortCircuit: true,
219
+ allowTaggedTemplates: true,
220
+ allowTernary: true
221
+ }],
222
+ "typescript/no-unused-vars": ["error", {
223
+ args: "none",
224
+ caughtErrors: "none",
225
+ ignoreRestSiblings: true,
226
+ vars: "all"
227
+ }]
228
+ }
229
+ }]
230
+ };
231
+ }
232
+ function createVueConfig(options = {}) {
233
+ const { version = 3 } = options;
234
+ return {
235
+ plugins: ["vue"],
236
+ rules: {
237
+ "vue/no-arrow-functions-in-watch": "error",
238
+ "vue/no-deprecated-destroyed-lifecycle": version === 2 ? "off" : "error",
239
+ "vue/no-export-in-script-setup": "error",
240
+ "vue/no-lifecycle-after-await": "error",
241
+ "vue/no-multiple-slot-args": "warn",
242
+ "vue/no-this-in-before-route-enter": "error",
243
+ "vue/prefer-import-from-vue": "error",
244
+ "vue/valid-define-emits": "error",
245
+ "vue/valid-define-props": "error"
246
+ },
247
+ globals: {
248
+ computed: "readonly",
249
+ defineEmits: "readonly",
250
+ defineExpose: "readonly",
251
+ defineProps: "readonly",
252
+ onMounted: "readonly",
253
+ onUnmounted: "readonly",
254
+ reactive: "readonly",
255
+ ref: "readonly",
256
+ shallowReactive: "readonly",
257
+ shallowRef: "readonly",
258
+ toRef: "readonly",
259
+ toRefs: "readonly",
260
+ watch: "readonly",
261
+ watchEffect: "readonly"
262
+ }
263
+ };
264
+ }
265
+ function createReactConfig() {
266
+ return {
267
+ plugins: ["react"],
268
+ overrides: [{
269
+ files: ["**/*.?([cm])[jt]s?(x)"],
270
+ rules: {
271
+ "react/exhaustive-deps": "warn",
272
+ "react/forward-ref-uses-ref": "error",
273
+ "react/jsx-key": "error",
274
+ "react/jsx-no-duplicate-props": "warn",
275
+ "react/jsx-no-undef": "error",
276
+ "react/jsx-props-no-spread-multi": "error",
277
+ "react/jsx-uses-vars": "warn",
278
+ "react/jsx-no-comment-textnodes": "warn",
279
+ "react/jsx-no-target-blank": "warn",
280
+ "react/jsx-no-script-url": "warn",
281
+ "react/jsx-boolean-value": "warn",
282
+ "react/jsx-no-useless-fragment": "warn",
283
+ "react/no-access-state-in-setstate": "error",
284
+ "react/no-array-index-key": "warn",
285
+ "react/no-children-prop": "error",
286
+ "react/no-danger": "warn",
287
+ "react/no-danger-with-children": "error",
288
+ "react/no-deprecated": "error",
289
+ "react/no-did-mount-set-state": "error",
290
+ "react/no-direct-mutation-state": "error",
291
+ "react/no-find-dom-node": "error",
292
+ "react/no-is-mounted": "error",
293
+ "react/no-render-return-value": "error",
294
+ "react/no-string-refs": "error",
295
+ "react/no-this-in-sfc": "error",
296
+ "react/no-unsafe": "error",
297
+ "react/no-unstable-nested-components": "error",
298
+ "react/no-will-update-set-state": "error",
299
+ "react/void-dom-elements-no-children": "warn",
300
+ "react/button-has-type": "warn",
301
+ "react/iframe-missing-sandbox": "warn",
302
+ "react/rules-of-hooks": "error"
303
+ }
304
+ }]
305
+ };
306
+ }
307
+ function createVitestConfig() {
308
+ return {
309
+ plugins: ["vitest"],
310
+ overrides: [{
311
+ files: ["**/*.{test,spec}.?(c|m)[jt]s?(x)"],
312
+ rules: {
313
+ "vitest/consistent-each-for": "error",
314
+ "vitest/hoisted-apis-on-top": "error",
315
+ "vitest/no-commented-out-tests": "warn",
316
+ "vitest/no-conditional-tests": "error",
317
+ "vitest/no-identical-title": "error",
318
+ "vitest/no-import-node-test": "warn",
319
+ "vitest/require-awaited-expect-poll": "error",
320
+ "vitest/require-local-test-context-for-concurrent-snapshots": "warn",
321
+ "vitest/require-mock-type-parameters": "error",
322
+ "vitest/valid-describe-callback": "error",
323
+ "vitest/valid-expect": "error",
324
+ "vitest/valid-title": "error",
325
+ "vitest/warn-todo": "error"
326
+ }
327
+ }]
328
+ };
329
+ }
330
+ function mergeContributions(...contributions) {
331
+ const categories = {};
332
+ const rules = {};
333
+ const overrides = [];
334
+ const globals = {};
335
+ const env = {};
336
+ const settings = {};
337
+ const plugins = [];
338
+ contributions.forEach((contribution) => {
339
+ contribution.plugins?.forEach((plugin) => plugins.push(plugin));
340
+ Object.assign(categories, contribution.categories);
341
+ Object.assign(rules, contribution.rules);
342
+ Object.assign(globals, contribution.globals);
343
+ Object.assign(env, contribution.env);
344
+ Object.assign(settings, contribution.settings);
345
+ if (contribution.overrides) overrides.push(...contribution.overrides);
346
+ });
347
+ return {
348
+ plugins,
349
+ categories,
350
+ rules,
351
+ overrides,
352
+ globals,
353
+ env,
354
+ settings
355
+ };
356
+ }
357
+ function lint(options = {}) {
358
+ const { ts = true, vue = true, react = false, vitest = true, ignores = [], rules = {}, overrides = [] } = options;
359
+ const contributions = [createJsConfig()];
360
+ if (ts) contributions.push(createTsConfig(vue ? ["vue"] : []));
361
+ if (vue) contributions.push(createVueConfig({ version: vue === true ? 3 : vue.version ?? 3 }));
362
+ if (react) contributions.push(createReactConfig());
363
+ if (vitest) contributions.push(createVitestConfig());
364
+ contributions.push({ rules });
365
+ const config = mergeContributions(...contributions);
366
+ config.ignorePatterns = createIgnoresConfig(ignores);
367
+ config.overrides = [...config.overrides ?? [], ...overrides];
368
+ return config;
369
+ }
370
+ function staged() {
371
+ return {
372
+ "*.{js,jsx,ts,tsx}": ["vp fmt --no-error-on-unmatched-pattern", "vp lint --fix --no-error-on-unmatched-pattern"],
373
+ "*.{md,json,yaml,yml,html,css,scss,less}": "vp fmt --no-error-on-unmatched-pattern",
374
+ "*.vue": ["vp fmt --no-error-on-unmatched-pattern", "vp lint --fix --no-error-on-unmatched-pattern"]
375
+ };
376
+ }
377
+ function fmt(options = {}) {
378
+ const { ignores = [] } = options;
379
+ return {
380
+ semi: false,
381
+ printWidth: 120,
382
+ singleQuote: true,
383
+ sortImports: { newlinesBetween: false },
384
+ sortTailwindcss: true,
385
+ ignorePatterns: createIgnoresConfig(ignores)
386
+ };
387
+ }
4
388
  function defineConfig(config) {
5
389
  return defineConfig$1(config);
6
390
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rattail",
3
- "version": "2.0.9",
3
+ "version": "2.1.1",
4
4
  "description": "A Vite+ oriented, AI Agent friendly front-end toolchain",
5
5
  "keywords": [
6
6
  "ai-agent",
@@ -91,7 +91,6 @@
91
91
  }
92
92
  },
93
93
  "dependencies": {
94
- "@configurajs/vite-plus": "0.2.6",
95
94
  "@varlet/axle": "1.0.2",
96
95
  "@varlet/release": "^2.2.1",
97
96
  "api-farmer": "0.1.5",
@@ -104,22 +103,28 @@
104
103
  "uuid": "13.0.0"
105
104
  },
106
105
  "devDependencies": {
107
- "@types/node": "^22.8.1",
108
- "@vitest/coverage-istanbul": "^4.1.0",
106
+ "@types/node": "^22.20.0",
107
+ "@vitest/coverage-istanbul": "^4.1.10",
108
+ "esbuild": "^0.28.1",
109
109
  "jsdom": "^25.0.1",
110
110
  "oxc-minify": "^0.124.0",
111
+ "oxfmt": "0.60.0",
112
+ "oxlint": "1.75.0",
111
113
  "tsx": "^4.21.0",
112
114
  "typescript": "5.3.3",
113
- "vite-plus": "0.1.19",
114
- "vitepress": "2.0.0-alpha.17",
115
- "vitest": "$vitest"
115
+ "vite-plus": "0.2.6",
116
+ "vitepress": "2.0.0-alpha.17"
116
117
  },
117
118
  "peerDependencies": {
118
- "@voidzero-dev/vite-plus-core": ">=0.1.16",
119
- "vite-plus": ">=0.1.16"
119
+ "oxfmt": ">=0.60.0",
120
+ "oxlint": ">=1.75.0",
121
+ "vite-plus": ">=0.2.6"
120
122
  },
121
123
  "peerDependenciesMeta": {
122
- "@voidzero-dev/vite-plus-core": {
124
+ "oxfmt": {
125
+ "optional": true
126
+ },
127
+ "oxlint": {
123
128
  "optional": true
124
129
  },
125
130
  "vite-plus": {
@@ -1,10 +0,0 @@
1
- import { t as __exportAll } from "./rolldown-runtime-Dfn8tqD8.mjs";
2
- import { n as getConfig } from "./config-CpH0B9DB.mjs";
3
- import { generate } from "api-farmer";
4
- //#region src/cli/api.ts
5
- var api_exports = /* @__PURE__ */ __exportAll({ api: () => api });
6
- async function api(config) {
7
- await generate(config ?? (await getConfig()).api ?? {});
8
- }
9
- //#endregion
10
- export { api_exports as n, api as t };
@@ -1,10 +0,0 @@
1
- import { t as __exportAll } from "./rolldown-runtime-Dfn8tqD8.mjs";
2
- import { n as getConfig } from "./config-CpH0B9DB.mjs";
3
- import { changelog } from "@varlet/release";
4
- //#region src/cli/changelog.ts
5
- var changelog_exports = /* @__PURE__ */ __exportAll({ changelog: () => changelog$1 });
6
- async function changelog$1(config) {
7
- await changelog(config ?? (await getConfig()).changelog ?? {});
8
- }
9
- //#endregion
10
- export { changelog_exports as n, changelog$1 as t };
@@ -1,17 +0,0 @@
1
- import { t as __exportAll } from "./rolldown-runtime-Dfn8tqD8.mjs";
2
- import { n as isArray, t as isString } from "./isString-eoLxw4CX.mjs";
3
- import { n as getConfig } from "./config-CpH0B9DB.mjs";
4
- import { rimraf } from "rimraf";
5
- //#region src/cli/clean.ts
6
- var clean_exports = /* @__PURE__ */ __exportAll({ clean: () => clean });
7
- function resolveCleanPatterns(clean) {
8
- if (!clean) return [];
9
- if (isString(clean)) return [clean];
10
- if (isArray(clean)) return clean;
11
- return clean.patterns ?? [];
12
- }
13
- async function clean(patterns) {
14
- await rimraf(patterns ?? resolveCleanPatterns((await getConfig()).clean), { glob: true });
15
- }
16
- //#endregion
17
- export { clean_exports as n, clean as t };
@@ -1,9 +0,0 @@
1
- import { t as __exportAll } from "./rolldown-runtime-Dfn8tqD8.mjs";
2
- import { commitLint } from "@varlet/release";
3
- //#region src/cli/commitLint.ts
4
- var commitLint_exports = /* @__PURE__ */ __exportAll({ commitLint: () => commitLint$1 });
5
- function commitLint$1(options) {
6
- commitLint(options);
7
- }
8
- //#endregion
9
- export { commitLint_exports as n, commitLint$1 as t };
@@ -1,16 +0,0 @@
1
- import { t as __exportAll } from "./rolldown-runtime-Dfn8tqD8.mjs";
2
- import { t as callOrReturn } from "./callOrReturn-MpTzoGlG.mjs";
3
- import { loadConfig } from "unconfig";
4
- //#region src/cli/config.ts
5
- var config_exports = /* @__PURE__ */ __exportAll({ getConfig: () => getConfig });
6
- async function getConfig() {
7
- const { config } = await loadConfig({ sources: [{
8
- files: "vite.config",
9
- async rewrite(config) {
10
- return (await callOrReturn(config))?.rattail;
11
- }
12
- }] });
13
- return config ?? {};
14
- }
15
- //#endregion
16
- export { getConfig as n, config_exports as t };
@@ -1,31 +0,0 @@
1
- import { t as __exportAll } from "./rolldown-runtime-Dfn8tqD8.mjs";
2
- import { n as getConfig } from "./config-CpH0B9DB.mjs";
3
- import fs from "node:fs";
4
- import { dirname, resolve } from "node:path";
5
- import { execSync } from "node:child_process";
6
- //#region src/cli/hook.ts
7
- var hook_exports = /* @__PURE__ */ __exportAll({
8
- getHooksDir: () => getHooksDir,
9
- hook: () => hook,
10
- writeHooks: () => writeHooks
11
- });
12
- function getHooksDir() {
13
- try {
14
- const hooksPath = execSync("git config core.hooksPath", { encoding: "utf-8" }).trim();
15
- return resolve(process.cwd(), dirname(hooksPath));
16
- } catch {
17
- throw new Error("core.hooksPath is not set. Run \"vp config --hooks-dir <dir>\" first.");
18
- }
19
- }
20
- function writeHooks(hookConfig, hooksDir) {
21
- const resolvedDir = hooksDir ?? getHooksDir();
22
- for (const [hookName, commands] of Object.entries(hookConfig)) {
23
- const hookFile = resolve(resolvedDir, hookName);
24
- fs.writeFileSync(hookFile, commands.join("\n") + "\n");
25
- }
26
- }
27
- async function hook() {
28
- writeHooks((await getConfig()).hook ?? {});
29
- }
30
- //#endregion
31
- export { writeHooks as i, hook as n, hook_exports as r, getHooksDir as t };
@@ -1,11 +0,0 @@
1
- //#region src/general/isArray.ts
2
- function isArray(val) {
3
- return Array.isArray(val);
4
- }
5
- //#endregion
6
- //#region src/general/isString.ts
7
- function isString(val) {
8
- return typeof val === "string";
9
- }
10
- //#endregion
11
- export { isArray as n, isString as t };
@@ -1,9 +0,0 @@
1
- import { t as __exportAll } from "./rolldown-runtime-Dfn8tqD8.mjs";
2
- import { lockfileCheck } from "@varlet/release";
3
- //#region src/cli/lockfileCheck.ts
4
- var lockfileCheck_exports = /* @__PURE__ */ __exportAll({ lockfileCheck: () => lockfileCheck$1 });
5
- async function lockfileCheck$1(options) {
6
- await lockfileCheck(options);
7
- }
8
- //#endregion
9
- export { lockfileCheck_exports as n, lockfileCheck$1 as t };
@@ -1,10 +0,0 @@
1
- import { t as __exportAll } from "./rolldown-runtime-Dfn8tqD8.mjs";
2
- import { n as getConfig } from "./config-CpH0B9DB.mjs";
3
- import { publish } from "@varlet/release";
4
- //#region src/cli/publish.ts
5
- var publish_exports = /* @__PURE__ */ __exportAll({ publish: () => publish$1 });
6
- async function publish$1(config) {
7
- await publish(config ?? (await getConfig()).publish ?? {});
8
- }
9
- //#endregion
10
- export { publish_exports as n, publish$1 as t };
@@ -1,10 +0,0 @@
1
- import { t as __exportAll } from "./rolldown-runtime-Dfn8tqD8.mjs";
2
- import { n as getConfig } from "./config-CpH0B9DB.mjs";
3
- import { release } from "@varlet/release";
4
- //#region src/cli/release.ts
5
- var release_exports = /* @__PURE__ */ __exportAll({ release: () => release$1 });
6
- async function release$1(config) {
7
- await release(config ?? (await getConfig()).release ?? {});
8
- }
9
- //#endregion
10
- export { release_exports as n, release$1 as t };
@@ -1,27 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __exportAll = (all, no_symbols) => {
7
- let target = {};
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
12
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
13
- return target;
14
- };
15
- var __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
17
- key = keys[i];
18
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
19
- get: ((k) => from[k]).bind(null, key),
20
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
- });
22
- }
23
- return to;
24
- };
25
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
26
- //#endregion
27
- export { __reExport as n, __exportAll as t };