From 49c7108338e292144bdc67850e9f754784783c2b Mon Sep 17 00:00:00 2001 From: Krr0ptioN Date: Thu, 16 Nov 2023 00:04:55 +0300 Subject: [PATCH] project: frontend setup --- frontend-e2e/.eslintrc.json | 22 +++++++ frontend-e2e/cypress.config.ts | 6 ++ frontend-e2e/project.json | 33 ++++++++++ frontend-e2e/src/e2e/app.cy.ts | 13 ++++ frontend-e2e/src/fixtures/example.json | 5 ++ frontend-e2e/src/support/app.po.ts | 1 + frontend-e2e/src/support/commands.ts | 35 ++++++++++ frontend-e2e/src/support/e2e.ts | 17 +++++ frontend-e2e/tsconfig.json | 20 ++++++ frontend/.eslintrc.json | 18 ++++++ frontend/index.html | 15 +++++ frontend/postcss.config.js | 15 +++++ frontend/project.json | 78 +++++++++++++++++++++++ frontend/public/favicon.ico | Bin 0 -> 15086 bytes frontend/src/app/app.spec.tsx | 25 ++++++++ frontend/src/app/app.tsx | 15 +++++ frontend/src/assets/.gitkeep | 0 frontend/src/assets/style.css | 3 + frontend/src/components/music-items.tsx | 0 frontend/src/components/music-player.tsx | 0 frontend/src/components/sidebar.tsx | 0 frontend/src/main.tsx | 17 +++++ frontend/src/pages/home.tsx | 9 +++ frontend/tailwind.config.js | 17 +++++ frontend/tsconfig.app.json | 23 +++++++ frontend/tsconfig.json | 21 ++++++ frontend/tsconfig.spec.json | 26 ++++++++ frontend/vite.config.ts | 34 ++++++++++ 28 files changed, 468 insertions(+) create mode 100644 frontend-e2e/.eslintrc.json create mode 100644 frontend-e2e/cypress.config.ts create mode 100644 frontend-e2e/project.json create mode 100644 frontend-e2e/src/e2e/app.cy.ts create mode 100644 frontend-e2e/src/fixtures/example.json create mode 100644 frontend-e2e/src/support/app.po.ts create mode 100644 frontend-e2e/src/support/commands.ts create mode 100644 frontend-e2e/src/support/e2e.ts create mode 100644 frontend-e2e/tsconfig.json create mode 100644 frontend/.eslintrc.json create mode 100644 frontend/index.html create mode 100644 frontend/postcss.config.js create mode 100644 frontend/project.json create mode 100644 frontend/public/favicon.ico create mode 100644 frontend/src/app/app.spec.tsx create mode 100644 frontend/src/app/app.tsx create mode 100644 frontend/src/assets/.gitkeep create mode 100644 frontend/src/assets/style.css create mode 100644 frontend/src/components/music-items.tsx create mode 100644 frontend/src/components/music-player.tsx create mode 100644 frontend/src/components/sidebar.tsx create mode 100644 frontend/src/main.tsx create mode 100644 frontend/src/pages/home.tsx create mode 100644 frontend/tailwind.config.js create mode 100644 frontend/tsconfig.app.json create mode 100644 frontend/tsconfig.json create mode 100644 frontend/tsconfig.spec.json create mode 100644 frontend/vite.config.ts diff --git a/frontend-e2e/.eslintrc.json b/frontend-e2e/.eslintrc.json new file mode 100644 index 0000000..23f42c9 --- /dev/null +++ b/frontend-e2e/.eslintrc.json @@ -0,0 +1,22 @@ +{ + "extends": ["plugin:cypress/recommended", "../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.cy.{ts,js,tsx,jsx}", "src/**/*.{ts,js,tsx,jsx}"], + "rules": {} + } + ] +} diff --git a/frontend-e2e/cypress.config.ts b/frontend-e2e/cypress.config.ts new file mode 100644 index 0000000..686ba4f --- /dev/null +++ b/frontend-e2e/cypress.config.ts @@ -0,0 +1,6 @@ +import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset'; +import { defineConfig } from 'cypress'; + +export default defineConfig({ + e2e: nxE2EPreset(__filename, { cypressDir: 'src', bundler: 'vite' }), +}); diff --git a/frontend-e2e/project.json b/frontend-e2e/project.json new file mode 100644 index 0000000..e844d3f --- /dev/null +++ b/frontend-e2e/project.json @@ -0,0 +1,33 @@ +{ + "name": "frontend-e2e", + "$schema": "../node_modules/nx/schemas/project-schema.json", + "projectType": "application", + "sourceRoot": "frontend-e2e/src", + "targets": { + "e2e": { + "executor": "@nx/cypress:cypress", + "options": { + "cypressConfig": "frontend-e2e/cypress.config.ts", + "testingType": "e2e", + "devServerTarget": "frontend:serve" + }, + "configurations": { + "production": { + "devServerTarget": "frontend:serve:production" + }, + "ci": { + "devServerTarget": "frontend:serve-static" + } + } + }, + "lint": { + "executor": "@nx/eslint:lint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["frontend-e2e/**/*.{js,ts}"] + } + } + }, + "implicitDependencies": ["frontend"], + "tags": [] +} diff --git a/frontend-e2e/src/e2e/app.cy.ts b/frontend-e2e/src/e2e/app.cy.ts new file mode 100644 index 0000000..24d2f3f --- /dev/null +++ b/frontend-e2e/src/e2e/app.cy.ts @@ -0,0 +1,13 @@ +import { getGreeting } from '../support/app.po'; + +describe('frontend-e2e', () => { + beforeEach(() => cy.visit('/')); + + it('should display welcome message', () => { + // Custom command example, see `../support/commands.ts` file + cy.login('my-email@something.com', 'myPassword'); + + // Function helper example, see `../support/app.po.ts` file + getGreeting().contains(/Welcome/); + }); +}); diff --git a/frontend-e2e/src/fixtures/example.json b/frontend-e2e/src/fixtures/example.json new file mode 100644 index 0000000..02e4254 --- /dev/null +++ b/frontend-e2e/src/fixtures/example.json @@ -0,0 +1,5 @@ +{ + "name": "Using fixtures to represent data", + "email": "hello@cypress.io", + "body": "Fixtures are a great way to mock data for responses to routes" +} diff --git a/frontend-e2e/src/support/app.po.ts b/frontend-e2e/src/support/app.po.ts new file mode 100644 index 0000000..3293424 --- /dev/null +++ b/frontend-e2e/src/support/app.po.ts @@ -0,0 +1 @@ +export const getGreeting = () => cy.get('h1'); diff --git a/frontend-e2e/src/support/commands.ts b/frontend-e2e/src/support/commands.ts new file mode 100644 index 0000000..c421a3c --- /dev/null +++ b/frontend-e2e/src/support/commands.ts @@ -0,0 +1,35 @@ +/// + +// *********************************************** +// This example commands.ts shows you how to +// create various custom commands and overwrite +// existing commands. +// +// For more comprehensive examples of custom +// commands please read more here: +// https://on.cypress.io/custom-commands +// *********************************************** + +// eslint-disable-next-line @typescript-eslint/no-namespace +declare namespace Cypress { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + interface Chainable { + login(email: string, password: string): void; + } +} + +// -- This is a parent command -- +Cypress.Commands.add('login', (email, password) => { + console.log('Custom command example: Login', email, password); +}); +// +// -- This is a child command -- +// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) +// +// +// -- This is a dual command -- +// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) +// +// +// -- This will overwrite an existing command -- +// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) diff --git a/frontend-e2e/src/support/e2e.ts b/frontend-e2e/src/support/e2e.ts new file mode 100644 index 0000000..1c1a9e7 --- /dev/null +++ b/frontend-e2e/src/support/e2e.ts @@ -0,0 +1,17 @@ +// *********************************************************** +// This example support/e2e.ts is processed and +// loaded automatically before your test files. +// +// This is a great place to put global configuration and +// behavior that modifies Cypress. +// +// You can change the location of this file or turn off +// automatically serving support files with the +// 'supportFile' configuration option. +// +// You can read more here: +// https://on.cypress.io/configuration +// *********************************************************** + +// Import commands.ts using ES2015 syntax: +import './commands'; diff --git a/frontend-e2e/tsconfig.json b/frontend-e2e/tsconfig.json new file mode 100644 index 0000000..0de3340 --- /dev/null +++ b/frontend-e2e/tsconfig.json @@ -0,0 +1,20 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": { + "allowJs": true, + "outDir": "../dist/out-tsc", + "module": "commonjs", + "types": ["cypress", "node"], + "sourceMap": false + }, + "include": [ + "**/*.ts", + "**/*.js", + "cypress.config.ts", + "**/*.cy.ts", + "**/*.cy.tsx", + "**/*.cy.js", + "**/*.cy.jsx", + "**/*.d.ts" + ] +} diff --git a/frontend/.eslintrc.json b/frontend/.eslintrc.json new file mode 100644 index 0000000..c5bdb41 --- /dev/null +++ b/frontend/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["plugin:@nx/react", "../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/frontend/index.html b/frontend/index.html new file mode 100644 index 0000000..329844d --- /dev/null +++ b/frontend/index.html @@ -0,0 +1,15 @@ + + + + + Frontend + + + + + + +
+ + + diff --git a/frontend/postcss.config.js b/frontend/postcss.config.js new file mode 100644 index 0000000..c72626d --- /dev/null +++ b/frontend/postcss.config.js @@ -0,0 +1,15 @@ +const { join } = require('path'); + +// Note: If you use library-specific PostCSS/Tailwind configuration then you should remove the `postcssConfig` build +// option from your application's configuration (i.e. project.json). +// +// See: https://nx.dev/guides/using-tailwind-css-in-react#step-4:-applying-configuration-to-libraries + +module.exports = { + plugins: { + tailwindcss: { + config: join(__dirname, 'tailwind.config.js'), + }, + autoprefixer: {}, + }, +}; diff --git a/frontend/project.json b/frontend/project.json new file mode 100644 index 0000000..0feab12 --- /dev/null +++ b/frontend/project.json @@ -0,0 +1,78 @@ +{ + "name": "frontend", + "$schema": "../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "frontend/src", + "projectType": "application", + "targets": { + "build": { + "executor": "@nx/vite:build", + "outputs": ["{options.outputPath}"], + "defaultConfiguration": "production", + "options": { + "outputPath": "dist/frontend" + }, + "configurations": { + "development": { + "mode": "development" + }, + "production": { + "mode": "production" + } + } + }, + "serve": { + "executor": "@nx/vite:dev-server", + "defaultConfiguration": "development", + "options": { + "buildTarget": "frontend:build" + }, + "configurations": { + "development": { + "buildTarget": "frontend:build:development", + "hmr": true + }, + "production": { + "buildTarget": "frontend:build:production", + "hmr": false + } + } + }, + "preview": { + "executor": "@nx/vite:preview-server", + "defaultConfiguration": "development", + "options": { + "buildTarget": "frontend:build" + }, + "configurations": { + "development": { + "buildTarget": "frontend:build:development" + }, + "production": { + "buildTarget": "frontend:build:production" + } + } + }, + "test": { + "executor": "@nx/vite:test", + "outputs": ["{options.reportsDirectory}"], + "options": { + "passWithNoTests": true, + "reportsDirectory": "../coverage/frontend" + } + }, + "lint": { + "executor": "@nx/eslint:lint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["frontend/**/*.{ts,tsx,js,jsx}"] + } + }, + "serve-static": { + "executor": "@nx/web:file-server", + "options": { + "buildTarget": "frontend:build" + } + } + }, + "tags": [] +} diff --git a/frontend/public/favicon.ico b/frontend/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..317ebcb2336e0833a22dddf0ab287849f26fda57 GIT binary patch literal 15086 zcmeI332;U^%p|z7g|#(P)qFEA@4f!_@qOK2 z_lJl}!lhL!VT_U|uN7%8B2iKH??xhDa;*`g{yjTFWHvXn;2s{4R7kH|pKGdy(7z!K zgftM+Ku7~24TLlh(!g)gz|foI94G^t2^IO$uvX$3(OR0<_5L2sB)lMAMy|+`xodJ{ z_Uh_1m)~h?a;2W{dmhM;u!YGo=)OdmId_B<%^V^{ovI@y`7^g1_V9G}*f# zNzAtvou}I!W1#{M^@ROc(BZ! z+F!!_aR&Px3_reO(EW+TwlW~tv*2zr?iP7(d~a~yA|@*a89IUke+c472NXM0wiX{- zl`UrZC^1XYyf%1u)-Y)jj9;MZ!SLfd2Hl?o|80Su%Z?To_=^g_Jt0oa#CT*tjx>BI z16wec&AOWNK<#i0Qd=1O$fymLRoUR*%;h@*@v7}wApDl^w*h}!sYq%kw+DKDY)@&A z@9$ULEB3qkR#85`lb8#WZw=@})#kQig9oqy^I$dj&k4jU&^2(M3q{n1AKeGUKPFbr z1^<)aH;VsG@J|B&l>UtU#Ejv3GIqERzYgL@UOAWtW<{p#zy`WyJgpCy8$c_e%wYJL zyGHRRx38)HyjU3y{-4z6)pzb>&Q1pR)B&u01F-|&Gx4EZWK$nkUkOI|(D4UHOXg_- zw{OBf!oWQUn)Pe(=f=nt=zkmdjpO^o8ZZ9o_|4tW1ni+Un9iCW47*-ut$KQOww!;u z`0q)$s6IZO!~9$e_P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MSYWIe{&pYq&9eGaArA~*kA { + it('should render successfully', () => { + const { baseElement } = render( + + + + ); + expect(baseElement).toBeTruthy(); + }); + + it('should have a greeting as the title', () => { + const { getByText } = render( + + + + ); + expect(getByText(/Welcome frontend/gi)).toBeTruthy(); + }); +}); diff --git a/frontend/src/app/app.tsx b/frontend/src/app/app.tsx new file mode 100644 index 0000000..8bac080 --- /dev/null +++ b/frontend/src/app/app.tsx @@ -0,0 +1,15 @@ +import { Route, Routes } from 'react-router-dom'; +import { HomePage } from './pages/home'; + +export function App() { + return ( +
+ + } /> + + {/* END: routes */} +
+ ); +} + +export default App; diff --git a/frontend/src/assets/.gitkeep b/frontend/src/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/frontend/src/assets/style.css b/frontend/src/assets/style.css new file mode 100644 index 0000000..b5c61c9 --- /dev/null +++ b/frontend/src/assets/style.css @@ -0,0 +1,3 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; diff --git a/frontend/src/components/music-items.tsx b/frontend/src/components/music-items.tsx new file mode 100644 index 0000000..e69de29 diff --git a/frontend/src/components/music-player.tsx b/frontend/src/components/music-player.tsx new file mode 100644 index 0000000..e69de29 diff --git a/frontend/src/components/sidebar.tsx b/frontend/src/components/sidebar.tsx new file mode 100644 index 0000000..e69de29 diff --git a/frontend/src/main.tsx b/frontend/src/main.tsx new file mode 100644 index 0000000..f5cd70b --- /dev/null +++ b/frontend/src/main.tsx @@ -0,0 +1,17 @@ +import { StrictMode } from 'react'; +import * as ReactDOM from 'react-dom/client'; +import { BrowserRouter } from 'react-router-dom'; +import './assets/style.css'; + +import App from './app/app'; + +const root = ReactDOM.createRoot( + document.getElementById('root') as HTMLElement +); +root.render( + + + + + +); diff --git a/frontend/src/pages/home.tsx b/frontend/src/pages/home.tsx new file mode 100644 index 0000000..f82d904 --- /dev/null +++ b/frontend/src/pages/home.tsx @@ -0,0 +1,9 @@ +import React from 'react'; + +export const HomePage = (props: {}) => { + return ( +
+
+
+ ); +}; diff --git a/frontend/tailwind.config.js b/frontend/tailwind.config.js new file mode 100644 index 0000000..e1cf7ce --- /dev/null +++ b/frontend/tailwind.config.js @@ -0,0 +1,17 @@ +const { createGlobPatternsForDependencies } = require('@nx/react/tailwind'); +const { join } = require('path'); + +/** @type {import('tailwindcss').Config} */ +module.exports = { + content: [ + join( + __dirname, + '{src,pages,components,app}/**/*!(*.stories|*.spec).{ts,tsx,html}' + ), + ...createGlobPatternsForDependencies(__dirname), + ], + theme: { + extend: {}, + }, + plugins: [], +}; diff --git a/frontend/tsconfig.app.json b/frontend/tsconfig.app.json new file mode 100644 index 0000000..0a0979e --- /dev/null +++ b/frontend/tsconfig.app.json @@ -0,0 +1,23 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../dist/out-tsc", + "types": [ + "node", + "@nx/react/typings/cssmodule.d.ts", + "@nx/react/typings/image.d.ts", + "vite/client" + ] + }, + "exclude": [ + "src/**/*.spec.ts", + "src/**/*.test.ts", + "src/**/*.spec.tsx", + "src/**/*.test.tsx", + "src/**/*.spec.js", + "src/**/*.test.js", + "src/**/*.spec.jsx", + "src/**/*.test.jsx" + ], + "include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"] +} diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json new file mode 100644 index 0000000..6849538 --- /dev/null +++ b/frontend/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "allowJs": false, + "esModuleInterop": false, + "allowSyntheticDefaultImports": true, + "strict": true, + "types": ["vite/client", "vitest"] + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.app.json" + }, + { + "path": "./tsconfig.spec.json" + } + ], + "extends": "../tsconfig.base.json" +} diff --git a/frontend/tsconfig.spec.json b/frontend/tsconfig.spec.json new file mode 100644 index 0000000..7bb15ca --- /dev/null +++ b/frontend/tsconfig.spec.json @@ -0,0 +1,26 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../dist/out-tsc", + "types": [ + "vitest/globals", + "vitest/importMeta", + "vite/client", + "node", + "vitest" + ] + }, + "include": [ + "vite.config.ts", + "src/**/*.test.ts", + "src/**/*.spec.ts", + "src/**/*.test.tsx", + "src/**/*.spec.tsx", + "src/**/*.test.js", + "src/**/*.spec.js", + "src/**/*.test.jsx", + "src/**/*.spec.jsx", + "src/**/*.d.ts" + ], + "types": ["@nx/react/typings/cssmodule.d.ts", "@nx/react/typings/image.d.ts"] +} diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts new file mode 100644 index 0000000..d1260fa --- /dev/null +++ b/frontend/vite.config.ts @@ -0,0 +1,34 @@ +/// +import { defineConfig } from 'vite'; +import react from '@vitejs/plugin-react'; +import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; + +export default defineConfig({ + cacheDir: '../node_modules/.vite/frontend', + + server: { + port: 4200, + host: 'localhost', + }, + + preview: { + port: 4300, + host: 'localhost', + }, + + plugins: [react(), nxViteTsPaths()], + + // Uncomment this if you are using workers. + // worker: { + // plugins: [ nxViteTsPaths() ], + // }, + + test: { + globals: true, + cache: { + dir: '../node_modules/.vitest', + }, + environment: 'jsdom', + include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], + }, +});