@vlandoss/clibuddy 0.2.0 → 0.2.1-git-b33212e.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/dist/index.d.mts CHANGED
@@ -15,6 +15,10 @@ declare const palette: {
15
15
  vland: ChalkInstance | (<T>(x: T) => T);
16
16
  };
17
17
  //#endregion
18
+ //#region src/meta.d.ts
19
+ declare function dirnameOf(meta: ImportMeta): string;
20
+ declare function filenameOf(meta: ImportMeta): string;
21
+ //#endregion
18
22
  //#region src/run.d.ts
19
23
  declare function run(fn: () => Promise<void>, logger: {
20
24
  error: (...args: unknown[]) => void;
@@ -70,4 +74,4 @@ declare function getPreferLocal(localBaseBinPath: string | Array<string> | undef
70
74
  //#region src/version.d.ts
71
75
  declare function getVersion(pkg: PkgService): string;
72
76
  //#endregion
73
- export { CreateOptions, PkgService, type Project, Shell, ShellOptions, ShellService, colorIsSupported, colorize, createPkgService, createShellService, cwd, getPreferLocal, getVersion, isProcessOutput, isRaw, palette, quote, run };
77
+ export { CreateOptions, PkgService, type Project, Shell, ShellOptions, ShellService, colorIsSupported, colorize, createPkgService, createShellService, cwd, dirnameOf, filenameOf, getPreferLocal, getVersion, isProcessOutput, isRaw, palette, quote, run };
package/dist/index.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import chalk from "chalk";
2
2
  import supportsColor from "supports-color";
3
- import path from "node:path";
3
+ import path, { dirname } from "node:path";
4
+ import { fileURLToPath } from "node:url";
4
5
  import { $, ProcessOutput } from "zx";
5
6
  import fs from "node:fs";
6
7
  import { findWorkspacePackages } from "@pnpm/workspace.find-packages";
@@ -19,6 +20,14 @@ const palette = {
19
20
  vland: colorize("#36d399")
20
21
  };
21
22
  //#endregion
23
+ //#region src/meta.ts
24
+ function dirnameOf(meta) {
25
+ return meta.dirname ?? dirname(fileURLToPath(meta.url));
26
+ }
27
+ function filenameOf(meta) {
28
+ return meta.filename ?? fileURLToPath(meta.url);
29
+ }
30
+ //#endregion
22
31
  //#region src/services/shell/utils.ts
23
32
  function isProcessOutput(value) {
24
33
  return value instanceof ProcessOutput;
@@ -175,4 +184,4 @@ function getVersion(pkg) {
175
184
  return process.env.VERSION || pkg.packageJson.version;
176
185
  }
177
186
  //#endregion
178
- export { PkgService, ShellService, colorIsSupported, colorize, createPkgService, createShellService, cwd, getPreferLocal, getVersion, isProcessOutput, isRaw, palette, quote, run };
187
+ export { PkgService, ShellService, colorIsSupported, colorize, createPkgService, createShellService, cwd, dirnameOf, filenameOf, getPreferLocal, getVersion, isProcessOutput, isRaw, palette, quote, run };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vlandoss/clibuddy",
3
- "version": "0.2.0",
3
+ "version": "0.2.1-git-b33212e.0",
4
4
  "description": "A helper library to create CLIs in Variable Land",
5
5
  "homepage": "https://github.com/variableland/dx/tree/main/packages/clibuddy#readme",
6
6
  "bugs": {
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./colors.ts";
2
+ export * from "./meta.ts";
2
3
  export * from "./run.ts";
3
4
  export * from "./services/index.ts";
4
5
  export * from "./version.ts";
package/src/meta.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { dirname } from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+
4
+ export function dirnameOf(meta: ImportMeta): string {
5
+ return meta.dirname ?? dirname(fileURLToPath(meta.url));
6
+ }
7
+
8
+ export function filenameOf(meta: ImportMeta): string {
9
+ return meta.filename ?? fileURLToPath(meta.url);
10
+ }