Skip to content

Commit 48bf8dc

Browse files
committed
Refactors CLI to be a pure executable
Streamlines the CLI package by removing its role as a re-exporter for core functionalities. Ensures explicit imports of core modules from `@envguard/core`, making the CLI package a dedicated executable rather than an importable library. Integrates `@napi-rs/keyring` directly into the CLI for robust system keychain interactions. Updates build validation to reflect the CLI's primary executable entry point.
1 parent 2890d46 commit 48bf8dc

File tree

5 files changed

+7
-17
lines changed

5 files changed

+7
-17
lines changed

packages/cli/__tests__/core/system-keychain.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
2-
import { SystemKeychain } from '../../src';
2+
import { SystemKeychain } from '@envguard/core';
33

44
// Check if we're in a CI environment without keychain support
55
const isCI = process.env.CI === 'true';

packages/cli/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
"url": "https://github.com/amannirala13"
3131
},
3232
"type": "module",
33-
"main": "./dist/index.js",
34-
"types": "./dist/index.d.ts",
3533
"bin": {
3634
"envg": "./dist/cli.js"
3735
},
@@ -60,12 +58,13 @@
6058
"clean": "rm -rf dist coverage .turbo",
6159
"clean:dist": "rm -rf dist",
6260
"clean:deps": "rm -rf node_modules",
63-
"validate:build": "node -e \"require('./dist/index.js')\" || echo 'Build validation complete'",
61+
"validate:build": "node ./dist/cli.js --version",
6462
"prepublishOnly": "pnpm run typecheck && pnpm run build",
6563
"pack:check": "npm pack --dry-run"
6664
},
6765
"dependencies": {
6866
"@envguard/core": "workspace:*",
67+
"@napi-rs/keyring": "1.1.0",
6968
"chalk": "^5.3.0",
7069
"commander": "^11.1.0",
7170
"conf": "^12.0.0",

packages/cli/src/index.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/cli/tsup.config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { defineConfig } from 'tsup';
33
export default defineConfig({
44
entry: {
55
cli: 'src/cli.ts',
6-
index: 'src/index.ts',
76
},
87
format: ['esm'], // ES modules for modern Node.js
98
outExtension: () => ({ js: '.js' }),
@@ -18,7 +17,7 @@ export default defineConfig({
1817
bundle: true, // Bundle all dependencies for CLI
1918
platform: 'node',
2019
external: [
21-
// Don't bundle native dependencies
20+
// Don't bundle native dependencies - they must be resolved at runtime
2221
'@napi-rs/keyring',
2322
],
2423
noExternal: [

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)