Skip to content

Commit 2d66400

Browse files
committed
add: chapter 6 code
1 parent 20c496e commit 2d66400

Some content is hidden

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

42 files changed

+2244
-1494
lines changed

ch06/.eslintrc.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = {
77
'plugin:vue/vue3-essential',
88
'eslint:recommended',
99
'@vue/eslint-config-typescript',
10-
'@vue/eslint-config-prettier'
10+
'@vue/eslint-config-prettier/skip-formatting'
1111
],
1212
parserOptions: {
1313
ecmaVersion: 'latest'

ch06/.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,3 @@ coverage
2626
*.njsproj
2727
*.sln
2828
*.sw?
29-
30-
test-results/
31-
playwright-report/

ch06/.prettierrc.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
{}
1+
{
2+
"$schema": "https://json.schemastore.org/prettierrc",
3+
"semi": false,
4+
"tabWidth": 2,
5+
"singleQuote": true,
6+
"printWidth": 100,
7+
"trailingComma": "none"
8+
}

ch06/.vscode/extensions.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
{
2-
"recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
2+
"recommendations": [
3+
"Vue.volar",
4+
"Vue.vscode-typescript-vue-plugin",
5+
"dbaeumer.vscode-eslint",
6+
"esbenp.prettier-vscode"
7+
]
38
}

ch06/README.md

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,25 +45,6 @@ npm run build
4545
npm run test:unit
4646
```
4747

48-
### Run End-to-End Tests with [Playwright](https://playwright.dev)
49-
50-
```sh
51-
# Install browsers for the first run
52-
npx playwright install
53-
54-
# When testing on CI, must build the project first
55-
npm run build
56-
57-
# Runs the end-to-end tests
58-
npm run test:e2e
59-
# Runs the tests only on Chromium
60-
npm run test:e2e -- --project=chromium
61-
# Runs the tests of a specific file
62-
npm run test:e2e -- tests/example.spec.ts
63-
# Runs the tests in debug mode
64-
npm run test:e2e -- --debug
65-
```
66-
6748
### Lint with [ESLint](https://eslint.org/)
6849

6950
```sh

ch06/e2e/vue.spec.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

ch06/package.json

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,40 @@
11
{
22
"name": "ch06",
33
"version": "0.0.0",
4+
"private": true,
45
"scripts": {
56
"dev": "vite",
67
"build": "run-p type-check build-only",
78
"preview": "vite preview",
8-
"test:unit": "vitest --environment jsdom --root src/",
9-
"test:e2e": "playwright test",
9+
"test:unit": "vitest",
1010
"build-only": "vite build",
1111
"type-check": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false",
12-
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
12+
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
13+
"format": "prettier --write src/"
1314
},
1415
"dependencies": {
15-
"vue": "^3.2.41"
16+
"axios": "^1.5.0",
17+
"vue": "^3.3.4"
1618
},
1719
"devDependencies": {
18-
"@playwright/test": "^1.27.1",
19-
"@rushstack/eslint-patch": "^1.1.4",
20-
"@types/jsdom": "^20.0.0",
21-
"@types/node": "^16.11.68",
22-
"@vitejs/plugin-vue": "^3.1.2",
23-
"@vue/eslint-config-prettier": "^7.0.0",
24-
"@vue/eslint-config-typescript": "^11.0.0",
25-
"@vue/test-utils": "^2.1.0",
26-
"@vue/tsconfig": "^0.1.3",
27-
"eslint": "^8.22.0",
28-
"eslint-plugin-vue": "^9.3.0",
29-
"jsdom": "^20.0.1",
20+
"@rushstack/eslint-patch": "^1.3.2",
21+
"@tsconfig/node18": "^18.2.0",
22+
"@types/jsdom": "^21.1.1",
23+
"@types/node": "^18.17.5",
24+
"@vitejs/plugin-vue": "^4.3.1",
25+
"@vitejs/plugin-vue-jsx": "^3.0.2",
26+
"@vue/eslint-config-prettier": "^8.0.0",
27+
"@vue/eslint-config-typescript": "^11.0.3",
28+
"@vue/test-utils": "^2.4.1",
29+
"@vue/tsconfig": "^0.4.0",
30+
"eslint": "^8.46.0",
31+
"eslint-plugin-vue": "^9.16.1",
32+
"jsdom": "^22.1.0",
3033
"npm-run-all": "^4.1.5",
31-
"prettier": "^2.7.1",
32-
"typescript": "~4.7.4",
33-
"vite": "^3.1.8",
34-
"vitest": "^0.24.3",
35-
"vue-tsc": "^1.0.8"
34+
"prettier": "^3.0.0",
35+
"typescript": "~5.1.6",
36+
"vite": "^4.4.9",
37+
"vitest": "^0.34.2",
38+
"vue-tsc": "^1.8.8"
3639
}
3740
}

ch06/playwright.config.ts

Lines changed: 0 additions & 112 deletions
This file was deleted.

ch06/src/App.vue

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,40 @@
11
<script setup lang="ts">
2-
import LifeCycleHooksVue from "./components/LifeCycleHooks.vue";
3-
import MyMessageComponent from "./components/MyMessageComponent.vue";
4-
import StaticMessage from "./components/StaticMessage.vue";
5-
import UserVue from "./components/User.vue";
6-
import UserComposition from "./components/UserComposition.vue";
2+
import UserProfile from './components/UserProfile.vue';
3+
import UserProfileWithFetchComponent from './components/UserProfileWithFetchComponent.vue';
74
</script>
85

96
<template>
10-
<UserVue username="mayashavin" />
11-
<StaticMessage />
7+
<main>
8+
<UserProfile />
9+
<UserProfileWithFetchComponent />
10+
</main>
1211
</template>
1312

14-
<style scoped></style>
13+
<style scoped>
14+
header {
15+
line-height: 1.5;
16+
}
17+
18+
.logo {
19+
display: block;
20+
margin: 0 auto 2rem;
21+
}
22+
23+
@media (min-width: 1024px) {
24+
header {
25+
display: flex;
26+
place-items: center;
27+
padding-right: calc(var(--section-gap) / 2);
28+
}
29+
30+
.logo {
31+
margin: 0 2rem 0 0;
32+
}
33+
34+
header .wrapper {
35+
display: flex;
36+
place-items: flex-start;
37+
flex-wrap: wrap;
38+
}
39+
}
40+
</style>

ch06/src/assets/base.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
*::after {
5656
box-sizing: border-box;
5757
margin: 0;
58-
position: relative;
5958
font-weight: normal;
6059
}
6160

0 commit comments

Comments
 (0)