Skip to content

Commit d015aeb

Browse files
committed
fixed cli not checking relative global.css correctly
1 parent 4424bfd commit d015aeb

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

.changeset/soft-snakes-sniff.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"qwik-ui": patch
3+
---
4+
5+
FIX: cli not checking relative global.css correctly

packages/cli/bin/index.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {
3737
QWIK_UI_CONFIG_FILENAME,
3838
} from '../src/_shared/config-filenames';
3939

40+
import path from 'path';
4041
import externalDeps from '../src/_shared/external-deps.json';
4142

4243
const COMMANDS = ['init', 'add'];
@@ -162,9 +163,10 @@ async function handleInit() {
162163
if (!config.rootCssPath) {
163164
config.rootCssPath = await collectFileLocationFromUser({
164165
message: cyan(
165-
'Your global css file location (where you defined your tailwind directives)',
166+
'The path to the global css file the tailwind directives are defined (relative to root)',
166167
),
167168
errorMessageName: 'Global css file',
169+
rootDir: config.projectRoot,
168170
initialValue: 'src/global.css',
169171
});
170172
}
@@ -507,6 +509,7 @@ function parseCommands(command: CommandModule) {
507509
interface FilePromptInfo {
508510
message: string;
509511
errorMessageName: string;
512+
rootDir: string;
510513
initialValue?: string;
511514
}
512515

@@ -517,9 +520,9 @@ async function collectFileLocationFromUser(config: FilePromptInfo) {
517520
initialValue: config.initialValue,
518521
}),
519522
);
520-
521-
if (!existsSync(filePath)) {
522-
log.error(`${config.errorMessageName} not found at ${filePath}, want to try again?`);
523+
const fullPath = path.join(config.rootDir, filePath);
524+
if (!existsSync(fullPath)) {
525+
log.error(`${config.errorMessageName} not found at ${fullPath}, want to try again?`);
523526
return collectFileLocationFromUser({ ...config, initialValue: filePath });
524527
}
525528
return filePath;

0 commit comments

Comments
 (0)