commit da93d2d894fbb5e58d54861997ac55e2332998bb Author: Artem-Darius Atlas Date: Fri Oct 27 11:15:13 2023 +0300 Initial commit diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..6e87a00 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +# Editor configuration, see http://editorconfig.org +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +max_line_length = off +trim_trailing_whitespace = false diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +node_modules diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..9ca2e83 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,35 @@ +{ + "root": true, + "ignorePatterns": ["**/*"], + "plugins": ["@nx"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": { + "@nx/enforce-module-boundaries": [ + "error", + { + "enforceBuildableLibDependency": true, + "allow": [], + "depConstraints": [ + { + "sourceTag": "*", + "onlyDependOnLibsWithTags": ["*"] + } + ] + } + ] + } + }, + { + "files": ["*.ts", "*.tsx"], + "extends": ["plugin:@nx/typescript"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "extends": ["plugin:@nx/javascript"], + "rules": {} + } + ] +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..98a6e38 --- /dev/null +++ b/.gitignore @@ -0,0 +1,41 @@ +# See http://help.github.com/ignore-files/ for more about ignoring files. + +# compiled output +dist +tmp +/out-tsc + +# dependencies +node_modules + +# IDEs and editors +/.idea +.project +.classpath +.c9/ +*.launch +.settings/ +*.sublime-workspace + +# IDE - VSCode +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json + +# misc +/.sass-cache +/connect.lock +/coverage +/libpeerconnection.log +npm-debug.log +yarn-error.log +testem.log +/typings + +# System Files +.DS_Store +Thumbs.db + +.nx/cache \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..d155fdb --- /dev/null +++ b/.prettierignore @@ -0,0 +1,4 @@ +# Add files here to ignore them from prettier formatting +/dist +/coverage +/.nx/cache \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..544138b --- /dev/null +++ b/.prettierrc @@ -0,0 +1,3 @@ +{ + "singleQuote": true +} diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..462e29b --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,7 @@ +{ + "recommendations": [ + "nrwl.angular-console", + "esbenp.prettier-vscode", + "dbaeumer.vscode-eslint" + ] +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..23a4340 --- /dev/null +++ b/README.md @@ -0,0 +1,63 @@ +# PermHack + + + +✨ **This workspace has been generated by [Nx, a Smart, fast and extensible build system.](https://nx.dev)** ✨ + + +## Start the app + +To start the development server run `nx serve crud`. Open your browser and navigate to http://localhost:4200/. Happy coding! + + +## Generate code + +If you happen to use Nx plugins, you can leverage code generators that might come with it. + +Run `nx list` to get a list of available plugins and whether they have generators. Then run `nx list ` to see what generators are available. + +Learn more about [Nx generators on the docs](https://nx.dev/plugin-features/use-code-generators). + +## Running tasks + +To execute tasks with Nx use the following syntax: + +``` +nx <...options> +``` + +You can also run multiple targets: + +``` +nx run-many -t +``` + +..or add `-p` to filter specific projects + +``` +nx run-many -t -p +``` + +Targets can be defined in the `package.json` or `projects.json`. Learn more [in the docs](https://nx.dev/core-features/run-tasks). + +## Want better Editor Integration? + +Have a look at the [Nx Console extensions](https://nx.dev/nx-console). It provides autocomplete support, a UI for exploring and running tasks & generators, and more! Available for VSCode, IntelliJ and comes with a LSP for Vim users. + +## Ready to deploy? + +Just run `nx build demoapp` to build the application. The build artifacts will be stored in the `dist/` directory, ready to be deployed. + +## Set up CI! + +Nx comes with local caching already built-in (check your `nx.json`). On CI you might want to go a step further. + +- [Set up remote caching](https://nx.dev/core-features/share-your-cache) +- [Set up task distribution across multiple machines](https://nx.dev/core-features/distribute-task-execution) +- [Learn more how to setup CI](https://nx.dev/recipes/ci) + +## Connect with us! + +- [Join the community](https://nx.dev/community) +- [Subscribe to the Nx Youtube Channel](https://www.youtube.com/@nxdevtools) +- [Follow us on Twitter](https://twitter.com/nxdevtools) diff --git a/apps/crud-e2e/.eslintrc.json b/apps/crud-e2e/.eslintrc.json new file mode 100644 index 0000000..a6ed4fc --- /dev/null +++ b/apps/crud-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/apps/crud-e2e/cypress.config.ts b/apps/crud-e2e/cypress.config.ts new file mode 100644 index 0000000..686ba4f --- /dev/null +++ b/apps/crud-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/apps/crud-e2e/project.json b/apps/crud-e2e/project.json new file mode 100644 index 0000000..4ce7e27 --- /dev/null +++ b/apps/crud-e2e/project.json @@ -0,0 +1,33 @@ +{ + "name": "crud-e2e", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "projectType": "application", + "sourceRoot": "apps/crud-e2e/src", + "targets": { + "e2e": { + "executor": "@nx/cypress:cypress", + "options": { + "cypressConfig": "apps/crud-e2e/cypress.config.ts", + "testingType": "e2e", + "devServerTarget": "crud:serve" + }, + "configurations": { + "production": { + "devServerTarget": "crud:serve:production" + }, + "ci": { + "devServerTarget": "crud:serve-static" + } + } + }, + "lint": { + "executor": "@nx/eslint:lint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["apps/crud-e2e/**/*.{js,ts}"] + } + } + }, + "implicitDependencies": ["crud"], + "tags": [] +} diff --git a/apps/crud-e2e/src/e2e/app.cy.ts b/apps/crud-e2e/src/e2e/app.cy.ts new file mode 100644 index 0000000..9f9dbc7 --- /dev/null +++ b/apps/crud-e2e/src/e2e/app.cy.ts @@ -0,0 +1,13 @@ +import { getGreeting } from '../support/app.po'; + +describe('crud-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/apps/crud-e2e/src/fixtures/example.json b/apps/crud-e2e/src/fixtures/example.json new file mode 100644 index 0000000..02e4254 --- /dev/null +++ b/apps/crud-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/apps/crud-e2e/src/support/app.po.ts b/apps/crud-e2e/src/support/app.po.ts new file mode 100644 index 0000000..3293424 --- /dev/null +++ b/apps/crud-e2e/src/support/app.po.ts @@ -0,0 +1 @@ +export const getGreeting = () => cy.get('h1'); diff --git a/apps/crud-e2e/src/support/commands.ts b/apps/crud-e2e/src/support/commands.ts new file mode 100644 index 0000000..c421a3c --- /dev/null +++ b/apps/crud-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/apps/crud-e2e/src/support/e2e.ts b/apps/crud-e2e/src/support/e2e.ts new file mode 100644 index 0000000..1c1a9e7 --- /dev/null +++ b/apps/crud-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/apps/crud-e2e/tsconfig.json b/apps/crud-e2e/tsconfig.json new file mode 100644 index 0000000..e1eeabd --- /dev/null +++ b/apps/crud-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/apps/crud/.eslintrc.json b/apps/crud/.eslintrc.json new file mode 100644 index 0000000..a39ac5d --- /dev/null +++ b/apps/crud/.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/apps/crud/index.html b/apps/crud/index.html new file mode 100644 index 0000000..f4a96ee --- /dev/null +++ b/apps/crud/index.html @@ -0,0 +1,16 @@ + + + + + Crud + + + + + + + +
+ + + diff --git a/apps/crud/project.json b/apps/crud/project.json new file mode 100644 index 0000000..48b9328 --- /dev/null +++ b/apps/crud/project.json @@ -0,0 +1,78 @@ +{ + "name": "crud", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "apps/crud/src", + "projectType": "application", + "targets": { + "build": { + "executor": "@nx/vite:build", + "outputs": ["{options.outputPath}"], + "defaultConfiguration": "production", + "options": { + "outputPath": "dist/apps/crud" + }, + "configurations": { + "development": { + "mode": "development" + }, + "production": { + "mode": "production" + } + } + }, + "serve": { + "executor": "@nx/vite:dev-server", + "defaultConfiguration": "development", + "options": { + "buildTarget": "crud:build" + }, + "configurations": { + "development": { + "buildTarget": "crud:build:development", + "hmr": true + }, + "production": { + "buildTarget": "crud:build:production", + "hmr": false + } + } + }, + "preview": { + "executor": "@nx/vite:preview-server", + "defaultConfiguration": "development", + "options": { + "buildTarget": "crud:build" + }, + "configurations": { + "development": { + "buildTarget": "crud:build:development" + }, + "production": { + "buildTarget": "crud:build:production" + } + } + }, + "test": { + "executor": "@nx/vite:test", + "outputs": ["{options.reportsDirectory}"], + "options": { + "passWithNoTests": true, + "reportsDirectory": "../../coverage/apps/crud" + } + }, + "lint": { + "executor": "@nx/eslint:lint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["apps/crud/**/*.{ts,tsx,js,jsx}"] + } + }, + "serve-static": { + "executor": "@nx/web:file-server", + "options": { + "buildTarget": "crud:build" + } + } + }, + "tags": [] +} diff --git a/apps/crud/public/favicon.ico b/apps/crud/public/favicon.ico new file mode 100644 index 0000000..317ebcb Binary files /dev/null and b/apps/crud/public/favicon.ico differ diff --git a/apps/crud/src/app/app.module.scss b/apps/crud/src/app/app.module.scss new file mode 100644 index 0000000..7b88fba --- /dev/null +++ b/apps/crud/src/app/app.module.scss @@ -0,0 +1 @@ +/* Your styles goes here. */ diff --git a/apps/crud/src/app/app.spec.tsx b/apps/crud/src/app/app.spec.tsx new file mode 100644 index 0000000..8bb4e39 --- /dev/null +++ b/apps/crud/src/app/app.spec.tsx @@ -0,0 +1,15 @@ +import { render } from '@testing-library/react'; + +import App from './app'; + +describe('App', () => { + it('should render successfully', () => { + const { baseElement } = render(); + expect(baseElement).toBeTruthy(); + }); + + it('should have a greeting as the title', () => { + const { getByText } = render(); + expect(getByText(/Welcome crud/gi)).toBeTruthy(); + }); +}); diff --git a/apps/crud/src/app/app.tsx b/apps/crud/src/app/app.tsx new file mode 100644 index 0000000..0645eb4 --- /dev/null +++ b/apps/crud/src/app/app.tsx @@ -0,0 +1,14 @@ +// eslint-disable-next-line @typescript-eslint/no-unused-vars +import styles from './app.module.scss'; + +import NxWelcome from './nx-welcome'; + +export function App() { + return ( +
+ +
+ ); +} + +export default App; diff --git a/apps/crud/src/app/nx-welcome.tsx b/apps/crud/src/app/nx-welcome.tsx new file mode 100644 index 0000000..f0cd657 --- /dev/null +++ b/apps/crud/src/app/nx-welcome.tsx @@ -0,0 +1,845 @@ +/* + * * * * * * * * * * * * * * * * * * * * * * * * * * * * + This is a starter component and can be deleted. + * * * * * * * * * * * * * * * * * * * * * * * * * * * * + Delete this file and get started with your project! + * * * * * * * * * * * * * * * * * * * * * * * * * * * * + */ +export function NxWelcome({ title }: { title: string }) { + return ( + <> +