Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: start new front #861

Merged
merged 27 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
36d046e
feat: setup dev folder
ga-devfront Aug 29, 2024
303127d
feat: setup controller to handle assets generated by vite in dev or p…
ga-devfront Aug 29, 2024
6d9fd6e
fix: vite configuration for dev and prod
ga-devfront Aug 30, 2024
a3a5841
fix: remove unused function
ga-devfront Aug 30, 2024
fc55700
fix: add package.json
ga-devfront Aug 30, 2024
7415e74
fix: dotenv
ga-devfront Aug 30, 2024
45f5c7d
fix: cs fixer and php stan issues
ga-devfront Aug 30, 2024
63c23ec
fix: 5.6 syntax check
ga-devfront Aug 30, 2024
fce38b6
feat: add CI for build and check lint JS
ga-devfront Sep 2, 2024
0edf261
fix: eslint config
ga-devfront Sep 2, 2024
9860247
feat: update ci and readme
ga-devfront Sep 2, 2024
8c26830
feat: clean package json with unnecessary packages
ga-devfront Sep 2, 2024
81bb23c
fix: vite.config.ts with ts error
ga-devfront Sep 2, 2024
720f2df
feat: add style and stylelint
ga-devfront Sep 2, 2024
da5f475
feat: add templates
ga-devfront Sep 2, 2024
cff77f4
feat: add index.php
ga-devfront Sep 2, 2024
146f5d2
feat: add storybook
ga-devfront Sep 2, 2024
799545f
feat: add images
ga-devfront Sep 2, 2024
77f808b
feat: remove test javascript
ga-devfront Sep 4, 2024
a8bf6be
feat: add compilation of _dev styles to storybook
ga-devfront Sep 4, 2024
9981e0e
feat: move scss and ts to src and rename folders
ga-devfront Sep 4, 2024
f6b9953
fix: review code
ga-devfront Sep 4, 2024
95028ac
fix: reformat twig templates
ga-devfront Sep 4, 2024
5c389ac
fix: workflow steps name
ga-devfront Sep 4, 2024
c9618ed
fix: review issues
ga-devfront Sep 4, 2024
285e58b
feat: add readme commands for lint and test front and back
ga-devfront Sep 5, 2024
156a717
feat: add instruction for php stan installation
ga-devfront Sep 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
AUTOUPGRADE_DEV_WATCH_MODE=0
14 changes: 13 additions & 1 deletion .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,22 @@ jobs:
- name: Install composer dependencies
run: composer install --ansi --prefer-dist --no-interaction --no-progress --no-dev

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '20.x'

- name: Install and build npm dependencies
run:
npm install --prefix ./_dev
npm run vite:build --prefix ./_dev

- name: Clean-up project
uses: PrestaShopCorp/[email protected]
with:
paths: storybook
paths:
- storybook
- _dev

- name: Create & upload artifact
uses: actions/[email protected]
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: JS tests
on: [push, pull_request]
concurrency:
group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
js-linter:
name: JS linter syntax check
runs-on: unbuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '20.x'

- name: Install npm dependencies
run:
npm install --prefix ./_dev

- name: Launch typescript linter
run:
npm run lint --prefix ./_dev

- name: Launch scss linter
run:
npm run lint-scss --prefix ./_dev
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
nbproject

vendor/
node_modules/
/config_*.xml
.php_cs.cache
.idea
.env

## QA Nightly
/artifacts
Expand Down
36 changes: 35 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ Please note PrestaShop 1.6 and older are not maintained anymore.
## Prerequisites

* PrestaShop 1.7 or 8
* PHP 7.1+
* PHP >= 7.1
* Node.js >= 20 - [Download Node.js](https://nodejs.org/) (preference for LTS 20.11.0)

## Installation

Expand All @@ -40,6 +41,7 @@ If you download a ZIP archive that contains the source code or if you want to us

* Clone (`git clone https://github.com/PrestaShop/autoupgrade.git`) or [download](https://github.com/PrestaShop/autoupgrade/archive/master.zip) the source code. You can also download a release **Source code** ([ex. v4.14.2](https://github.com/PrestaShop/autoupgrade/archive/v4.14.2.zip)). If you download a source code archive, you need to extract the file and rename the extracted folder to **autoupgrade**
* Enter into folder **autoupgrade** and run the command `composer install` ([composer](https://getcomposer.org/)).
* Enter into folder **autoupgrade/_dev** and run the commands `npm install` and `npm run build:vite` ([npm](https://docs.npmjs.com/)).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be interesting to list other commands that can help, how to linter, build... Also explain hot-reload

* Create a new ZIP archive from the of **autoupgrade** folder.
* Now you can install it in your shop. For example, you can upload it using the dropzone in Module Manager back office page.

Expand Down Expand Up @@ -91,6 +93,38 @@ The [Storybook folder](/storybook) contains a project allowing you to use Storyb

More information on the project [README](/storybook/README.md).

## Linting and Testing

This section outlines all the commands for code linting and testing. Before running these, ensure you've followed the project setup steps and installed all dependencies.

### Backend

All backend commands should be executed from the root directory.

- `./tests/phpstan/phpstan.sh [version]` ⮕ Runs **PHPStan**, a tool for static code analysis to identify potential errors in your PHP code (requires running a `composer install` in the `tests` folder). Available version options:
- `1.7.2.5`
- `1.7.3.4`
- `1.7.4.4`
- `1.7.5.1`
- `1.7.6`
- `1.7.7`
- `1.7.8`
- `8.0.0`
- `latest`

- `./vendor/bin/phpunit ./tests/unit/` ⮕ Runs **PHPUnit**, a framework for running unit tests on your PHP code. You can modify the path to target specific test files.

- `./vendor/bin/php-cs-fixer` ⮕ Runs **PHP CS Fixer**, a tool that ensures your PHP code follows the correct coding standards. Add the `fix` option to automatically resolve fixable style issues.

### Frontend

All frontend commands should be executed from the `_dev` directory.

- `npm run lint` ⮕ Runs **ESLint** and **Prettier** to perform static code analysis and automatic formatting of your JavaScript code. Add `:fix` to the command to automatically fix fixable issues.

- `npm run lint-scss` ⮕ Runs **Stylelint** to lint and format your SCSS files. You can append `:fix` to automatically resolve solvable formatting issues.


## Contributing

PrestaShop modules are open source extensions to the [PrestaShop e-commerce platform][prestashop]. Everyone is welcome and even encouraged to contribute with their own improvements!
Expand Down
19 changes: 19 additions & 0 deletions _dev/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"tabWidth": 2,
"overrides": [
{
"files": "*.scss",
"options": {
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"singleQuote": false,
"bracketSpacing": true,
"parser": "scss"
}
}
]
}
8 changes: 8 additions & 0 deletions _dev/.stylelintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
extends: '@prestashopcorp/stylelint-config',
rules: {
'comment-empty-line-before': null,
'no-unknown-animations': null,
'scss/at-import-no-partial-leading-underscore': null
}
};
51 changes: 51 additions & 0 deletions _dev/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// @ts-check

import eslint from '@eslint/js';
import tseslintPlugin from '@typescript-eslint/eslint-plugin';
import tseslintParser from '@typescript-eslint/parser';
import eslintPluginPrettier from 'eslint-plugin-prettier';
import globals from 'globals';

export default [
eslint.configs.recommended,
{
files: ['**/*.js'],
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: {
...globals.browser,
...globals.node
}
}
},
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: {
...globals.browser,
...globals.node
},
parser: tseslintParser,
parserOptions: {
project: './tsconfig.json'
}
},
plugins: {
'@typescript-eslint': tseslintPlugin
},
rules: {
...tseslintPlugin.configs.recommended.rules
}
},
{
plugins: {
prettier: eslintPluginPrettier
},
rules: {
...eslintPluginPrettier.configs.recommended.rules
}
}
];
1 change: 1 addition & 0 deletions _dev/img/check.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions _dev/img/close.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions _dev/img/rocket_white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions _dev/img/unfold_more.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading