@zenithbuild/core 0.3.0 → 0.3.3

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/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@zenithbuild/core",
3
- "version": "0.3.0",
3
+ "version": "0.3.3",
4
4
  "description": "Core library for the Zenith framework",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "main": "./index.ts",
8
8
  "bin": {
9
- "zenith": "./dist/cli.js",
10
- "zenith-dev": "./dist/cli.js",
11
- "zen-dev": "./dist/cli.js",
12
- "zen-build": "./dist/cli.js",
13
- "zen-preview": "./dist/cli.js"
9
+ "zenith": "./dist/zenith.js",
10
+ "zenith-dev": "./dist/zen-dev.js",
11
+ "zen-dev": "./dist/zen-dev.js",
12
+ "zen-build": "./dist/zen-build.js",
13
+ "zen-preview": "./dist/zen-preview.js"
14
14
  },
15
15
  "files": [
16
16
  "bin",
@@ -44,7 +44,7 @@
44
44
  "dev": "bun dev",
45
45
  "build": "bun build",
46
46
  "start": "bun run build && bun run dev",
47
- "build:cli": "bun build bin/cli-source.ts --outfile dist/cli.js --target bun --bundle && echo '#!/usr/bin/env bun' | cat - dist/cli.js > dist/cli.tmp && mv dist/cli.tmp dist/cli.js && chmod +x dist/cli.js",
47
+ "build:cli": "bun build bin/zenith.ts bin/zen-dev.ts bin/zen-build.ts bin/zen-preview.ts --outdir dist --target bun --bundle && for f in dist/*.js; do echo '#!/usr/bin/env bun' | cat - \"$f\" > \"$f.tmp\" && mv \"$f.tmp\" \"$f\" && chmod +x \"$f\"; done",
48
48
  "format": "prettier --write \"**/*.ts\"",
49
49
  "format:check": "prettier --check \"**/*.ts\""
50
50
  },
package/bin/cli-source.ts DELETED
@@ -1,81 +0,0 @@
1
- /**
2
- * @zenith/cli - Entry Point
3
- *
4
- * Main executable for the Zenith CLI.
5
- * Handles both "zenith <command>" and direct alias calls (zenith-dev, etc.)
6
- */
7
-
8
- import process from 'node:process'
9
- import path from 'node:path'
10
- import { getCommand, showHelp, placeholderCommands } from '../cli/commands/index'
11
- import * as logger from '../cli/utils/logger'
12
-
13
- async function main() {
14
- const args = process.argv.slice(2)
15
- const invokedAs = path.basename(process.argv[1] || '')
16
-
17
- let commandName: string | undefined = args[0]
18
- let commandArgs = args.slice(1)
19
-
20
- // Handle aliases (e.g. zenith-dev, zen-dev)
21
- if (invokedAs.includes('dev')) {
22
- commandName = 'dev'
23
- commandArgs = args
24
- } else if (invokedAs.includes('build')) {
25
- commandName = 'build'
26
- commandArgs = args
27
- } else if (invokedAs.includes('preview')) {
28
- commandName = 'preview'
29
- commandArgs = args
30
- }
31
-
32
- if (!commandName || commandName === '--help' || commandName === '-h') {
33
- showHelp()
34
- process.exit(0)
35
- }
36
-
37
- // Filter out options from commandArgs for simple command parsing if needed
38
- // However, most commands parse their own options
39
- const filteredArgs = commandArgs.filter((a: string) => !a.startsWith('--'))
40
-
41
- // Parse options (--key value format)
42
- const options: Record<string, string> = {}
43
- for (let i = 0; i < commandArgs.length; i++) {
44
- const arg = commandArgs[i]!
45
- if (arg.startsWith('--')) {
46
- const key = arg.slice(2)
47
- const value = commandArgs[i + 1]
48
- if (value && !value.startsWith('--')) {
49
- options[key] = value
50
- i++
51
- } else {
52
- options[key] = 'true'
53
- }
54
- }
55
- }
56
-
57
- // Check for placeholder commands
58
- if (placeholderCommands.includes(commandName)) {
59
- logger.warn(`Command "${commandName}" is not yet implemented.`)
60
- logger.info('This feature is planned for a future release.')
61
- process.exit(0)
62
- }
63
-
64
- const command = getCommand(commandName)
65
-
66
- if (!command) {
67
- logger.error(`Unknown command: ${commandName}`)
68
- showHelp()
69
- process.exit(1)
70
- }
71
-
72
- try {
73
- await command!.run(commandArgs, options)
74
- } catch (err: unknown) {
75
- const message = err instanceof Error ? err.message : String(err)
76
- logger.error(message)
77
- process.exit(1)
78
- }
79
- }
80
-
81
- main()