@vyriy/dist 0.5.3 → 0.5.5

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 CHANGED
@@ -14,6 +14,8 @@ Prepare compiled workspace packages for distribution:
14
14
 
15
15
  ```bash
16
16
  vyriy-dist
17
+ vyriy-dist --help
18
+ vyriy-dist --version
17
19
  ```
18
20
 
19
21
  ## API
@@ -24,12 +26,14 @@ Install as a project dependency:
24
26
  npm install @vyriy/dist
25
27
  ```
26
28
 
27
- Run distribution preparation from code:
29
+ Run distribution preparation and CLI helper from code:
28
30
 
29
31
  ```ts
30
- import { dist } from '@vyriy/dist';
32
+ import { dist, runDistCli } from '@vyriy/dist';
31
33
 
32
34
  const code = await dist();
35
+
36
+ await runDistCli(['--help']);
33
37
  ```
34
38
 
35
39
  `dist()` copies root package metadata, prepares each `dist/<package>/package.json`, creates export maps, removes empty generated JavaScript files, and returns a process-style exit code.
package/bin/index.js ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import { runDistCli } from '../index.js';
3
+ await runDistCli(process.argv.slice(2));
package/cli.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import type { DistHelpText, ParseDistBinArgs, RunDistCli } from './types.js';
2
+ export declare const distVersion: string;
3
+ export declare const createDistHelpText: DistHelpText;
4
+ export declare const parseDistBinArgs: ParseDistBinArgs;
5
+ export declare const runDistCli: RunDistCli;
package/cli.js ADDED
@@ -0,0 +1,42 @@
1
+ import packageJson from './package.json' with { type: 'json' };
2
+ import { dist } from './dist.js';
3
+ export const distVersion = packageJson.version;
4
+ export const createDistHelpText = (command = 'vyriy-dist', alias = 'vd') => {
5
+ const aliasText = alias ? ` ${alias} Alias for ${command}\n` : '';
6
+ const aliasExampleText = alias ? `\n ${alias}` : '';
7
+ return `Vyriy Dist Builder
8
+
9
+ Usage:
10
+ ${command} Prepare dist package metadata
11
+ ${aliasText}\
12
+ ${command} --help, -h Show help
13
+ ${command} --version, -v Show version
14
+
15
+ Examples:
16
+ ${command}${aliasExampleText}`;
17
+ };
18
+ export const parseDistBinArgs = (args) => {
19
+ if (args.includes('--help') || args.includes('-h')) {
20
+ return { type: 'help' };
21
+ }
22
+ if (args.includes('--version') || args.includes('-v')) {
23
+ return { type: 'version' };
24
+ }
25
+ return { type: 'dist' };
26
+ };
27
+ export const runDistCli = async (args = [], command = 'vyriy-dist', alias = 'vd') => {
28
+ const parsed = parseDistBinArgs(args);
29
+ switch (parsed.type) {
30
+ case 'help':
31
+ console.log(createDistHelpText(command, alias));
32
+ process.exitCode = 0;
33
+ break;
34
+ case 'version':
35
+ console.log(distVersion);
36
+ process.exitCode = 0;
37
+ break;
38
+ case 'dist':
39
+ process.exitCode = await dist();
40
+ break;
41
+ }
42
+ };
package/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
+ export * from './cli.js';
1
2
  export * from './dist.js';
2
3
  export type * from './types.js';
package/index.js CHANGED
@@ -1 +1,2 @@
1
+ export * from './cli.js';
1
2
  export * from './dist.js';
package/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "@vyriy/dist",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "description": "Vyriy distribution build CLI.",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "node": ">=24.0.0"
8
8
  },
9
- "bin": "./bin/vyriy-dist.js",
9
+ "bin": {
10
+ "vd": "./bin/index.js",
11
+ "vyriy-dist": "./bin/index.js"
12
+ },
10
13
  "agents": "./AGENTS.md",
11
14
  "license": "MIT",
12
15
  "repository": {
@@ -52,6 +55,16 @@
52
55
  "import": "./cleanup.js",
53
56
  "default": "./cleanup.js"
54
57
  },
58
+ "./cli": {
59
+ "types": "./cli.d.ts",
60
+ "import": "./cli.js",
61
+ "default": "./cli.js"
62
+ },
63
+ "./cli.js": {
64
+ "types": "./cli.d.ts",
65
+ "import": "./cli.js",
66
+ "default": "./cli.js"
67
+ },
55
68
  "./constants": {
56
69
  "types": "./constants.d.ts",
57
70
  "import": "./constants.js",
package/types.d.ts CHANGED
@@ -1,4 +1,10 @@
1
1
  export type Command = () => Promise<number>;
2
+ export type DistBinCommand = {
3
+ readonly type: 'dist' | 'help' | 'version';
4
+ };
5
+ export type ParseDistBinArgs = (args: readonly string[]) => DistBinCommand;
6
+ export type DistHelpText = (command?: string, alias?: false | string) => string;
7
+ export type RunDistCli = (args?: readonly string[], command?: string, alias?: false | string) => Promise<void>;
2
8
  export type ExportTarget = {
3
9
  readonly default: string;
4
10
  readonly import: string;
package/bin/vyriy-dist.js DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import { dist } from '../index.js';
3
- process.exitCode = await dist();