generated from cds-snc/project-template
-
Notifications
You must be signed in to change notification settings - Fork 5
feat: vue starter app #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 25 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
83ad34e
chore: add wip pieces
daine be8a970
chore: add routing and i18n
daine 1bef13b
chore: add routing, breadcrumbs, 404
daine 2ee1097
add tests and updated bug report form
daine 33caf44
chore: add tests
daine f0a92fe
chore: add intro text
daine fb25b5e
chore: remove typescript - not in definition of done
daine d90c75e
chore: remove logo
daine 6ec699c
chore: cleanup
daine 246a29c
chore: internal components + updated tests
daine 5f1768b
chore: change p to text
daine 4020326
chore: change favicon
daine 0491079
fix: deps
daine 583871b
Merge branch 'main' into feat/vue-starter-app
daine 408362e
chore: update playwright
daine 8d26d10
fix: deps package lock
daine 01f5c7f
chore: update deps
daine 42bf02c
docs: update readme
daine f43a4e7
chore: PR feedback changes
daine 2cf1b52
Merge branch 'main' into feat/vue-starter-app
daine 80fa067
chore: deps update, put back alignment=right on top nav
daine 7b1c982
chore: PR feedback
daine a9caa56
chore: add text instead of lorem ipsum
daine 352da6f
chore: npm audit fix
daine a82c788
Merge branch 'main' into feat/vue-starter-app
daine d536ce1
chore: missed one file
daine cbf9704
chore: update package versions
daine cb44b68
chore: PR review changes
daine 8ab2c3f
Merge branch 'main' into feat/vue-starter-app
daine 190657e
chore: update comment
daine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,54 @@ | ||
| # TODO | ||
| # Vue3 Starter App with GCDS Components Vue Package | ||
| This is a starter app that you can use to bootstrap your project using Vue3 and GCDS Components | ||
|
|
||
| ## Project Structure | ||
| A brief overview of the project structure: | ||
|
|
||
| ```graphql | ||
| vue-template/ # Project root (Javascript) | ||
| ├── e2e/ # End-to-end tests | ||
| ├── public/ # Static assets | ||
| ├── src/ # Source files | ||
| │ ├── assets/ # Project assets | ||
| │ ├── components/ # Vue components | ||
| │ │ ├── __tests__/ # Unit tests | ||
| │ │ ├── forms/ # Form components | ||
| │ │ ├── AppLink.vue # GCDS implementation of a router link component | ||
| │ │ ├── Container.vue # Example of usage of the GCDS container component | ||
| │ │ ├── DateModified.vue # Example of usage of the GCDS date modified component | ||
| │ │ ├── Header.vue # Example of usage of the GCDS header component | ||
| │ │ ├── Footer.vue # Example of usage of the GCDS footer component | ||
| │ │ ├── HeaderBreadcrumbs.vue # Example of usage of the GCDS breadcrumbs component | ||
| │ │ ├── Heading.vue # Example of usage of the GCDS heading component | ||
| │ │ ├── NavLink.vue # Example of usage of the GCDS nav link component | ||
| │ │ └── Text.vue # Example of usage of the GCDS text component | ||
| │ ├── config # Configuration files | ||
| │ │ └── constants.js # Constants fie | ||
| │ ├── i18n # Configuration files | ||
| │ │ ├── en.js # English translations | ||
| │ │ └── fr.js # French translations | ||
| │ │ └── index.js # Constants fie | ||
| │ ├── router # Router config folder | ||
| │ │ └── index.js # Router configuration | ||
| │ ├── stores # Pinia store folder | ||
| │ │ └── formStore.js # Example store file for forms | ||
| │ ├── utils # Utility functions | ||
| │ │ ├── nav.js # Navigation utility functions | ||
| │ │ └── refresh.js # Utility function to refresh states | ||
| │ ├── views # Views folder | ||
| │ │ ├── About/ # View files for the about page | ||
| │ │ ├── HomeView.vue # Example view file | ||
| │ │ ├── NotFound.vue # Page not found view file | ||
| │ │ └── ReportABug.vue # Example view file using GCDS components | ||
| │ ├── App.vue # Root component | ||
| │ └──main.js # Entry point | ||
| ├── .gitignore # Git ignore rules | ||
| ├── index.html # HTML template | ||
| ├── package.json # Project metadata and dependencies | ||
| ├── README.md # Project documentation | ||
| ├── .eslintrc.js # ESLint configuration | ||
| ├── .prettierrc.js # Prettier configuration | ||
| ├── playwright.config.js # Playwright configuration | ||
| ├── vitest.config.js # Vite test configuration | ||
| └── vite.config.js # Vite configuration | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /* eslint-env node */ | ||
| require('@rushstack/eslint-patch/modern-module-resolution') | ||
|
|
||
| module.exports = { | ||
| root: true, | ||
| 'extends': [ | ||
| 'plugin:vue/vue3-essential', | ||
| 'eslint:recommended', | ||
| '@vue/eslint-config-prettier/skip-formatting' | ||
| ], | ||
| overrides: [ | ||
| { | ||
| files: [ | ||
| 'e2e/**/*.{test,spec}.{js,ts,jsx,tsx}' | ||
| ], | ||
| 'extends': [ | ||
| 'plugin:playwright/recommended' | ||
| ] | ||
| } | ||
| ], | ||
| parserOptions: { | ||
| ecmaVersion: 'latest' | ||
| }, | ||
| rules: { | ||
| // Slots used in GCDS Components (web components) are valid usage | ||
| // source: https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_templates_and_slots | ||
| 'vue/no-deprecated-slot-attribute': 'off', | ||
| 'vue/multi-word-component-names': ['error', { | ||
| // TODO: Remove About1 from the list if it is no longer needed | ||
| 'ignores': ['Header', 'Footer', 'Container', 'Heading', 'Text', 'Button', 'Input', 'About1'] | ||
| }] | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # Logs | ||
| logs | ||
| *.log | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
| pnpm-debug.log* | ||
| lerna-debug.log* | ||
|
|
||
| node_modules | ||
| .DS_Store | ||
| dist | ||
| dist-ssr | ||
| coverage | ||
| *.local | ||
|
|
||
| /cypress/videos/ | ||
| /cypress/screenshots/ | ||
|
|
||
| # Editor directories and files | ||
| .vscode/* | ||
| !.vscode/extensions.json | ||
| .idea | ||
| *.suo | ||
| *.ntvs* | ||
| *.njsproj | ||
| *.sln | ||
| *.sw? | ||
|
|
||
| *.tsbuildinfo | ||
|
|
||
| test-results/ | ||
| playwright-report/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "$schema": "https://json.schemastore.org/prettierrc", | ||
| "semi": false, | ||
| "tabWidth": 2, | ||
| "singleQuote": true, | ||
| "printWidth": 100, | ||
| "trailingComma": "none" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "recommendations": [ | ||
| "Vue.volar", | ||
| "ms-playwright.playwright", | ||
| "dbaeumer.vscode-eslint", | ||
| "esbenp.prettier-vscode" | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # vue-starter-app | ||
|
|
||
| This template should help get you started developing with Vue 3 in Vite using GCDS Components from [@cdssnc/gcds-components-vue](https://www.npmjs.com/package/@cdssnc/gcds-components-vue). | ||
|
|
||
| ## Customize configuration | ||
|
|
||
| See [Vite Configuration Reference](https://vitejs.dev/config/). | ||
|
|
||
| ## Project Setup | ||
|
|
||
| ```sh | ||
| npm install | ||
| ``` | ||
|
|
||
| ### Compile and Hot-Reload for Development | ||
|
|
||
| ```sh | ||
| npm run dev | ||
| ``` | ||
|
|
||
| ### Compile and Minify for Production | ||
|
|
||
| ```sh | ||
| npm run build | ||
| ``` | ||
|
|
||
| ### Run Unit Tests with [Vitest](https://vitest.dev/) | ||
|
|
||
| ```sh | ||
| npm run test:unit | ||
| ``` | ||
|
|
||
| ### Run End-to-End Tests with [Playwright](https://playwright.dev) | ||
|
|
||
| ```sh | ||
| # Install browsers for the first run | ||
| npx playwright install | ||
|
|
||
| # When testing on CI, must build the project first | ||
| npm run build | ||
|
|
||
| # Runs the end-to-end tests | ||
| npm run test:e2e | ||
| # Runs the tests only on Chromium | ||
| npm run test:e2e -- --project=chromium | ||
| # Runs the tests of a specific file | ||
| npm run test:e2e -- tests/example.spec.ts | ||
| # Runs the tests in debug mode | ||
| npm run test:e2e -- --debug | ||
| ``` | ||
|
|
||
| ### Lint with [ESLint](https://eslint.org/) | ||
|
|
||
| ```sh | ||
| npm run lint | ||
| ``` |
17 changes: 17 additions & 0 deletions
17
starter-apps/vue/vue-template/e2e/aboutPageBreadcrumbs.spec.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import { expect, test } from '@playwright/test' | ||
| import { en } from '@/i18n/en.js' | ||
| import { fr } from '@/i18n/fr.js' | ||
|
|
||
| test('shows aboutTopic page breadcrumbs', async ({ page }) => { | ||
| await page.goto('/en/about/topic') | ||
|
|
||
| await expect( | ||
| page.locator('gcds-breadcrumbs').locator('router-link gcds-breadcrumbs-item') | ||
| ).toHaveText([en.home, en.about]) | ||
|
|
||
| await page.click('text=Français') | ||
|
|
||
| await expect( | ||
| page.locator('gcds-breadcrumbs').locator('router-link gcds-breadcrumbs-item') | ||
| ).toHaveText([fr.home, fr.about]) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import { expect, test } from '@playwright/test' | ||
| import { en } from '../src/i18n/en.js' | ||
| import { fr } from '../src/i18n/fr.js' | ||
|
|
||
| // See here how to get started: | ||
| // https://playwright.dev/docs/intro | ||
| test('visits the app root url', async ({ page }) => { | ||
| await page.goto('/') | ||
| await expect(page.locator('gcds-heading')).toHaveText(en.homePage.heading) | ||
|
|
||
| await expect(page.locator('gcds-text').first()).toHaveText(en.homePage.paragraph) | ||
| }) | ||
|
|
||
| test('switches to french', async ({ page }) => { | ||
| await page.goto('/') | ||
| await page.click('text=Français') | ||
| await expect(page.locator('gcds-heading')).toHaveText(fr.homePage.heading) | ||
| }) | ||
|
|
||
| test('switches to english', async ({ page }) => { | ||
| await page.goto('/fr') | ||
| await page.click('text=English') | ||
| await expect(page.locator('gcds-heading')).toHaveText(en.homePage.heading) | ||
| }) |
15 changes: 15 additions & 0 deletions
15
starter-apps/vue/vue-template/e2e/reportABug/reportABug.spec.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import { expect, test } from '@playwright/test' | ||
| import { en } from '@/i18n/en.js' | ||
| import { fr } from '@/i18n/fr.js' | ||
|
|
||
| test('visit bug report page', async ({ page }) => { | ||
| await page.goto('/en/report-a-bug') | ||
| await expect(page.locator('gcds-heading').first()).toHaveText(en.reportABugPage.heading) | ||
| await expect(page.locator('gcds-text').first()).toHaveText(en.reportABugPage.intro) | ||
| }) | ||
|
|
||
| test('switches to french', async ({ page }) => { | ||
| await page.goto('/en/report-a-bug') | ||
| await page.click('text=Français') | ||
| await expect(page.locator('gcds-heading').first()).toHaveText(fr.reportABugPage.heading) | ||
| }) |
9 changes: 9 additions & 0 deletions
9
starter-apps/vue/vue-template/e2e/reportABug/reportABugErrors.spec.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import { expect, test } from '@playwright/test' | ||
|
|
||
| test('report bug form missing fields', async ({ page }) => { | ||
| await page.goto('/en/report-a-bug') | ||
| await page.click('text=Submit') | ||
| await expect(page.locator('gcds-error-message').first()).toHaveText( | ||
| 'Enter information to continue.' | ||
| ) | ||
| }) |
19 changes: 19 additions & 0 deletions
19
starter-apps/vue/vue-template/e2e/reportABug/reportABugSubmission.spec.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { expect, test } from '@playwright/test' | ||
| import { en } from '@/i18n/en.js' | ||
|
|
||
| test('report bug form', async ({ page }) => { | ||
| await page.goto('/en/report-a-bug') | ||
| await page.getByLabel('GC Design System Components Package and Version').fill('1.0.0') | ||
| await page.getByLabel('Title').fill('title') | ||
| await page.getByLabel('Current Behavior').fill('current behavior') | ||
| await page.getByLabel('Expected Behavior').fill('expected behavior') | ||
| await page.getByLabel('Steps to Reproduce').fill('steps to reproduce') | ||
| await page.getByLabel('Code Reproduction URL').fill('code reproduction url') | ||
| await page.getByLabel('System Info').fill('system info') | ||
| await page.getByLabel('Additional Information').fill('additional information') | ||
| await page.click('text=Submit') | ||
| await expect(page.locator('gcds-heading').locator('nth=0')).toHaveText(en.reportABugPage.heading) | ||
| await expect(page.locator('gcds-heading').locator('nth=1')).toHaveText( | ||
| en.reportABugPage.form.confirmation | ||
| ) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <link href="/favicon.ico" rel="icon"> | ||
| <meta content="width=device-width, initial-scale=1.0" name="viewport"> | ||
|
|
||
| <!-- GCDS required assets --> | ||
| <link href="https://fonts.googleapis.com" rel="preconnect" /> | ||
| <link crossorigin href="https://fonts.gstatic.com" rel="preconnect" /> | ||
|
|
||
| <!-- GC Design System Utility --> | ||
| <link href="https://cdn.design-system.alpha.canada.ca/@cdssnc/gcds-utility@latest/dist/gcds-utility.min.css" rel="stylesheet"> | ||
|
|
||
| <!-- TODO: Change the title --> | ||
| <title>GC Design System Starter Template</title> | ||
| </head> | ||
| <body> | ||
| <div id="app"></div> | ||
| <script src="/src/main.js" type="module"></script> | ||
| </body> | ||
| </html> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "compilerOptions": { | ||
| "paths": { | ||
| "@/*": ["./src/*"] | ||
| } | ||
| }, | ||
| "exclude": ["node_modules", "dist"] | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.