Skip to content

Commit

Permalink
Upgraded and removed vulnerabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
tsoganov committed Dec 17, 2024
1 parent ff4ac36 commit 43303de
Show file tree
Hide file tree
Showing 148 changed files with 10,550 additions and 31,591 deletions.
8 changes: 0 additions & 8 deletions .babelrc

This file was deleted.

21 changes: 12 additions & 9 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
# --- HOSTS --- #
HOST=localhost
REACT_APP_URL=https://$HOST
PORT=3000
VITE_URL=https://$HOST
NODE_TLS_REJECT_UNAUTHORIZED=0

# APP API (PORT 3000 is reserved for CRA dev server)
REACT_APP_SERVER_PORT=1234
# APP API
VITE_SERVER_PORT=1234

# REGISTRANT API HOST
API_HOST=https://testrant.internet.ee

# PUBLIC API
PUBLIC_API_HOST=https://www.internet.ee
PUBLIC_API_KEY=key
SKIP_PREFLIGHT_CHECK=true

# --- EEID--- #

# --- TARA --- #

# TARA client ID
# EEID client ID
CLIENT_ID=eis_client_dev

# TARA client secret
# EEID client secret
CLIENT_SECRET=asd123

# Scopes
REACT_APP_SCOPE=openid idcard mid smartid
VITE_SCOPE=openid idcard mid smartid

# Response type
RESPONSE_TYPE=code

# TARA URL
# EEID URL
ISSUER_URL=https://tara-test.ria.ee

# OAuth Token URL
Expand All @@ -50,3 +52,4 @@ SESSION_SECRET=pass

# --- HTTPS --- #
HTTPS=true

49 changes: 30 additions & 19 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,35 +1,46 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
.idea
/node_modules
# Dependencies
node_modules
/.pnp
.pnp.js

# testing
# Build outputs
/dist
/dist-ssr
/server/dist
*.local

# Testing
/coverage
/cypress/screenshots
/cypress/videos

# production
/build

# server
/server/build

# logs
/logs/*
# Logs
/logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

# misc
.DS_Store
# Environment variables
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# Linting and formatting
.eslintignore
.prettierignore
79 changes: 54 additions & 25 deletions README.md
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,32 +1,61 @@
# EESTI INTERNETI SA - Registrant center
# EESTI INTERNETI SA - Registrant Center

### Kasutatud 📦
- Node.js: [node 14](https://nodejs.org/en/)
- Core: [React v16](https://www.npmjs.com/package/react), [Redux](https://www.npmjs.com/package/redux), [React Router v4](https://www.npmjs.com/package/react-router), [React Intl](https://github.com/yahoo/react-intl)
- Code: ES2017+ standard modern javascript
- Server: [express v4](https://www.npmjs.com/package/express)
- Logging: [winston](https://www.npmjs.com/package/winston)
- Bundler: [CRA](https://github.com/facebook/create-react-app)
## Tech Stack 🛠

### Tests and linting
- Syntax checking (aka linting) with [eslint](https://www.npmjs.com/package/eslint)
- Unit testing with [jest](http://facebook.github.io/jest/)
- End to end/integration testing with [cypress](https://www.cypress.io/)
### Core Technologies
- Node.js: [Node 22](https://nodejs.org/en/)
- Frontend:
- [React v18](https://www.npmjs.com/package/react)
- [Redux](https://www.npmjs.com/package/redux)
- [React Router v7](https://www.npmjs.com/package/react-router)
- [React Intl](https://github.com/yahoo/react-intl)
- Backend: [Express v4](https://www.npmjs.com/package/express)
- Logging: [Winston v3](https://www.npmjs.com/package/winston)

## Setup
- Create .env file from .env.example
### Development Tools
- Bundler: [Vite v6](https://github.com/vitejs/vite)
- Language: Modern JavaScript (ES2020+)
- Full ESM support (import/export)
- Latest ECMAScript features
- TypeScript and JSX support

### Quality Assurance
- Linting: [ESLint](https://www.npmjs.com/package/eslint)
- Unit Testing: [Jest](http://facebook.github.io/jest/)
- E2E Testing: [Cypress](https://www.cypress.io/)

```
npm i
npm run deploy
## Getting Started 🚀

### Prerequisites
- Node.js 22 or higher
- npm 10 or higher

### Setup
1. Clone the repository
2. Create `.env` file:
```bash
cp .env.example .env
```
3. Install dependencies and deploy:
```bash
npm i
npm run deploy
```

## Available Scripts 📜

### Development
```bash
npm start # Start development environment
```

## Scripts
### Production
```bash
npm run serve # Start production environment
```

##### Start development environment
```npm start```
##### Start production environment
```npm run serve```
##### Run tests
```npm run test```
```npm run test:e2e``` - edit cypress.json baseUrl before use
### Testing
```bash
npm run test # Run unit tests
npm run test:e2e # Run end-to-end tests (update cypress.json baseUrl first)
```
61 changes: 50 additions & 11 deletions buildScript.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,53 @@
const fs = require('fs');
const fse = require('fs-extra');
const childProcess = require('child_process');
import fs from 'node:fs';
import fse from 'fs-extra';
import { exec } from 'node:child_process';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { promisify } from 'node:util';

if (fs.existsSync('./build')) {
fse.removeSync('./build');
}
const execAsync = promisify(exec);
const __dirname = path.dirname(fileURLToPath(import.meta.url));

async function build() {
// Clean up existing directories
const clientDist = path.join(__dirname, 'dist');
const serverDist = path.join(__dirname, 'server', 'dist');

if (fs.existsSync(clientDist)) {
console.log('Cleaning client dist directory...');
fse.removeSync(clientDist);
}

if (fs.existsSync(serverDist)) {
console.log('Cleaning server dist directory...');
fse.removeSync(serverDist);
}

try {
// Build client
console.log('Building client...');
await execAsync('vite build', { stdio: 'inherit' });

// Run 'react-scripts build' script
childProcess.execSync('react-scripts build', { stdio: 'inherit' });
// Ensure client dist was created
if (!fs.existsSync(clientDist)) {
throw new Error('Client build failed - dist directory not created');
}

// Create server dist directory
console.log('Creating server dist directory...');
fse.ensureDirSync(serverDist);

// Copy client build to server
console.log('Copying client build to server...');
fse.copySync(clientDist, serverDist);

console.log('Build completed successfully!');
console.log(`Client build: ${clientDist}`);
console.log(`Server build: ${serverDist}`);
} catch (error) {
console.error('Build failed:', error);
process.exit(1);
}
}

// Move app build to server/build directory
console.log('Moving ./build to /server/build');
fse.moveSync('./build', './server/build', { overwrite: true });
build();
1 change: 0 additions & 1 deletion config/CSSStub.js

This file was deleted.

60 changes: 60 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import js from '@eslint/js'
import globals from 'globals'
import react from 'eslint-plugin-react'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import prettier from 'eslint-plugin-prettier'
import airbnb from 'eslint-config-airbnb'

export default [
{ ignores: ['dist'] },
{
files: ['**/*.{js,jsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
ecmaVersion: 'latest',
ecmaFeatures: { jsx: true },
sourceType: 'module',
},
},
settings: { react: { version: 'detect' } },
plugins: {
react,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
prettier
},
rules: {
...js.configs.recommended.rules,
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
...reactHooks.configs.recommended.rules,
...airbnb.rules,
'camelcase': 0,
'react/style-prop-object': 0,
'global-require': 0,
'import/newline-after-import': 0,
'import/no-dynamic-require': 0,
'import/no-extraneous-dependencies': 0,
'jsx-a11y/anchor-is-valid': ['error'],
'no-console': 0,
'no-duplicate-imports': 0,
'one-var': 0,
'prettier/prettier': ['error'],
'react/forbid-prop-types': [0, { checkChildContextTypes: false }],
'react/jsx-filename-extension': [1, { extensions: ['.jsx'] }],
'react/jsx-props-no-spreading': 0,
'react/jsx-sort-props': ['error'],
'react/prop-types': 0,
'react/sort-comp': ['error'],
'object-literal-sort-keys': 0,
'react/jsx-no-target-blank': 'off',
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
},
]
15 changes: 15 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#000000" />
<link rel="apple-touch-icon" href="/logo192.png" />
<link rel="manifest" href="/manifest.json" />
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

4 changes: 0 additions & 4 deletions logs/.gitignore

This file was deleted.

Loading

0 comments on commit 43303de

Please sign in to comment.