create-zs3-app 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +182 -0
- package/bin/cli.js +118 -0
- package/package.json +38 -0
- package/src/index.js +981 -0
- package/templates/backend-ts/.editorconfig +21 -0
- package/templates/backend-ts/.env.example +2 -0
- package/templates/backend-ts/.prettierignore +28 -0
- package/templates/backend-ts/.prettierrc +13 -0
- package/templates/backend-ts/README.md +55 -0
- package/templates/backend-ts/eslint.config.js +43 -0
- package/templates/backend-ts/package.json +35 -0
- package/templates/backend-ts/src/index.ts +7 -0
- package/templates/backend-ts/tsconfig.json +25 -0
- package/templates/backend-ts-express/.editorconfig +21 -0
- package/templates/backend-ts-express/.env.example +2 -0
- package/templates/backend-ts-express/.prettierignore +28 -0
- package/templates/backend-ts-express/.prettierrc +13 -0
- package/templates/backend-ts-express/README.md +59 -0
- package/templates/backend-ts-express/eslint.config.js +43 -0
- package/templates/backend-ts-express/package.json +37 -0
- package/templates/backend-ts-express/src/index.ts +17 -0
- package/templates/backend-ts-express/tsconfig.json +25 -0
- package/templates/backend-vanilla/.editorconfig +21 -0
- package/templates/backend-vanilla/.env.example +2 -0
- package/templates/backend-vanilla/.prettierignore +28 -0
- package/templates/backend-vanilla/.prettierrc +13 -0
- package/templates/backend-vanilla/README.md +46 -0
- package/templates/backend-vanilla/eslint.config.js +27 -0
- package/templates/backend-vanilla/package.json +29 -0
- package/templates/backend-vanilla/src/index.js +7 -0
- package/templates/backend-vanilla-express/.editorconfig +21 -0
- package/templates/backend-vanilla-express/.env.example +2 -0
- package/templates/backend-vanilla-express/.prettierignore +28 -0
- package/templates/backend-vanilla-express/.prettierrc +13 -0
- package/templates/backend-vanilla-express/README.md +50 -0
- package/templates/backend-vanilla-express/eslint.config.js +27 -0
- package/templates/backend-vanilla-express/package.json +30 -0
- package/templates/backend-vanilla-express/src/index.js +17 -0
- package/templates/frontend-ts/.editorconfig +27 -0
- package/templates/frontend-ts/.prettierignore +31 -0
- package/templates/frontend-ts/.prettierrc +13 -0
- package/templates/frontend-ts/README.md +51 -0
- package/templates/frontend-ts/eslint.config.js +43 -0
- package/templates/frontend-ts/index.html +12 -0
- package/templates/frontend-ts/package.json +32 -0
- package/templates/frontend-ts/src/main.ts +14 -0
- package/templates/frontend-ts/src/style.css +56 -0
- package/templates/frontend-ts/tsconfig.json +24 -0
- package/templates/frontend-ts/vite.config.ts +13 -0
- package/templates/frontend-ts-zs3/.editorconfig +27 -0
- package/templates/frontend-ts-zs3/.prettierignore +31 -0
- package/templates/frontend-ts-zs3/.prettierrc +13 -0
- package/templates/frontend-ts-zs3/README.md +51 -0
- package/templates/frontend-ts-zs3/eslint.config.js +43 -0
- package/templates/frontend-ts-zs3/index.html +12 -0
- package/templates/frontend-ts-zs3/package.json +34 -0
- package/templates/frontend-ts-zs3/src/main.ts +31 -0
- package/templates/frontend-ts-zs3/src/style.css +65 -0
- package/templates/frontend-ts-zs3/tsconfig.json +24 -0
- package/templates/frontend-ts-zs3/vite.config.ts +13 -0
- package/templates/frontend-vanilla/.editorconfig +27 -0
- package/templates/frontend-vanilla/.prettierignore +31 -0
- package/templates/frontend-vanilla/.prettierrc +13 -0
- package/templates/frontend-vanilla/README.md +50 -0
- package/templates/frontend-vanilla/eslint.config.js +27 -0
- package/templates/frontend-vanilla/index.html +12 -0
- package/templates/frontend-vanilla/package.json +28 -0
- package/templates/frontend-vanilla/src/main.js +13 -0
- package/templates/frontend-vanilla/src/style.css +56 -0
- package/templates/frontend-vanilla/vite.config.js +12 -0
- package/templates/frontend-vanilla-zs3/.editorconfig +27 -0
- package/templates/frontend-vanilla-zs3/.prettierignore +31 -0
- package/templates/frontend-vanilla-zs3/.prettierrc +13 -0
- package/templates/frontend-vanilla-zs3/README.md +50 -0
- package/templates/frontend-vanilla-zs3/eslint.config.js +27 -0
- package/templates/frontend-vanilla-zs3/index.html +12 -0
- package/templates/frontend-vanilla-zs3/package.json +30 -0
- package/templates/frontend-vanilla-zs3/src/main.js +31 -0
- package/templates/frontend-vanilla-zs3/src/style.css +65 -0
- package/templates/frontend-vanilla-zs3/vite.config.js +12 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# EditorConfig: https://editorconfig.org
|
|
2
|
+
|
|
3
|
+
root = true
|
|
4
|
+
|
|
5
|
+
[*]
|
|
6
|
+
charset = utf-8
|
|
7
|
+
end_of_line = lf
|
|
8
|
+
indent_style = space
|
|
9
|
+
indent_size = 2
|
|
10
|
+
insert_final_newline = true
|
|
11
|
+
trim_trailing_whitespace = true
|
|
12
|
+
max_line_length = 150
|
|
13
|
+
|
|
14
|
+
[*.md]
|
|
15
|
+
trim_trailing_whitespace = false
|
|
16
|
+
|
|
17
|
+
[*.json]
|
|
18
|
+
indent_size = 2
|
|
19
|
+
|
|
20
|
+
[*.{js,ts,jsx,tsx}]
|
|
21
|
+
indent_size = 2
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
node_modules
|
|
3
|
+
|
|
4
|
+
# Build output
|
|
5
|
+
dist
|
|
6
|
+
build
|
|
7
|
+
coverage
|
|
8
|
+
|
|
9
|
+
# Lock files
|
|
10
|
+
package-lock.json
|
|
11
|
+
yarn.lock
|
|
12
|
+
pnpm-lock.yaml
|
|
13
|
+
|
|
14
|
+
# Logs
|
|
15
|
+
*.log
|
|
16
|
+
|
|
17
|
+
# Environment
|
|
18
|
+
.env
|
|
19
|
+
.env.*
|
|
20
|
+
|
|
21
|
+
# Cache
|
|
22
|
+
.cache
|
|
23
|
+
.eslintcache
|
|
24
|
+
.prettierrc.cache
|
|
25
|
+
|
|
26
|
+
# OS
|
|
27
|
+
.DS_Store
|
|
28
|
+
Thumbs.db
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"semi": false,
|
|
3
|
+
"trailingComma": "es5",
|
|
4
|
+
"singleQuote": true,
|
|
5
|
+
"printWidth": 150,
|
|
6
|
+
"tabWidth": 4,
|
|
7
|
+
"useTabs": false,
|
|
8
|
+
"arrowParens": "always",
|
|
9
|
+
"endOfLine": "lf",
|
|
10
|
+
"bracketSpacing": true,
|
|
11
|
+
"bracketSameLine": false,
|
|
12
|
+
"quoteProps": "as-needed"
|
|
13
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Backend Project
|
|
2
|
+
|
|
3
|
+
Backend amb TypeScript.
|
|
4
|
+
|
|
5
|
+
## Requisits
|
|
6
|
+
|
|
7
|
+
- Node.js >= 18
|
|
8
|
+
- npm o yarn
|
|
9
|
+
|
|
10
|
+
## Instal·lació
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Configuració
|
|
17
|
+
|
|
18
|
+
Copia `.env.example` a `.env` i configura les variables d'entorn:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
cp .env.example .env
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Scripts disponibles
|
|
25
|
+
|
|
26
|
+
- `npm run dev` - Inicia el servidor en mode desenvolupament amb hot reload
|
|
27
|
+
- `npm run build` - Compila el projecte a JavaScript
|
|
28
|
+
- `npm start` - Inicia el servidor en mode producció
|
|
29
|
+
- `npm run lint` - Executa el linter
|
|
30
|
+
- `npm run lint:fix` - Corregeix automàticament els errors de linting
|
|
31
|
+
- `npm run format` - Formata el codi amb Prettier
|
|
32
|
+
- `npm run format:check` - Comprova el format del codi
|
|
33
|
+
- `npm run type-check` - Comprova els tipus de TypeScript
|
|
34
|
+
|
|
35
|
+
## Estructura del projecte
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
src/
|
|
39
|
+
├── index.ts # Punt d'entrada de l'aplicació
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Desenvolupament
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm run dev
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
El servidor s'executarà a `http://localhost:3000`
|
|
49
|
+
|
|
50
|
+
## Producció
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npm run build
|
|
54
|
+
npm start
|
|
55
|
+
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import eslint from '@eslint/js'
|
|
2
|
+
import prettierConfig from 'eslint-plugin-prettier/recommended'
|
|
3
|
+
import globals from 'globals'
|
|
4
|
+
import tseslint from 'typescript-eslint'
|
|
5
|
+
|
|
6
|
+
export default [
|
|
7
|
+
{ ignores: ['dist', 'node_modules', 'coverage', '*.js', '*.d.ts'] },
|
|
8
|
+
eslint.configs.recommended,
|
|
9
|
+
...tseslint.configs.recommendedTypeChecked,
|
|
10
|
+
{
|
|
11
|
+
// Configuració global per a tots els fitxers
|
|
12
|
+
languageOptions: {
|
|
13
|
+
globals: {
|
|
14
|
+
...globals.node,
|
|
15
|
+
...globals.jest,
|
|
16
|
+
},
|
|
17
|
+
parserOptions: {
|
|
18
|
+
project: true,
|
|
19
|
+
tsconfigRootDir: import.meta.dirname,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
// Regles que vols aplicar
|
|
23
|
+
rules: {
|
|
24
|
+
'prettier/prettier': 'error',
|
|
25
|
+
semi: ['error', 'never'],
|
|
26
|
+
'@typescript-eslint/no-explicit-any': 'error',
|
|
27
|
+
'@typescript-eslint/explicit-function-return-type': 'warn',
|
|
28
|
+
'@typescript-eslint/explicit-module-boundary-types': 'warn',
|
|
29
|
+
'@typescript-eslint/no-unused-vars': [
|
|
30
|
+
'error',
|
|
31
|
+
{
|
|
32
|
+
argsIgnorePattern: '^_',
|
|
33
|
+
varsIgnorePattern: '^_',
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
'@typescript-eslint/no-floating-promises': 'error',
|
|
37
|
+
'@typescript-eslint/strict-boolean-expressions': 'off',
|
|
38
|
+
'@typescript-eslint/prefer-nullish-coalescing': 'warn',
|
|
39
|
+
'@typescript-eslint/prefer-optional-chain': 'warn',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
prettierConfig, // Aquesta ha de ser l'última configuració per sobreescriure regles d'estil
|
|
43
|
+
]
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "backend-project",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Backend project with TypeScript",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"dev": "tsx watch src/index.ts",
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"start": "node dist/index.js",
|
|
11
|
+
"lint": "eslint src",
|
|
12
|
+
"lint:fix": "eslint src --fix",
|
|
13
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
14
|
+
"format:check": "prettier --check \"src/**/*.ts\"",
|
|
15
|
+
"type-check": "tsc --noEmit"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [],
|
|
18
|
+
"author": "",
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"dotenv": "^16.3.1"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@eslint/js": "9.39.2",
|
|
25
|
+
"@types/node": "^20.10.0",
|
|
26
|
+
"eslint": "9.39.2",
|
|
27
|
+
"eslint-config-prettier": "^10.1.5",
|
|
28
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
29
|
+
"globals": "^16.1.0",
|
|
30
|
+
"prettier": "3.8.1",
|
|
31
|
+
"tsx": "^4.7.0",
|
|
32
|
+
"typescript": "5.9.3",
|
|
33
|
+
"typescript-eslint": "8.53.1"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ES2022",
|
|
5
|
+
"lib": ["ES2022"],
|
|
6
|
+
"moduleResolution": "node",
|
|
7
|
+
"rootDir": "./src",
|
|
8
|
+
"outDir": "./dist",
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"strict": true,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"resolveJsonModule": true,
|
|
14
|
+
"declaration": true,
|
|
15
|
+
"declarationMap": true,
|
|
16
|
+
"sourceMap": true,
|
|
17
|
+
"noUnusedLocals": true,
|
|
18
|
+
"noUnusedParameters": true,
|
|
19
|
+
"noImplicitReturns": true,
|
|
20
|
+
"noFallthroughCasesInSwitch": true,
|
|
21
|
+
"allowSyntheticDefaultImports": true
|
|
22
|
+
},
|
|
23
|
+
"include": ["src/**/*"],
|
|
24
|
+
"exclude": ["node_modules", "dist"]
|
|
25
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# EditorConfig: https://editorconfig.org
|
|
2
|
+
|
|
3
|
+
root = true
|
|
4
|
+
|
|
5
|
+
[*]
|
|
6
|
+
charset = utf-8
|
|
7
|
+
end_of_line = lf
|
|
8
|
+
indent_style = space
|
|
9
|
+
indent_size = 2
|
|
10
|
+
insert_final_newline = true
|
|
11
|
+
trim_trailing_whitespace = true
|
|
12
|
+
max_line_length = 150
|
|
13
|
+
|
|
14
|
+
[*.md]
|
|
15
|
+
trim_trailing_whitespace = false
|
|
16
|
+
|
|
17
|
+
[*.json]
|
|
18
|
+
indent_size = 2
|
|
19
|
+
|
|
20
|
+
[*.{js,ts,jsx,tsx}]
|
|
21
|
+
indent_size = 2
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
node_modules
|
|
3
|
+
|
|
4
|
+
# Build output
|
|
5
|
+
dist
|
|
6
|
+
build
|
|
7
|
+
coverage
|
|
8
|
+
|
|
9
|
+
# Lock files
|
|
10
|
+
package-lock.json
|
|
11
|
+
yarn.lock
|
|
12
|
+
pnpm-lock.yaml
|
|
13
|
+
|
|
14
|
+
# Logs
|
|
15
|
+
*.log
|
|
16
|
+
|
|
17
|
+
# Environment
|
|
18
|
+
.env
|
|
19
|
+
.env.*
|
|
20
|
+
|
|
21
|
+
# Cache
|
|
22
|
+
.cache
|
|
23
|
+
.eslintcache
|
|
24
|
+
.prettierrc.cache
|
|
25
|
+
|
|
26
|
+
# OS
|
|
27
|
+
.DS_Store
|
|
28
|
+
Thumbs.db
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"semi": false,
|
|
3
|
+
"trailingComma": "es5",
|
|
4
|
+
"singleQuote": true,
|
|
5
|
+
"printWidth": 150,
|
|
6
|
+
"tabWidth": 4,
|
|
7
|
+
"useTabs": false,
|
|
8
|
+
"arrowParens": "always",
|
|
9
|
+
"endOfLine": "lf",
|
|
10
|
+
"bracketSpacing": true,
|
|
11
|
+
"bracketSameLine": false,
|
|
12
|
+
"quoteProps": "as-needed"
|
|
13
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Backend Project
|
|
2
|
+
|
|
3
|
+
Backend amb Express i TypeScript.
|
|
4
|
+
|
|
5
|
+
## Requisits
|
|
6
|
+
|
|
7
|
+
- Node.js >= 18
|
|
8
|
+
- npm o yarn
|
|
9
|
+
|
|
10
|
+
## Instal·lació
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Configuració
|
|
17
|
+
|
|
18
|
+
Copia `.env.example` a `.env` i configura les variables d'entorn:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
cp .env.example .env
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Scripts disponibles
|
|
25
|
+
|
|
26
|
+
- `npm run dev` - Inicia el servidor en mode desenvolupament amb hot reload
|
|
27
|
+
- `npm run build` - Compila el projecte a JavaScript
|
|
28
|
+
- `npm start` - Inicia el servidor en mode producció
|
|
29
|
+
- `npm run lint` - Executa el linter
|
|
30
|
+
- `npm run lint:fix` - Corregeix automàticament els errors de linting
|
|
31
|
+
- `npm run format` - Formata el codi amb Prettier
|
|
32
|
+
- `npm run format:check` - Comprova el format del codi
|
|
33
|
+
- `npm run type-check` - Comprova els tipus de TypeScript
|
|
34
|
+
|
|
35
|
+
## Estructura del projecte
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
src/
|
|
39
|
+
├── index.ts # Punt d'entrada de l'aplicació (Express server)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Desenvolupament
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm run dev
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
El servidor s'executarà a `http://localhost:3000`
|
|
49
|
+
|
|
50
|
+
## API
|
|
51
|
+
|
|
52
|
+
- `GET /` - Retorna un missatge de benvinguda
|
|
53
|
+
|
|
54
|
+
## Producció
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm run build
|
|
58
|
+
npm start
|
|
59
|
+
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import eslint from '@eslint/js'
|
|
2
|
+
import prettierConfig from 'eslint-plugin-prettier/recommended'
|
|
3
|
+
import globals from 'globals'
|
|
4
|
+
import tseslint from 'typescript-eslint'
|
|
5
|
+
|
|
6
|
+
export default [
|
|
7
|
+
{ ignores: ['dist', 'node_modules', 'coverage', '*.js', '*.d.ts'] },
|
|
8
|
+
eslint.configs.recommended,
|
|
9
|
+
...tseslint.configs.recommendedTypeChecked,
|
|
10
|
+
{
|
|
11
|
+
// Configuració global per a tots els fitxers
|
|
12
|
+
languageOptions: {
|
|
13
|
+
globals: {
|
|
14
|
+
...globals.node,
|
|
15
|
+
...globals.jest,
|
|
16
|
+
},
|
|
17
|
+
parserOptions: {
|
|
18
|
+
project: true,
|
|
19
|
+
tsconfigRootDir: import.meta.dirname,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
// Regles que vols aplicar
|
|
23
|
+
rules: {
|
|
24
|
+
'prettier/prettier': 'error',
|
|
25
|
+
semi: ['error', 'never'],
|
|
26
|
+
'@typescript-eslint/no-explicit-any': 'error',
|
|
27
|
+
'@typescript-eslint/explicit-function-return-type': 'warn',
|
|
28
|
+
'@typescript-eslint/explicit-module-boundary-types': 'warn',
|
|
29
|
+
'@typescript-eslint/no-unused-vars': [
|
|
30
|
+
'error',
|
|
31
|
+
{
|
|
32
|
+
argsIgnorePattern: '^_',
|
|
33
|
+
varsIgnorePattern: '^_',
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
'@typescript-eslint/no-floating-promises': 'error',
|
|
37
|
+
'@typescript-eslint/strict-boolean-expressions': 'off',
|
|
38
|
+
'@typescript-eslint/prefer-nullish-coalescing': 'warn',
|
|
39
|
+
'@typescript-eslint/prefer-optional-chain': 'warn',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
prettierConfig, // Aquesta ha de ser l'última configuració per sobreescriure regles d'estil
|
|
43
|
+
]
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "backend-project",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Backend project with Express and TypeScript",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"dev": "tsx watch src/index.ts",
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"start": "node dist/index.js",
|
|
11
|
+
"lint": "eslint src",
|
|
12
|
+
"lint:fix": "eslint src --fix",
|
|
13
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
14
|
+
"format:check": "prettier --check \"src/**/*.ts\"",
|
|
15
|
+
"type-check": "tsc --noEmit"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [],
|
|
18
|
+
"author": "",
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"dotenv": "^16.3.1",
|
|
22
|
+
"express": "^4.18.2"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@eslint/js": "9.39.2",
|
|
26
|
+
"@types/express": "^4.17.21",
|
|
27
|
+
"@types/node": "^20.10.0",
|
|
28
|
+
"eslint": "9.39.2",
|
|
29
|
+
"eslint-config-prettier": "^10.1.5",
|
|
30
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
31
|
+
"globals": "^16.1.0",
|
|
32
|
+
"prettier": "3.8.1",
|
|
33
|
+
"tsx": "^4.7.0",
|
|
34
|
+
"typescript": "5.9.3",
|
|
35
|
+
"typescript-eslint": "8.53.1"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import dotenv from 'dotenv'
|
|
2
|
+
import express from 'express'
|
|
3
|
+
|
|
4
|
+
dotenv.config()
|
|
5
|
+
|
|
6
|
+
const app = express()
|
|
7
|
+
const port = process.env.PORT || 3000
|
|
8
|
+
|
|
9
|
+
app.use(express.json())
|
|
10
|
+
|
|
11
|
+
app.get('/', (_req, res) => {
|
|
12
|
+
res.json({ message: 'Backend funcionant correctament!' })
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
app.listen(port, () => {
|
|
16
|
+
console.log(`Server running on http://localhost:${port}`)
|
|
17
|
+
})
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ES2022",
|
|
5
|
+
"lib": ["ES2022"],
|
|
6
|
+
"moduleResolution": "node",
|
|
7
|
+
"rootDir": "./src",
|
|
8
|
+
"outDir": "./dist",
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"strict": true,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"resolveJsonModule": true,
|
|
14
|
+
"declaration": true,
|
|
15
|
+
"declarationMap": true,
|
|
16
|
+
"sourceMap": true,
|
|
17
|
+
"noUnusedLocals": true,
|
|
18
|
+
"noUnusedParameters": true,
|
|
19
|
+
"noImplicitReturns": true,
|
|
20
|
+
"noFallthroughCasesInSwitch": true,
|
|
21
|
+
"allowSyntheticDefaultImports": true
|
|
22
|
+
},
|
|
23
|
+
"include": ["src/**/*"],
|
|
24
|
+
"exclude": ["node_modules", "dist"]
|
|
25
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# EditorConfig: https://editorconfig.org
|
|
2
|
+
|
|
3
|
+
root = true
|
|
4
|
+
|
|
5
|
+
[*]
|
|
6
|
+
charset = utf-8
|
|
7
|
+
end_of_line = lf
|
|
8
|
+
indent_style = space
|
|
9
|
+
indent_size = 2
|
|
10
|
+
insert_final_newline = true
|
|
11
|
+
trim_trailing_whitespace = true
|
|
12
|
+
max_line_length = 150
|
|
13
|
+
|
|
14
|
+
[*.md]
|
|
15
|
+
trim_trailing_whitespace = false
|
|
16
|
+
|
|
17
|
+
[*.json]
|
|
18
|
+
indent_size = 2
|
|
19
|
+
|
|
20
|
+
[*.{js,ts,jsx,tsx}]
|
|
21
|
+
indent_size = 2
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
node_modules
|
|
3
|
+
|
|
4
|
+
# Build output
|
|
5
|
+
dist
|
|
6
|
+
build
|
|
7
|
+
coverage
|
|
8
|
+
|
|
9
|
+
# Lock files
|
|
10
|
+
package-lock.json
|
|
11
|
+
yarn.lock
|
|
12
|
+
pnpm-lock.yaml
|
|
13
|
+
|
|
14
|
+
# Logs
|
|
15
|
+
*.log
|
|
16
|
+
|
|
17
|
+
# Environment
|
|
18
|
+
.env
|
|
19
|
+
.env.*
|
|
20
|
+
|
|
21
|
+
# Cache
|
|
22
|
+
.cache
|
|
23
|
+
.eslintcache
|
|
24
|
+
.prettierrc.cache
|
|
25
|
+
|
|
26
|
+
# OS
|
|
27
|
+
.DS_Store
|
|
28
|
+
Thumbs.db
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"semi": false,
|
|
3
|
+
"trailingComma": "es5",
|
|
4
|
+
"singleQuote": true,
|
|
5
|
+
"printWidth": 150,
|
|
6
|
+
"tabWidth": 4,
|
|
7
|
+
"useTabs": false,
|
|
8
|
+
"arrowParens": "always",
|
|
9
|
+
"endOfLine": "lf",
|
|
10
|
+
"bracketSpacing": true,
|
|
11
|
+
"bracketSameLine": false,
|
|
12
|
+
"quoteProps": "as-needed"
|
|
13
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Backend Project
|
|
2
|
+
|
|
3
|
+
Backend amb JavaScript.
|
|
4
|
+
|
|
5
|
+
## Requisits
|
|
6
|
+
|
|
7
|
+
- Node.js >= 18
|
|
8
|
+
- npm o yarn
|
|
9
|
+
|
|
10
|
+
## Instal·lació
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Configuració
|
|
17
|
+
|
|
18
|
+
Copia `.env.example` a `.env` i configura les variables d'entorn:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
cp .env.example .env
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Scripts disponibles
|
|
25
|
+
|
|
26
|
+
- `npm run dev` - Inicia el servidor en mode desenvolupament amb hot reload
|
|
27
|
+
- `npm start` - Inicia el servidor en mode producció
|
|
28
|
+
- `npm run lint` - Executa el linter
|
|
29
|
+
- `npm run lint:fix` - Corregeix automàticament els errors de linting
|
|
30
|
+
- `npm run format` - Formata el codi amb Prettier
|
|
31
|
+
- `npm run format:check` - Comprova el format del codi
|
|
32
|
+
|
|
33
|
+
## Estructura del projecte
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
src/
|
|
37
|
+
├── index.js # Punt d'entrada de l'aplicació
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Desenvolupament
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm run dev
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
El servidor s'executarà a `http://localhost:3000`
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import eslint from '@eslint/js'
|
|
2
|
+
import prettierConfig from 'eslint-plugin-prettier/recommended'
|
|
3
|
+
import globals from 'globals'
|
|
4
|
+
|
|
5
|
+
export default [
|
|
6
|
+
{ ignores: ['dist', 'node_modules', 'coverage'] },
|
|
7
|
+
eslint.configs.recommended,
|
|
8
|
+
{
|
|
9
|
+
languageOptions: {
|
|
10
|
+
globals: {
|
|
11
|
+
...globals.node,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
rules: {
|
|
15
|
+
'prettier/prettier': 'error',
|
|
16
|
+
semi: ['error', 'never'],
|
|
17
|
+
'no-unused-vars': [
|
|
18
|
+
'error',
|
|
19
|
+
{
|
|
20
|
+
argsIgnorePattern: '^_',
|
|
21
|
+
varsIgnorePattern: '^_',
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
prettierConfig,
|
|
27
|
+
]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "backend-project",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Backend project with JavaScript",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"dev": "node --watch src/index.js",
|
|
9
|
+
"start": "node src/index.js",
|
|
10
|
+
"lint": "eslint src",
|
|
11
|
+
"lint:fix": "eslint src --fix",
|
|
12
|
+
"format": "prettier --write \"src/**/*.js\"",
|
|
13
|
+
"format:check": "prettier --check \"src/**/*.js\""
|
|
14
|
+
},
|
|
15
|
+
"keywords": [],
|
|
16
|
+
"author": "",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"dotenv": "^16.3.1"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@eslint/js": "9.39.2",
|
|
23
|
+
"eslint": "9.39.2",
|
|
24
|
+
"eslint-config-prettier": "^10.1.5",
|
|
25
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
26
|
+
"globals": "^16.1.0",
|
|
27
|
+
"prettier": "3.8.1"
|
|
28
|
+
}
|
|
29
|
+
}
|