@lunanoir/dep-lens 0.1.1 → 0.1.2

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/args.js CHANGED
@@ -16,6 +16,8 @@ OPTIONS:
16
16
  --tr Turkish UI (Turkce arayuz)
17
17
  --test Run a self-check: verify the scanner binary and
18
18
  report which ecosystems it detects in --path
19
+ --setup Re-run the interactive setup wizard (language,
20
+ PATH check) even outside of npm install
19
21
  --help Show this help
20
22
  --version Show version
21
23
 
@@ -49,6 +51,7 @@ export function parseArgs(argv) {
49
51
  help: false,
50
52
  version: false,
51
53
  test: false,
54
+ setup: false,
52
55
  };
53
56
  for (let i = 0; i < argv.length; i += 1) {
54
57
  const arg = argv[i];
@@ -98,6 +101,9 @@ export function parseArgs(argv) {
98
101
  case '--test':
99
102
  options.test = true;
100
103
  break;
104
+ case '--setup':
105
+ options.setup = true;
106
+ break;
101
107
  case '--help':
102
108
  case '-h':
103
109
  options.help = true;
package/dist/cli.js CHANGED
@@ -6,6 +6,7 @@ import { render } from 'ink';
6
6
  import { parseArgs, USAGE } from './args.js';
7
7
  import { renderCsv, renderHtml, renderMarkdown, runScan } from './bridge.js';
8
8
  import { readConfig } from './config.js';
9
+ import { main as runSetupWizard } from './postinstall.js';
9
10
  import { runSelfTest } from './selftest.js';
10
11
  import { violations } from './utils.js';
11
12
  import { Root } from './ui/Root.js';
@@ -52,6 +53,10 @@ async function main() {
52
53
  options.locale = config.locale;
53
54
  }
54
55
  }
56
+ if (options.setup) {
57
+ await runSetupWizard(true);
58
+ return;
59
+ }
55
60
  const scanOptions = { path: options.path, ignore: options.ignore, locale: options.locale };
56
61
  if (options.test) {
57
62
  process.exitCode = await runSelfTest(scanOptions);
@@ -69,7 +69,11 @@ function pathContains(dir) {
69
69
  const sep = process.platform === 'win32' ? ';' : ':';
70
70
  return pathEnv.split(sep).some((entry) => entry.replace(/[/\\]+$/, '') === dir.replace(/[/\\]+$/, ''));
71
71
  }
72
- async function main() {
72
+ /**
73
+ * Run the setup wizard. `force` skips the TTY/CI checks (used by
74
+ * `dep-lens --setup`, where the user explicitly asked for it).
75
+ */
76
+ export async function main(force = false) {
73
77
  // Always print a one-line banner so even non-interactive installs show
74
78
  // something useful, but never prompt unless we have a real TTY.
75
79
  const cwd = process.env['INIT_CWD'] ?? process.cwd();
@@ -79,7 +83,7 @@ async function main() {
79
83
  const labels = detected.map((eco) => eco.label).join(', ');
80
84
  process.stdout.write(`${dim('detected in this project:')} ${good(labels)}\n`);
81
85
  }
82
- if (!isInteractive()) {
86
+ if (!force && !isInteractive()) {
83
87
  process.stdout.write(`${dim('run')} dep-lens ${dim('to scan, or')} dep-lens --help\n\n`);
84
88
  return;
85
89
  }
@@ -133,6 +137,10 @@ async function appendToShellProfile(binDir) {
133
137
  process.stdout.write(`${dim('could not update shell profile, add manually:')} ${line}\n`);
134
138
  }
135
139
  }
136
- main().catch(() => {
137
- // Never fail the install over the setup wizard.
138
- });
140
+ // Only auto-run when invoked directly as the postinstall script, not when
141
+ // imported by `dep-lens --setup`.
142
+ if (process.argv[1]?.endsWith('postinstall.js')) {
143
+ main().catch(() => {
144
+ // Never fail the install over the setup wizard.
145
+ });
146
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunanoir/dep-lens",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Dependency license scanner across npm, Cargo, Go, Python, Ruby, PHP, Java, Dart, and C/C++ with commercial risk reporting",
5
5
  "type": "module",
6
6
  "license": "MIT",