Skip to content

Commit

Permalink
fixed cli not checking relative global.css correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
shairez committed Nov 4, 2024
1 parent 4424bfd commit 5e9ac1f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/soft-snakes-sniff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"qwik-ui": patch
---

FIX: cli not checking relative global.css correctly
11 changes: 7 additions & 4 deletions packages/cli/bin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {
QWIK_UI_CONFIG_FILENAME,
} from '../src/_shared/config-filenames';

import path from 'path';
import externalDeps from '../src/_shared/external-deps.json';

const COMMANDS = ['init', 'add'];
Expand Down Expand Up @@ -162,9 +163,10 @@ async function handleInit() {
if (!config.rootCssPath) {
config.rootCssPath = await collectFileLocationFromUser({
message: cyan(
'Your global css file location (where you defined your tailwind directives)',
'The path to the global css file the tailwind directives are defined (relative to the root you specified above)',
),
errorMessageName: 'Global css file',
rootDir: config.projectRoot,
initialValue: 'src/global.css',
});
}
Expand Down Expand Up @@ -507,6 +509,7 @@ function parseCommands(command: CommandModule) {
interface FilePromptInfo {
message: string;
errorMessageName: string;
rootDir: string;
initialValue?: string;
}

Expand All @@ -517,9 +520,9 @@ async function collectFileLocationFromUser(config: FilePromptInfo) {
initialValue: config.initialValue,
}),
);

if (!existsSync(filePath)) {
log.error(`${config.errorMessageName} not found at ${filePath}, want to try again?`);
const fullPath = path.join(config.rootDir, filePath);
if (!existsSync(fullPath)) {
log.error(`${config.errorMessageName} not found at ${fullPath}, want to try again?`);
return collectFileLocationFromUser({ ...config, initialValue: filePath });
}
return filePath;
Expand Down

0 comments on commit 5e9ac1f

Please sign in to comment.