Skip to content

Commit f560ffb

Browse files
committed
fix: correct package.json path depth and move Node version check above clack imports
1 parent c1e0113 commit f560ffb

2 files changed

Lines changed: 11 additions & 12 deletions

File tree

bin.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ import { red } from './src/utils/logging';
2828
import { config as loadDotenv } from 'dotenv';
2929
loadDotenv();
3030

31+
// Have to run this above the other imports because they are importing clack that
32+
// has the problematic imports.
33+
const NODE_VERSION_RANGE = '>=18.17.0';
34+
if (!satisfies(process.version, NODE_VERSION_RANGE)) {
35+
red(
36+
`Amplitude wizard requires Node.js ${NODE_VERSION_RANGE}. You are using Node.js ${process.version}. Please upgrade your Node.js version.`,
37+
);
38+
process.exit(1);
39+
}
40+
3141
import yargs from 'yargs';
3242
import { hideBin } from 'yargs/helpers';
3343
import chalk from 'chalk';
@@ -88,17 +98,6 @@ import {
8898
manifestCommand,
8999
} from './src/commands';
90100

91-
const NODE_VERSION_RANGE = '>=18.17.0';
92-
93-
// Have to run this above the other imports because they are importing clack that
94-
// has the problematic imports.
95-
if (!satisfies(process.version, NODE_VERSION_RANGE)) {
96-
red(
97-
`Amplitude wizard requires Node.js ${NODE_VERSION_RANGE}. You are using Node.js ${process.version}. Please upgrade your Node.js version.`,
98-
);
99-
process.exit(1);
100-
}
101-
102101
// ── Observability bootstrap ─────────────────────────────────────────
103102
// Initialize structured logging early so all code paths can use it.
104103
// The terminal sink routes log output through the UI singleton (getUI()),

src/commands/context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const WIZARD_VERSION: string = (() => {
2424
.parse(
2525
JSON.parse(
2626
readFileSync(
27-
resolve(dirname(__filename), '..', '..', 'package.json'),
27+
resolve(dirname(__filename), '..', '..', '..', 'package.json'),
2828
'utf-8',
2929
),
3030
),

0 commit comments

Comments
 (0)