Skip to content

Commit b3aab62

Browse files
committed
Initial commit: Laravel React E-commerce project setup
0 parents  commit b3aab62

File tree

3,605 files changed

+1260931
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,605 files changed

+1260931
-0
lines changed

.editorconfig

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
9+
[*.{js,jsx,ts,tsx,json,css,scss,md}]
10+
indent_style = space
11+
indent_size = 2
12+
13+
[*.{php}]
14+
indent_style = space
15+
indent_size = 4
16+
17+
[*.{yml,yaml}]
18+
indent_style = space
19+
indent_size = 2
20+
21+
[package.json]
22+
indent_style = space
23+
indent_size = 2
24+
25+
[composer.json]
26+
indent_style = space
27+
indent_size = 4

.eslint.config.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import js from '@eslint/js';
2+
import globals from 'globals';
3+
import reactHooks from 'eslint-plugin-react-hooks';
4+
import reactRefresh from 'eslint-plugin-react-refresh';
5+
import tseslint from 'typescript-eslint';
6+
7+
export default tseslint.config(
8+
{ ignores: ['dist', 'node_modules', 'vendor', 'storage', 'bootstrap/cache'] },
9+
{
10+
extends: [js.configs.recommended, ...tseslint.configs.recommended],
11+
files: ['**/*.{ts,tsx}'],
12+
languageOptions: {
13+
ecmaVersion: 2020,
14+
globals: globals.browser,
15+
},
16+
plugins: {
17+
'react-hooks': reactHooks,
18+
'react-refresh': reactRefresh,
19+
},
20+
rules: {
21+
...reactHooks.configs.recommended.rules,
22+
'react-refresh/only-export-components': [
23+
'warn',
24+
{ allowConstantExport: true },
25+
],
26+
'@typescript-eslint/no-unused-vars': [
27+
'error',
28+
{ argsIgnorePattern: '^_' },
29+
],
30+
'@typescript-eslint/no-explicit-any': 'warn',
31+
'prefer-const': 'error',
32+
'no-var': 'error',
33+
},
34+
},
35+
);

.github/workflows/deploy.yml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: Deploy to Hostinger
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
node-version: [20.x]
15+
php-version: [8.2]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Use Node.js ${{ matrix.node-version }}
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: ${{ matrix.node-version }}
24+
cache: 'npm'
25+
cache-dependency-path: frontend/package-lock.json
26+
27+
- name: Use PHP ${{ matrix.php-version }}
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: ${{ matrix.php-version }}
31+
extensions: mbstring, xml, ctype, json, bcmath, sqlite3
32+
coverage: xdebug
33+
34+
- name: Install Composer dependencies
35+
run: cd backend && php ../composer install --no-dev --optimize-autoloader
36+
37+
- name: Install Node dependencies
38+
run: cd frontend && npm ci
39+
40+
- name: Run PHP tests
41+
run: cd backend && php artisan test
42+
43+
- name: Run PHP linting
44+
run: cd backend && php ../vendor/bin/php-cs-fixer fix --dry-run --diff
45+
46+
- name: Run TypeScript type checking
47+
run: cd frontend && npm run type-check
48+
49+
- name: Run ESLint
50+
run: cd frontend && npm run lint
51+
52+
- name: Build frontend
53+
run: cd frontend && npm run build
54+
55+
deploy:
56+
needs: test
57+
runs-on: ubuntu-latest
58+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
59+
60+
steps:
61+
- uses: actions/checkout@v4
62+
63+
- name: Use Node.js 20.x
64+
uses: actions/setup-node@v4
65+
with:
66+
node-version: 20.x
67+
cache: 'npm'
68+
cache-dependency-path: frontend/package-lock.json
69+
70+
- name: Use PHP 8.2
71+
uses: shivammathur/setup-php@v2
72+
with:
73+
php-version: 8.2
74+
extensions: mbstring, xml, ctype, json, bcmath, sqlite3
75+
76+
- name: Install dependencies
77+
run: |
78+
php ./composer install --no-dev --optimize-autoloader
79+
cd frontend && npm ci
80+
81+
- name: Build application
82+
run: |
83+
cd frontend && npm run build
84+
cp -r dist/* backend/public/app/
85+
86+
- name: Deploy to Hostinger
87+
uses: SamKirkland/[email protected]
88+
with:
89+
server: ${{ secrets.FTP_SERVER }}
90+
username: ${{ secrets.FTP_USERNAME }}
91+
password: ${{ secrets.FTP_PASSWORD }}
92+
local-dir: ./backend/
93+
server-dir: ./
94+
exclude: |
95+
**/.git*
96+
**/.git*/**
97+
**/node_modules/**
98+
**/vendor/**
99+
**/storage/app/**
100+
**/storage/framework/**
101+
**/storage/logs/**
102+
**/bootstrap/cache/**
103+
**/.env**
104+
**/composer.json
105+
**/composer.lock
106+
**/package.json
107+
**/package-lock.json
108+
**/vite.config.js
109+
**/tailwind.config.js
110+
**/postcss.config.js
111+
**/tsconfig.json
112+
**/tsconfig.node.json
113+
**/frontend/**
114+
**/deploy.sh
115+
**/.github/**
116+
**/.editorconfig
117+
**/.prettier*
118+
**/.eslint*
119+
**/.php-cs-fixer.php

.php-cs-fixer.php

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<?php
2+
3+
return [
4+
'rules' => [
5+
'@PSR12' => true,
6+
'array_syntax' => ['syntax' => 'short'],
7+
'binary_operator_spaces' => [
8+
'operators' => [
9+
'=' => 'align',
10+
'=>' => 'align',
11+
],
12+
],
13+
'blank_line_after_namespace' => true,
14+
'blank_line_after_opening_tag' => true,
15+
'blank_line_before_statement' => [
16+
'statements' => ['return'],
17+
],
18+
'braces' => [
19+
'allow_single_line_closure' => true,
20+
],
21+
'cast_spaces' => true,
22+
'class_definition' => [
23+
'multi_line_extends_each_single_line' => true,
24+
],
25+
'concat_space' => [
26+
'spacing' => 'one',
27+
],
28+
'declare_equal_normalize' => true,
29+
'function_typehint_space' => true,
30+
'include' => true,
31+
'lowercase_cast' => true,
32+
'method_argument_space' => true,
33+
'native_function_casing' => true,
34+
'new_with_braces' => true,
35+
'no_blank_lines_after_class_opening' => true,
36+
'no_blank_lines_after_phpdoc' => true,
37+
'no_closing_tag' => true,
38+
'no_empty_phpdoc' => true,
39+
'no_empty_statement' => true,
40+
'no_extra_blank_lines' => true,
41+
'no_leading_import_slash' => true,
42+
'no_leading_namespace_whitespace' => true,
43+
'no_multiline_whitespace_around_double_arrow' => true,
44+
'no_short_bool_cast' => true,
45+
'no_singleline_whitespace_before_semicolons' => true,
46+
'no_spaces_after_function_name' => true,
47+
'no_spaces_around_offset' => true,
48+
'no_spaces_inside_parenthesis' => true,
49+
'no_trailing_comma_in_list_call' => true,
50+
'no_trailing_comma_in_singleline_array' => true,
51+
'no_trailing_whitespace' => true,
52+
'no_trailing_whitespace_in_comment' => true,
53+
'no_unneeded_control_parentheses' => true,
54+
'no_unused_imports' => true,
55+
'no_whitespace_before_comma_in_array' => true,
56+
'no_whitespace_in_blank_line' => true,
57+
'normalize_index_brace' => true,
58+
'object_operator_without_whitespace' => true,
59+
'ordered_imports' => [
60+
'sort_algorithm' => 'alpha',
61+
],
62+
'php_unit_fqcn_annotation' => true,
63+
'phpdoc_align' => true,
64+
'phpdoc_annotation_without_dot' => true,
65+
'phpdoc_indent' => true,
66+
'phpdoc_inline_tag_normalizer' => true,
67+
'phpdoc_no_access' => true,
68+
'phpdoc_no_package' => true,
69+
'phpdoc_no_useless_inheritdoc' => true,
70+
'phpdoc_order' => true,
71+
'phpdoc_return_self_reference' => true,
72+
'phpdoc_scalar' => true,
73+
'phpdoc_separation' => true,
74+
'phpdoc_single_line_var_spacing' => true,
75+
'phpdoc_summary' => true,
76+
'phpdoc_to_comment' => true,
77+
'phpdoc_trim' => true,
78+
'phpdoc_types' => true,
79+
'phpdoc_var_without_name' => true,
80+
'return_type_declaration' => true,
81+
'self_accessor' => true,
82+
'short_scalar_cast' => true,
83+
'single_blank_line_at_eof' => true,
84+
'single_class_element_per_statement' => true,
85+
'single_import_per_statement' => true,
86+
'single_line_after_imports' => true,
87+
'single_line_comment_style' => true,
88+
'single_quote' => true,
89+
'space_after_semicolon' => true,
90+
'standardize_not_equals' => true,
91+
'switch_case_semicolon_to_colon' => true,
92+
'switch_case_space' => true,
93+
'ternary_operator_spaces' => true,
94+
'trailing_comma_in_multiline' => true,
95+
'trim_array_spaces' => true,
96+
'unary_operator_spaces' => true,
97+
'visibility_required' => true,
98+
'whitespace_after_comma_in_array' => true,
99+
],
100+
];

.prettierignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Dependencies
2+
node_modules/
3+
vendor/
4+
5+
# Build outputs
6+
dist/
7+
build/
8+
public/app/
9+
10+
# Environment files
11+
.env*
12+
13+
# Logs
14+
*.log
15+
npm-debug.log*
16+
yarn-debug.log*
17+
yarn-error.log*
18+
19+
# IDE files
20+
.vscode/
21+
.idea/
22+
23+
# OS files
24+
.DS_Store
25+
Thumbs.db
26+
27+
# Laravel specific
28+
storage/
29+
bootstrap/cache/
30+
31+
# Coverage reports
32+
coverage/
33+
34+
# Lock files (format with package manager)
35+
package-lock.json
36+
yarn.lock
37+
pnpm-lock.yaml

.prettierrc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "es5",
4+
"singleQuote": true,
5+
"printWidth": 80,
6+
"tabWidth": 2,
7+
"useTabs": false,
8+
"bracketSpacing": true,
9+
"bracketSameLine": false,
10+
"arrowParens": "avoid",
11+
"endOfLine": "lf",
12+
"quoteProps": "as-needed",
13+
"jsxSingleQuote": true,
14+
"overrides": [
15+
{
16+
"files": ["*.php"],
17+
"options": {
18+
"tabWidth": 4,
19+
"printWidth": 100
20+
}
21+
}
22+
]
23+
}

0 commit comments

Comments
 (0)