Skip to content

Commit f1e79f0

Browse files
authored
Merge pull request #578 from shairez/pr-fluffy-cli
✨ Qwik UI CLI
2 parents cb7c9f8 + 9f862a7 commit f1e79f0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+3145
-417
lines changed

apps/website/src/components/note/note.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const Note = component$<NoteProps>(({ status, ...props }) => {
4444
status ?? NoteStatus.Info,
4545
)} note-link relative mx-[-24px] px-5 py-4 lg:mx-[-32px] lg:px-8 lg:py-6 `}
4646
>
47-
<div class="absolute left-[-17.5px] top-[-17.5px] hidden h-8 w-8 rounded-full bg-white dark:bg-slate-900 lg:block">
47+
<div class="absolute left-[-17.5px] top-[-17.5px] hidden h-8 w-8 rounded-full bg-white lg:block dark:bg-slate-900">
4848
<div class="flex h-8 w-8 items-center justify-center ">
4949
{getIconByStatus(status ?? NoteStatus.Info)}
5050
</div>

apps/website/src/components/preview-code-example/preview-code-example-tabs-deprecated.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const PreviewCodeExampleTabsDeprecated = component$((props: { code?: stri
2727
Code
2828
</Tab>
2929
</TabList>
30-
<TabPanel class="shadow-light-medium dark:shadow-dark-medium border-qwikui-blue-300 dark:border-qwikui-purple-200 rounded-b-xl border-[1.5px] bg-slate-200 bg-slate-800 p-4 dark:bg-slate-900 md:p-12">
30+
<TabPanel class="shadow-light-medium dark:shadow-dark-medium border-qwikui-blue-300 dark:border-qwikui-purple-200 rounded-b-xl border-[1.5px] bg-slate-200 bg-slate-800 p-4 md:p-12 dark:bg-slate-900">
3131
<section class="flex flex-col items-center">
3232
<Slot name="actualComponent" />
3333
</section>

jest.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { getJestProjects } from '@nx/jest';
2+
3+
export default {
4+
projects: getJestProjects(),
5+
};

jest.preset.cjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const nxPreset = require('@nx/jest/preset').default;
2+
3+
module.exports = { ...nxPreset };

nx.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,24 @@
77
"appsDir": "apps",
88
"libsDir": "packages"
99
},
10+
"release": {
11+
"version": {
12+
"generatorOptions": {
13+
"currentVersionResolver": "disk"
14+
}
15+
}
16+
},
1017
"targetDefaults": {
1118
"lint": {
1219
"inputs": ["default", "{workspaceRoot}/.eslintrc.json"],
1320
"cache": true
1421
},
22+
"version-dry": {
23+
"dependsOn": ["^version-dry"]
24+
},
25+
"build-bin": {
26+
"cache": true
27+
},
1528
"build": {
1629
"cache": true,
1730
"dependsOn": ["^build"]

package.json

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,19 @@
3939
"@floating-ui/core": "1.4.1",
4040
"@floating-ui/dom": "^1.5.1",
4141
"@fontsource-variable/inter": "5.0.8",
42-
"@jscutlery/semver": "^3.1.0",
42+
"@img/sharp-linux-x64": "^0.33.0",
43+
"@jscutlery/semver": "^4.2.0",
4344
"@k11r/nx-cloudflare-wrangler": "2.7.1",
4445
"@nx/cypress": "17.1.3",
4546
"@nx/eslint": "17.1.3",
4647
"@nx/eslint-plugin": "17.1.3",
48+
"@nx/jest": "17.1.3",
4749
"@nx/js": "17.1.3",
50+
"@nx/plugin": "17.2.3",
4851
"@nx/storybook": "17.1.3",
4952
"@nx/vite": "17.1.3",
5053
"@nx/workspace": "17.1.3",
54+
"@oddbird/popover-polyfill": "0.3.7",
5155
"@storybook/addon-a11y": "7.6.0",
5256
"@storybook/addon-coverage": "^0.0.9",
5357
"@storybook/addon-essentials": "7.6.0",
@@ -63,6 +67,7 @@
6367
"@testing-library/cypress": "9.0.0",
6468
"@types/eslint": "^8.44.2",
6569
"@types/estree-jsx": "^1.0.3",
70+
"@types/jest": "^29.4.0",
6671
"@types/node": "^20.5.7",
6772
"@typescript-eslint/eslint-plugin": "6.13.1",
6873
"@typescript-eslint/parser": "6.13.1",
@@ -71,6 +76,11 @@
7176
"all-contributors-cli": "^6.26.1",
7277
"autoprefixer": "^10.4.15",
7378
"axe-core": "^4.7.2",
79+
"body-scroll-lock-upgrade": "1.1.0",
80+
"canvas-confetti": "1.9.2",
81+
"class-variance-authority": "0.7.0",
82+
"clsx": "2.0.0",
83+
"tslib": "^2.6.2",
7484
"chromatic": "^6.24.1",
7585
"clipboard-copy": "4.0.1",
7686
"commitizen": "^4.3.0",
@@ -90,6 +100,8 @@
90100
"eslint-plugin-storybook": "^0.6.13",
91101
"focus-trap": "7.5.3",
92102
"husky": "^8.0.3",
103+
"jest": "^29.4.1",
104+
"jest-environment-jsdom": "^29.4.1",
93105
"jsdom": "22.1.0",
94106
"libphonenumber-js": "^1.10.43",
95107
"ngx-deploy-npm": "^7.0.1",
@@ -110,6 +122,7 @@
110122
"storybook-framework-qwik": "^0.2.3",
111123
"tailwind-merge": "^1.14.0",
112124
"tailwindcss": "^3.3.3",
125+
"ts-jest": "^29.1.0",
113126
"ts-node": "10.9.1",
114127
"tsm": "2.3.0",
115128
"typescript": "^5.2.2",
@@ -124,7 +137,11 @@
124137
"vite-plugin-static-copy": "0.17.0",
125138
"vite-tsconfig-paths": "4.2.0",
126139
"vitest": "^0.34.3",
127-
"wrangler": "^3.11.0"
140+
"wrangler": "^3.11.0",
141+
"@clack/prompts": "^0.7.0",
142+
"@nx/devkit": "17.1.3",
143+
"kleur": "^4.1.5",
144+
"yargs": "17.7.2"
128145
},
129146
"config": {
130147
"commitizen": {
@@ -136,17 +153,7 @@
136153
"qwik ui components",
137154
"components library"
138155
],
139-
"dependencies": {
140-
"@fontsource-variable/inter": "5.0.8",
141-
"@img/sharp-linux-x64": "^0.33.0",
142-
"@oddbird/popover-polyfill": "0.3.7",
143-
"body-scroll-lock-upgrade": "1.1.0",
144-
"canvas-confetti": "1.9.2",
145-
"class-variance-authority": "0.7.0",
146-
"clsx": "2.0.0",
147-
"shiki": "0.14.5",
148-
"tslib": "^2.6.2"
149-
},
156+
"dependencies": {},
150157
"nx": {
151158
"includedScripts": []
152159
}

packages/cli-e2e/.eslintrc.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"extends": ["../../.eslintrc.json"],
3+
"ignorePatterns": ["!**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7+
"rules": {}
8+
},
9+
{
10+
"files": ["*.ts", "*.tsx"],
11+
"rules": {}
12+
},
13+
{
14+
"files": ["*.js", "*.jsx"],
15+
"rules": {}
16+
}
17+
]
18+
}

packages/cli-e2e/jest.config.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* eslint-disable */
2+
export default {
3+
displayName: 'qwik-ui-cli-e2e',
4+
preset: '../../jest.preset.cjs',
5+
transform: {
6+
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
7+
},
8+
moduleFileExtensions: ['ts', 'js', 'html'],
9+
coverageDirectory: '../../coverage/packages/cli-e2e',
10+
globalSetup: '../../tools/scripts/start-local-registry.ts',
11+
globalTeardown: '../../tools/scripts/stop-local-registry.ts',
12+
};

packages/cli-e2e/project.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "cli-e2e",
3+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
4+
"projectType": "application",
5+
"sourceRoot": "packages/cli-e2e/src",
6+
"targets": {
7+
"e2e": {
8+
"executor": "@nx/jest:jest",
9+
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
10+
"options": {
11+
"jestConfig": "packages/cli-e2e/jest.config.ts",
12+
"runInBand": true
13+
},
14+
"dependsOn": ["^build"]
15+
},
16+
"lint": {
17+
"executor": "@nx/eslint:lint",
18+
"outputs": ["{options.outputFile}"],
19+
"options": {
20+
"lintFilePatterns": ["packages/cli-e2e/**/*.ts"]
21+
}
22+
}
23+
},
24+
"implicitDependencies": ["cli"]
25+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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 [email protected] init --e2e --projectRoot / --styledKit "fluffy" --uiComponentsPath "src/components/ui" --rootCssPath "src/global.css" --installTailwind --components=button',
27+
{
28+
cwd: projectDirectory,
29+
stdio: 'inherit',
30+
env: process.env,
31+
},
32+
);
33+
const buttonIsInTheRightPlace = existsSync(
34+
join(projectDirectory, 'src/components/ui/button/button.tsx'),
35+
);
36+
expect(buttonIsInTheRightPlace).toBeTruthy();
37+
});
38+
});
39+
40+
/**
41+
* Creates a test project
42+
* @returns The directory where the test project was created
43+
*/
44+
function createTestQwikProject() {
45+
const projectName = 'test-qwik-project';
46+
const tempDir = join('/tmp', 'tmp-qwik-ui-cli-e2e');
47+
48+
// Ensure projectDirectory is empty
49+
rmSync(tempDir, {
50+
recursive: true,
51+
force: true,
52+
});
53+
mkdirSync(tempDir, {
54+
recursive: true,
55+
});
56+
57+
execSync(`pnpm create qwik@latest basic ${projectName}`, {
58+
cwd: tempDir,
59+
stdio: 'inherit',
60+
env: process.env,
61+
});
62+
console.log(`Created test project in "${tempDir}"`);
63+
64+
const projectDirectory = join(tempDir, projectName);
65+
66+
return {
67+
projectDirectory,
68+
tempDir,
69+
};
70+
}

packages/cli-e2e/tsconfig.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "../../tsconfig.base.json",
3+
"files": [],
4+
"include": [],
5+
"references": [
6+
{
7+
"path": "./tsconfig.spec.json"
8+
}
9+
]
10+
}

packages/cli-e2e/tsconfig.spec.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "../../dist/out-tsc",
5+
"module": "commonjs",
6+
"types": ["jest", "node"]
7+
},
8+
"include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"]
9+
}

packages/cli/.eslintrc.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"extends": ["../../.eslintrc.json"],
3+
"ignorePatterns": ["!**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7+
"rules": {}
8+
},
9+
{
10+
"files": ["*.ts", "*.tsx"],
11+
"rules": {}
12+
},
13+
{
14+
"files": ["*.js", "*.jsx"],
15+
"rules": {}
16+
},
17+
{
18+
"files": ["*.json"],
19+
"parser": "jsonc-eslint-parser",
20+
"rules": {
21+
"@nx/dependency-checks": "error"
22+
}
23+
},
24+
{
25+
"files": ["./package.json", "./generators.json"],
26+
"parser": "jsonc-eslint-parser",
27+
"rules": {
28+
"@nx/nx-plugin-checks": "error"
29+
}
30+
}
31+
]
32+
}

0 commit comments

Comments
 (0)