Skip to content

Commit f180713

Browse files
authored
fixed cli (#1105)
1 parent d8827b1 commit f180713

File tree

5 files changed

+82
-79
lines changed

5 files changed

+82
-79
lines changed

.changeset/stale-dingos-crash.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 now works but defaults to tailwind 3 installation. Support for Tailwind 4 is coming

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111

1212
strategy:
1313
matrix:
14-
node_version: [18, 20, 21, 22]
14+
node_version: [18, 20, 22]
1515

1616
steps:
1717
- uses: actions/checkout@v3

packages/cli-e2e/src/cli.smoke.spec.skip.ts

Lines changed: 0 additions & 77 deletions
This file was deleted.
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import { execSync } from 'child_process';
2+
import { existsSync, mkdirSync, rmSync } from 'fs';
3+
import { join } from 'path';
4+
5+
describe('Qwik UI CLI Smoke test', () => {
6+
let projectDirectory: string;
7+
let tempDirectory: string;
8+
9+
beforeAll(() => {
10+
const { projectDirectory: projDir, tempDir } = createTestQwikProject();
11+
12+
projectDirectory = projDir;
13+
tempDirectory = tempDir;
14+
});
15+
16+
afterAll(() => {
17+
// Cleanup the test project
18+
rmSync(tempDirectory, {
19+
recursive: true,
20+
force: true,
21+
});
22+
});
23+
24+
it('should be installed and add the button file', () => {
25+
execSync(
26+
'npx -y qwik-ui@e2e init --e2e --projectRoot ./ --uiComponentsPath "src/components/ui" --rootCssPath "src/global.css" --installTailwind --style "simple" --components=button',
27+
{
28+
cwd: projectDirectory,
29+
env: process.env,
30+
stdio: 'inherit',
31+
},
32+
);
33+
execSync('npx -y qwik-ui@e2e add button', {
34+
cwd: projectDirectory,
35+
env: process.env,
36+
stdio: 'inherit',
37+
});
38+
const buttonIsInTheRightPlace = existsSync(
39+
join(projectDirectory, 'src/components/ui/button/button.tsx'),
40+
);
41+
expect(buttonIsInTheRightPlace).toBeTruthy();
42+
});
43+
});
44+
45+
/**
46+
* Creates a test project
47+
* @returns The directory where the test project was created
48+
*/
49+
function createTestQwikProject() {
50+
const projectName = 'test-qwik-project';
51+
const tempDir = join('/tmp', 'tmp-qwik-ui-cli-e2e');
52+
53+
// Ensure projectDirectory is empty
54+
rmSync(tempDir, {
55+
recursive: true,
56+
force: true,
57+
});
58+
mkdirSync(tempDir, {
59+
recursive: true,
60+
});
61+
62+
execSync(`pnpm create qwik@latest empty ${projectName}`, {
63+
cwd: tempDir,
64+
stdio: 'inherit',
65+
env: process.env,
66+
});
67+
console.log(`Created test project in "${tempDir}"`);
68+
69+
const projectDirectory = join(tempDir, projectName);
70+
71+
return {
72+
projectDirectory,
73+
tempDir,
74+
};
75+
}

packages/cli/bin/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ async function handleInit() {
185185

186186
if (installTailwind) {
187187
execSync(
188-
`${getPackageManagerCommand().exec} qwik add tailwind --skipConfirmation=true --projectDir=${config.projectRoot}`,
188+
`${getPackageManagerCommand().exec} qwik add tailwind-v3 --skipConfirmation=true --projectDir=${config.projectRoot}`,
189189
{
190190
stdio: 'inherit',
191191
cwd: config.projectRoot,

0 commit comments

Comments
 (0)