rattail 2.1.0 → 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 };
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-D_MS0eEx.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-BAhe-2Qc.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-BsFKhwBl.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-DyjJBx_r.mjs").then((n) => n.t);
28
- const { release } = await import("../release-DcENhCIa.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-DyjJBx_r.mjs").then((n) => n.t);
41
- const { publish } = await import("../publish-tTIXb5nn.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-giizMwKa.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-CGrVknHB.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-DR-KZIyO.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,9 +1,2 @@
1
- import { t as clean } from "../clean-D_MS0eEx.mjs";
2
- import { t as api } from "../api-BAhe-2Qc.mjs";
3
- import { i as writeHooks, n as hook, t as getHooksDir } from "../hook-BsFKhwBl.mjs";
4
- import { t as release } from "../release-DcENhCIa.mjs";
5
- import { t as publish } from "../publish-tTIXb5nn.mjs";
6
- import { t as changelog } from "../changelog-giizMwKa.mjs";
7
- import { t as commitLint } from "../commitLint-CGrVknHB.mjs";
8
- import { t as lockfileCheck } from "../lockfileCheck-DR-KZIyO.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 };
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
- //#endregion
5
4
  //#region src/array/at.d.ts
6
5
  declare function at<T>(arr: T[], index: number): T | undefined;
7
6
  //#endregion
@@ -569,4 +568,4 @@ declare function floor(val: number, precision?: number): number;
569
568
  //#region src/math/ceil.d.ts
570
569
  declare function ceil(val: number, precision?: number): number;
571
570
  //#endregion
572
- 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, __exportAll as t, throttle, times, toArrayBuffer, toDataURL, toNumber, toRawType, toText, toTypeString, toggleItem, tryAsyncCall, tryCall, tryParseJSON, uniq, uniqBy, upperFirst, uuid, uuidV6, xor, xorWith };
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-Ci3uKJYg.mjs";
2
- import { n as isFunction, t as callOrReturn } from "./callOrReturn-CZqsjrou.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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rattail",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "A Vite+ oriented, AI Agent friendly front-end toolchain",
5
5
  "keywords": [
6
6
  "ai-agent",
@@ -1,10 +0,0 @@
1
- import { n as getConfig } from "./config-DyjJBx_r.mjs";
2
- import { t as __exportAll } from "./index.d.mts";
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 { n as getConfig } from "./config-DyjJBx_r.mjs";
2
- import { t as __exportAll } from "./index.d.mts";
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 { n as isArray, t as isString } from "./isString-Ci3uKJYg.mjs";
2
- import { n as getConfig } from "./config-DyjJBx_r.mjs";
3
- import { t as __exportAll } from "./index.d.mts";
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 "./index.d.mts";
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 callOrReturn } from "./callOrReturn-CZqsjrou.mjs";
2
- import { t as __exportAll } from "./index.d.mts";
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 { n as getConfig } from "./config-DyjJBx_r.mjs";
2
- import { t as __exportAll } from "./index.d.mts";
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 "./index.d.mts";
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 { n as getConfig } from "./config-DyjJBx_r.mjs";
2
- import { t as __exportAll } from "./index.d.mts";
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 { n as getConfig } from "./config-DyjJBx_r.mjs";
2
- import { t as __exportAll } from "./index.d.mts";
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 };