From 36d046eea7c4e7a6ef058ac282e3539eb2ee66e2 Mon Sep 17 00:00:00 2001 From: Alexis Guyomar Date: Thu, 29 Aug 2024 17:48:55 +0200 Subject: [PATCH 01/27] feat: setup dev folder --- _dev/.babelrc | 5 +++++ _dev/.prettierrc | 6 ++++++ _dev/eslint.config.mjs | 38 ++++++++++++++++++++++++++++++++++++++ _dev/scripts/main.ts | 8 ++++++++ _dev/scripts/test.ts | 5 +++++ _dev/styles/main.scss | 3 +++ _dev/tsconfig.json | 29 +++++++++++++++++++++++++++++ _dev/vite.config.ts | 39 +++++++++++++++++++++++++++++++++++++++ 8 files changed, 133 insertions(+) create mode 100644 _dev/.babelrc create mode 100644 _dev/.prettierrc create mode 100644 _dev/eslint.config.mjs create mode 100644 _dev/scripts/main.ts create mode 100644 _dev/scripts/test.ts create mode 100644 _dev/styles/main.scss create mode 100644 _dev/tsconfig.json create mode 100644 _dev/vite.config.ts diff --git a/_dev/.babelrc b/_dev/.babelrc new file mode 100644 index 000000000..0225dca2f --- /dev/null +++ b/_dev/.babelrc @@ -0,0 +1,5 @@ +{ + "presets": [ + ["@babel/preset-env", { "modules": "commonjs" }] + ] +} diff --git a/_dev/.prettierrc b/_dev/.prettierrc new file mode 100644 index 000000000..b1f77404b --- /dev/null +++ b/_dev/.prettierrc @@ -0,0 +1,6 @@ +{ + "singleQuote": true, + "trailingComma": "none", + "printWidth": 100, + "tabWidth": 2 +} diff --git a/_dev/eslint.config.mjs b/_dev/eslint.config.mjs new file mode 100644 index 000000000..9ed0c1bb2 --- /dev/null +++ b/_dev/eslint.config.mjs @@ -0,0 +1,38 @@ +// @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'; + +export default [ + // Inclure la configuration recommandée d'ESLint + eslint.configs.recommended, + + // Inclure la configuration recommandée pour TypeScript + { + files: ['**/*.ts', '**/*.tsx'], + languageOptions: { + parser: tseslintParser, + parserOptions: { + project: './tsconfig.json' + } + }, + plugins: { + '@typescript-eslint': tseslintPlugin + }, + rules: { + ...tseslintPlugin.configs.recommended.rules + } + }, + + // Inclure la configuration recommandée pour Prettier + { + plugins: { + prettier: eslintPluginPrettier + }, + rules: { + ...eslintPluginPrettier.configs.recommended.rules + } + } +]; diff --git a/_dev/scripts/main.ts b/_dev/scripts/main.ts new file mode 100644 index 000000000..eb3b926e1 --- /dev/null +++ b/_dev/scripts/main.ts @@ -0,0 +1,8 @@ +import yolo from './test'; + +const test = () => { + console.log('test'); + yolo(); +}; + +test(); diff --git a/_dev/scripts/test.ts b/_dev/scripts/test.ts new file mode 100644 index 000000000..32acfe184 --- /dev/null +++ b/_dev/scripts/test.ts @@ -0,0 +1,5 @@ +const yolo = () => { + console.log('yolo'); +}; + +export default yolo; diff --git a/_dev/styles/main.scss b/_dev/styles/main.scss new file mode 100644 index 000000000..92c4408d0 --- /dev/null +++ b/_dev/styles/main.scss @@ -0,0 +1,3 @@ +div.panel-heading { + background: red !important; +} diff --git a/_dev/tsconfig.json b/_dev/tsconfig.json new file mode 100644 index 000000000..bfbb2e0ae --- /dev/null +++ b/_dev/tsconfig.json @@ -0,0 +1,29 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "compilerOptions": { +// "composite": true, +// "declaration": true, +// "declarationMap": true, +// "forceConsistentCasingInFileNames": true, +// "inlineSources": false, +// "suppressImplicitAnyIndexErrors": false, +// "noUnusedLocals": false, +// "noUnusedParameters": false, +// "preserveWatchOutput": true, +// "target": "ESNext", +// "useDefineForClassFields": true, +// "module": "ESNext", +// "moduleResolution": "Node", +// "strict": true, +// "sourceMap": true, +// "resolveJsonModule": true, +// "isolatedModules": true, +// "esModuleInterop": true, +// "lib": ["ESNext", "DOM"], +// "skipLibCheck": true, +// "types": ["@types/jsdom"], + }, + "exclude": [ + "node_modules" + ] +} diff --git a/_dev/vite.config.ts b/_dev/vite.config.ts new file mode 100644 index 000000000..6822623f9 --- /dev/null +++ b/_dev/vite.config.ts @@ -0,0 +1,39 @@ +import { defineConfig } from 'vite'; +import { resolve } from 'path'; +import symfonyPlugin from 'vite-plugin-symfony'; + +export default defineConfig({ + // define global variable like process.env.MY_VAR + define: {}, + plugins: [symfonyPlugin()], + build: { + cssCodeSplit: true, + rollupOptions: { + input: { + main: './scripts/main.ts', + theme: './styles/main.scss' + }, + output: { + validate: true, + dir: resolve(__dirname, '../views/'), + entryFileNames: (chunkInfo) => { + if ( + chunkInfo.facadeModuleId?.endsWith('.ts') || + chunkInfo.facadeModuleId?.endsWith('.js') + ) { + return 'js/autoupgrade.js'; + } + return 'js/[name].js'; + }, + assetFileNames: (assetInfo) => { + if (assetInfo.name?.endsWith('.css')) { + return 'css/autoupgrade.css'; + } + return 'css/[name].[ext]'; + }, + // set global variable to let it then building like $ of jQuery + globals: {} + } + } + } +}); From 303127d6cea6a119815a38d5ad55e29711f9c71c Mon Sep 17 00:00:00 2001 From: Alexis Guyomar Date: Thu, 29 Aug 2024 17:50:10 +0200 Subject: [PATCH 02/27] feat: setup controller to handle assets generated by vite in dev or production --- .env.example | 1 + .gitignore | 1 + autoupgrade.php | 12 + composer.json | 3 +- composer.lock | 539 ++++++++++++------ .../admin/AdminSelfUpgradeController.php | 10 + views/templates/module-script-tag.html.twig | 1 + 7 files changed, 405 insertions(+), 162 deletions(-) create mode 100644 .env.example create mode 100644 views/templates/module-script-tag.html.twig diff --git a/.env.example b/.env.example new file mode 100644 index 000000000..1d13a2c45 --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +AUTOUPGRADE_DEV_WATCH_MODE=0 diff --git a/.gitignore b/.gitignore index f6c7a124b..1651b1ccd 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ vendor/ /config_*.xml .php_cs.cache .idea +.env ## QA Nightly /artifacts diff --git a/autoupgrade.php b/autoupgrade.php index 4b0b1b7c9..16b2ea036 100644 --- a/autoupgrade.php +++ b/autoupgrade.php @@ -24,6 +24,8 @@ * @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) */ +use Dotenv\Dotenv; + class Autoupgrade extends Module { /** @@ -57,6 +59,8 @@ public function __construct() $this->description = $this->trans('Upgrade to the latest version of PrestaShop in a few clicks, thanks to this automated method.'); $this->ps_versions_compliancy = ['min' => '1.7.0.0', 'max' => _PS_VERSION_]; + + $this->loadEnv(); } /** @@ -191,4 +195,12 @@ public function trans($id, array $parameters = [], $domain = null, $locale = nul return $translator->trans($id, $parameters); } + + private function loadEnv() + { + if (file_exists(__DIR__ . '/.env')) { + $dotenv = Dotenv::create(__DIR__); + $dotenv->load(); + } + } } diff --git a/composer.json b/composer.json index 8514d703c..583c14ba0 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,8 @@ "ext-zip": "*", "symfony/filesystem": "^3.0", "doctrine/collections": "~1.3.0", - "segmentio/analytics-php": "^1.8" + "segmentio/analytics-php": "^1.8", + "vlucas/phpdotenv": "^5.5" }, "require-dev": { "phpunit/phpunit": "^5", diff --git a/composer.lock b/composer.lock index 47a6f063b..d23088805 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f5fa53f72144ec38a19d2640d53ba2ba", + "content-hash": "b177323f563393898ea1ec8bbb666e37", "packages": [ { "name": "doctrine/collections", @@ -75,6 +75,139 @@ }, "time": "2015-04-14T22:21:58+00:00" }, + { + "name": "graham-campbell/result-type", + "version": "v1.0.4", + "source": { + "type": "git", + "url": "https://github.com/GrahamCampbell/Result-Type.git", + "reference": "0690bde05318336c7221785f2a932467f98b64ca" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/0690bde05318336c7221785f2a932467f98b64ca", + "reference": "0690bde05318336c7221785f2a932467f98b64ca", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0", + "phpoption/phpoption": "^1.8" + }, + "require-dev": { + "phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.19 || ^9.5.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "GrahamCampbell\\ResultType\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + } + ], + "description": "An Implementation Of The Result Type", + "keywords": [ + "Graham Campbell", + "GrahamCampbell", + "Result Type", + "Result-Type", + "result" + ], + "support": { + "issues": "https://github.com/GrahamCampbell/Result-Type/issues", + "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.0.4" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/graham-campbell/result-type", + "type": "tidelift" + } + ], + "time": "2021-11-21T21:41:47+00:00" + }, + { + "name": "phpoption/phpoption", + "version": "1.8.1", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/php-option.git", + "reference": "eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15", + "reference": "eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.19 || ^9.5.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8-dev" + } + }, + "autoload": { + "psr-4": { + "PhpOption\\": "src/PhpOption/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh" + }, + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + } + ], + "description": "Option Type for PHP", + "keywords": [ + "language", + "option", + "php", + "type" + ], + "support": { + "issues": "https://github.com/schmittjoh/php-option/issues", + "source": "https://github.com/schmittjoh/php-option/tree/1.8.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption", + "type": "tidelift" + } + ], + "time": "2021-12-04T23:24:31+00:00" + }, { "name": "segmentio/analytics-php", "version": "1.8.0", @@ -270,6 +403,250 @@ } ], "time": "2024-05-31T15:07:36+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.30.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fd22ab50000ef01661e2a31d850ebaa297f8e03c", + "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.30.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-06-19T12:30:46+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.30.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "77fa7995ac1b21ab60769b7323d600a991a90433" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/77fa7995ac1b21ab60769b7323d600a991a90433", + "reference": "77fa7995ac1b21ab60769b7323d600a991a90433", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.30.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-05-31T15:07:36+00:00" + }, + { + "name": "vlucas/phpdotenv", + "version": "v5.5.0", + "source": { + "type": "git", + "url": "https://github.com/vlucas/phpdotenv.git", + "reference": "1a7ea2afc49c3ee6d87061f5a233e3a035d0eae7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/1a7ea2afc49c3ee6d87061f5a233e3a035d0eae7", + "reference": "1a7ea2afc49c3ee6d87061f5a233e3a035d0eae7", + "shasum": "" + }, + "require": { + "ext-pcre": "*", + "graham-campbell/result-type": "^1.0.2", + "php": "^7.1.3 || ^8.0", + "phpoption/phpoption": "^1.8", + "symfony/polyfill-ctype": "^1.23", + "symfony/polyfill-mbstring": "^1.23.1", + "symfony/polyfill-php80": "^1.23.1" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "ext-filter": "*", + "phpunit/phpunit": "^7.5.20 || ^8.5.30 || ^9.5.25" + }, + "suggest": { + "ext-filter": "Required to use the boolean validator." + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": true + }, + "branch-alias": { + "dev-master": "5.5-dev" + } + }, + "autoload": { + "psr-4": { + "Dotenv\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Vance Lucas", + "email": "vance@vancelucas.com", + "homepage": "https://github.com/vlucas" + } + ], + "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", + "keywords": [ + "dotenv", + "env", + "environment" + ], + "support": { + "issues": "https://github.com/vlucas/phpdotenv/issues", + "source": "https://github.com/vlucas/phpdotenv/tree/v5.5.0" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv", + "type": "tidelift" + } + ], + "time": "2022-10-16T01:01:54+00:00" } ], "packages-dev": [ @@ -3064,86 +3441,6 @@ ], "time": "2022-07-20T09:59:04+00:00" }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.30.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fd22ab50000ef01661e2a31d850ebaa297f8e03c", - "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-mbstring": "*" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.30.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-06-19T12:30:46+00:00" - }, { "name": "symfony/polyfill-php70", "version": "v1.20.0", @@ -3285,86 +3582,6 @@ ], "time": "2024-06-19T12:30:46+00:00" }, - { - "name": "symfony/polyfill-php80", - "version": "v1.30.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "77fa7995ac1b21ab60769b7323d600a991a90433" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/77fa7995ac1b21ab60769b7323d600a991a90433", - "reference": "77fa7995ac1b21ab60769b7323d600a991a90433", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.30.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-05-31T15:07:36+00:00" - }, { "name": "symfony/process", "version": "v4.4.44", diff --git a/controllers/admin/AdminSelfUpgradeController.php b/controllers/admin/AdminSelfUpgradeController.php index a6479631f..8031d0730 100644 --- a/controllers/admin/AdminSelfUpgradeController.php +++ b/controllers/admin/AdminSelfUpgradeController.php @@ -526,6 +526,16 @@ public function initContent() ->getJson() ); + if (!empty($_ENV['AUTOUPGRADE_DEV_WATCH_MODE']) && $_ENV['AUTOUPGRADE_DEV_WATCH_MODE'] !== "1") { + $vite_dev_url = 'http://localhost:5173/build/'; + $this->context->controller->addCSS($vite_dev_url . 'styles/main.scss'); + $twig = $this->upgradeContainer->getTwig(); + return $twig->render('@ModuleAutoUpgrade/module-script-tag.html.twig', [ 'src' => $vite_dev_url . 'scripts/main.ts' ]); + } else { + $this->context->controller->addCSS(_PS_ROOT_DIR_ . 'modules/autoupgrade/views/css/autoupgrade.css'); + $this->context->controller->addJS(_PS_ROOT_DIR_ . 'modules/autoupgrade/views/js/autoupgrade.js?version='); + } + return parent::initContent(); } } diff --git a/views/templates/module-script-tag.html.twig b/views/templates/module-script-tag.html.twig new file mode 100644 index 000000000..84d5c36bb --- /dev/null +++ b/views/templates/module-script-tag.html.twig @@ -0,0 +1 @@ + From 6d9fd6ed624c6dd0b411332530b080b62b4ffa1c Mon Sep 17 00:00:00 2001 From: Alexis Guyomar Date: Fri, 30 Aug 2024 11:04:46 +0200 Subject: [PATCH 03/27] fix: vite configuration for dev and prod --- _dev/eslint.config.mjs | 7 ++++++ _dev/img/unfold_more.png | Bin 0 -> 820 bytes _dev/img/unfold_more.svg | 1 + _dev/styles/main.scss | 13 +++++++++-- _dev/vite.config.ts | 16 ++++++------- _dev/vite.dev.config.ts | 22 ++++++++++++++++++ .../admin/AdminSelfUpgradeController.php | 8 +++---- 7 files changed, 52 insertions(+), 15 deletions(-) create mode 100644 _dev/img/unfold_more.png create mode 100644 _dev/img/unfold_more.svg create mode 100644 _dev/vite.dev.config.ts diff --git a/_dev/eslint.config.mjs b/_dev/eslint.config.mjs index 9ed0c1bb2..313a25946 100644 --- a/_dev/eslint.config.mjs +++ b/_dev/eslint.config.mjs @@ -4,6 +4,7 @@ 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 [ // Inclure la configuration recommandée d'ESLint @@ -13,6 +14,12 @@ export default [ { files: ['**/*.ts', '**/*.tsx'], languageOptions: { + ecmaVersion: 2022, + sourceType: 'module', + globals: { + ...globals.browser, + ...globals.node + }, parser: tseslintParser, parserOptions: { project: './tsconfig.json' diff --git a/_dev/img/unfold_more.png b/_dev/img/unfold_more.png new file mode 100644 index 0000000000000000000000000000000000000000..c37b255675bce9c02d29cf376f37952e0e3e364f GIT binary patch literal 820 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7Ro>VEXOp;uum9_x6rsP_u&w%Y}on zd<*1`ytz7grMmIEuL`diHwkBJYz)%$_{Za1y1mToCd2$MkJA+rUrdU>z+#nAD(=t5 zAkV^Pz+k~xP+8uc^Y!{4RhFy<)rYGUE--E3h-YjRT9EqV4Mzz>cFXx52i5?oy8BC)KV05nXX{dbF>!a& zGR760|9_Q!p3z)?|DAlOpa#RV7JIp$t2hc8#2#uZJ1|DIt?y!Bj!>>~Wsx{={H)#o znMQvWm%f{NzU&y|_dA=Wa_nBc{cLT?ZQbe3j8FIl9anJf7hn|oSHN{QXmeWha)D_r z@-7W+{)`6KIdu=&H#6|hXL}&AF!hHqhseWV#vYE^>2Y4{cV2|wKY#R=Zq|XhxBP!d z2=KmNub0lSVGSdC2sH>ZOfP4bV3@*Qo?}2KpfNKEP{6{(~RGXrHh%l_Rax|=wYFNs#3h4JMN<7Uk&I^|)hc7FY!acUpu#0!#s=Fh)P=3B5#ScxOY{oi|2zm(^Kr?W8I_ZY_V# ymCW{h>8kzIUvR0sQ)MM{!&e@7%EKM5|9Sm&ZWesjU~vNG1_n=8KbLh*2~7ZPuu^IO literal 0 HcmV?d00001 diff --git a/_dev/img/unfold_more.svg b/_dev/img/unfold_more.svg new file mode 100644 index 000000000..23a5fc969 --- /dev/null +++ b/_dev/img/unfold_more.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/_dev/styles/main.scss b/_dev/styles/main.scss index 92c4408d0..b90a0df5e 100644 --- a/_dev/styles/main.scss +++ b/_dev/styles/main.scss @@ -1,3 +1,12 @@ -div.panel-heading { - background: red !important; +select { + padding-inline-end: 2rem; + background-image: url("../img/unfold_more.png") !important; + background-repeat: no-repeat; + background-position: right 0.5rem center; + background-size: 1.125rem 1.125rem; + appearance: none; + + &.error { + margin-block-end: 0.25rem; + } } diff --git a/_dev/vite.config.ts b/_dev/vite.config.ts index 6822623f9..602e7fa0b 100644 --- a/_dev/vite.config.ts +++ b/_dev/vite.config.ts @@ -1,12 +1,11 @@ import { defineConfig } from 'vite'; import { resolve } from 'path'; -import symfonyPlugin from 'vite-plugin-symfony'; +import { unlinkSync } from 'fs'; export default defineConfig({ - // define global variable like process.env.MY_VAR - define: {}, - plugins: [symfonyPlugin()], + base: './', build: { + assetsInlineLimit: 0, cssCodeSplit: true, rollupOptions: { input: { @@ -14,7 +13,6 @@ export default defineConfig({ theme: './styles/main.scss' }, output: { - validate: true, dir: resolve(__dirname, '../views/'), entryFileNames: (chunkInfo) => { if ( @@ -28,11 +26,11 @@ export default defineConfig({ assetFileNames: (assetInfo) => { if (assetInfo.name?.endsWith('.css')) { return 'css/autoupgrade.css'; + } else if (/\.(webp|png|jpe?g|gif|svg)$/.test(assetInfo.name)) { + return 'img/[name].[ext]'; } - return 'css/[name].[ext]'; - }, - // set global variable to let it then building like $ of jQuery - globals: {} + return 'assets/[name].[ext]'; + } } } } diff --git a/_dev/vite.dev.config.ts b/_dev/vite.dev.config.ts new file mode 100644 index 000000000..7ec3fc228 --- /dev/null +++ b/_dev/vite.dev.config.ts @@ -0,0 +1,22 @@ +import { defineConfig } from 'vite'; + +export default defineConfig({ + server: { + // Configure la racine pour servir les fichiers à partir du bon répertoire + fs: { + strict: false + } + }, + build: { + rollupOptions: { + input: { + main: './scripts/main.ts', + theme: './styles/main.scss' + }, + output: { + // Assurez-vous que les fichiers sont sortis dans le bon répertoire + dir: 'public' + } + } + } +}); diff --git a/controllers/admin/AdminSelfUpgradeController.php b/controllers/admin/AdminSelfUpgradeController.php index 8031d0730..50d5dc54a 100644 --- a/controllers/admin/AdminSelfUpgradeController.php +++ b/controllers/admin/AdminSelfUpgradeController.php @@ -526,14 +526,14 @@ public function initContent() ->getJson() ); - if (!empty($_ENV['AUTOUPGRADE_DEV_WATCH_MODE']) && $_ENV['AUTOUPGRADE_DEV_WATCH_MODE'] !== "1") { - $vite_dev_url = 'http://localhost:5173/build/'; + if (!empty($_ENV['AUTOUPGRADE_DEV_WATCH_MODE']) && $_ENV['AUTOUPGRADE_DEV_WATCH_MODE'] === "1") { + $vite_dev_url = 'http://localhost:5173/'; $this->context->controller->addCSS($vite_dev_url . 'styles/main.scss'); $twig = $this->upgradeContainer->getTwig(); - return $twig->render('@ModuleAutoUpgrade/module-script-tag.html.twig', [ 'src' => $vite_dev_url . 'scripts/main.ts' ]); + $this->content .= $twig->render('@ModuleAutoUpgrade/module-script-tag.html.twig', [ 'src' => $vite_dev_url . 'scripts/main.ts' ]); } else { $this->context->controller->addCSS(_PS_ROOT_DIR_ . 'modules/autoupgrade/views/css/autoupgrade.css'); - $this->context->controller->addJS(_PS_ROOT_DIR_ . 'modules/autoupgrade/views/js/autoupgrade.js?version='); + $this->context->controller->addJS(_PS_ROOT_DIR_ . 'modules/autoupgrade/views/js/autoupgrade.js?version=' . $this->context->controller->module->version); } return parent::initContent(); From a3a58414d0b642eae33d83b54fccff466fdf8c15 Mon Sep 17 00:00:00 2001 From: Alexis Guyomar Date: Fri, 30 Aug 2024 11:05:15 +0200 Subject: [PATCH 04/27] fix: remove unused function --- _dev/vite.config.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/_dev/vite.config.ts b/_dev/vite.config.ts index 602e7fa0b..97026852d 100644 --- a/_dev/vite.config.ts +++ b/_dev/vite.config.ts @@ -1,6 +1,5 @@ import { defineConfig } from 'vite'; import { resolve } from 'path'; -import { unlinkSync } from 'fs'; export default defineConfig({ base: './', From fc5570030e8de3ff3d2dd45a83b0c3a1c15f6a5d Mon Sep 17 00:00:00 2001 From: Alexis Guyomar Date: Fri, 30 Aug 2024 11:18:21 +0200 Subject: [PATCH 05/27] fix: add package.json --- _dev/package.json | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 _dev/package.json diff --git a/_dev/package.json b/_dev/package.json new file mode 100644 index 000000000..f2f8e419f --- /dev/null +++ b/_dev/package.json @@ -0,0 +1,47 @@ +{ + "name": "autoupgrade", + "version": "7.0.0", + "type": "module", + "description": "Upgrade to the latest version of PrestaShop in a few clicks, thanks to this automated method.", + "scripts": { + "vite:watch": "vite --config vite.dev.config.ts", + "vite:build": "vite build", + "lint": "eslint", + "lint:fix": "eslint --fix", + "format": "prettier --write \"**/*.{ts,js}\"" + }, + "repository": { + "type": "git", + "url": "git@github.com:PrestaShop/autoupgrade.git" + }, + "author": "PrestaShop", + "license": "AFL", + "bugs": { + "url": "https://github.com/PrestaShop/autoupgrade/issues" + }, + "homepage": "https://github.com/PrestaShop/autoupgrade#readme", + "devDependencies": { + "@babel/core": "^7.25.2", + "@babel/preset-env": "^7.25.4", + "@eslint/js": "^9.9.1", + "@types/eslint__js": "^8.42.3", + "@types/jsdom": "^21.1.7", + "@types/node": "^22.5.1", + "@typescript-eslint/eslint-plugin": "^8.3.0", + "@typescript-eslint/parser": "^8.3.0", + "autoprefixer": "^10.4.20", + "eslint": "^9.9.1", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-prettier": "^5.2.1", + "globals": "^15.9.0", + "postcss": "^8.4.41", + "postcss-cli": "^11.0.0", + "prettier": "3.3.3", + "sass": "^1.77.8", + "ts-jest": "^29.2.5", + "ts-loader": "^9.5.1", + "typescript": "^5.5.4", + "typescript-eslint": "^8.3.0", + "vite": "^5.4.1" + } +} From 7415e74fc534f87fe14b87aa66d02ed5e5b88c23 Mon Sep 17 00:00:00 2001 From: Alexis Guyomar Date: Fri, 30 Aug 2024 16:32:44 +0200 Subject: [PATCH 06/27] fix: dotenv --- autoupgrade.php | 12 - composer.json | 2 +- composer.lock | 572 +++++++----------- .../admin/AdminSelfUpgradeController.php | 10 + 4 files changed, 223 insertions(+), 373 deletions(-) diff --git a/autoupgrade.php b/autoupgrade.php index 16b2ea036..4b0b1b7c9 100644 --- a/autoupgrade.php +++ b/autoupgrade.php @@ -24,8 +24,6 @@ * @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) */ -use Dotenv\Dotenv; - class Autoupgrade extends Module { /** @@ -59,8 +57,6 @@ public function __construct() $this->description = $this->trans('Upgrade to the latest version of PrestaShop in a few clicks, thanks to this automated method.'); $this->ps_versions_compliancy = ['min' => '1.7.0.0', 'max' => _PS_VERSION_]; - - $this->loadEnv(); } /** @@ -195,12 +191,4 @@ public function trans($id, array $parameters = [], $domain = null, $locale = nul return $translator->trans($id, $parameters); } - - private function loadEnv() - { - if (file_exists(__DIR__ . '/.env')) { - $dotenv = Dotenv::create(__DIR__); - $dotenv->load(); - } - } } diff --git a/composer.json b/composer.json index 583c14ba0..5483afca8 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "symfony/filesystem": "^3.0", "doctrine/collections": "~1.3.0", "segmentio/analytics-php": "^1.8", - "vlucas/phpdotenv": "^5.5" + "symfony/dotenv": "^4.4" }, "require-dev": { "phpunit/phpunit": "^5", diff --git a/composer.lock b/composer.lock index d23088805..f3e9768fb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b177323f563393898ea1ec8bbb666e37", + "content-hash": "9e0434108302bde61534a684cd60e35d", "packages": [ { "name": "doctrine/collections", @@ -75,139 +75,6 @@ }, "time": "2015-04-14T22:21:58+00:00" }, - { - "name": "graham-campbell/result-type", - "version": "v1.0.4", - "source": { - "type": "git", - "url": "https://github.com/GrahamCampbell/Result-Type.git", - "reference": "0690bde05318336c7221785f2a932467f98b64ca" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/0690bde05318336c7221785f2a932467f98b64ca", - "reference": "0690bde05318336c7221785f2a932467f98b64ca", - "shasum": "" - }, - "require": { - "php": "^7.0 || ^8.0", - "phpoption/phpoption": "^1.8" - }, - "require-dev": { - "phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.19 || ^9.5.8" - }, - "type": "library", - "autoload": { - "psr-4": { - "GrahamCampbell\\ResultType\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - } - ], - "description": "An Implementation Of The Result Type", - "keywords": [ - "Graham Campbell", - "GrahamCampbell", - "Result Type", - "Result-Type", - "result" - ], - "support": { - "issues": "https://github.com/GrahamCampbell/Result-Type/issues", - "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.0.4" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/graham-campbell/result-type", - "type": "tidelift" - } - ], - "time": "2021-11-21T21:41:47+00:00" - }, - { - "name": "phpoption/phpoption", - "version": "1.8.1", - "source": { - "type": "git", - "url": "https://github.com/schmittjoh/php-option.git", - "reference": "eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15", - "reference": "eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15", - "shasum": "" - }, - "require": { - "php": "^7.0 || ^8.0" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.4.1", - "phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.19 || ^9.5.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.8-dev" - } - }, - "autoload": { - "psr-4": { - "PhpOption\\": "src/PhpOption/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Johannes M. Schmitt", - "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh" - }, - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - } - ], - "description": "Option Type for PHP", - "keywords": [ - "language", - "option", - "php", - "type" - ], - "support": { - "issues": "https://github.com/schmittjoh/php-option/issues", - "source": "https://github.com/schmittjoh/php-option/tree/1.8.1" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption", - "type": "tidelift" - } - ], - "time": "2021-12-04T23:24:31+00:00" - }, { "name": "segmentio/analytics-php", "version": "1.8.0", @@ -264,27 +131,29 @@ "time": "2021-05-31T22:44:22+00:00" }, { - "name": "symfony/filesystem", - "version": "v3.4.47", + "name": "symfony/dotenv", + "version": "v4.4.37", "source": { "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "e58d7841cddfed6e846829040dca2cca0ebbbbb3" + "url": "https://github.com/symfony/dotenv.git", + "reference": "fcedd6d382b3afc3e1e786aa4e4fc4cf06f564cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/e58d7841cddfed6e846829040dca2cca0ebbbbb3", - "reference": "e58d7841cddfed6e846829040dca2cca0ebbbbb3", + "url": "https://api.github.com/repos/symfony/dotenv/zipball/fcedd6d382b3afc3e1e786aa4e4fc4cf06f564cf", + "reference": "fcedd6d382b3afc3e1e786aa4e4fc4cf06f564cf", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-ctype": "~1.8" + "php": ">=7.1.3" + }, + "require-dev": { + "symfony/process": "^3.4.2|^4.0|^5.0" }, "type": "library", "autoload": { "psr-4": { - "Symfony\\Component\\Filesystem\\": "" + "Symfony\\Component\\Dotenv\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -304,10 +173,15 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Filesystem Component", + "description": "Registers environment variables from a .env file", "homepage": "https://symfony.com", + "keywords": [ + "dotenv", + "env", + "environment" + ], "support": { - "source": "https://github.com/symfony/filesystem/tree/v3.4.47" + "source": "https://github.com/symfony/dotenv/tree/v4.4.37" }, "funding": [ { @@ -323,45 +197,34 @@ "type": "tidelift" } ], - "time": "2020-10-24T10:57:07+00:00" + "time": "2022-01-02T09:41:36+00:00" }, { - "name": "symfony/polyfill-ctype", - "version": "v1.30.0", + "name": "symfony/filesystem", + "version": "v3.4.47", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "0424dff1c58f028c451efff2045f5d92410bd540" + "url": "https://github.com/symfony/filesystem.git", + "reference": "e58d7841cddfed6e846829040dca2cca0ebbbbb3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/0424dff1c58f028c451efff2045f5d92410bd540", - "reference": "0424dff1c58f028c451efff2045f5d92410bd540", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/e58d7841cddfed6e846829040dca2cca0ebbbbb3", + "reference": "e58d7841cddfed6e846829040dca2cca0ebbbbb3", "shasum": "" }, "require": { - "php": ">=7.1" - }, - "provide": { - "ext-ctype": "*" - }, - "suggest": { - "ext-ctype": "For best performance" + "php": "^5.5.9|>=7.0.8", + "symfony/polyfill-ctype": "~1.8" }, "type": "library", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, "autoload": { - "files": [ - "bootstrap.php" - ], "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - } + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -369,24 +232,18 @@ ], "authors": [ { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for ctype functions", + "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.30.0" + "source": "https://github.com/symfony/filesystem/tree/v3.4.47" }, "funding": [ { @@ -402,30 +259,30 @@ "type": "tidelift" } ], - "time": "2024-05-31T15:07:36+00:00" + "time": "2020-10-24T10:57:07+00:00" }, { - "name": "symfony/polyfill-mbstring", + "name": "symfony/polyfill-ctype", "version": "v1.30.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c" + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "0424dff1c58f028c451efff2045f5d92410bd540" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fd22ab50000ef01661e2a31d850ebaa297f8e03c", - "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/0424dff1c58f028c451efff2045f5d92410bd540", + "reference": "0424dff1c58f028c451efff2045f5d92410bd540", "shasum": "" }, "require": { "php": ">=7.1" }, "provide": { - "ext-mbstring": "*" + "ext-ctype": "*" }, "suggest": { - "ext-mbstring": "For best performance" + "ext-ctype": "For best performance" }, "type": "library", "extra": { @@ -439,7 +296,7 @@ "bootstrap.php" ], "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" + "Symfony\\Polyfill\\Ctype\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -448,105 +305,24 @@ ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.30.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-06-19T12:30:46+00:00" - }, - { - "name": "symfony/polyfill-php80", - "version": "v1.30.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "77fa7995ac1b21ab60769b7323d600a991a90433" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/77fa7995ac1b21ab60769b7323d600a991a90433", - "reference": "77fa7995ac1b21ab60769b7323d600a991a90433", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "description": "Symfony polyfill for ctype functions", "homepage": "https://symfony.com", "keywords": [ "compatibility", + "ctype", "polyfill", - "portable", - "shim" + "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.30.0" }, "funding": [ { @@ -563,90 +339,6 @@ } ], "time": "2024-05-31T15:07:36+00:00" - }, - { - "name": "vlucas/phpdotenv", - "version": "v5.5.0", - "source": { - "type": "git", - "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "1a7ea2afc49c3ee6d87061f5a233e3a035d0eae7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/1a7ea2afc49c3ee6d87061f5a233e3a035d0eae7", - "reference": "1a7ea2afc49c3ee6d87061f5a233e3a035d0eae7", - "shasum": "" - }, - "require": { - "ext-pcre": "*", - "graham-campbell/result-type": "^1.0.2", - "php": "^7.1.3 || ^8.0", - "phpoption/phpoption": "^1.8", - "symfony/polyfill-ctype": "^1.23", - "symfony/polyfill-mbstring": "^1.23.1", - "symfony/polyfill-php80": "^1.23.1" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.4.1", - "ext-filter": "*", - "phpunit/phpunit": "^7.5.20 || ^8.5.30 || ^9.5.25" - }, - "suggest": { - "ext-filter": "Required to use the boolean validator." - }, - "type": "library", - "extra": { - "bamarni-bin": { - "bin-links": true, - "forward-command": true - }, - "branch-alias": { - "dev-master": "5.5-dev" - } - }, - "autoload": { - "psr-4": { - "Dotenv\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - }, - { - "name": "Vance Lucas", - "email": "vance@vancelucas.com", - "homepage": "https://github.com/vlucas" - } - ], - "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", - "keywords": [ - "dotenv", - "env", - "environment" - ], - "support": { - "issues": "https://github.com/vlucas/phpdotenv/issues", - "source": "https://github.com/vlucas/phpdotenv/tree/v5.5.0" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv", - "type": "tidelift" - } - ], - "time": "2022-10-16T01:01:54+00:00" } ], "packages-dev": [ @@ -3441,6 +3133,86 @@ ], "time": "2022-07-20T09:59:04+00:00" }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.30.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fd22ab50000ef01661e2a31d850ebaa297f8e03c", + "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.30.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-06-19T12:30:46+00:00" + }, { "name": "symfony/polyfill-php70", "version": "v1.20.0", @@ -3582,6 +3354,86 @@ ], "time": "2024-06-19T12:30:46+00:00" }, + { + "name": "symfony/polyfill-php80", + "version": "v1.30.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "77fa7995ac1b21ab60769b7323d600a991a90433" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/77fa7995ac1b21ab60769b7323d600a991a90433", + "reference": "77fa7995ac1b21ab60769b7323d600a991a90433", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.30.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-05-31T15:07:36+00:00" + }, { "name": "symfony/process", "version": "v4.4.44", diff --git a/controllers/admin/AdminSelfUpgradeController.php b/controllers/admin/AdminSelfUpgradeController.php index 50d5dc54a..6727a0e60 100644 --- a/controllers/admin/AdminSelfUpgradeController.php +++ b/controllers/admin/AdminSelfUpgradeController.php @@ -124,6 +124,8 @@ public function __construct() require_once $autoloadPath; } + $this->loadEnv(); + @set_time_limit(0); @ini_set('max_execution_time', '0'); @ini_set('magic_quotes_runtime', '0'); @@ -538,4 +540,12 @@ public function initContent() return parent::initContent(); } + + private function loadEnv() + { + if (file_exists(__DIR__ . '/../../.env')) { + $dotenv = new Symfony\Component\Dotenv\Dotenv(); + $dotenv->load(__DIR__ . '/../../.env'); + } + } } From 45f5c7d8015fc3976d5f55a813a38aa3f1642d26 Mon Sep 17 00:00:00 2001 From: Alexis Guyomar Date: Fri, 30 Aug 2024 17:04:25 +0200 Subject: [PATCH 07/27] fix: cs fixer and php stan issues --- .gitignore | 1 + classes/UpgradeContainer.php | 2 +- controllers/admin/AdminSelfUpgradeController.php | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 1651b1ccd..e96ddc0b7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ nbproject vendor/ +node_modules/ /config_*.xml .php_cs.cache .idea diff --git a/classes/UpgradeContainer.php b/classes/UpgradeContainer.php index 07eec9120..ddee770d4 100644 --- a/classes/UpgradeContainer.php +++ b/classes/UpgradeContainer.php @@ -519,7 +519,7 @@ public function getTranslator(): Translator /** * @throws LoaderError * - * @return \Twig\Environment|\Twig_Environment + * @return \Twig\Environment */ public function getTwig() { diff --git a/controllers/admin/AdminSelfUpgradeController.php b/controllers/admin/AdminSelfUpgradeController.php index 6727a0e60..cbf76ba01 100644 --- a/controllers/admin/AdminSelfUpgradeController.php +++ b/controllers/admin/AdminSelfUpgradeController.php @@ -528,20 +528,20 @@ public function initContent() ->getJson() ); - if (!empty($_ENV['AUTOUPGRADE_DEV_WATCH_MODE']) && $_ENV['AUTOUPGRADE_DEV_WATCH_MODE'] === "1") { + if (!empty($_ENV['AUTOUPGRADE_DEV_WATCH_MODE']) && $_ENV['AUTOUPGRADE_DEV_WATCH_MODE'] === '1') { $vite_dev_url = 'http://localhost:5173/'; $this->context->controller->addCSS($vite_dev_url . 'styles/main.scss'); $twig = $this->upgradeContainer->getTwig(); - $this->content .= $twig->render('@ModuleAutoUpgrade/module-script-tag.html.twig', [ 'src' => $vite_dev_url . 'scripts/main.ts' ]); + $this->content .= $twig->render('@ModuleAutoUpgrade/module-script-tag.html.twig', ['src' => $vite_dev_url . 'scripts/main.ts']); } else { $this->context->controller->addCSS(_PS_ROOT_DIR_ . 'modules/autoupgrade/views/css/autoupgrade.css'); - $this->context->controller->addJS(_PS_ROOT_DIR_ . 'modules/autoupgrade/views/js/autoupgrade.js?version=' . $this->context->controller->module->version); + $this->context->controller->addJS(_PS_ROOT_DIR_ . 'modules/autoupgrade/views/js/autoupgrade.js?version=' . $this->module->version); } return parent::initContent(); } - private function loadEnv() + private function loadEnv(): void { if (file_exists(__DIR__ . '/../../.env')) { $dotenv = new Symfony\Component\Dotenv\Dotenv(); From 63c23ec85b00d47e6f49741b4fd934b45fde6c94 Mon Sep 17 00:00:00 2001 From: Alexis Guyomar Date: Fri, 30 Aug 2024 17:09:28 +0200 Subject: [PATCH 08/27] fix: 5.6 syntax check --- controllers/admin/AdminSelfUpgradeController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/controllers/admin/AdminSelfUpgradeController.php b/controllers/admin/AdminSelfUpgradeController.php index cbf76ba01..c19d962f2 100644 --- a/controllers/admin/AdminSelfUpgradeController.php +++ b/controllers/admin/AdminSelfUpgradeController.php @@ -541,7 +541,10 @@ public function initContent() return parent::initContent(); } - private function loadEnv(): void + /** + * @return void + */ + private function loadEnv() { if (file_exists(__DIR__ . '/../../.env')) { $dotenv = new Symfony\Component\Dotenv\Dotenv(); From fce38b6b5278470f2dc763a63eb317c211f58848 Mon Sep 17 00:00:00 2001 From: Alexis Guyomar Date: Mon, 2 Sep 2024 09:34:23 +0200 Subject: [PATCH 09/27] feat: add CI for build and check lint JS --- .github/workflows/build-release.yml | 14 +++++++++++++- .github/workflows/js.yml | 25 +++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/js.yml diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index e5b9b1182..8693d0069 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -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.11.0' + + - name: Install and build npm dependencies + run: + npm install --prefix ./_dev + npm vite:build --prefix ./_dev + - name: Clean-up project uses: PrestaShopCorp/github-action-clean-before-deploy@v2.0 with: - paths: storybook + paths: + - storybook + - _dev - name: Create & upload artifact uses: actions/upload-artifact@v4.1.0 diff --git a/.github/workflows/js.yml b/.github/workflows/js.yml new file mode 100644 index 000000000..fbd4ceec0 --- /dev/null +++ b/.github/workflows/js.yml @@ -0,0 +1,25 @@ +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.1.3 + + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: '20.11.0' + + - name: Install npm dependencies + run: + npm install --prefix ./_dev + + - name: Launch Eslint + run: + npm lint --prefix ./_dev From 0edf2611c448e1bb3fefa76b1ca716d1d5a0a636 Mon Sep 17 00:00:00 2001 From: Alexis Guyomar Date: Mon, 2 Sep 2024 09:48:12 +0200 Subject: [PATCH 10/27] fix: eslint config --- _dev/eslint.config.mjs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/_dev/eslint.config.mjs b/_dev/eslint.config.mjs index 313a25946..d47830c8d 100644 --- a/_dev/eslint.config.mjs +++ b/_dev/eslint.config.mjs @@ -7,10 +7,7 @@ import eslintPluginPrettier from 'eslint-plugin-prettier'; import globals from 'globals'; export default [ - // Inclure la configuration recommandée d'ESLint eslint.configs.recommended, - - // Inclure la configuration recommandée pour TypeScript { files: ['**/*.ts', '**/*.tsx'], languageOptions: { @@ -32,8 +29,6 @@ export default [ ...tseslintPlugin.configs.recommended.rules } }, - - // Inclure la configuration recommandée pour Prettier { plugins: { prettier: eslintPluginPrettier From 9860247d1584959379239ad36dc61f0b6eb637f2 Mon Sep 17 00:00:00 2001 From: Alexis Guyomar Date: Mon, 2 Sep 2024 10:50:56 +0200 Subject: [PATCH 11/27] feat: update ci and readme --- .github/workflows/build-release.yml | 2 +- .github/workflows/js.yml | 4 ++-- README.md | 4 +++- storybook/README.md | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 8693d0069..6f1fa0c48 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -28,7 +28,7 @@ jobs: - name: Install and build npm dependencies run: npm install --prefix ./_dev - npm vite:build --prefix ./_dev + npm run vite:build --prefix ./_dev - name: Clean-up project uses: PrestaShopCorp/github-action-clean-before-deploy@v2.0 diff --git a/.github/workflows/js.yml b/.github/workflows/js.yml index fbd4ceec0..d47d34986 100644 --- a/.github/workflows/js.yml +++ b/.github/workflows/js.yml @@ -9,7 +9,7 @@ jobs: runs-on: unbuntu-latest steps: - name: Checkout - uses: actions/checkout@v4.1.3 + uses: actions/checkout@v4 - name: Setup node uses: actions/setup-node@v4 @@ -22,4 +22,4 @@ jobs: - name: Launch Eslint run: - npm lint --prefix ./_dev + npm run lint --prefix ./_dev diff --git a/README.md b/README.md index 1aaae62dd..df63ce565 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 commande `npm install` and `npm run build:vite` ([npm](https://docs.npmjs.com/)). * 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. diff --git a/storybook/README.md b/storybook/README.md index 262d0bae2..7020a995b 100644 --- a/storybook/README.md +++ b/storybook/README.md @@ -7,7 +7,7 @@ in different versions of Prestashop. - PHP >= 8.2 - Composer - [Download Composer](https://getcomposer.org/) -- Node.js >= 19 - [Download Node.js](https://nodejs.org/) +- Node.js >= 20 - [Download Node.js](https://nodejs.org/) (preference for LTS 20.11.0) ## Install project dependencies From 8c2683093ec0bfcc407095b8f80fb247fb94ede0 Mon Sep 17 00:00:00 2001 From: Alexis Guyomar Date: Mon, 2 Sep 2024 11:20:36 +0200 Subject: [PATCH 12/27] feat: clean package json with unnecessary packages --- _dev/.babelrc | 5 ----- _dev/package.json | 10 ---------- _dev/tsconfig.json | 42 +++++++++++++++++++++--------------------- 3 files changed, 21 insertions(+), 36 deletions(-) delete mode 100644 _dev/.babelrc diff --git a/_dev/.babelrc b/_dev/.babelrc deleted file mode 100644 index 0225dca2f..000000000 --- a/_dev/.babelrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "presets": [ - ["@babel/preset-env", { "modules": "commonjs" }] - ] -} diff --git a/_dev/package.json b/_dev/package.json index f2f8e419f..365b4f4c0 100644 --- a/_dev/package.json +++ b/_dev/package.json @@ -21,25 +21,15 @@ }, "homepage": "https://github.com/PrestaShop/autoupgrade#readme", "devDependencies": { - "@babel/core": "^7.25.2", - "@babel/preset-env": "^7.25.4", "@eslint/js": "^9.9.1", - "@types/eslint__js": "^8.42.3", - "@types/jsdom": "^21.1.7", - "@types/node": "^22.5.1", "@typescript-eslint/eslint-plugin": "^8.3.0", "@typescript-eslint/parser": "^8.3.0", - "autoprefixer": "^10.4.20", "eslint": "^9.9.1", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.2.1", "globals": "^15.9.0", - "postcss": "^8.4.41", - "postcss-cli": "^11.0.0", "prettier": "3.3.3", "sass": "^1.77.8", - "ts-jest": "^29.2.5", - "ts-loader": "^9.5.1", "typescript": "^5.5.4", "typescript-eslint": "^8.3.0", "vite": "^5.4.1" diff --git a/_dev/tsconfig.json b/_dev/tsconfig.json index bfbb2e0ae..cd625bbd3 100644 --- a/_dev/tsconfig.json +++ b/_dev/tsconfig.json @@ -1,27 +1,27 @@ { "$schema": "https://json.schemastore.org/tsconfig", "compilerOptions": { -// "composite": true, -// "declaration": true, -// "declarationMap": true, -// "forceConsistentCasingInFileNames": true, -// "inlineSources": false, -// "suppressImplicitAnyIndexErrors": false, -// "noUnusedLocals": false, -// "noUnusedParameters": false, -// "preserveWatchOutput": true, -// "target": "ESNext", -// "useDefineForClassFields": true, -// "module": "ESNext", -// "moduleResolution": "Node", -// "strict": true, -// "sourceMap": true, -// "resolveJsonModule": true, -// "isolatedModules": true, -// "esModuleInterop": true, -// "lib": ["ESNext", "DOM"], -// "skipLibCheck": true, -// "types": ["@types/jsdom"], + "composite": true, + "declaration": true, + "declarationMap": true, + "forceConsistentCasingInFileNames": true, + "inlineSources": false, + "suppressImplicitAnyIndexErrors": false, + "noUnusedLocals": false, + "noUnusedParameters": false, + "preserveWatchOutput": true, + "target": "ESNext", + "useDefineForClassFields": true, + "module": "ESNext", + "moduleResolution": "Node", + "strict": true, + "sourceMap": true, + "resolveJsonModule": true, + "isolatedModules": true, + "esModuleInterop": true, + "lib": ["ESNext", "DOM"], + "skipLibCheck": true, + "types": [], }, "exclude": [ "node_modules" From 81bb23cc53f0eaa6a69e02cdcec38c443c8300d7 Mon Sep 17 00:00:00 2001 From: Alexis Guyomar Date: Mon, 2 Sep 2024 12:58:55 +0200 Subject: [PATCH 13/27] fix: vite.config.ts with ts error --- _dev/vite.config.ts | 6 ++++-- _dev/vite.dev.config.ts | 2 -- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/_dev/vite.config.ts b/_dev/vite.config.ts index 97026852d..57a339ac2 100644 --- a/_dev/vite.config.ts +++ b/_dev/vite.config.ts @@ -23,9 +23,11 @@ export default defineConfig({ return 'js/[name].js'; }, assetFileNames: (assetInfo) => { - if (assetInfo.name?.endsWith('.css')) { + const assetName = assetInfo.name || ''; + + if (assetName.endsWith('.css')) { return 'css/autoupgrade.css'; - } else if (/\.(webp|png|jpe?g|gif|svg)$/.test(assetInfo.name)) { + } else if (/\.(webp|png|jpe?g|gif|svg)$/.test(assetName)) { return 'img/[name].[ext]'; } return 'assets/[name].[ext]'; diff --git a/_dev/vite.dev.config.ts b/_dev/vite.dev.config.ts index 7ec3fc228..04ac472b5 100644 --- a/_dev/vite.dev.config.ts +++ b/_dev/vite.dev.config.ts @@ -2,7 +2,6 @@ import { defineConfig } from 'vite'; export default defineConfig({ server: { - // Configure la racine pour servir les fichiers à partir du bon répertoire fs: { strict: false } @@ -14,7 +13,6 @@ export default defineConfig({ theme: './styles/main.scss' }, output: { - // Assurez-vous que les fichiers sont sortis dans le bon répertoire dir: 'public' } } From 720f2df4b9c2e7d8fe14c09b4ac543348e23245e Mon Sep 17 00:00:00 2001 From: Alexis Guyomar Date: Mon, 2 Sep 2024 17:01:47 +0200 Subject: [PATCH 14/27] feat: add style and stylelint --- .github/workflows/js.yml | 4 + _dev/.prettierrc | 15 +- _dev/.stylelintrc.cjs | 8 + _dev/eslint.config.mjs | 11 ++ _dev/package.json | 6 +- _dev/styles/_mixins.scss | 10 + _dev/styles/_variables.scss | 82 ++++++++ _dev/styles/components/_alert.scss | 76 ++++++++ _dev/styles/components/_backup-deletion.scss | 32 +++ _dev/styles/components/_button.scss | 22 +++ .../components/_check-requirements.scss | 99 ++++++++++ _dev/styles/components/_content.scss | 26 +++ _dev/styles/components/_index.scss | 17 ++ _dev/styles/components/_local-archive.scss | 11 ++ _dev/styles/components/_logs.scss | 76 ++++++++ _dev/styles/components/_modal.scss | 98 ++++++++++ _dev/styles/components/_privacy.scss | 31 +++ _dev/styles/components/_progress.scss | 39 ++++ _dev/styles/components/_radio-card.scss | 183 ++++++++++++++++++ _dev/styles/components/_stepper.scss | 93 +++++++++ _dev/styles/components/_typography.scss | 78 ++++++++ _dev/styles/components/form/_checkbox.scss | 65 +++++++ _dev/styles/components/form/_form.scss | 48 +++++ _dev/styles/components/form/_index.scss | 5 + _dev/styles/components/form/_radio.scss | 52 +++++ .../styles/components/form/_render-field.scss | 48 +++++ _dev/styles/components/form/_switch.scss | 77 ++++++++ _dev/styles/layouts/_backup.scss | 13 ++ _dev/styles/layouts/_index.scss | 5 + _dev/styles/layouts/_layout.scss | 32 +++ _dev/styles/layouts/_page.scss | 13 ++ _dev/styles/layouts/_version-choice.scss | 61 ++++++ _dev/styles/layouts/_welcome.scss | 13 ++ _dev/styles/main.scss | 120 ++++++++++-- 34 files changed, 1556 insertions(+), 13 deletions(-) create mode 100644 _dev/.stylelintrc.cjs create mode 100644 _dev/styles/_mixins.scss create mode 100644 _dev/styles/_variables.scss create mode 100644 _dev/styles/components/_alert.scss create mode 100644 _dev/styles/components/_backup-deletion.scss create mode 100644 _dev/styles/components/_button.scss create mode 100644 _dev/styles/components/_check-requirements.scss create mode 100644 _dev/styles/components/_content.scss create mode 100644 _dev/styles/components/_index.scss create mode 100644 _dev/styles/components/_local-archive.scss create mode 100644 _dev/styles/components/_logs.scss create mode 100644 _dev/styles/components/_modal.scss create mode 100644 _dev/styles/components/_privacy.scss create mode 100644 _dev/styles/components/_progress.scss create mode 100644 _dev/styles/components/_radio-card.scss create mode 100644 _dev/styles/components/_stepper.scss create mode 100644 _dev/styles/components/_typography.scss create mode 100644 _dev/styles/components/form/_checkbox.scss create mode 100644 _dev/styles/components/form/_form.scss create mode 100644 _dev/styles/components/form/_index.scss create mode 100644 _dev/styles/components/form/_radio.scss create mode 100644 _dev/styles/components/form/_render-field.scss create mode 100644 _dev/styles/components/form/_switch.scss create mode 100644 _dev/styles/layouts/_backup.scss create mode 100644 _dev/styles/layouts/_index.scss create mode 100644 _dev/styles/layouts/_layout.scss create mode 100644 _dev/styles/layouts/_page.scss create mode 100644 _dev/styles/layouts/_version-choice.scss create mode 100644 _dev/styles/layouts/_welcome.scss diff --git a/.github/workflows/js.yml b/.github/workflows/js.yml index d47d34986..bde0d9be2 100644 --- a/.github/workflows/js.yml +++ b/.github/workflows/js.yml @@ -23,3 +23,7 @@ jobs: - name: Launch Eslint run: npm run lint --prefix ./_dev + + - name: Launch Eslint + run: + npm run lint-scss --prefix ./_dev diff --git a/_dev/.prettierrc b/_dev/.prettierrc index b1f77404b..d8add0a74 100644 --- a/_dev/.prettierrc +++ b/_dev/.prettierrc @@ -2,5 +2,18 @@ "singleQuote": true, "trailingComma": "none", "printWidth": 100, - "tabWidth": 2 + "tabWidth": 2, + "overrides": [ + { + "files": "*.scss", + "options": { + "printWidth": 100, + "tabWidth": 2, + "useTabs": false, + "singleQuote": false, + "bracketSpacing": true, + "parser": "scss" + } + } + ] } diff --git a/_dev/.stylelintrc.cjs b/_dev/.stylelintrc.cjs new file mode 100644 index 000000000..98828fd10 --- /dev/null +++ b/_dev/.stylelintrc.cjs @@ -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 + } +}; diff --git a/_dev/eslint.config.mjs b/_dev/eslint.config.mjs index d47830c8d..0fbe6a364 100644 --- a/_dev/eslint.config.mjs +++ b/_dev/eslint.config.mjs @@ -8,6 +8,17 @@ 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: { diff --git a/_dev/package.json b/_dev/package.json index 365b4f4c0..2b7ed9eb0 100644 --- a/_dev/package.json +++ b/_dev/package.json @@ -8,7 +8,10 @@ "vite:build": "vite build", "lint": "eslint", "lint:fix": "eslint --fix", - "format": "prettier --write \"**/*.{ts,js}\"" + "lint-scss": "npx stylelint 'styles/**/*.scss'", + "lint-scss:fix": "npx stylelint --fix 'styles/**/*.scss'", + "prettier": "prettier --check \"**/*.{ts,js,scss}\"", + "prettier:fix": "prettier --write \"**/*.{ts,js,scss}\"" }, "repository": { "type": "git", @@ -22,6 +25,7 @@ "homepage": "https://github.com/PrestaShop/autoupgrade#readme", "devDependencies": { "@eslint/js": "^9.9.1", + "@prestashopcorp/stylelint-config": "^1.0.0", "@typescript-eslint/eslint-plugin": "^8.3.0", "@typescript-eslint/parser": "^8.3.0", "eslint": "^9.9.1", diff --git a/_dev/styles/_mixins.scss b/_dev/styles/_mixins.scss new file mode 100644 index 000000000..12c9ba13a --- /dev/null +++ b/_dev/styles/_mixins.scss @@ -0,0 +1,10 @@ +/* Animations */ +@keyframes rotate { + from { + transform: rotate(0deg); + } + + to { + transform: rotate(360deg); + } +} diff --git a/_dev/styles/_variables.scss b/_dev/styles/_variables.scss new file mode 100644 index 000000000..ed8d16ef2 --- /dev/null +++ b/_dev/styles/_variables.scss @@ -0,0 +1,82 @@ +$ua-id: "#update_assistant"; +$ua-prefix: "ua-"; +$cdk-prefix: "cdk-"; + +/* CSS variables */ +/* Global variables to handle both theme */ +/* 9.0.0 */ +:root { + /* Primitive */ + --#{$ua-prefix}white: #ffffff; + --#{$ua-prefix}black: #000000; + --#{$ua-prefix}primary-800: var(--#{$cdk-prefix}primary-800, #1d1d1b); + --#{$ua-prefix}primary-700: var(--#{$cdk-prefix}primary-700, #3f3f3d); + --#{$ua-prefix}primary-600: var(--#{$cdk-prefix}primary-600, #5e5e5e); + --#{$ua-prefix}primary-500: var(--#{$cdk-prefix}primary-500, #bbbbbb); + --#{$ua-prefix}primary-400: var(--#{$cdk-prefix}primary-400, #dddddd); + --#{$ua-prefix}primary-200: var(--#{$cdk-prefix}primary-200, #f7f7f7); + --#{$ua-prefix}purple-500: var(--#{$cdk-prefix}purple-500, #decde7); + --#{$ua-prefix}purple-50: var(--#{$cdk-prefix}purple-50, #f8f0f7); + --#{$ua-prefix}ocean-blue-700: var(--#{$cdk-prefix}ocean-blue-700, #5c92aa); + --#{$ua-prefix}ocean-blue-500: var(--#{$cdk-prefix}ocean-blue-500, #a4dbe8); + --#{$ua-prefix}ocean-blue-50: var(--#{$cdk-prefix}ocean-blue-50, #e4f4f8); + --#{$ua-prefix}blue-500: var(--#{$cdk-prefix}blue-500, #174eef); + --#{$ua-prefix}blue-50: var(--#{$cdk-prefix}blue-50, #e8edfd); + --#{$ua-prefix}green-500: var(--#{$cdk-prefix}green-500, #207f4b); + --#{$ua-prefix}green-50: var(--#{$cdk-prefix}green-50, #eaf8ef); + --#{$ua-prefix}yellow-500: var(--#{$cdk-prefix}yellow-500, #ffa000); + --#{$ua-prefix}yellow-50: var(--#{$cdk-prefix}yellow-50, #fff5e5); + --#{$ua-prefix}red-500: var(--#{$cdk-prefix}red-500, #ba151a); + --#{$ua-prefix}red-50: var(--#{$cdk-prefix}red-50, #ffe4e6); + + /* Global */ + --#{$ua-prefix}border-radius: 0; + --#{$ua-prefix}base-text-color: var(--#{$ua-prefix}primary-800); + --#{$ua-prefix}base-text-color-hover: var(--#{$ua-prefix}primary-700); + --#{$ua-prefix}disabled-color: var(--#{$ua-prefix}primary-500); + --#{$ua-prefix}border-color: var(--#{$ua-prefix}primary-400); + --#{$ua-prefix}box-shadow-modal: var( + --#{$cdk-prefix}box-shadow-pop-modal, + 0 12px 24px rgb(0 0 0 / 0.1) + ); + --#{$ua-prefix}required-color: var(--#{$ua-prefix}red-500); + --#{$ua-prefix}primary: var(--#{$ua-prefix}primary-800); + --#{$ua-prefix}primary-hover: var(--#{$ua-prefix}primary-700); + --#{$ua-prefix}muted-background-color: var(--#{$ua-prefix}primary-200); + --#{$ua-prefix}font-family-material-icons: var( + --#{$cdk-prefix}font-family-material-icons, + "Material Icons" + ); +} + +/* 1.7.8.0 */ +.v1-7-8-0 { + --#{$ua-prefix}border-radius: 0.5rem; + --#{$ua-prefix}primary: #25b9d7; + --#{$ua-prefix}primary-hover: #1a8196; + --#{$ua-prefix}base-text-color: #555555; + --#{$ua-prefix}blue-500: #25b9d7; + --#{$ua-prefix}blue-50: #beeaf3; + --#{$ua-prefix}green-500: #53d572; + --#{$ua-prefix}green-50: #cbf2d4; + --#{$ua-prefix}yellow-500: #fab000; + --#{$ua-prefix}yellow-50: #fffbd3; + --#{$ua-prefix}red-500: #f44336; + --#{$ua-prefix}red-50: #fbc6c3; +} + +/* 1.7.3.0 */ +.v1-7-3-0 { + --#{$ua-prefix}border-radius: 0.3125rem; + --#{$ua-prefix}primary: #00aff0; + --#{$ua-prefix}primary-hover: #008abd; + --#{$ua-prefix}base-text-color: #555555; + --#{$ua-prefix}blue-500: #4ac7e0; + --#{$ua-prefix}blue-50: #dcf4f9; + --#{$ua-prefix}green-500: #72c279; + --#{$ua-prefix}green-50: #ddf0de; + --#{$ua-prefix}yellow-500: #fcc94f; + --#{$ua-prefix}yellow-50: #fff3d7; + --#{$ua-prefix}red-500: #eab3b7; + --#{$ua-prefix}red-50: #ffe2e4; +} diff --git a/_dev/styles/components/_alert.scss b/_dev/styles/components/_alert.scss new file mode 100644 index 000000000..89016730f --- /dev/null +++ b/_dev/styles/components/_alert.scss @@ -0,0 +1,76 @@ +@use "../variables" as *; + +$e: ".alert"; + +#{$ua-id} { + --#{$ua-prefix}alert-info-button-background-color-hover: var(--#{$ua-prefix}blue-500); + --#{$ua-prefix}alert-success-button-background-color-hover: var(--#{$ua-prefix}green-500); + --#{$ua-prefix}alert-warning-button-background-color-hover: var(--#{$ua-prefix}yellow-500); + --#{$ua-prefix}alert-danger-button-background-color-hover: var(--#{$ua-prefix}red-500); + #{$e} { + display: flex; + flex-wrap: wrap; + gap: 1rem; + align-items: flex-start; + margin-block-end: 0; + border: none; + + &__title { + margin-block: 0; + font-size: 1.125rem; + font-weight: 600; + line-height: 1; + color: var(--#{$ua-prefix}base-text-color); + } + + &__message { + margin-block: 0; + font-size: 0.875rem; + line-height: 1.4; + color: var(--#{$ua-prefix}base-text-color); + word-break: break-word; + word-wrap: break-word; + } + + &__infos { + display: flex; + flex-basis: 70%; + flex-direction: column; + flex-grow: 1; + gap: 0.5rem; + } + + &__link { + background-color: transparent; + color: var(--#{$ua-prefix}base-text-color); + text-decoration: none; + white-space: normal; + + &:hover { + &.btn-info { + background-color: var(--#{$ua-prefix}alert-info-button-background-color-hover); + border-color: var(--#{$ua-prefix}alert-info-button-background-color-hover); + color: var(--#{$ua-prefix}white); + } + + &.btn-success { + background-color: var(--#{$ua-prefix}alert-success-button-background-color-hover); + border-color: var(--#{$ua-prefix}alert-success-button-background-color-hover); + color: var(--#{$ua-prefix}white); + } + + &.btn-warning { + background-color: var(--#{$ua-prefix}alert-warning-button-background-color-hover); + border-color: var(--#{$ua-prefix}alert-warning-button-background-color-hover); + color: var(--#{$ua-prefix}white); + } + + &.btn-danger { + background-color: var(--#{$ua-prefix}alert-danger-button-background-color-hover); + border-color: var(--#{$ua-prefix}alert-danger-button-background-color-hover); + color: var(--#{$ua-prefix}white); + } + } + } + } +} diff --git a/_dev/styles/components/_backup-deletion.scss b/_dev/styles/components/_backup-deletion.scss new file mode 100644 index 000000000..420093663 --- /dev/null +++ b/_dev/styles/components/_backup-deletion.scss @@ -0,0 +1,32 @@ +@use "../mixins" as *; +@use "../variables" as *; + +$e: ".backup-selection"; + +#{$ua-id} { + #{$e} { + display: flex; + flex-wrap: wrap; + gap: 1rem; + align-items: flex-end; + + &__infos { + flex-basis: 70%; + flex-grow: 1; + + select { + margin-block-end: 0; + } + } + + &__delete { + padding-inline: 0.5rem; + text-decoration: none; + + &:hover { + color: var(--#{$ua-prefix}red-500); + text-decoration: none; + } + } + } +} diff --git a/_dev/styles/components/_button.scss b/_dev/styles/components/_button.scss new file mode 100644 index 000000000..d9b6de2f2 --- /dev/null +++ b/_dev/styles/components/_button.scss @@ -0,0 +1,22 @@ +@use "../variables" as *; + +$e: ".btn"; + +#{$ua-id} { + #{$e} { + display: inline-flex; + gap: 0.5rem; + align-items: center; + font-weight: 500; + text-transform: none; + + .material-icons { + font-size: 1.25rem; + line-height: 1; + } + + &-lg { + font-size: 1rem; + } + } +} diff --git a/_dev/styles/components/_check-requirements.scss b/_dev/styles/components/_check-requirements.scss new file mode 100644 index 000000000..e671e7933 --- /dev/null +++ b/_dev/styles/components/_check-requirements.scss @@ -0,0 +1,99 @@ +@use "../mixins" as *; +@use "../variables" as *; + +$e: ".check-requirements"; + +#{$ua-id} { + #{$e} { + --#{$ua-prefix}requirements-background-color: var(--#{$ua-prefix}muted-background-color); + --#{$ua-prefix}requirements-loader-color: var(--#{$ua-prefix}base-text-color); + --#{$ua-prefix}requirements-loader-dot-color: var(--#{$ua-prefix}ocean-blue-700); + --#{$ua-prefix}requirements-loader-gradient-color: var(--#{$ua-prefix}ocean-blue-500); + padding: 1rem; + margin-block-start: 0.5rem; + background-color: var(--#{$ua-prefix}requirements-background-color); + border-radius: var(--#{$ua-prefix}border-radius); + + &__loader { + position: relative; + width: 1.625rem; + height: 1.625rem; + margin-block-end: 1rem; + margin-inline: auto; + background: + linear-gradient( + var(--#{$ua-prefix}requirements-background-color), + var(--#{$ua-prefix}requirements-background-color) + ) + padding-box, + conic-gradient(from 0, transparent, var(--#{$ua-prefix}requirements-loader-gradient-color)) + border-box; + border: 0.1875rem solid transparent; + border-radius: 100%; + text-align: center; + animation: rotate 1.5s linear infinite; + + &::before { + content: ""; + position: absolute; + top: 0; + left: 50%; + display: block; + width: 0.1875rem; + height: 0.1875rem; + background: var(--#{$ua-prefix}requirements-loader-dot-color); + border-radius: 50%; + transform: translate(-50%, -100%); + } + } + + &__loader-title { + font-size: 0.875rem; + font-weight: 700; + line-height: 1.4; + color: var(--#{$ua-prefix}requirements-loader-color); + text-align: center; + } + + &__title { + margin-block-end: 0.5rem; + } + + &__message { + margin-block-end: 1rem; + } + + &__list { + display: flex; + flex-direction: column; + gap: 0.5rem; + margin-block-end: 1rem; + } + + &__requirement { + padding-inline-start: 2rem; + background-repeat: no-repeat; + background-position: left center; + background-size: 1.5rem 1.5rem; + font-size: 0.875rem; + line-height: 1.4; + + &--error { + background-image: url("../img/close.svg"); + } + + &--warning { + background-image: url("../img/warning.svg"); + } + + &--success { + background-image: url("../img/check.svg"); + } + } + + &--success { + padding: 0; + background-color: transparent; + } + } +} diff --git a/_dev/styles/components/_content.scss b/_dev/styles/components/_content.scss new file mode 100644 index 000000000..6b2d83a1c --- /dev/null +++ b/_dev/styles/components/_content.scss @@ -0,0 +1,26 @@ +@use "../variables" as *; + +$e: ".content"; + +#{$ua-id} { + #{$e} { + &__container { + display: flex; + flex-direction: column; + gap: 2rem; + } + + &__section { + font-size: 1rem; + + .h3 { + /* stylelint-disable */ + margin: 0 !important; + margin-block-end: 1rem !important; + border: none !important; + background-color: transparent !important; + /* stylelint-enable */ + } + } + } +} diff --git a/_dev/styles/components/_index.scss b/_dev/styles/components/_index.scss new file mode 100644 index 000000000..30abd82a8 --- /dev/null +++ b/_dev/styles/components/_index.scss @@ -0,0 +1,17 @@ +/* Global */ +@use "typography"; + +/* Specific */ +@use "alert"; +@use "backup-deletion"; +@use "button"; +@use "check-requirements"; +@use "content"; +@use "form"; +@use "local-archive"; +@use "logs"; +@use "modal"; +@use "privacy"; +@use "progress"; +@use "radio-card"; +@use "stepper"; diff --git a/_dev/styles/components/_local-archive.scss b/_dev/styles/components/_local-archive.scss new file mode 100644 index 000000000..51b59a8e0 --- /dev/null +++ b/_dev/styles/components/_local-archive.scss @@ -0,0 +1,11 @@ +@use "../variables" as *; + +$e: ".local-archive"; + +#{$ua-id} { + #{$e} { + &__alert { + margin-top: 0.75rem; + } + } +} diff --git a/_dev/styles/components/_logs.scss b/_dev/styles/components/_logs.scss new file mode 100644 index 000000000..7cba1f842 --- /dev/null +++ b/_dev/styles/components/_logs.scss @@ -0,0 +1,76 @@ +@use "../variables" as *; + +$e: ".logs"; + +#{$ua-id} { + #{$e} { + --#{$ua-prefix}logs-height: 14rem; + --#{$ua-prefix}logs-background-color: var(--#{$ua-prefix}muted-background-color); + display: flex; + flex-direction: column; + gap: 1rem; + min-height: var(--#{$ua-prefix}logs-height); + max-height: 100%; + padding: 1rem; + background-color: var(--#{$ua-prefix}logs-background-color); + border-radius: var(--#{$ua-prefix}border-radius); + + &__scroll { + display: flex; + flex-direction: column; + flex-grow: 1; + flex-shrink: 1; + gap: 1rem; + height: 100%; + overflow-y: auto; + } + + &__buttons { + flex-shrink: 0; + } + + &__list { + display: flex; + flex-direction: column; + gap: 0.5rem; + } + + &__line { + padding-inline-start: 2rem; + background-repeat: no-repeat; + background-position: left center; + background-size: 1.5rem 1.5rem; + font-size: 0.875rem; + line-height: 1.4; + + &--success { + background-image: url("../img/check.svg"); + } + + &--warning { + background-image: url("../img/warning.svg"); + } + + &--error { + background-image: url("../img/close.svg"); + } + } + + &__summary-anchor { + font-weight: 700; + } + + &__summaries { + display: flex; + flex-direction: column; + gap: 1rem; + padding-block-end: 0.5rem; + } + + &__summary { + display: flex; + flex-direction: column; + gap: 0.5rem; + } + } +} diff --git a/_dev/styles/components/_modal.scss b/_dev/styles/components/_modal.scss new file mode 100644 index 000000000..5f376a328 --- /dev/null +++ b/_dev/styles/components/_modal.scss @@ -0,0 +1,98 @@ +@use "../variables" as *; + +$e: ".modal"; + +#{$ua-id} { + #{$e} { + &-content { + display: flex; + flex-direction: column; + gap: 1.5rem; + border: none; + box-shadow: var(--#{$ua-prefix}box-shadow-modal); + } + + &-header { + display: flex; + gap: 1rem; + align-items: center; + width: 100%; + padding: 1.5rem; + padding-block-end: 0; + border: none; + + .close { + flex-shrink: 0; + float: none; + margin: 0; + margin-inline-start: auto; + opacity: 1; + color: var(--#{$ua-prefix}base-text-color); + cursor: pointer; + + &:hover { + color: var(--#{$ua-prefix}base-text-color-hover); + } + + .material-icons { + font-size: 1.5rem; + } + } + } + + &-body { + display: flex; + flex-direction: column; + gap: 1.5rem; + padding-block: 0; + padding-inline: 1.5rem; + font-size: 1rem; + line-height: 1.375; + } + + &-footer { + padding: 1.5rem; + padding-block-start: 0; + border: none; + } + + // Custom modals + &__no-backup { + margin-block: 0; + + label { + font-weight: 400; + } + } + + &__rocket-icon { + width: 1.425em; + height: 1.425em; + } + + &__error-report-form { + display: flex; + flex-direction: column; + gap: 0.5rem; + } + + &--danger { + #{$e}-header { + &::before { + content: "\e872"; + display: flex; + flex-shrink: 0; + align-items: center; + justify-content: center; + width: 2.5rem; + height: 2.5rem; + background-color: var(--#{$ua-prefix}red-50); + border-radius: 999px; + font-family: var(--#{$ua-prefix}font-family-material-icons); + font-size: 1.5rem; + font-weight: 400; + } + } + } + } +} diff --git a/_dev/styles/components/_privacy.scss b/_dev/styles/components/_privacy.scss new file mode 100644 index 000000000..2ac55850a --- /dev/null +++ b/_dev/styles/components/_privacy.scss @@ -0,0 +1,31 @@ +@use "../variables" as *; + +$e: ".privacy-link"; + +#{$ua-id} { + #{$e} { + --#{$ua-prefix}privacy-link-color: var(--#{$ua-prefix}base-text-color); + --#{$ua-prefix}privacy-link-border-color: var(--#{$ua-prefix}border-color); + --#{$ua-prefix}privacy-link-border-color-hover: var(--#{$ua-prefix}privacy-link-color); + display: inline-flex; + gap: 0.25rem; + align-items: center; + justify-self: center; + border-bottom: 0.0625rem solid var(--#{$ua-prefix}privacy-link-border-color); + font-size: 1rem; + line-height: 1.4; + color: var(--#{$ua-prefix}privacy-link-color); + text-decoration: none; + transition: border-color 0.15s; + + &:hover { + border-color: var(--#{$ua-prefix}privacy-link-border-color-hover); + text-decoration: none; + } + + i { + font-size: 1rem; + line-height: 1; + } + } +} diff --git a/_dev/styles/components/_progress.scss b/_dev/styles/components/_progress.scss new file mode 100644 index 000000000..431d520cd --- /dev/null +++ b/_dev/styles/components/_progress.scss @@ -0,0 +1,39 @@ +@use "../variables" as *; + +$e: ".log-progress"; + +#{$ua-id} { + #{$e} { + display: flex; + flex-direction: column; + gap: 0.5rem; + margin-block-end: 0.5rem; + + &__status { + display: flex; + gap: 0.5rem; + align-items: center; + color: var(--#{$ua-prefix}primary-600); + } + + &__icon { + flex-shrink: 0; + + i { + display: block; + animation: rotate 1.5s linear infinite; + } + } + + // Custom progress bar + .progress { + height: 0.5rem; + margin-block-end: 0; + border-radius: 999px; + } + + .progress-bar { + border-radius: 999px; + } + } +} diff --git a/_dev/styles/components/_radio-card.scss b/_dev/styles/components/_radio-card.scss new file mode 100644 index 000000000..786b281cd --- /dev/null +++ b/_dev/styles/components/_radio-card.scss @@ -0,0 +1,183 @@ +@use "../variables" as *; + +$e: ".radio-card"; + +#{$ua-id} { + #{$e} { + --#{$ua-prefix}radio-card-background-color: var(--#{$ua-prefix}white); + --#{$ua-prefix}radio-card-title-color: var(--#{$ua-prefix}base-text-color); + --#{$ua-prefix}radio-card-title-color-disabled: var(--#{$ua-prefix}disabled-color); + --#{$ua-prefix}radio-card-message-color: #5e5e5e; + --#{$ua-prefix}radio-card-message-color-disabled: var(--#{$ua-prefix}disabled-color); + --#{$ua-prefix}radio-card-disabled-message-color: var(--#{$ua-prefix}white); + --#{$ua-prefix}radio-card-disabled-message-background-color: var(--#{$ua-prefix}primary); + --#{$ua-prefix}radio-card-border-radius: var(--#{$ua-prefix}border-radius); + --#{$ua-prefix}radio-card-border-color: var(--#{$ua-prefix}border-color); + --#{$ua-prefix}radio-card-border-color-hover: var(--#{$ua-prefix}primary); + --#{$ua-prefix}radio-card-border-color-active: var( + --#{$ua-prefix}radio-card-border-color-hover + ); + --#{$ua-prefix}radio-card-release-color: var(--#{$ua-prefix}base-text-color); + --#{$ua-prefix}radio-card-release-border-color: var(--#{$ua-prefix}border-color); + --#{$ua-prefix}radio-card-release-border-color-hover: var( + --#{$ua-prefix}radio-card-release-color + ); + --#{$ua-prefix}radio-card-badge-color: var(--#{$ua-prefix}base-text-color); + --#{$ua-prefix}radio-card-badge-background-color: var(--#{$ua-prefix}primary-200); + --#{$ua-prefix}radio-card-badge-border-color: var(--#{$ua-prefix}border-color); + --#{$ua-prefix}radio-card-badge-major-background-color: var(--#{$ua-prefix}purple-50); + --#{$ua-prefix}radio-card-badge-major-border-color: var(--#{$ua-prefix}purple-500); + --#{$ua-prefix}radio-card-badge-minor-background-color: var(--#{$ua-prefix}ocean-blue-50); + --#{$ua-prefix}radio-card-badge-minor-border-color: var(--#{$ua-prefix}ocean-blue-500); + all: unset; + display: flex; + gap: 0.5rem; + padding: 1rem; + background-color: var(--#{$ua-prefix}radio-card-background-color); + border: 0.0625rem solid var(--#{$ua-prefix}radio-card-border-color); + border-radius: var(--#{$ua-prefix}radio-card-border-radius); + transition: border-color 0.15s; + + &:not(#{$e}--disabled) { + &:hover { + border-color: var(--#{$ua-prefix}radio-card-border-color-hover); + cursor: pointer; + } + } + + &:has(input[type="radio"]:checked) { + border-color: var(--#{$ua-prefix}radio-card-border-color-active); + } + + &__radio-wrapper { + flex-shrink: 0; + } + + &__infos-wrapper { + flex-grow: 1; + } + + &__infos-top { + display: flex; + flex-wrap: wrap; + gap: 0.5rem; + align-items: center; + justify-content: space-between; + } + + &__title { + display: inline-flex; + flex-wrap: wrap; + gap: 0.5rem; + align-items: center; + margin-block: 0; + font-size: 0.875rem; + font-weight: 700; + line-height: 1.4; + color: var(--#{$ua-prefix}radio-card-title-color); + } + + &__badge { + flex-shrink: 0; + padding: 0.125rem 0.5rem; + background-color: var(--#{$ua-prefix}radio-card-badge-background-color); + border: 0.0625rem solid var(--#{$ua-prefix}radio-card-badge-border-color); + border-radius: 2rem; + font-size: 0.75rem; + font-weight: 500; + line-height: 1.5; + color: var(--#{$ua-prefix}radio-card-badge-color); + + &--major { + background-color: var(--#{$ua-prefix}radio-card-badge-major-background-color); + border-color: var(--#{$ua-prefix}radio-card-badge-major-border-color); + } + + &--minor { + background-color: var(--#{$ua-prefix}radio-card-badge-minor-background-color); + border-color: var(--#{$ua-prefix}radio-card-badge-minor-border-color); + } + + &--patch { + background-color: var(--#{$ua-prefix}radio-card-badge-background-color); + border-color: var(--#{$ua-prefix}radio-card-badge-border-color); + } + } + + &__message { + margin-block: 0.5rem 0; + font-size: 0.875rem; + color: var(--#{$ua-prefix}radio-card-message-color); + word-break: break-word; + word-wrap: break-word; + } + + &__release-note { + display: inline-flex; + gap: 0.25rem; + align-items: center; + justify-content: flex-end; + border-bottom: 0.0625rem solid var(--#{$ua-prefix}radio-card-release-border-color); + font-size: 0.875rem; + line-height: 1.4; + color: var(--#{$ua-prefix}radio-card-release-color); + text-decoration: none; + transition: border-color 0.15s; + + &:hover { + border-color: var(--#{$ua-prefix}radio-card-release-border-color-hover); + text-decoration: none; + } + + i { + font-size: 0.875rem; + } + } + + &__disabled-message { + position: absolute; + inset: 0; + z-index: 1; + display: none; + padding: 1rem; + } + + &__disabled-message-placement { + padding: 0.5rem 0.75rem; + background-color: var(--#{$ua-prefix}radio-card-disabled-message-background-color); + border-radius: var(--#{$ua-prefix}border-radius); + font-size: 0.875rem; + line-height: 1.4em; + color: var(--#{$ua-prefix}radio-card-disabled-message-color); + } + + &__local-archive { + padding-block-start: 0.5rem; + } + + &--disabled { + position: relative; + cursor: not-allowed; + + #{$e}__title { + color: var(--#{$ua-prefix}radio-card-title-color-disabled); + } + + #{$e}__message { + color: var(--#{$ua-prefix}radio-card-message-color-disabled); + } + + #{$e}__badge, + #{$e}__release-note { + opacity: 0.4; + pointer-events: none; + } + + #{$e}__disabled-message { + display: flex; + align-items: center; + justify-content: center; + } + } + } +} diff --git a/_dev/styles/components/_stepper.scss b/_dev/styles/components/_stepper.scss new file mode 100644 index 000000000..b566ce09a --- /dev/null +++ b/_dev/styles/components/_stepper.scss @@ -0,0 +1,93 @@ +@use "../variables" as *; + +$e: ".stepper"; + +#{$ua-id} { + #{$e} { + --#{$ua-prefix}step-number-size: 1.75rem; + --#{$ua-prefix}step-line-color: var(--#{$ua-prefix}border-color); + --#{$ua-prefix}step-number-color: var(--#{$ua-prefix}white); + --#{$ua-prefix}step-normal-background-color: var(--#{$ua-prefix}primary-400); + --#{$ua-prefix}step-current-background-color: var(--#{$ua-prefix}primary); + --#{$ua-prefix}step-done-background-color: var(--#{$ua-prefix}green-50); + display: grid; + grid-auto-columns: minmax(7rem, 12rem); + grid-auto-flow: column; + align-items: flex-start; + max-width: fit-content; + padding-block-end: 0.5rem; + margin: 0 auto; + overflow-x: auto; + + &__step { + position: relative; + display: grid; + flex-direction: column; + gap: 0.25rem; + + &:not(#{$e}__step--last) { + &::before { + content: ""; + position: absolute; + top: calc(var(--#{$ua-prefix}step-number-size) / 2); + left: 50%; + z-index: 0; + display: block; + width: 100%; + height: 0.0625rem; + background-color: var(--#{$ua-prefix}step-line-color); + } + } + + &--normal { + #{$e}__step-number { + background-color: var(--#{$ua-prefix}step-normal-background-color); + + &::before { + content: attr(data-step-number); + } + } + } + + &--current { + #{$e}__step-number { + background-color: var(--#{$ua-prefix}step-current-background-color); + + &::before { + content: attr(data-step-number); + } + } + } + + &--done { + #{$e}__step-number { + background-color: var(--#{$ua-prefix}step-done-background-color); + background-image: url("../img/check.svg"); + background-repeat: no-repeat; + background-position: center center; + background-size: 1rem 1rem; + } + } + } + + &__step-number { + z-index: 1; + display: block; + width: var(--#{$ua-prefix}step-number-size); + height: var(--#{$ua-prefix}step-number-size); + margin: 0 auto; + background-color: var(--#{$ua-prefix}step-normal-background-color); + border-radius: 50%; + font-size: 0.875rem; + line-height: var(--#{$ua-prefix}step-number-size); + color: var(--#{$ua-prefix}step-number-color); + text-align: center; + } + + &__step-title { + font-size: 0.75rem; + line-height: 1.5; + text-align: center; + } + } +} diff --git a/_dev/styles/components/_typography.scss b/_dev/styles/components/_typography.scss new file mode 100644 index 000000000..1ec2b307f --- /dev/null +++ b/_dev/styles/components/_typography.scss @@ -0,0 +1,78 @@ +@use "../variables" as *; + +#{$ua-id} { + --#{$ua-prefix}typography-color: var(--#{$ua-prefix}base-text-color); + --#{$ua-prefix}link-color: var(--#{$ua-prefix}primary); + --#{$ua-prefix}link-color-hover: var(--#{$ua-prefix}primary-hover); + + h1, + h2, + h3, + h4, + h5, + h6, + .h1, + .h2, + .h3, + .h4, + .h5, + .h6 { + margin: 0; + background-color: transparent; + font-weight: 600; + text-wrap: pretty; + } + + .h1 { + margin-block: 0 1.5rem; + font-size: 1.5rem; + font-weight: 600; + } + + .h2 { + font-size: 1.5rem; + font-weight: 600; + } + + .h3 { + font-size: 1.125rem; + font-weight: 600; + } + + p { + margin-block-end: 0.25rem; + font-size: 0.875rem; + } + + a.link { + display: inline-block; + color: var(--#{$ua-prefix}link-color); + text-decoration: underline; + text-underline-offset: 0.125rem; + transition: text-underline-offset 0.15s; + + &:hover { + color: var(--#{$ua-prefix}link-color-hover); + text-decoration-color: var(--#{$ua-prefix}link-color-hover); + text-underline-offset: 0.25rem; + } + + .material-icons { + padding-inline: 0.25rem; + font-size: 1rem; + text-decoration: none; + vertical-align: middle; + } + } + + ul { + display: flex; + flex-direction: column; + gap: 1rem; + padding-inline-start: 2rem; + + li { + line-height: 1.4; + } + } +} diff --git a/_dev/styles/components/form/_checkbox.scss b/_dev/styles/components/form/_checkbox.scss new file mode 100644 index 000000000..6ef969d37 --- /dev/null +++ b/_dev/styles/components/form/_checkbox.scss @@ -0,0 +1,65 @@ +@use "../../variables" as *; + +$e: ".checkbox"; + +#{$ua-id} { + #{$e} { + --#{$ua-prefix}checkbox-border-color: var(--#{$ua-prefix}primary); + --#{$ua-prefix}checkbox-checked-background-color: var(--#{$ua-prefix}primary); + --#{$ua-prefix}checkbox-checked-border-color: var(--#{$ua-prefix}primary); + --#{$ua-prefix}checkbox-disabled-border-color: var(--#{$ua-prefix}disabled-color); + + &-inline { + margin-block-end: 0.5rem; + } + + label { + display: inline-flex; + gap: 0.5rem; + align-items: flex-start; + padding: 0; + line-height: 1.25rem; + cursor: pointer; + } + + input[type="checkbox"], + &:is(input[type="checkbox"]) { + position: relative; + flex-shrink: 0; + width: 1.25rem; + height: 1.25rem; + padding: 0; + margin: 0; + background: none; + border: 0.125rem solid var(--#{$ua-prefix}checkbox-border-color); + border-radius: 0.125rem; + outline: 0; + line-height: 0; + -webkit-appearance: none; + cursor: pointer; + + &:checked { + background-color: var(--#{$ua-prefix}checkbox-checked-background-color); + border-color: var(--#{$ua-prefix}checkbox-checked-border-color); + } + + &:disabled { + border-color: var(--#{$ua-prefix}checkbox-disabled-border-color); + } + + &::before { + content: ""; + position: absolute; + top: 50%; + right: 50%; + z-index: 2; + width: 0.3125rem; + height: 0.625rem; + margin: -0.0625rem -0.0625rem 0; + border: solid var(--#{$ua-prefix}white); + border-width: 0 0.125rem 0.125rem 0; + transform: rotate(45deg) translate(-50%, -50%); + } + } + } +} diff --git a/_dev/styles/components/form/_form.scss b/_dev/styles/components/form/_form.scss new file mode 100644 index 000000000..c6f78608a --- /dev/null +++ b/_dev/styles/components/form/_form.scss @@ -0,0 +1,48 @@ +@use "../../variables" as *; + +#{$ua-id} { + .require-star { + color: var(--#{$ua-prefix}required-color); + } + + .form { + &-group { + margin-block-end: 0.5rem; + } + } + + label { + margin-block-end: 0.25rem; + font-size: 0.875rem; + font-weight: 500; + line-height: 1.4; + } + + select { + padding-inline-end: 2rem; + background-image: url("../img/unfold_more.svg"); + background-repeat: no-repeat; + background-position: right 0.5rem center; + background-size: 1.125rem 1.125rem; + appearance: none; + + &.error { + margin-block-end: 0.25rem; + border-color: var(--#{$ua-prefix}red-500); + } + } + + .error-message { + display: flex; + gap: 0.25rem; + align-items: flex-start; + font-size: 0.75rem; + line-height: 1.5; + color: var(--#{$ua-prefix}red-500); + + .material-icons { + font-size: 1.125rem; + line-height: 1; + } + } +} diff --git a/_dev/styles/components/form/_index.scss b/_dev/styles/components/form/_index.scss new file mode 100644 index 000000000..3adbc76b6 --- /dev/null +++ b/_dev/styles/components/form/_index.scss @@ -0,0 +1,5 @@ +@use "checkbox"; +@use "form"; +@use "radio"; +@use "render-field"; +@use "switch"; diff --git a/_dev/styles/components/form/_radio.scss b/_dev/styles/components/form/_radio.scss new file mode 100644 index 000000000..11c1d9ef1 --- /dev/null +++ b/_dev/styles/components/form/_radio.scss @@ -0,0 +1,52 @@ +@use "../../variables" as *; + +$e: ".radio"; + +#{$ua-id} { + #{$e} { + --#{$ua-prefix}radio-border-color: var(--#{$ua-prefix}primary); + --#{$ua-prefix}radio-checked-background-color: var(--#{$ua-prefix}primary); + --#{$ua-prefix}radio-checked-border-color: var(--#{$ua-prefix}primary); + --#{$ua-prefix}radio-disabled-border-color: var(--#{$ua-prefix}disabled-color); + + &-inline { + margin-block-end: 0.5rem; + } + + label { + display: inline-flex; + gap: 0.5rem; + align-items: center; + padding: 0; + cursor: pointer; + } + + input[type="radio"], + &:is(input[type="radio"]) { + position: relative; + flex-shrink: 0; + width: 1.25rem; + height: 1.25rem; + padding: 0; + margin: 0; + background: transparent; + background-clip: content-box; + border: 0.125rem solid var(--#{$ua-prefix}radio-border-color); + border-radius: 50%; + outline: none; + line-height: 0; + -webkit-appearance: none; + cursor: pointer; + + &:checked { + padding: 0.1875rem; + background-color: var(--#{$ua-prefix}radio-checked-background-color); + border: 0.125rem solid var(--#{$ua-prefix}radio-checked-border-color); + } + + &:disabled { + border-color: var(--#{$ua-prefix}radio-disabled-border-color); + } + } + } +} diff --git a/_dev/styles/components/form/_render-field.scss b/_dev/styles/components/form/_render-field.scss new file mode 100644 index 000000000..1d74825e6 --- /dev/null +++ b/_dev/styles/components/form/_render-field.scss @@ -0,0 +1,48 @@ +@use "../../variables" as *; + +$e: ".render-field"; + +#{$ua-id} { + #{$e} { + display: flex; + flex-wrap: wrap; + gap: 1rem; + align-items: flex-start; + padding-block-end: 1rem; + margin-block-end: 1rem; + border-block-end: 0.0625rem solid var(--#{$ua-prefix}border-color); + container-type: inline-size; + container-name: render-field; + + &__title { + margin-block-end: 0; + font-size: 0.875rem; + font-weight: 500; + line-height: 1.4; + } + + &__desc { + margin-block-end: 0; + font-size: 0.875rem; + line-height: 1.4; + } + + &__infos { + display: flex; + flex-basis: 0; + flex-direction: column; + flex-grow: 1; + gap: 0.25rem; + } + + &--no-desc { + align-items: center; + } + + @container render-field (max-width: 400px) { + &__infos { + flex-basis: 100%; + } + } + } +} diff --git a/_dev/styles/components/form/_switch.scss b/_dev/styles/components/form/_switch.scss new file mode 100644 index 000000000..ceb44c504 --- /dev/null +++ b/_dev/styles/components/form/_switch.scss @@ -0,0 +1,77 @@ +@use "../../variables" as *; + +$e: ".prestashop-switch"; + +#{$ua-id} { + #{$e} { + display: flex; + gap: 1rem; + align-items: center; + margin: 0; + background-color: transparent; + box-shadow: none; + + // Custom switch ugly harmonization + input { + inset: 0; + z-index: 1; + margin: 0; + cursor: pointer; + + &:checked { + z-index: 0; + } + + &:first-of-type:checked ~ label:first-of-type { + display: block; + } + + &:last-of-type:checked ~ label:last-of-type { + display: block; + } + + &:first-of-type:checked ~ .slide-button::after { + transform: translateX(0.875rem); + } + } + + label { + position: static; + inset: auto; + display: none; + height: auto; + padding: 0; + margin: 0; + font-weight: 500; + color: var(--#{$ua-prefix}base-text-color); + pointer-events: none; + transform: none; + } + + .slide-button { + position: relative; + inset: auto; + z-index: 0; + display: block; + flex-shrink: 0; + width: 2.25rem; + height: 1.375rem; + padding: 0.5rem 1rem; + border: none; + border-radius: 999px; + transform: none; + + &::after { + content: ""; + position: absolute; + top: 0.125rem; + left: 0.125rem; + width: 1.125rem; + height: 1.125rem; + background: var(--#{$ua-prefix}white); + border-radius: 999px; + transform: none; + } + } + } +} diff --git a/_dev/styles/layouts/_backup.scss b/_dev/styles/layouts/_backup.scss new file mode 100644 index 000000000..e34d1dedf --- /dev/null +++ b/_dev/styles/layouts/_backup.scss @@ -0,0 +1,13 @@ +@use "../variables" as *; + +$e: ".backup-page"; + +#{$ua-id} { + #{$e} { + &__container { + display: flex; + flex-direction: column; + gap: 2rem; + } + } +} diff --git a/_dev/styles/layouts/_index.scss b/_dev/styles/layouts/_index.scss new file mode 100644 index 000000000..d737043e4 --- /dev/null +++ b/_dev/styles/layouts/_index.scss @@ -0,0 +1,5 @@ +@use "backup"; +@use "layout"; +@use "page"; +@use "version-choice"; +@use "welcome"; diff --git a/_dev/styles/layouts/_layout.scss b/_dev/styles/layouts/_layout.scss new file mode 100644 index 000000000..ac42eca43 --- /dev/null +++ b/_dev/styles/layouts/_layout.scss @@ -0,0 +1,32 @@ +@use "../variables" as *; + +$e: "#ua"; + +#{$e} { + &_main { + display: flex; + flex-direction: column; + gap: 2rem; + padding-block: 1rem; + container-type: inline-size; + container-name: ua-main; + } + + &_container { + display: flex; + flex-direction: column; + gap: 2rem; + padding: 4rem; + background-color: var(--#{$ua-prefix}white); + } + + &_privacy { + text-align: center; + } + + @container ua-main (max-width: 700px) { + &_container { + padding: 2rem; + } + } +} diff --git a/_dev/styles/layouts/_page.scss b/_dev/styles/layouts/_page.scss new file mode 100644 index 000000000..33a055cac --- /dev/null +++ b/_dev/styles/layouts/_page.scss @@ -0,0 +1,13 @@ +@use "../variables" as *; + +$e: ".page"; + +#{$e} { + &__buttons { + display: flex; + flex-wrap: wrap; + gap: 1rem; + align-items: center; + justify-content: flex-end; + } +} diff --git a/_dev/styles/layouts/_version-choice.scss b/_dev/styles/layouts/_version-choice.scss new file mode 100644 index 000000000..256e82b86 --- /dev/null +++ b/_dev/styles/layouts/_version-choice.scss @@ -0,0 +1,61 @@ +@use "../variables" as *; + +$e: ".version-page"; + +#{$ua-id} { + #{$e} { + // Up To Date + .up-to-date { + margin-block-end: 1.5rem; + + &--no-archive { + text-align: center; + + .up-to-date__title { + justify-content: center; + } + } + } + + .up-to-date__img { + display: block; + max-width: 100%; + height: auto; + margin-inline: auto; + } + + .up-to-date__title { + display: flex; + flex-wrap: wrap; + gap: 0.5rem; + align-items: center; + margin-block-end: 0.5rem; + + .material-icons { + font-size: 2rem; + } + } + + // Not Up To Date + .not-up-to-date__title { + display: flex; + flex-wrap: wrap; + gap: 0.5rem; + align-items: center; + margin-block-end: 0.5rem; + + .material-icons { + font-size: 2rem; + } + } + + .not-up-to-date__message { + margin-block-end: 1.5rem; + } + + &__card-list { + display: grid; + gap: 0.5rem; + } + } +} diff --git a/_dev/styles/layouts/_welcome.scss b/_dev/styles/layouts/_welcome.scss new file mode 100644 index 000000000..0b0dab74f --- /dev/null +++ b/_dev/styles/layouts/_welcome.scss @@ -0,0 +1,13 @@ +@use "../variables" as *; + +$e: ".welcome-page"; + +#{$ua-id} { + #{$e} { + &__card-list { + display: flex; + flex-direction: column; + gap: 0.5rem; + } + } +} diff --git a/_dev/styles/main.scss b/_dev/styles/main.scss index b90a0df5e..c47889648 100644 --- a/_dev/styles/main.scss +++ b/_dev/styles/main.scss @@ -1,12 +1,110 @@ -select { - padding-inline-end: 2rem; - background-image: url("../img/unfold_more.png") !important; - background-repeat: no-repeat; - background-position: right 0.5rem center; - background-size: 1.125rem 1.125rem; - appearance: none; - - &.error { - margin-block-end: 0.25rem; - } +@use "components"; +@use "layouts"; + +.upgradestep { + padding-right: 5px; + padding-left: 10px; + margin-right: 5px; +} + +.processing { + margin-top: 1px; + overflow: auto; + border: 2px outset gray; +} + +#infoStep { + height: 100px; +} + +#infoError { + height: 100px; +} + +#quickInfo { + height: 200px; +} + +#errorDuringUpgrade { + color: #cc0000; +} + +#checkPrestaShopFilesVersion, +#checkPrestaShopModifiedFiles { + margin-bottom: 20px; +} + +.changedFileList { + padding-left: 5px; + margin-left: 20px; +} + +.changedNotice li { + color: gray; +} + +.changedImportant li { + font-weight: 700; + color: red; +} + +.upgradeDbError { + background-color: #feefb3; +} + +.upgradeDbOk { + background-color: #dff2bf; +} + +.small_label { + float: none; + width: 300px; + padding: 0; + font-weight: 400; + text-align: left; +} + +.ocu-feature-list { + padding: 0; + margin: 0; + list-style: none; +} + +.ocu-feature-list li { + padding-left: 20px; + margin: 0; + background: url("../img/admin/enabled.gif") no-repeat; +} + +.label-small { + width: 130px; +} + +.margin-form-small { + padding: 0 0 1em 130px; +} + +.nextStep { + font-weight: 700; +} + +#diffList, +#changedList { + margin-top: 20px; +} + +#autoupgradePhpWarningMainIcon { + font-size: 3em; +} + +#autoupgradePhpWarn .icon-stack-text { + color: white; +} + +.panel-heading { + text-transform: uppercase; +} + +.required { + color: #cc0000; } From da5f47584c0ccd940f7973f3fc32a4add7720069 Mon Sep 17 00:00:00 2001 From: Alexis Guyomar Date: Mon, 2 Sep 2024 17:26:01 +0200 Subject: [PATCH 15/27] feat: add templates --- views/templates/components/alert.html.twig | 20 ++ .../components/backup-selection.html.twig | 22 ++ .../components/check-requirements.html.twig | 222 ++++++++++++++++++ views/templates/components/index.php | 34 +++ .../components/local-archive.html.twig | 61 +++++ .../components/logs-progress.html.twig | 15 ++ views/templates/components/logs.html.twig | 59 +++++ views/templates/components/modal.html.twig | 50 ++++ views/templates/components/privacy.html.twig | 6 + .../templates/components/radio-card.html.twig | 52 ++++ .../components/render-bool.html.twig | 17 ++ .../components/render-field.html.twig | 18 ++ .../components/render-select.html.twig | 13 + views/templates/components/stepper.html.twig | 13 + views/templates/layouts/backup.html.twig | 57 +++++ views/templates/layouts/layout.html.twig | 5 + views/templates/layouts/page.html.twig | 52 ++++ .../layouts/post-update-checklist.html.twig | 62 +++++ views/templates/layouts/restore.html.twig | 17 ++ .../layouts/update-options.html.twig | 89 +++++++ views/templates/layouts/update.html.twig | 22 ++ .../layouts/version-choice.html.twig | 127 ++++++++++ views/templates/layouts/welcome.html.twig | 35 +++ views/templates/macros/form-fields.html.twig | 10 + .../modals/modal-backup-all.html.twig | 16 ++ .../modals/modal-backup-delete.html.twig | 15 ++ views/templates/modals/modal-backup.html.twig | 16 ++ .../modals/modal-error-report.html.twig | 45 ++++ views/templates/modals/modal-update.html.twig | 35 +++ 29 files changed, 1205 insertions(+) create mode 100644 views/templates/components/alert.html.twig create mode 100644 views/templates/components/backup-selection.html.twig create mode 100644 views/templates/components/check-requirements.html.twig create mode 100644 views/templates/components/index.php create mode 100644 views/templates/components/local-archive.html.twig create mode 100644 views/templates/components/logs-progress.html.twig create mode 100644 views/templates/components/logs.html.twig create mode 100644 views/templates/components/modal.html.twig create mode 100644 views/templates/components/privacy.html.twig create mode 100644 views/templates/components/radio-card.html.twig create mode 100644 views/templates/components/render-bool.html.twig create mode 100644 views/templates/components/render-field.html.twig create mode 100644 views/templates/components/render-select.html.twig create mode 100644 views/templates/components/stepper.html.twig create mode 100644 views/templates/layouts/backup.html.twig create mode 100644 views/templates/layouts/layout.html.twig create mode 100644 views/templates/layouts/page.html.twig create mode 100644 views/templates/layouts/post-update-checklist.html.twig create mode 100644 views/templates/layouts/restore.html.twig create mode 100644 views/templates/layouts/update-options.html.twig create mode 100644 views/templates/layouts/update.html.twig create mode 100644 views/templates/layouts/version-choice.html.twig create mode 100644 views/templates/layouts/welcome.html.twig create mode 100644 views/templates/macros/form-fields.html.twig create mode 100644 views/templates/modals/modal-backup-all.html.twig create mode 100644 views/templates/modals/modal-backup-delete.html.twig create mode 100644 views/templates/modals/modal-backup.html.twig create mode 100644 views/templates/modals/modal-error-report.html.twig create mode 100644 views/templates/modals/modal-update.html.twig diff --git a/views/templates/components/alert.html.twig b/views/templates/components/alert.html.twig new file mode 100644 index 000000000..c645961f1 --- /dev/null +++ b/views/templates/components/alert.html.twig @@ -0,0 +1,20 @@ +{% if title or message %} +
+
+ {% if title %} +

{{ title }}

+ {% endif %} + {% if message %} +

{{ message|raw }}

+ {% endif %} +
+ + {% if buttonLabel and buttonUrl %} + + {% endif %} +
+{% endif %} diff --git a/views/templates/components/backup-selection.html.twig b/views/templates/components/backup-selection.html.twig new file mode 100644 index 000000000..da5b4ef8a --- /dev/null +++ b/views/templates/components/backup-selection.html.twig @@ -0,0 +1,22 @@ +
+
+ + +
+ + {% if showDelete %} + + {% endif %} +
diff --git a/views/templates/components/check-requirements.html.twig b/views/templates/components/check-requirements.html.twig new file mode 100644 index 000000000..513c0b13a --- /dev/null +++ b/views/templates/components/check-requirements.html.twig @@ -0,0 +1,222 @@ +{% if not requirementsOk %} +
+ {% if checkingForRequirements %} +
+
+ +
+ {{ "Checking requirements..."|trans({}) }} +
+
+ {% else %} +

+ {{ "Update requirements"|trans({}) }} +

+ +

+ {{ 'Once all the following conditions are met, you can continue with the update. Read more in the [1]developer documentation[/1].'|trans({ + '[1]' : '', + '[/1]' : '', + })|raw }} +

+ +
+ {# ERROR #} + {# Check for PHP compatibility error #} + {% if phpRequirementsState and phpRequirementsState != constant('PrestaShop\\Module\\AutoUpgrade\\UpgradeSelfCheck::PHP_REQUIREMENTS_VALID') %} + {% if phpRequirementsState == constant('PrestaShop\\Module\\AutoUpgrade\\UpgradeSelfCheck::PHP_REQUIREMENTS_INVALID') %} +
+ {{ 'Your current PHP version isn\'t compatible with PrestaShop %max_version%. (Expected: %min_version% - %max_version% | Current: %current_version%)'|trans({ + '%min_version%': phpCompatibilityRange['php_min_version'], + '%max_version%': phpCompatibilityRange['php_max_version'], + '%current_version%': phpCompatibilityRange['php_current_version'] + }) }} +
+ {% endif %} + {% endif %} + + {# Check if root directory is writable #} + {% if not rootDirectoryIsWritable %} +
+ {{ 'Your store\'s root directory (%root_directory%) isn\'t writable. Provide write access to the user running PHP with appropriate permission & ownership.'|trans({ + '%root_directory%': rootDirectory + }) }} +
+ {% endif %} + + {# Check if admin directory is writable #} + {% if not adminDirectoryIsWritable %} +
+ {{ 'The "/admin/autoupgrade" directory isn\'t writable. Provide write access to the user running PHP with appropriate permission & ownership.'|trans({}) }} +
+ {% endif %} + + {# Check if safe mode is off #} + {% if not safeModeIsDisabled %} +
+ {{ 'PHP\'s "Safe mode" needs to be disabled.'|trans({})|raw }} +
+ {% endif %} + + {# Check if allow_url_fopen or cURL are enable #} + {% if not allowUrlFopenOrCurlIsEnabled %} +
+ {{ 'Files can\'t be downloaded. Enable PHP\'s "allow_url_fopen" option or install PHP extension "cURL".'|trans({})|raw }} +
+ {% endif %} + + {# Check if zip extension is enable #} + {% if not zipIsEnabled %} +
+ {{ 'Missing PHP extension "zip".'|trans({})|raw }} +
+ {% endif %} + + {# Check if environment is local #} + {% if not isLocalEnvironment %} + {# Check if maintenance is enable #} + {% if not storeIsInMaintenance %} +
+ {{ 'Maintenance mode needs to be enabled. Enable maintenance mode and add your maintenance IP in [1]Shop parameters > General > Maintenance[/1].'|trans({ + '[1]' : '', + '[/1]' : '', + })|raw }} +
+ {% endif %} + {% endif %} + + {# Check if cache is disabled #} + {% if not cachingIsDisabled %} +
+ {{ 'PrestaShop\'s caching features needs to be disabled. Disable caching features in [1]Advanced parameters > Performance > Caching[/1].'|trans({ + '[1]' : '', + '[/1]' : '', + })|raw }} +
+ {% endif %} + + {# Check if max_execution_time has high value #} + {% if maxExecutionTime <= 30 and maxExecutionTime != 0 %} +
+ {{ 'PHP\'s max_execution_time setting needs to have a high value or needs to be disabled entirely (current value: %s seconds).'|trans([maxExecutionTime]) }} +
+ {% endif %} + + + {# Check if apache mod_rewrite is enabled #} + {% if not checkApacheModRewrite %} +
+ {{ 'Apache mod_rewrite needs to be enabled.'|trans({}) }} +
+ {% endif %} + + {# Check PHP extensions that need to be enabled #} + {% if notLoadedPhpExtensions|length > 0 %} +
+ {% if notLoadedPhpExtensions|length > 1 %} + {{ 'The following PHP extensions need to be installed: %extensions%.'|trans({ + '%extensions%': '' ~ notLoadedPhpExtensions|join(', ') ~ '' + })|raw }} + {% else %} + {{ 'The following PHP extension needs to be installed: %extension%.'|trans({ + '%extension%': '' ~ notLoadedPhpExtensions|first ~ '' + })|raw }} + {% endif %} +
+ {% endif %} + + {# Check PHP functions that need to be allowed #} + {% if notExistsPhpFunctions|length > 0 %} +
+ {% if notExistsPhpFunctions|length > 1 %} + {{ 'The following PHP functions need to be allowed: %functions%.'|trans({ + '%functions%': '' ~ notExistsPhpFunctions|join(', ') ~ '' + })|raw }} + {% else %} + {{ 'The following PHP function needs to be allowed: %function%.'|trans({ + '%function%': '' ~ notExistsPhpFunctions|first ~ '' + })|raw }} + {% endif %} +
+ {% endif %} + + {# Check if PHP memory_limit is greater than 256 #} + {% if not checkMemoryLimit %} +
+ {{ 'PHP memory_limit needs to be greater than 256 MB.'|trans({}) }} +
+ {% endif %} + + {# Check if PHP file_uploads is enabled #} + {% if not checkFileUploads %} +
+ {{ 'PHP file_uploads configuration needs to be enabled.'|trans({}) }} +
+ {% endif %} + + {# Check for private keys generation #} + {% if not checkKeyGeneration %} +
+ {{ 'Unable to generate private keys using openssl_pkey_new. Check your OpenSSL configuration, especially the path to openssl.cafile.'|trans({}) }} +
+ {% endif %} + + {# Check for folders writing permissions #} + {% if notWritingDirectories|length > 0 %} +
+ {{ 'It\'s not possible to write in the following folders: %directories%.'|trans({ + '%directories%': '' ~ notWritingDirectories|join(', ') ~ '' + })|raw }} + {{ 'Provide write access to the user running PHP with appropriate permission & ownership.'|trans({}) }} +
+ {% endif %} + + {# Check PrestaShop version mismatch #} + {% if not isShopVersionMatchingVersionInDatabase %} +
+ {{ 'The version of PrestaShop does not match the one stored in database. Your database structure may not be up-to-date and/or the value of PS_VERSION_DB needs to be updated in the configuration table.'|trans({}) }} +
+ {% endif %} + + {# WARNING #} + {# Check if the module is up to date #} + {% if not moduleIsUpToDate %} +
+ {{ 'Your current version of the module is out of date. Update now %link%'|trans({ + '%link%': 'Modules > Module Manager > Updates' + })|raw }} +
+ {% endif %} + + {# Check for PHP compatibility warning #} + {% if phpRequirementsState and phpRequirementsState != constant('PrestaShop\\Module\\AutoUpgrade\\UpgradeSelfCheck::PHP_REQUIREMENTS_VALID') %} +
+ {% if phpRequirementsState != constant('PrestaShop\\Module\\AutoUpgrade\\UpgradeSelfCheck::PHP_REQUIREMENTS_INVALID') %} + {{ 'We were unable to check your PHP compatibility with the destination PrestaShop version.'|trans({}) }} + {% endif %} +
+ {% endif %} + + {# Check for missing core files #} + {% if not noMissingFiles %} +
+ {{ 'Some core files have been altered, customization made on these files will be lost during the update. See the list in %link%'|trans({ + '%link%': 'Advanced parameters > Information' + })|raw }} +
+ {% endif %} +
+ + + {% endif %} +
+{% else %} +
+
+ {{ 'The requirements check is complete, you can update your store (to this version of PrestaShop).'|trans({}) }} +
+
+{% endif %} diff --git a/views/templates/components/index.php b/views/templates/components/index.php new file mode 100644 index 000000000..45df26c54 --- /dev/null +++ b/views/templates/components/index.php @@ -0,0 +1,34 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/views/templates/components/local-archive.html.twig b/views/templates/components/local-archive.html.twig new file mode 100644 index 000000000..c5e5ddc7e --- /dev/null +++ b/views/templates/components/local-archive.html.twig @@ -0,0 +1,61 @@ +{% if (archiveFiles is defined and archiveFiles is not empty) and (xmlFiles is defined and xmlFiles is not empty) %} +
+
+ + + + + {% if unableToFindVersion %} +
+ error + {{ "We couldn't find a PrestaShop version in the .zip file you uploaded. Please try again."|trans({}) }} +
+ {% endif %} +
+ +
+ + + + + {% if unableToFindVersionInXML %} +
+ error + {{ "We couldn't find a PrestaShop version in the XML file that was uploaded in your local archive. Please try again."|trans({}) }} +
+ {% endif %} + + {% if versionsMismatch and (not unableToFindVersionInXML and not unableToFindVersion) %} +
+ {% include '@ModuleAutoUpgrade/components/alert.html.twig' with { + title: "", + message: "The PrestaShop version in your archive doesn’t match the one in XML file. Please fix this issue and try again.", + alertStatus: "warning", + buttonLabel: "", + buttonUrl: "", + } %} +
+ {% endif %} +
+
+{% else %} +
+ {{ 'No archive found in your admin/autoupgrade/download directory'|trans({}) }} +
+{% endif %} diff --git a/views/templates/components/logs-progress.html.twig b/views/templates/components/logs-progress.html.twig new file mode 100644 index 000000000..60af1fbc1 --- /dev/null +++ b/views/templates/components/logs-progress.html.twig @@ -0,0 +1,15 @@ +
+
+
+ loop +
+ +
+ {{ progressStatus }} +
+
+ +
+
+
+
\ No newline at end of file diff --git a/views/templates/components/logs.html.twig b/views/templates/components/logs.html.twig new file mode 100644 index 000000000..9a3db5b01 --- /dev/null +++ b/views/templates/components/logs.html.twig @@ -0,0 +1,59 @@ +{% if logs %} +
+
+
+ {% for log in logs %} +
+ {{ log.message }} +
+ {% endfor %} +
+ + {% if logsSummaryWarning or logsSummaryError %} +
+ {% if logsSummaryWarning %} +
+

{{ "Warning summary"|trans({}) }}

+ + {% for log in logsSummaryWarning %} +
+ {{ log.message }} + + {% if log.anchor is defined %} + {{ "See warning"|trans({}) }} + {% endif %} +
+ {% endfor %} +
+ {% endif %} + + {% if logsSummaryError %} +
+

{{ "Error summary"|trans({}) }}

+ + {% for log in logsSummaryError %} +
+ {{ log.message }} + + {% if log.anchor is defined %} + {{ "See error"|trans({}) }} + {% endif %} +
+ {% endfor %} +
+ {% endif %} +
+ {% endif %} +
+ + {% if downloadLogsButtonUrl and downloadLogsButtonLabel %} + + {% endif %} +
+{% endif %} + diff --git a/views/templates/components/modal.html.twig b/views/templates/components/modal.html.twig new file mode 100644 index 000000000..703f4bef2 --- /dev/null +++ b/views/templates/components/modal.html.twig @@ -0,0 +1,50 @@ + diff --git a/views/templates/components/privacy.html.twig b/views/templates/components/privacy.html.twig new file mode 100644 index 000000000..31775a8c0 --- /dev/null +++ b/views/templates/components/privacy.html.twig @@ -0,0 +1,6 @@ + + {{ 'Privacy policy'|trans({}) }} + + launch + + diff --git a/views/templates/components/radio-card.html.twig b/views/templates/components/radio-card.html.twig new file mode 100644 index 000000000..a944a9d60 --- /dev/null +++ b/views/templates/components/radio-card.html.twig @@ -0,0 +1,52 @@ + diff --git a/views/templates/components/render-bool.html.twig b/views/templates/components/render-bool.html.twig new file mode 100644 index 000000000..155063465 --- /dev/null +++ b/views/templates/components/render-bool.html.twig @@ -0,0 +1,17 @@ +{% extends '@ModuleAutoUpgrade/components/render-field.html.twig' %} + +{% block action_content %} + + + + + + + +{% endblock %} diff --git a/views/templates/components/render-field.html.twig b/views/templates/components/render-field.html.twig new file mode 100644 index 000000000..ce5cdc50d --- /dev/null +++ b/views/templates/components/render-field.html.twig @@ -0,0 +1,18 @@ +
+
+

+ {{ field.title }} {% if field.required %}*{% endif %} +

+ + {% if field.desc %} +

{{ field.desc }}

+ {% endif %} +
+ +
+ {% block action_content %} + {# Default content can go here, or it can be left empty for children to override #} + {% endblock %} +
+
diff --git a/views/templates/components/render-select.html.twig b/views/templates/components/render-select.html.twig new file mode 100644 index 000000000..06a575f0c --- /dev/null +++ b/views/templates/components/render-select.html.twig @@ -0,0 +1,13 @@ +{% extends '@ModuleAutoUpgrade/components/render-field.html.twig' %} + +{% block action_content %} + + + +{% endblock %} diff --git a/views/templates/components/stepper.html.twig b/views/templates/components/stepper.html.twig new file mode 100644 index 000000000..f5dd407b5 --- /dev/null +++ b/views/templates/components/stepper.html.twig @@ -0,0 +1,13 @@ +
+ {% if steps %} + {% for step in steps %} +
+
+ +
+ {{ step.title }} +
+
+ {% endfor %} + {% endif %} +
diff --git a/views/templates/layouts/backup.html.twig b/views/templates/layouts/backup.html.twig new file mode 100644 index 000000000..8033dc1b8 --- /dev/null +++ b/views/templates/layouts/backup.html.twig @@ -0,0 +1,57 @@ +{% extends '@ModuleAutoUpgrade/layouts/page.html.twig' %} + +{% block page_class %}backup-page{% endblock %} + +{% block title %} +

{{ 'Back up your store'|trans({}) }}

+{% endblock %} + +{% block content %} +
+
+

{{ 'Backing up your store\'s files, database, and images means you can restore to a previous version if something goes wrong during the update. This keeps your data safe and ensures your business stays up and running.'|trans({}) }}

+
+ +
+ {% include '@ModuleAutoUpgrade/components/render-bool.html.twig' with { + field: { + id: "backup_files_db", + title: "Back up files and database", + desc: "", + js: { + on: 'onclick="enableFeature()"', + off: 'onclick="disableFeature()"', + }, + type: 'bool', + required: true, + disabled: true, + }, + key: "PS_AUTOUP_BACKUP_FILES_DB", + val: true, + } %} + + {% include '@ModuleAutoUpgrade/components/render-bool.html.twig' with { + field: { + id: "backup_files_db", + title: "Include images", + desc: "", + js: { + on: 'onclick="enableFeature()"', + off: 'onclick="disableFeature()"', + }, + type: 'bool', + required: true, + disabled: true, + }, + key: "PS_AUTOUP_BACKUP_WITH_IMAGES", + val: false, + } %} +
+
+{% endblock %} + +{% block buttons_inner %} + +{% endblock %} diff --git a/views/templates/layouts/layout.html.twig b/views/templates/layouts/layout.html.twig new file mode 100644 index 000000000..2302afcf3 --- /dev/null +++ b/views/templates/layouts/layout.html.twig @@ -0,0 +1,5 @@ +
+ {% if page == "welcome" %} + {% include '@ModuleAutoUpgrade/layouts/welcome.html.twig' %} + {% endif %} +
diff --git a/views/templates/layouts/page.html.twig b/views/templates/layouts/page.html.twig new file mode 100644 index 000000000..7364be2fc --- /dev/null +++ b/views/templates/layouts/page.html.twig @@ -0,0 +1,52 @@ +{% block update_assistant %} +
+ {% block stepper %} +
+ {% include '@ModuleAutoUpgrade/components/stepper.html.twig' %} +
+ {% endblock %} + + {% block container %} +
+ {% block container_inner %} +
+ {% block title %} + {# Default title or leave empty for child templates to provide #} + {% endblock %} +
+ +
+ {% block content %} + {# Default content or leave empty for child templates to provide #} + {# +
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc molestie efficitur tortor at feugiat. Donec pretium libero non tortor lobortis, eu cursus ligula tincidunt. +
+ +
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc molestie efficitur tortor at feugiat. Donec pretium libero non tortor lobortis, eu cursus ligula tincidunt. +
+
+ #} + {% endblock %} +
+ + {% block buttons %} +
+ {% block buttons_inner %} + {# Default buttons or leave empty for child templates to provide #} + {% endblock %} +
+ {% endblock %} + {% endblock %} +
+ {% endblock %} + + {% block privacy %} +
+ {% include '@ModuleAutoUpgrade/components/privacy.html.twig' %} +
+ {% endblock %} +
+{% endblock %} diff --git a/views/templates/layouts/post-update-checklist.html.twig b/views/templates/layouts/post-update-checklist.html.twig new file mode 100644 index 000000000..9542bf2b2 --- /dev/null +++ b/views/templates/layouts/post-update-checklist.html.twig @@ -0,0 +1,62 @@ +{% extends '@ModuleAutoUpgrade/layouts/page.html.twig' %} + +{% block page_class %}post-update-checklist-page{% endblock %} + +{% block title %} +

{{ 'Post-update checklist'|trans({}) }}

+{% endblock %} + +{% block content %} +
+ {% include '@ModuleAutoUpgrade/components/alert.html.twig' with { + title: "Your store is up to date", + message: "Before continuing with your tasks, please review the following checklist to ensure smooth operation after recent updates.", + alertStatus: "success", + buttonLabel: "", + buttonUrl: "", + } %} + +
+

{{ 'Next steps'|trans({}) }}

+ +
    +
  • {{ 'Open the developer documentation to keep this checklist at-hand.'|trans({})|raw }}
  • +
  • {{ 'Re-enable and check your modules one by one to prevent any compatibility issue.'|trans({})|raw }}
  • +
  • {{ 'Make sure your store’s front office is working properly: try to create an account, place an order, add a product, etc.'|trans({})|raw }}
  • +
  • {{ 'Disable the maintenance mode in General settings > Maintenance.'|trans({})|raw }}
  • +
+
+ +
+

{{ 'Troubleshooting'|trans({}) }}

+ +
    +
  • {{ 'If some images don’t appear in the front office, try regenerating thumbnails in Preferences > Images.'|trans({}) }}
  • +
  • {{ 'If something\'s wrong, you can restore a backup with this module. Your backup is available at {admin}/autoupgrade/backup.'|trans({}) }}
  • +
  • {{ 'If you can\'t access your back office, try enabling the debug mode manually in config/defines.inc.php by setting _PS_MODE_DEV_ to true.'|trans({}) }}
  • +
+
+ + +
+{% endblock %} + +{% block buttons_inner %} + + + +{% endblock %} diff --git a/views/templates/layouts/restore.html.twig b/views/templates/layouts/restore.html.twig new file mode 100644 index 000000000..8829df1ad --- /dev/null +++ b/views/templates/layouts/restore.html.twig @@ -0,0 +1,17 @@ +{% extends '@ModuleAutoUpgrade/layouts/page.html.twig' %} + +{% block page_class %}update-options-page{% endblock %} + +{% block title %} +

{{ 'Backup selection'|trans({}) }}

+{% endblock %} + +{% block content %} + {% include '@ModuleAutoUpgrade/components/backup-selection.html.twig' %} +{% endblock %} + +{% block buttons_inner %} + +{% endblock %} diff --git a/views/templates/layouts/update-options.html.twig b/views/templates/layouts/update-options.html.twig new file mode 100644 index 000000000..da7592b16 --- /dev/null +++ b/views/templates/layouts/update-options.html.twig @@ -0,0 +1,89 @@ +{% extends '@ModuleAutoUpgrade/layouts/page.html.twig' %} + +{% block page_class %}update-options-page{% endblock %} + +{% block title %} +

{{ 'Update options'|trans({}) }}

+{% endblock %} + +{% block content %} +
+ {% include '@ModuleAutoUpgrade/components/render-bool.html.twig' with { + field: { + id: "deactivate_modules", + title: "Deactivate non-native modules", + desc: "All the modules installed after creating your store are considered non-native modules. They might be incompatible with the new version of PrestaShop. We recommend deactivating them during the update.", + js: { + on: 'onclick="enableFeature()"', + off: 'onclick="disableFeature()"', + }, + type: 'bool', + required: true, + disabled: true, + }, + key: "PS_AUTOUP_CUSTOM_MOD_DESACT", + val: true, + } %} + + {% include '@ModuleAutoUpgrade/components/render-bool.html.twig' with { + field: { + id: "regen_email", + title: "Regenerate email templates", + desc: "If you've customized email templates, your changes will be lost if you activate this option.", + js: { + on: 'onclick="enableFeature()"', + off: 'onclick="disableFeature()"', + }, + type: 'bool', + required: true, + disabled: true, + }, + key: "PS_AUTOUP_REGEN_EMAIL", + val: true, + } %} + + {% include '@ModuleAutoUpgrade/components/render-select.html.twig' with { + field: { + id: "regen_mail", + title: "Switch the theme", + desc: "Custom themes may cause compatibility issues. We recommend using a default theme during the update and change it afterwards.", + choices: { + 0: "Keep the actual theme", + 1: "Upgrade the default theme", + 2: "Do nothing", + }, + type: "select", + required: true, + disabled: false, + }, + key: "PS_AUTOUP_SWITCH_THEME", + val: "1", + } %} + + {% include '@ModuleAutoUpgrade/components/render-bool.html.twig' with { + field: { + id: "disable_override", + title: "Disable all overrides", + desc: "Overriding is a way to replace business behaviors (class files and controller files) to target only one method or as many as you need. This option disables all classes & controllers overrides, allowing you to avoid conflicts during and after updates.", + js: { + on: 'onclick="enableFeature()"', + off: 'onclick="disableFeature()"', + }, + type: 'bool', + required: true, + disabled: true, + }, + key: "PS_AUTOUP_DISABLE_OVERRIDE", + val: false, + } %} +
+{% endblock %} + +{% block buttons_inner %} + +{% endblock %} diff --git a/views/templates/layouts/update.html.twig b/views/templates/layouts/update.html.twig new file mode 100644 index 000000000..3056848e7 --- /dev/null +++ b/views/templates/layouts/update.html.twig @@ -0,0 +1,22 @@ +{% extends '@ModuleAutoUpgrade/layouts/page.html.twig' %} + +{% block page_class %}update-page{% endblock %} + +{% block title %} +

{{ 'Update'|trans({}) }}

+{% endblock %} + +{% block content %} + {% include '@ModuleAutoUpgrade/components/logs-progress.html.twig' %} + + {% include '@ModuleAutoUpgrade/components/logs.html.twig' %} +{% endblock %} + +{% block buttons_inner %} + +{% endblock %} diff --git a/views/templates/layouts/version-choice.html.twig b/views/templates/layouts/version-choice.html.twig new file mode 100644 index 000000000..aae1bb56b --- /dev/null +++ b/views/templates/layouts/version-choice.html.twig @@ -0,0 +1,127 @@ +{% extends '@ModuleAutoUpgrade/layouts/page.html.twig' %} + +{% block page_class %}version-page{% endblock %} + +{% block title %} +

{{ 'Version choice'|trans({}) }}

+{% endblock %} + +{% block content %} + {% if upToDate %} +
+ {% if noLocalArchive %} + + {% endif %} + +

+ check_circle + {{ 'You’re up to date'|trans({}) }} +

+ +

+ {{ 'Current PrestaShop version:'|trans({}) }} {{ currentPrestashopVersion }}
+ {{ 'Current PHP version:'|trans({}) }} {{ currentPhpVersion }} +

+
+ + {% if noLocalArchive %} + {% include '@ModuleAutoUpgrade/components/alert.html.twig' with { + title: "", + message: "Unlock the local update feature and manually update your store to your preferred upgrade by saving the archive and XML files of the PrestaShop version in the following directory on your server: /admin/autoupgrade/download/", + alertStatus: "info", + buttonLabel: "", + buttonUrl: "", + } %} + {% else %} +
+

+ {{ 'You are already using the latest PrestaShop version available but you can update to the version of your choice from a local archive.'|trans({}) }} +

+ + {% include '@ModuleAutoUpgrade/components/radio-card.html.twig' with { + radioCardId: "", + checked: true, + title: "Local archive", + message: "Save the archive file of the version you want to update to in the following directory: /admin/autoUpdate/download/", + disabled: false, + disabledMessage: "", + badgeLabel: "", + releaseNote: "", + archiveCard: true, + } %} +
+ {% endif %} + {% else %} +
+

+ {{ 'A more recent version is available'|trans({}) }} +

+ +

+ {{ 'Current PrestaShop version:'|trans({}) }} {{ currentPrestashopVersion }}
+ {{ 'Current PHP version:'|trans({}) }} {{ currentPhpVersion }} +

+ + {% if not noLocalArchive %} +

+ + {{ 'Select version:'|trans({}) }} + +

+ +

+ {{ 'A more recent version of PrestaShop is available. You can also use a local archive.'|trans({}) }} +

+ {% endif %} +
+ +
+ {% include '@ModuleAutoUpgrade/components/radio-card.html.twig' with { + radioCardId: "", + checked: false, + title: "PrestaShop 9.0.0", + message: "Released on 01/05/2024.", + disabled: false, + disabledMessage: "", + badgeLabel: "Major version", + badgeStatus: "major", + releaseNote: "https://github.com/PrestaShop/autoupgrade", + archiveCard: false, + checkRequirements: false, + } %} + + {% if not noLocalArchive %} + {% include '@ModuleAutoUpgrade/components/radio-card.html.twig' with { + radioCardId: "", + checked: true, + title: "Local archive", + message: "Save the archive file of the version you want to update to in the following directory: /admin/autoUpdate/download/", + disabled: false, + disabledMessage: "", + badgeLabel: "", + releaseNote: "", + archiveCard: true, + } %} + {% else %} + {% include '@ModuleAutoUpgrade/components/alert.html.twig' with { + title: "", + message: "Unlock the local update feature and manually update your store to your preferred upgrade by saving the archive and XML files of the PrestaShop version in the following directory on your server: /admin/autoupgrade/download/", + alertStatus: "info", + buttonLabel: "", + buttonUrl: "", + } %} + {% endif %} +
+ {% endif %} +{% endblock %} + +{% block buttons_inner %} + {% if ( upToDate and not noLocalArchive ) or ( not upToDate ) %} + + {% endif %} +{% endblock %} diff --git a/views/templates/layouts/welcome.html.twig b/views/templates/layouts/welcome.html.twig new file mode 100644 index 000000000..efc913fe3 --- /dev/null +++ b/views/templates/layouts/welcome.html.twig @@ -0,0 +1,35 @@ +{% extends '@ModuleAutoUpgrade/layouts/page.html.twig' %} + +{% block stepper %}{% endblock %} + +{% block page_class %}welcome-page{% endblock %} + +{% block title %} +

{{ 'Welcome to PrestaShop Update Assistant'|trans({}) }}

+{% endblock %} + +{% block content %} +
+ {% include '@ModuleAutoUpgrade/components/radio-card.html.twig' with { + checked: true, + title: "Update your store", + message: "Update your store to benefit from the latest improvements, bug fixes and security patches.", + badgeLabel: "", + releaseNote: "", + } %} + {% include '@ModuleAutoUpgrade/components/radio-card.html.twig' with { + checked: true, + title: "Restore from a backup", + message: "Use this feature if the update failed or if your store or a module is no longer working properly.", + disabled: true, + badgeLabel: "", + releaseNote: "", + } %} +
+{% endblock %} + +{% block buttons_inner %} + +{% endblock %} diff --git a/views/templates/macros/form-fields.html.twig b/views/templates/macros/form-fields.html.twig new file mode 100644 index 000000000..06bd02b63 --- /dev/null +++ b/views/templates/macros/form-fields.html.twig @@ -0,0 +1,10 @@ +{% macro select(labelText, inputId, options) %} +
+ + +
+{% endmacro %} diff --git a/views/templates/modals/modal-backup-all.html.twig b/views/templates/modals/modal-backup-all.html.twig new file mode 100644 index 000000000..3a3955148 --- /dev/null +++ b/views/templates/modals/modal-backup-all.html.twig @@ -0,0 +1,16 @@ +{% extends '@ModuleAutoUpgrade/components/modal.html.twig' %} + +{% block modal_extra_content %}{% endblock %} + +{% block modal_footer %} + +{% endblock %} diff --git a/views/templates/modals/modal-backup-delete.html.twig b/views/templates/modals/modal-backup-delete.html.twig new file mode 100644 index 000000000..c9256cded --- /dev/null +++ b/views/templates/modals/modal-backup-delete.html.twig @@ -0,0 +1,15 @@ +{% extends '@ModuleAutoUpgrade/components/modal.html.twig' %} + +{% block modal_extra_content %}{% endblock %} + +{% block modal_footer %} + +{% endblock %} diff --git a/views/templates/modals/modal-backup.html.twig b/views/templates/modals/modal-backup.html.twig new file mode 100644 index 000000000..3a3955148 --- /dev/null +++ b/views/templates/modals/modal-backup.html.twig @@ -0,0 +1,16 @@ +{% extends '@ModuleAutoUpgrade/components/modal.html.twig' %} + +{% block modal_extra_content %}{% endblock %} + +{% block modal_footer %} + +{% endblock %} diff --git a/views/templates/modals/modal-error-report.html.twig b/views/templates/modals/modal-error-report.html.twig new file mode 100644 index 000000000..145e29f33 --- /dev/null +++ b/views/templates/modals/modal-error-report.html.twig @@ -0,0 +1,45 @@ +{% extends '@ModuleAutoUpgrade/components/modal.html.twig' %} + + +{% block modal_content %} + +{% endblock %} + +{% block modal_extra_content_inner %} + +{% endblock %} + +{% block modal_footer %} + +{% endblock %} diff --git a/views/templates/modals/modal-update.html.twig b/views/templates/modals/modal-update.html.twig new file mode 100644 index 000000000..d0bb331bc --- /dev/null +++ b/views/templates/modals/modal-update.html.twig @@ -0,0 +1,35 @@ +{% extends '@ModuleAutoUpgrade/components/modal.html.twig' %} + +{% block modal_content %} + {% if noBackUp %} +

+ {{ 'Before starting the update, make sure you have a complete and recent backup of your store (database, files, and images).'|trans({}) }} +

+ {% else %} + {{ parent() }} + {% endif %} +{% endblock %} + +{% block modal_extra_content %} + {% if noBackUp %} + + {% endif %} +{% endblock %} + +{% block modal_footer %} + +{% endblock %} From cff77f439780594abcf5cf4fb1a3645addc09b49 Mon Sep 17 00:00:00 2001 From: Alexis Guyomar Date: Mon, 2 Sep 2024 17:26:32 +0200 Subject: [PATCH 16/27] feat: add index.php --- views/templates/layouts/index.php | 34 +++++++++++++++++++++++++++++++ views/templates/modals/index.php | 34 +++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 views/templates/layouts/index.php create mode 100644 views/templates/modals/index.php diff --git a/views/templates/layouts/index.php b/views/templates/layouts/index.php new file mode 100644 index 000000000..45df26c54 --- /dev/null +++ b/views/templates/layouts/index.php @@ -0,0 +1,34 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; diff --git a/views/templates/modals/index.php b/views/templates/modals/index.php new file mode 100644 index 000000000..45df26c54 --- /dev/null +++ b/views/templates/modals/index.php @@ -0,0 +1,34 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; From 146f5d292a523504c3de6581b68bc2ea0277aca8 Mon Sep 17 00:00:00 2001 From: Alexis Guyomar Date: Mon, 2 Sep 2024 17:37:24 +0200 Subject: [PATCH 17/27] feat: add storybook --- storybook/.storybook/main.ts | 7 +- storybook/.storybook/preview.ts | 10 +- storybook/README.md | 2 +- storybook/package-lock.json | 4 +- storybook/package.json | 2 +- storybook/stories/components/Alert.stories.js | 46 ++++ .../components/BackupSelection.stories.js | 41 ++++ .../components/CheckRequirements.stories.js | 80 +++++++ .../components/LocalArchive.stories.js | 52 +++++ storybook/stories/components/Logs.stories.js | 207 ++++++++++++++++++ .../components/LogsProgress.stories.js | 37 ++++ storybook/stories/components/Modal.stories.js | 55 +++++ .../stories/components/ModalBackup.stories.js | 40 ++++ .../components/ModalBackupAll.stories.js | 40 ++++ .../components/ModalBackupDelete.stories.js | 41 ++++ .../components/ModalErrorReport.stories.js | 42 ++++ .../stories/components/ModalUpdate.stories.js | 41 ++++ .../stories/components/Privacy.stories.js | 33 +++ .../stories/components/RadioCard.stories.js | 102 +++++++++ .../stories/components/RenderBool.stories.js | 56 +++++ .../components/RenderSelect.stories.js | 66 ++++++ .../stories/components/Stepper.stories.js | 57 +++++ storybook/stories/layouts/Backup.stories.js | 49 +++++ storybook/stories/layouts/Layout.stories.js | 38 ++++ storybook/stories/layouts/Page.stories.js | 37 ++++ .../layouts/PostUpdateChecklist.stories.js | 62 ++++++ storybook/stories/layouts/Restore.stories.js | 51 +++++ storybook/stories/layouts/Update.stories.js | 61 ++++++ .../stories/layouts/UpdateOptions.stories.js | 57 +++++ .../stories/layouts/VersionChoice.stories.js | 66 ++++++ storybook/stories/layouts/Welcome.stories.js | 37 ++++ 31 files changed, 1509 insertions(+), 10 deletions(-) create mode 100644 storybook/stories/components/Alert.stories.js create mode 100644 storybook/stories/components/BackupSelection.stories.js create mode 100644 storybook/stories/components/CheckRequirements.stories.js create mode 100644 storybook/stories/components/LocalArchive.stories.js create mode 100644 storybook/stories/components/Logs.stories.js create mode 100644 storybook/stories/components/LogsProgress.stories.js create mode 100644 storybook/stories/components/Modal.stories.js create mode 100644 storybook/stories/components/ModalBackup.stories.js create mode 100644 storybook/stories/components/ModalBackupAll.stories.js create mode 100644 storybook/stories/components/ModalBackupDelete.stories.js create mode 100644 storybook/stories/components/ModalErrorReport.stories.js create mode 100644 storybook/stories/components/ModalUpdate.stories.js create mode 100644 storybook/stories/components/Privacy.stories.js create mode 100644 storybook/stories/components/RadioCard.stories.js create mode 100644 storybook/stories/components/RenderBool.stories.js create mode 100644 storybook/stories/components/RenderSelect.stories.js create mode 100644 storybook/stories/components/Stepper.stories.js create mode 100644 storybook/stories/layouts/Backup.stories.js create mode 100644 storybook/stories/layouts/Layout.stories.js create mode 100644 storybook/stories/layouts/Page.stories.js create mode 100644 storybook/stories/layouts/PostUpdateChecklist.stories.js create mode 100644 storybook/stories/layouts/Restore.stories.js create mode 100644 storybook/stories/layouts/Update.stories.js create mode 100644 storybook/stories/layouts/UpdateOptions.stories.js create mode 100644 storybook/stories/layouts/VersionChoice.stories.js create mode 100644 storybook/stories/layouts/Welcome.stories.js diff --git a/storybook/.storybook/main.ts b/storybook/.storybook/main.ts index a21c79f92..1e73962a7 100644 --- a/storybook/.storybook/main.ts +++ b/storybook/.storybook/main.ts @@ -74,15 +74,16 @@ const config: StorybookConfig = { `, previewBody: (body) => ` - + ${body} `, staticDirs: [ "../public", - "../../css", - "../../js", "../node_modules/prestashop-bo-themes", + { from: "../../css", to: "css" }, + { from: "../../js", to: "js" }, + { from: "../../img", to: "img" }, ], }; export default config; diff --git a/storybook/.storybook/preview.ts b/storybook/.storybook/preview.ts index e2f03cb09..0d9718442 100644 --- a/storybook/.storybook/preview.ts +++ b/storybook/.storybook/preview.ts @@ -75,13 +75,17 @@ const preview: Preview = { (story, context) => { const selectedTheme = context.globals.backofficeTheme || defaultBoTheme; const cssContents = cssEntrypoints[selectedTheme]; + // Replace dots with hyphens and prepend 'v' + const selectedThemeClass = `v${selectedTheme.replace(/\./g, '-')}`; const calledStory = story(); calledStory.template = twig(`
-
- ${calledStory.template.getSource()} - ${cssContents.map((cssFile) => ``)} +
+
+ ${calledStory.template.getSource()} + ${cssContents.map((cssFile) => ``)} +
`); diff --git a/storybook/README.md b/storybook/README.md index 7020a995b..262d0bae2 100644 --- a/storybook/README.md +++ b/storybook/README.md @@ -7,7 +7,7 @@ in different versions of Prestashop. - PHP >= 8.2 - Composer - [Download Composer](https://getcomposer.org/) -- Node.js >= 20 - [Download Node.js](https://nodejs.org/) (preference for LTS 20.11.0) +- Node.js >= 19 - [Download Node.js](https://nodejs.org/) ## Install project dependencies diff --git a/storybook/package-lock.json b/storybook/package-lock.json index 1e40dfa6e..f343f92fe 100644 --- a/storybook/package-lock.json +++ b/storybook/package-lock.json @@ -11,7 +11,7 @@ "@storybook/addon-webpack5-compiler-swc": "^1.0.2", "@storybook/blocks": "^8.0.0", "@storybook/cli": "^8.0.0", - "prestashop-bo-themes": "PrestaShop/Prestashop-BO-themes-package", + "prestashop-bo-themes": "PrestaShop/Prestashop-BO-themes-package#main", "typescript": "^5.4.2", "webpack": "^5.90.3" } @@ -12587,7 +12587,7 @@ }, "node_modules/prestashop-bo-themes": { "version": "1.0.0", - "resolved": "git+ssh://git@github.com/PrestaShop/Prestashop-BO-themes-package.git#cb65bc40c26623deada5c8134105ba4b0459c7a0", + "resolved": "git+ssh://git@github.com/PrestaShop/Prestashop-BO-themes-package.git#4534d04f56343a22ea0924b3b8813f7358dc561e", "dev": true, "license": "MIT" }, diff --git a/storybook/package.json b/storybook/package.json index 18cfb5bcb..dfb1f6d05 100644 --- a/storybook/package.json +++ b/storybook/package.json @@ -6,7 +6,7 @@ "@storybook/addon-webpack5-compiler-swc": "^1.0.2", "@storybook/blocks": "^8.0.0", "@storybook/cli": "^8.0.0", - "prestashop-bo-themes": "PrestaShop/Prestashop-BO-themes-package", + "prestashop-bo-themes": "PrestaShop/Prestashop-BO-themes-package#main", "typescript": "^5.4.2", "webpack": "^5.90.3" }, diff --git a/storybook/stories/components/Alert.stories.js b/storybook/stories/components/Alert.stories.js new file mode 100644 index 000000000..b9075f294 --- /dev/null +++ b/storybook/stories/components/Alert.stories.js @@ -0,0 +1,46 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License 3.0 (AFL-3.0) + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ + +import Alert from "../../../views/templates/components/alert.html.twig"; + +export default { + component: Alert, + title: "Components/Alert", + argTypes: { + alertStatus: { + control: "select", + options: ["info", "success", "warning", "danger"], + }, + }, + args: { + title: "Backup completed", + message: "It’s available at admin/autoupgrade/backup. You're ready to start the update now.", + alertStatus: "success", + buttonLabel: "Download backup logs", + buttonUrl: "#", + }, +}; + +export const Default = {}; diff --git a/storybook/stories/components/BackupSelection.stories.js b/storybook/stories/components/BackupSelection.stories.js new file mode 100644 index 000000000..79744d161 --- /dev/null +++ b/storybook/stories/components/BackupSelection.stories.js @@ -0,0 +1,41 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License 3.0 (AFL-3.0) + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ + +import BackupSelection from "../../../views/templates/components/backup-selection.html.twig"; + +export default { + component: BackupSelection, + title: "Components/Backup selection", + args: { + availableBackups: [ + "autoupgrade_save_8.1.6 - 15/07/2024 8:00", + "autoupgrade_save_8.1.6 - 05/07/2024 16:30", + "autoupgrade_save_8.1.6 - 12/04/2024 22:10", + ], + showDelete: false, + }, +}; + +export const Default = {}; diff --git a/storybook/stories/components/CheckRequirements.stories.js b/storybook/stories/components/CheckRequirements.stories.js new file mode 100644 index 000000000..02c6c607e --- /dev/null +++ b/storybook/stories/components/CheckRequirements.stories.js @@ -0,0 +1,80 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License 3.0 (AFL-3.0) + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ + +import CheckRequirements from "../../../views/templates/components/check-requirements.html.twig"; + +export default { + component: CheckRequirements, + title: "Components/Check requirements", + args: { + requirementsOk: true, + checkingForRequirements: true, + updateAssistantDocs: + "https://devdocs.prestashop-project.org/8/basics/keeping-up-to-date/use-autoupgrade-module/", + moduleIsUpToDate: false, + moduleUpdateLink: + "/admin/index.php/improve/modules/updates?_token=MbkhzPrMc9ZknpvSTqeKbKiekftXvp4IowAxrW4Jcfw", + noMissingFiles: false, + informationLink: + "/admin/index.php/configure/advanced/system-information/?_token=MbkhzPrMc9ZknpvSTqeKbKiekftXvp4IowAxrW4Jcfw", + phpRequirementsState: 1, + phpCompatibilityRange: { + php_min_version: "7.2.5", + php_max_version: "8.1", + php_current_version: "7.4.33", + }, + rootDirectoryIsWritable: false, + rootDirectory: "/var/www/html", + adminDirectoryIsWritable: false, + adminDirectoryWritableReport: "", // Not used + safeModeIsDisabled: false, + allowUrlFopenOrCurlIsEnabled: false, + zipIsEnabled: false, + isLocalEnvironment: false, + storeIsInMaintenance: false, + maintenanceLink: + "/admin/index.php/configure/shop/maintenance/?_token=MbkhzPrMc9ZknpvSTqeKbKiekftXvp4IowAxrW4Jcfw", + cachingIsDisabled: false, + cacheLink: + "/admin/index.php/configure/advanced/performance/?_token=MbkhzPrMc9ZknpvSTqeKbKiekftXvp4IowAxrW4Jcfw", + maxExecutionTime: 5, + checkApacheModRewrite: false, + notLoadedPhpExtensions: [ + "curl", "dom", "fileinfo", "gd", "intl", "json", "mbstring", "openssl", "pdo_mysql", "simplexml", "zip" + ], + notExistsPhpFunctions: [ + "fopen", "fclose", "fread", "fwrite", "rename", "file_exists", "unlink", "rmdir", "mkdir", "getcwd", "chdir", "chmod" + ], + checkMemoryLimit: false, + checkFileUploads: false, + checkKeyGeneration: false, + notWritingDirectories: [ + "autoupgrade", "views", "js", "css" + ], + isShopVersionMatchingVersionInDatabase: false, + }, +}; + +export const Default = {}; diff --git a/storybook/stories/components/LocalArchive.stories.js b/storybook/stories/components/LocalArchive.stories.js new file mode 100644 index 000000000..0acdd5ad1 --- /dev/null +++ b/storybook/stories/components/LocalArchive.stories.js @@ -0,0 +1,52 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License 3.0 (AFL-3.0) + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ + +import LocalArchive from "../../../views/templates/components/local-archive.html.twig"; + +export default { + component: LocalArchive, + title: "Components/Local archive", + args: { + archiveFiles: [ + "backup1.zip", + "backup2.zip", + "backup3.zip" + ], + archiveFileName: "backup1.zip", + xmlFiles: [ + "xml1.xml", + "xml2.xml", + "xml2.xml" + ], + xmlFileName: "xml1.xml", + downloadPath: + "/var/www/html/admin128ejliho1ih29s5ahu/autoupgrade/download/", + unableToFindVersion: false, + unableToFindVersionInXML: false, + versionsMismatch: false, + }, +}; + +export const Default = {}; diff --git a/storybook/stories/components/Logs.stories.js b/storybook/stories/components/Logs.stories.js new file mode 100644 index 000000000..cbcc36fc0 --- /dev/null +++ b/storybook/stories/components/Logs.stories.js @@ -0,0 +1,207 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License 3.0 (AFL-3.0) + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ + +import Logs from "../../../views/templates/components/logs.html.twig"; + +export default { + component: Logs, + title: "Components/Logs", + args: { + logs: [ + { + status: "success", + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + }, + { + status: "success", + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + }, + { + status: "success", + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + }, + { + status: "success", + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + }, + { + status: "success", + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + }, + { + status: "warning", + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + id: "warning_1", + }, + { + status: "error", + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + id: "error_1", + }, + { + status: "success", + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + }, + { + status: "success", + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + }, + { + status: "success", + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + }, + { + status: "success", + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + }, + { + status: "success", + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + }, + { + status: "success", + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + }, + { + status: "warning", + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + id: "warning_2", + }, + { + status: "error", + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + id: "error_2", + }, + { + status: "success", + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + }, + { + status: "success", + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + }, + { + status: "success", + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + }, + { + status: "success", + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + }, + { + status: "success", + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + }, + { + status: "success", + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + }, + { + status: "success", + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + }, + { + status: "success", + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + }, + { + status: "success", + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + }, + { + status: "success", + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + }, + { + status: "success", + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + }, + { + status: "success", + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + }, + { + status: "success", + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + }, + { + status: "success", + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + }, + ], + logsSummaryWarning: [ + { + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + anchor: "warning_1", + }, + { + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + anchor: "warning_2", + }, + ], + logsSummaryError: [ + { + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + anchor: "error_1", + }, + { + message: "src/Core/Domain/Product/Pack/Query/GetPackedProducts.php added to archive. 13114 files left.", + anchor: "error_2", + }, + ], + downloadLogsButtonUrl: "#", + downloadLogsButtonLabel: "Download update logs", + }, +}; + +export const Default = {}; + +document.addEventListener("DOMContentLoaded", () => { + document.querySelectorAll(".logs__summary-anchor").forEach(anchor => { + anchor.addEventListener("click", function(e) { + e.preventDefault(); + + const targetId = this.getAttribute("href").substring(1); + const targetElement = document.getElementById(targetId); + const logsScroll = document.querySelector(".logs__scroll"); + + if (logsScroll && targetElement) { + const targetRect = targetElement.getBoundingClientRect(); + const containerRect = logsScroll.getBoundingClientRect(); + const offsetTop = targetRect.top - containerRect.top + logsScroll.scrollTop; + + logsScroll.scrollTo({ + top: offsetTop, + behavior: "smooth" + }); + } else { + console.error("Element not found:", { + logsScroll: logsScroll, + targetElement: targetElement + }); + } + }); + }); +}); \ No newline at end of file diff --git a/storybook/stories/components/LogsProgress.stories.js b/storybook/stories/components/LogsProgress.stories.js new file mode 100644 index 000000000..1c950c8a6 --- /dev/null +++ b/storybook/stories/components/LogsProgress.stories.js @@ -0,0 +1,37 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License 3.0 (AFL-3.0) + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ + +import LogsProgress from "../../../views/templates/components/logs-progress.html.twig"; + +export default { + component: LogsProgress, + title: "Components/Logs progress", + args: { + progressStatus: "Backup files in progress XX files left", + progressPercentage: 25, + } +}; + +export const Default = {}; diff --git a/storybook/stories/components/Modal.stories.js b/storybook/stories/components/Modal.stories.js new file mode 100644 index 000000000..19b4fb618 --- /dev/null +++ b/storybook/stories/components/Modal.stories.js @@ -0,0 +1,55 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License 3.0 (AFL-3.0) + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ + +import Modal from "../../../views/templates/components/modal.html.twig"; + +export default { + title: "Components/Modal", + component: Modal, + argTypes: { + modalSize: { + control: "select", + options: ["sm", "md", "lg"], + }, + }, + args: { + modalId: "modal_id", + title: "Title goes here", + message: "Message goes here, lorem ipsum dolor site amet", + modalSize: "lg", + psBaseUri: "/", + modalDanger: false, + }, +}; + +export const Default = {}; + +document.addEventListener("DOMContentLoaded", () => { + const modals = document.querySelectorAll(".modal"); + modals.forEach((modal) => { + modal.style.display = "block"; + modal.classList.add("in"); + }); +}); diff --git a/storybook/stories/components/ModalBackup.stories.js b/storybook/stories/components/ModalBackup.stories.js new file mode 100644 index 000000000..22e978511 --- /dev/null +++ b/storybook/stories/components/ModalBackup.stories.js @@ -0,0 +1,40 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License 3.0 (AFL-3.0) + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ + +import ModalBackup from "../../../views/templates/modals/modal-backup.html.twig"; +import Modal from "./Modal.stories"; + +export default { + title: "Components/Modal", + component: ModalBackup, + args: { + ...Modal.args, + title: "Start backup?", + message: "Your files and database will be backed up.", + modalSize: "md", + }, +}; + +export const Backup = {}; diff --git a/storybook/stories/components/ModalBackupAll.stories.js b/storybook/stories/components/ModalBackupAll.stories.js new file mode 100644 index 000000000..381d09a22 --- /dev/null +++ b/storybook/stories/components/ModalBackupAll.stories.js @@ -0,0 +1,40 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License 3.0 (AFL-3.0) + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ + +import ModalBackup from "../../../views/templates/modals/modal-backup-all.html.twig"; +import Modal from "./Modal.stories"; + +export default { + title: "Components/Modal", + component: ModalBackup, + args: { + ...Modal.args, + title: "Start backup?", + message: "Your files, database, and images will be backed up.", + modalSize: "md", + }, +}; + +export const BackupWithImg = {}; diff --git a/storybook/stories/components/ModalBackupDelete.stories.js b/storybook/stories/components/ModalBackupDelete.stories.js new file mode 100644 index 000000000..3f982b8e9 --- /dev/null +++ b/storybook/stories/components/ModalBackupDelete.stories.js @@ -0,0 +1,41 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License 3.0 (AFL-3.0) + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ + +import ModalBackupDelete from "../../../views/templates/modals/modal-backup-delete.html.twig"; +import Modal from "./Modal.stories"; + +export default { + title: "Components/Modal", + component: ModalBackupDelete, + args: { + ...Modal.args, + title: "Delete backup", + message: "You are about to delete the autoupgrade_save_8.1.6 backup made on 15/07/2024 8:00. As it's your only backup, you will be redirected to the module's home page.", + modalSize: "lg", + modalDanger: true, + }, +}; + +export const BackupDelete = {}; diff --git a/storybook/stories/components/ModalErrorReport.stories.js b/storybook/stories/components/ModalErrorReport.stories.js new file mode 100644 index 000000000..8711d710a --- /dev/null +++ b/storybook/stories/components/ModalErrorReport.stories.js @@ -0,0 +1,42 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License 3.0 (AFL-3.0) + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ + +import ModalErrorReport from "../../../views/templates/modals/modal-error-report.html.twig"; +import Modal from "./Modal.stories"; + +export default { + title: "Components/Modal", + component: ModalErrorReport, + args: { + ...Modal.args, + modalId: "errorModal", + title: "Send error report?", + message: "", + modalSize: "md", + dataPrivacyLink: "#" + }, +}; + +export const ErrorReport = {}; diff --git a/storybook/stories/components/ModalUpdate.stories.js b/storybook/stories/components/ModalUpdate.stories.js new file mode 100644 index 000000000..fc6f58a40 --- /dev/null +++ b/storybook/stories/components/ModalUpdate.stories.js @@ -0,0 +1,41 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License 3.0 (AFL-3.0) + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ + +import ModalUpdate from "../../../views/templates/modals/modal-update.html.twig"; +import Modal from "./Modal.stories"; + +export default { + title: "Components/Modal", + component: ModalUpdate, + args: { + ...Modal.args, + title: "Start update?", + message: "You are about to launch the update, do you want to continue?", + modalSize: "lg", + noBackUp: false, + }, +}; + +export const Update = {}; diff --git a/storybook/stories/components/Privacy.stories.js b/storybook/stories/components/Privacy.stories.js new file mode 100644 index 000000000..135f80864 --- /dev/null +++ b/storybook/stories/components/Privacy.stories.js @@ -0,0 +1,33 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License 3.0 (AFL-3.0) + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ + +import Privacy from "../../../views/templates/components/privacy.html.twig"; + +export default { + component: Privacy, + title: "Components/Privacy", +}; + +export const Default = {}; diff --git a/storybook/stories/components/RadioCard.stories.js b/storybook/stories/components/RadioCard.stories.js new file mode 100644 index 000000000..f46fff35d --- /dev/null +++ b/storybook/stories/components/RadioCard.stories.js @@ -0,0 +1,102 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License 3.0 (AFL-3.0) + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ + +import RadioCard from "../../../views/templates/components/radio-card.html.twig"; +import LocalArchive from "./LocalArchive.stories"; +import CheckRequirements from "./CheckRequirements.stories"; + +export default { + component: RadioCard, + title: "Components/Radio card", + argTypes: { + badgeStatus: { + control: "select", + options: ["major", "minor", "patch"], + }, + }, + args: { + radioCardId: "", + checked: false, + title: "Update your store", + message: + "Update your store to benefit from the latest improvements, bug fixes and security patches.", + disabled: false, + disabledMessage: "No backup file found on your store.", + badgeLabel: "Major version", + badgeStatus: "major", + releaseNote: "https://github.com/PrestaShop/autoupgrade", + archiveCard: false, + checkRequirements: false, + ...LocalArchive.args, + ...CheckRequirements.args, + }, +}; + +export const Default = {}; + +export const Archive = { + args: { + radioCardId: "", + checked: true, + title: "Local archive", + message: + "Save the archive file of the version you want to update to in the following directory: /admin/autoUpdate/download/", + disabled: false, + disabledMessage: "No backup file found on your store.", + badgeLabel: "", + releaseNote: "", + archiveCard: true, + checkRequirements: false, + ...LocalArchive.args, + ...CheckRequirements.args, + }, +}; + +export const Requirements = { + args: { + checked: true, + checkRequirements: true, + ...LocalArchive.args, + ...CheckRequirements.args, + requirementsOk: false, + checkingForRequirements: false, + }, +}; + +document.addEventListener("DOMContentLoaded", () => { + const radioCards = document.querySelectorAll( + '.radio-card input[type="radio"]', + ); + + radioCards.forEach((radio) => { + radio.addEventListener("click", function () { + radioCards.forEach((radio) => { + if (radio !== this) { + radio.checked = false; + } + }); + }); + }); +}); diff --git a/storybook/stories/components/RenderBool.stories.js b/storybook/stories/components/RenderBool.stories.js new file mode 100644 index 000000000..653d797b0 --- /dev/null +++ b/storybook/stories/components/RenderBool.stories.js @@ -0,0 +1,56 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License 3.0 (AFL-3.0) + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ + +import RenderBool from "../../../views/templates/components/render-bool.html.twig"; + +export default { + title: "Components/Render fields", + component: RenderBool, + argTypes: { + type: { + control: 'select', + options: ['disabled', 'bool', 'radio', 'select', 'textarea', 'container', 'container_end', 'text'], + defaultValue: 'bool', + }, + }, + args: { + field: { + id: "deactivate_modules", + title: "Deactivate non-native modules", + desc: "All the modules installed after creating your store are considered non-native modules. They might be incompatible with the new version of PrestaShop. We recommend deactivating them during the update.", + js: { + on: 'onclick="enableFeature()"', + off: 'onclick="disableFeature()"', + }, + type: 'bool', + required: true, + disabled: true, + }, + key: "PS_AUTOUP_CUSTOM_MOD_DESACT", + val: true, + }, +}; + +export const Boolean = {}; diff --git a/storybook/stories/components/RenderSelect.stories.js b/storybook/stories/components/RenderSelect.stories.js new file mode 100644 index 000000000..8dbbbfe90 --- /dev/null +++ b/storybook/stories/components/RenderSelect.stories.js @@ -0,0 +1,66 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License 3.0 (AFL-3.0) + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ + +import RenderSelect from "../../../views/templates/components/render-select.html.twig"; + +export default { + title: "Components/Render fields", + component: RenderSelect, + argTypes: { + type: { + control: "select", + options: [ + "disabled", + "bool", + "radio", + "select", + "textarea", + "container", + "container_end", + "text", + ], + defaultValue: "select", + }, + }, + args: { + field: { + id: "switch_theme", + title: "Switch the theme", + desc: "Custom themes may cause compatibility issues. We recommend using a default theme during the update and change it afterwards.", + choices: { + 0: "Keep the actual theme", + 1: "Upgrade the default theme", + 2: "Do nothing", + }, + type: "select", + required: true, + disabled: false, + }, + key: "PS_AUTOUP_SWITCH_THEME", + val: "1", + }, +}; + +export const Select = {}; diff --git a/storybook/stories/components/Stepper.stories.js b/storybook/stories/components/Stepper.stories.js new file mode 100644 index 000000000..a31edba6f --- /dev/null +++ b/storybook/stories/components/Stepper.stories.js @@ -0,0 +1,57 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License 3.0 (AFL-3.0) + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ + +import Stepper from "../../../views/templates/components/stepper.html.twig"; + +export default { + component: Stepper, + title: "Components/Stepper", + args: { + steps: [ + { + state: "done", + title: "Version choice", + }, + { + state: "current", + title: "Update options", + }, + { + state: "normal", + title: "Backup", + }, + { + state: "normal", + title: "Update", + }, + { + state: "normal", + title: "Post-update", + }, + ], + }, +}; + +export const Default = {}; diff --git a/storybook/stories/layouts/Backup.stories.js b/storybook/stories/layouts/Backup.stories.js new file mode 100644 index 000000000..d3cabdd61 --- /dev/null +++ b/storybook/stories/layouts/Backup.stories.js @@ -0,0 +1,49 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License 3.0 (AFL-3.0) + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ + +import BackupLayout from "../../../views/templates/layouts/backup.html.twig"; + +export default { + component: BackupLayout, + title: "Layouts/Pages/Backup", + args: { + steps: [ + { + state: "current", + title: "Backup selection", + }, + { + state: "normal", + title: "Restore", + }, + { + state: "normal", + title: "Post-restore", + }, + ], + }, +}; + +export const Default = {}; diff --git a/storybook/stories/layouts/Layout.stories.js b/storybook/stories/layouts/Layout.stories.js new file mode 100644 index 000000000..34d17b2f8 --- /dev/null +++ b/storybook/stories/layouts/Layout.stories.js @@ -0,0 +1,38 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License 3.0 (AFL-3.0) + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ + +import BaseLayout from "../../../views/templates/layouts/layout.html.twig"; +import Welcome from "./Welcome.stories"; + +export default { + component: BaseLayout, + title: "Layouts/Pages/Layout test", + args: { + ...Welcome.args, + page: "welcome", + }, +}; + +export const Default = {}; diff --git a/storybook/stories/layouts/Page.stories.js b/storybook/stories/layouts/Page.stories.js new file mode 100644 index 000000000..efa4c121b --- /dev/null +++ b/storybook/stories/layouts/Page.stories.js @@ -0,0 +1,37 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License 3.0 (AFL-3.0) + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ + +import PageLayout from "../../../views/templates/layouts/page.html.twig"; +import Stepper from "../components/Stepper.stories"; + +export default { + component: PageLayout, + title: "Layouts/Pages/Base", + args: { + ...Stepper.args, + }, +}; + +export const Default = {}; diff --git a/storybook/stories/layouts/PostUpdateChecklist.stories.js b/storybook/stories/layouts/PostUpdateChecklist.stories.js new file mode 100644 index 000000000..a77cf0c9d --- /dev/null +++ b/storybook/stories/layouts/PostUpdateChecklist.stories.js @@ -0,0 +1,62 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License 3.0 (AFL-3.0) + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ + +import PostUpdateChecklistLayout from "../../../views/templates/layouts/post-update-checklist.html.twig"; + +export default { + component: PostUpdateChecklistLayout, + title: "Layouts/Pages/Post update checklist", + args: { + psBaseUri: "/", + upToDate: true, + noLocalArchive: true, + currentPrestashopVersion: "8.1.6", + currentPhpVersion: "8.1", + steps: [ + { + state: "done", + title: "Version choice", + }, + { + state: "done", + title: "Update options", + }, + { + state: "done", + title: "Backup", + }, + { + state: "done", + title: "Update", + }, + { + state: "current", + title: "Post-update", + }, + ], + }, +}; + +export const Default = {}; diff --git a/storybook/stories/layouts/Restore.stories.js b/storybook/stories/layouts/Restore.stories.js new file mode 100644 index 000000000..5fc423f37 --- /dev/null +++ b/storybook/stories/layouts/Restore.stories.js @@ -0,0 +1,51 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License 3.0 (AFL-3.0) + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ + +import RestoreLayout from "../../../views/templates/layouts/restore.html.twig"; +import BackupSelection from "../components/BackupSelection.stories"; + +export default { + component: RestoreLayout, + title: "Layouts/Pages/Restore", + args: { + ...BackupSelection.args, + steps: [ + { + state: "current", + title: "Backup selection", + }, + { + state: "normal", + title: "Restore", + }, + { + state: "normal", + title: "Post-restore", + }, + ], + }, +}; + +export const Default = {}; diff --git a/storybook/stories/layouts/Update.stories.js b/storybook/stories/layouts/Update.stories.js new file mode 100644 index 000000000..9937deeec --- /dev/null +++ b/storybook/stories/layouts/Update.stories.js @@ -0,0 +1,61 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License 3.0 (AFL-3.0) + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ + +import UpdateLayout from "../../../views/templates/layouts/update.html.twig"; +import LogsProgress from "../components/LogsProgress.stories"; +import Logs from "../components/Logs.stories"; + +export default { + component: UpdateLayout, + title: "Layouts/Pages/Update", + args: { + ...LogsProgress.args, + ...Logs.args, + steps: [ + { + state: "done", + title: "Version choice", + }, + { + state: "done", + title: "Update options", + }, + { + state: "done", + title: "Backup", + }, + { + state: "current", + title: "Update", + }, + { + state: "normal", + title: "Post-update", + }, + ], + }, +}; + +export const Default = {}; diff --git a/storybook/stories/layouts/UpdateOptions.stories.js b/storybook/stories/layouts/UpdateOptions.stories.js new file mode 100644 index 000000000..edbf07d6a --- /dev/null +++ b/storybook/stories/layouts/UpdateOptions.stories.js @@ -0,0 +1,57 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License 3.0 (AFL-3.0) + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ + +import UpdateOptionsLayout from "../../../views/templates/layouts/update-options.html.twig"; + +export default { + component: UpdateOptionsLayout, + title: "Layouts/Pages/Update options", + args: { + steps: [ + { + state: "done", + title: "Version choice", + }, + { + state: "current", + title: "Update options", + }, + { + state: "normal", + title: "Backup", + }, + { + state: "normal", + title: "Update", + }, + { + state: "normal", + title: "Post-update", + }, + ], + }, +}; + +export const Default = {}; diff --git a/storybook/stories/layouts/VersionChoice.stories.js b/storybook/stories/layouts/VersionChoice.stories.js new file mode 100644 index 000000000..27d46cad1 --- /dev/null +++ b/storybook/stories/layouts/VersionChoice.stories.js @@ -0,0 +1,66 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License 3.0 (AFL-3.0) + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ + +import VersionChoiceLayout from "../../../views/templates/layouts/version-choice.html.twig"; +import LocalArchive from "../components/LocalArchive.stories"; +import RadioCard from "../components/RadioCard.stories"; + +export default { + component: VersionChoiceLayout, + title: "Layouts/Pages/Version choice", + args: { + psBaseUri: "/", + upToDate: true, + noLocalArchive: true, + currentPrestashopVersion: "8.1.6", + currentPhpVersion: "8.1", + ...RadioCard.args, + ...LocalArchive.args, + steps: [ + { + state: "current", + title: "Version choice", + }, + { + state: "normal", + title: "Update options", + }, + { + state: "normal", + title: "Backup", + }, + { + state: "normal", + title: "Update", + }, + { + state: "normal", + title: "Post-update", + }, + ], + }, +}; + +export const Default = {}; diff --git a/storybook/stories/layouts/Welcome.stories.js b/storybook/stories/layouts/Welcome.stories.js new file mode 100644 index 000000000..802b3510f --- /dev/null +++ b/storybook/stories/layouts/Welcome.stories.js @@ -0,0 +1,37 @@ +/** + * Copyright since 2007 PrestaShop SA and Contributors + * PrestaShop is an International Registered Trademark & Property of PrestaShop SA + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License 3.0 (AFL-3.0) + * that is bundled with this package in the file LICENSE.md. + * It is also available through the world-wide-web at this URL: + * https://opensource.org/licenses/AFL-3.0 + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@prestashop.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) + */ + +import WelcomeLayout from "../../../views/templates/layouts/welcome.html.twig"; +import RadioCard from "../components/RadioCard.stories"; + +export default { + component: WelcomeLayout, + title: "Layouts/Pages/Welcome", + args: { + ...RadioCard.args, + }, +}; + +export const Default = {}; From 799545f118bc6e63647f260c3cd29c76e740e7d7 Mon Sep 17 00:00:00 2001 From: Alexis Guyomar Date: Mon, 2 Sep 2024 17:48:26 +0200 Subject: [PATCH 18/27] feat: add images --- _dev/img/check.svg | 1 + _dev/img/close.svg | 1 + _dev/img/rocket_white.svg | 3 + _dev/img/unfold_more.png | Bin 820 -> 0 bytes _dev/img/up_to_date.svg | 494 ++++++++++++++++++++++++++++++++++++++ _dev/img/warning.svg | 1 + 6 files changed, 500 insertions(+) create mode 100644 _dev/img/check.svg create mode 100644 _dev/img/close.svg create mode 100644 _dev/img/rocket_white.svg delete mode 100644 _dev/img/unfold_more.png create mode 100644 _dev/img/up_to_date.svg create mode 100644 _dev/img/warning.svg diff --git a/_dev/img/check.svg b/_dev/img/check.svg new file mode 100644 index 000000000..979b91f55 --- /dev/null +++ b/_dev/img/check.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/_dev/img/close.svg b/_dev/img/close.svg new file mode 100644 index 000000000..5b821afb8 --- /dev/null +++ b/_dev/img/close.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/_dev/img/rocket_white.svg b/_dev/img/rocket_white.svg new file mode 100644 index 000000000..8f78c5c70 --- /dev/null +++ b/_dev/img/rocket_white.svg @@ -0,0 +1,3 @@ + + + diff --git a/_dev/img/unfold_more.png b/_dev/img/unfold_more.png deleted file mode 100644 index c37b255675bce9c02d29cf376f37952e0e3e364f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 820 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7Ro>VEXOp;uum9_x6rsP_u&w%Y}on zd<*1`ytz7grMmIEuL`diHwkBJYz)%$_{Za1y1mToCd2$MkJA+rUrdU>z+#nAD(=t5 zAkV^Pz+k~xP+8uc^Y!{4RhFy<)rYGUE--E3h-YjRT9EqV4Mzz>cFXx52i5?oy8BC)KV05nXX{dbF>!a& zGR760|9_Q!p3z)?|DAlOpa#RV7JIp$t2hc8#2#uZJ1|DIt?y!Bj!>>~Wsx{={H)#o znMQvWm%f{NzU&y|_dA=Wa_nBc{cLT?ZQbe3j8FIl9anJf7hn|oSHN{QXmeWha)D_r z@-7W+{)`6KIdu=&H#6|hXL}&AF!hHqhseWV#vYE^>2Y4{cV2|wKY#R=Zq|XhxBP!d z2=KmNub0lSVGSdC2sH>ZOfP4bV3@*Qo?}2KpfNKEP{6{(~RGXrHh%l_Rax|=wYFNs#3h4JMN<7Uk&I^|)hc7FY!acUpu#0!#s=Fh)P=3B5#ScxOY{oi|2zm(^Kr?W8I_ZY_V# ymCW{h>8kzIUvR0sQ)MM{!&e@7%EKM5|9Sm&ZWesjU~vNG1_n=8KbLh*2~7ZPuu^IO diff --git a/_dev/img/up_to_date.svg b/_dev/img/up_to_date.svg new file mode 100644 index 000000000..acd115c9e --- /dev/null +++ b/_dev/img/up_to_date.svg @@ -0,0 +1,494 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/_dev/img/warning.svg b/_dev/img/warning.svg new file mode 100644 index 000000000..ac6dffafe --- /dev/null +++ b/_dev/img/warning.svg @@ -0,0 +1 @@ + \ No newline at end of file From 77f808bd254a8e9d7274fb405c1fa83ee3eadb59 Mon Sep 17 00:00:00 2001 From: Alexis Guyomar Date: Wed, 4 Sep 2024 09:13:07 +0200 Subject: [PATCH 19/27] feat: remove test javascript --- _dev/scripts/main.ts | 9 +++------ _dev/scripts/test.ts | 5 ----- 2 files changed, 3 insertions(+), 11 deletions(-) delete mode 100644 _dev/scripts/test.ts diff --git a/_dev/scripts/main.ts b/_dev/scripts/main.ts index eb3b926e1..d9b5aca2b 100644 --- a/_dev/scripts/main.ts +++ b/_dev/scripts/main.ts @@ -1,8 +1,5 @@ -import yolo from './test'; - -const test = () => { - console.log('test'); - yolo(); +const main = () => { + return null; }; -test(); +main(); diff --git a/_dev/scripts/test.ts b/_dev/scripts/test.ts deleted file mode 100644 index 32acfe184..000000000 --- a/_dev/scripts/test.ts +++ /dev/null @@ -1,5 +0,0 @@ -const yolo = () => { - console.log('yolo'); -}; - -export default yolo; From a8bf6be3f6e04580e14873895ccde145a149f4aa Mon Sep 17 00:00:00 2001 From: Alexis Guyomar Date: Wed, 4 Sep 2024 11:25:20 +0200 Subject: [PATCH 20/27] feat: add compilation of _dev styles to storybook --- _dev/styles/main.scss | 3 +- storybook/.storybook/main.ts | 13 ++- storybook/.storybook/preview.ts | 1 + storybook/package-lock.json | 198 ++++++++++++++++++++++++++++++-- storybook/package.json | 5 + 5 files changed, 205 insertions(+), 15 deletions(-) diff --git a/_dev/styles/main.scss b/_dev/styles/main.scss index c47889648..e522dd5d6 100644 --- a/_dev/styles/main.scss +++ b/_dev/styles/main.scss @@ -73,7 +73,8 @@ .ocu-feature-list li { padding-left: 20px; margin: 0; - background: url("../img/admin/enabled.gif") no-repeat; + /* webpackIgnore: true */ + background: url( "../img/admin/enabled.gif") no-repeat; } .label-small { diff --git a/storybook/.storybook/main.ts b/storybook/.storybook/main.ts index 1e73962a7..6577167e8 100644 --- a/storybook/.storybook/main.ts +++ b/storybook/.storybook/main.ts @@ -34,6 +34,7 @@ const config: StorybookConfig = { "@storybook/addon-webpack5-compiler-swc", "@storybook/addon-links", "@storybook/addon-essentials", + "@storybook/addon-styling-webpack" ], framework: { name: "@sensiolabs/storybook-symfony-webpack5", @@ -49,6 +50,14 @@ const config: StorybookConfig = { }, }, webpackFinal: async (config) => { + config?.module?.rules?.push({ + test: /\.scss$/, + use: [ + "style-loader", + "css-loader", + "sass-loader" + ], + }); // List translations files on compilation to fill language selection list const newPlugin = new webpack.DefinePlugin({ TRANSLATION_LOCALES: JSON.stringify( @@ -74,16 +83,12 @@ const config: StorybookConfig = { `, previewBody: (body) => ` - ${body} `, staticDirs: [ "../public", "../node_modules/prestashop-bo-themes", - { from: "../../css", to: "css" }, - { from: "../../js", to: "js" }, - { from: "../../img", to: "img" }, ], }; export default config; diff --git a/storybook/.storybook/preview.ts b/storybook/.storybook/preview.ts index 0d9718442..12073c3d3 100644 --- a/storybook/.storybook/preview.ts +++ b/storybook/.storybook/preview.ts @@ -24,6 +24,7 @@ */ import { Preview, twig } from "@sensiolabs/storybook-symfony-webpack5"; +import '../../_dev/styles/main.scss'; const cssEntrypoints = { "9.0.0": ["/9.0.0/default/theme.css"], diff --git a/storybook/package-lock.json b/storybook/package-lock.json index f343f92fe..9306ee8eb 100644 --- a/storybook/package-lock.json +++ b/storybook/package-lock.json @@ -8,10 +8,15 @@ "@sensiolabs/storybook-symfony-webpack5": "file:vendor/sensiolabs/storybook-bundle/storybook", "@storybook/addon-essentials": "^8.0.0", "@storybook/addon-links": "^8.0.0", + "@storybook/addon-styling-webpack": "^1.0.0", "@storybook/addon-webpack5-compiler-swc": "^1.0.2", "@storybook/blocks": "^8.0.0", "@storybook/cli": "^8.0.0", + "css-loader": "^7.1.2", "prestashop-bo-themes": "PrestaShop/Prestashop-BO-themes-package#main", + "sass": "^1.78.0", + "sass-loader": "^16.0.1", + "style-loader": "^4.0.0", "typescript": "^5.4.2", "webpack": "^5.90.3" } @@ -3537,6 +3542,18 @@ "url": "https://opencollective.com/storybook" } }, + "node_modules/@storybook/addon-styling-webpack": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@storybook/addon-styling-webpack/-/addon-styling-webpack-1.0.0.tgz", + "integrity": "sha512-jo1kzn7pi+NA+LZxrWoRvW6w7dXIKY/BjTG80XX2uU92lIKT+X1k/9vYk/0KPVK3Bsf4tO6ToAuqIRyOk7MHtg==", + "dev": true, + "dependencies": { + "@storybook/node-logger": "^8.0.0-alpha.10" + }, + "peerDependencies": { + "webpack": "^5.0.0" + } + }, "node_modules/@storybook/addon-toolbars": { "version": "8.1.11", "resolved": "https://registry.npmjs.org/@storybook/addon-toolbars/-/addon-toolbars-8.1.11.tgz", @@ -3698,6 +3715,41 @@ } } }, + "node_modules/@storybook/builder-webpack5/node_modules/css-loader": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-6.11.0.tgz", + "integrity": "sha512-CTJ+AEQJjq5NzLga5pE39qdiSV56F8ywCIsqNIRF0r7BDgWsN25aazToqAFg7ZrtA/U016xudB3ffgweORxX7g==", + "dev": true, + "dependencies": { + "icss-utils": "^5.1.0", + "postcss": "^8.4.33", + "postcss-modules-extract-imports": "^3.1.0", + "postcss-modules-local-by-default": "^4.0.5", + "postcss-modules-scope": "^3.2.0", + "postcss-modules-values": "^4.0.0", + "postcss-value-parser": "^4.2.0", + "semver": "^7.5.4" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "@rspack/core": "0.x || 1.x", + "webpack": "^5.0.0" + }, + "peerDependenciesMeta": { + "@rspack/core": { + "optional": true + }, + "webpack": { + "optional": true + } + } + }, "node_modules/@storybook/builder-webpack5/node_modules/semver": { "version": "7.6.2", "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", @@ -3710,6 +3762,22 @@ "node": ">=10" } }, + "node_modules/@storybook/builder-webpack5/node_modules/style-loader": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-3.3.4.tgz", + "integrity": "sha512-0WqXzrsMTyb8yjZJHDqwmnwRJvhALK9LfRtRc6B4UTWe8AijYLZYZ9thuJTZc2VfQWINADW/j+LiJnfy2RoC1w==", + "dev": true, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.0.0" + } + }, "node_modules/@storybook/builder-webpack5/node_modules/webpack-virtual-modules": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/webpack-virtual-modules/-/webpack-virtual-modules-0.5.0.tgz", @@ -7118,9 +7186,9 @@ } }, "node_modules/css-loader": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-6.11.0.tgz", - "integrity": "sha512-CTJ+AEQJjq5NzLga5pE39qdiSV56F8ywCIsqNIRF0r7BDgWsN25aazToqAFg7ZrtA/U016xudB3ffgweORxX7g==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-7.1.2.tgz", + "integrity": "sha512-6WvYYn7l/XEGN8Xu2vWFt9nVzrCn39vKyTEFf/ExEyoksJjjSZV/0/35XPlMbpnr6VGhZIUg5yJrL8tGfes/FA==", "dev": true, "dependencies": { "icss-utils": "^5.1.0", @@ -7133,7 +7201,7 @@ "semver": "^7.5.4" }, "engines": { - "node": ">= 12.13.0" + "node": ">= 18.12.0" }, "funding": { "type": "opencollective", @@ -7141,7 +7209,7 @@ }, "peerDependencies": { "@rspack/core": "0.x || 1.x", - "webpack": "^5.0.0" + "webpack": "^5.27.0" }, "peerDependenciesMeta": { "@rspack/core": { @@ -9757,6 +9825,12 @@ "node": ">= 4" } }, + "node_modules/immutable": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.7.tgz", + "integrity": "sha512-1hqclzwYwjRDFLjcFxOM5AYkkG0rpFPpr1RLPMEuGczoS7YA8gLhy8SWXYRAA/XwfEHpfo3cw5JGioS32fnMRw==", + "dev": true + }, "node_modules/import-fresh": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", @@ -13496,6 +13570,63 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true }, + "node_modules/sass": { + "version": "1.78.0", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.78.0.tgz", + "integrity": "sha512-AaIqGSrjo5lA2Yg7RvFZrlXDBCp3nV4XP73GrLGvdRWWwk+8H3l0SDvq/5bA4eF+0RFPLuWUk3E+P1U/YqnpsQ==", + "dev": true, + "dependencies": { + "chokidar": ">=3.0.0 <4.0.0", + "immutable": "^4.0.0", + "source-map-js": ">=0.6.2 <2.0.0" + }, + "bin": { + "sass": "sass.js" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/sass-loader": { + "version": "16.0.1", + "resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-16.0.1.tgz", + "integrity": "sha512-xACl1ToTsKnL9Ce5yYpRxrLj9QUDCnwZNhzpC7tKiFyA8zXsd3Ap+HGVnbCgkdQcm43E+i6oKAWBsvGA6ZoiMw==", + "dev": true, + "dependencies": { + "neo-async": "^2.6.2" + }, + "engines": { + "node": ">= 18.12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "@rspack/core": "0.x || 1.x", + "node-sass": "^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0", + "sass": "^1.3.0", + "sass-embedded": "*", + "webpack": "^5.0.0" + }, + "peerDependenciesMeta": { + "@rspack/core": { + "optional": true + }, + "node-sass": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "webpack": { + "optional": true + } + } + }, "node_modules/saxes": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", @@ -14074,19 +14205,19 @@ "dev": true }, "node_modules/style-loader": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-3.3.4.tgz", - "integrity": "sha512-0WqXzrsMTyb8yjZJHDqwmnwRJvhALK9LfRtRc6B4UTWe8AijYLZYZ9thuJTZc2VfQWINADW/j+LiJnfy2RoC1w==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-4.0.0.tgz", + "integrity": "sha512-1V4WqhhZZgjVAVJyt7TdDPZoPBPNHbekX4fWnCJL1yQukhCeZhJySUL+gL9y6sNdN95uEOS83Y55SqHcP7MzLA==", "dev": true, "engines": { - "node": ">= 12.13.0" + "node": ">= 18.12.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/webpack" }, "peerDependencies": { - "webpack": "^5.0.0" + "webpack": "^5.27.0" } }, "node_modules/sucrase": { @@ -16976,6 +17107,41 @@ } } }, + "vendor/sensiolabs/storybook-bundle/storybook/node_modules/css-loader": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-6.11.0.tgz", + "integrity": "sha512-CTJ+AEQJjq5NzLga5pE39qdiSV56F8ywCIsqNIRF0r7BDgWsN25aazToqAFg7ZrtA/U016xudB3ffgweORxX7g==", + "dev": true, + "dependencies": { + "icss-utils": "^5.1.0", + "postcss": "^8.4.33", + "postcss-modules-extract-imports": "^3.1.0", + "postcss-modules-local-by-default": "^4.0.5", + "postcss-modules-scope": "^3.2.0", + "postcss-modules-values": "^4.0.0", + "postcss-value-parser": "^4.2.0", + "semver": "^7.5.4" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "@rspack/core": "0.x || 1.x", + "webpack": "^5.0.0" + }, + "peerDependenciesMeta": { + "@rspack/core": { + "optional": true + }, + "webpack": { + "optional": true + } + } + }, "vendor/sensiolabs/storybook-bundle/storybook/node_modules/rimraf": { "version": "5.0.7", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.7.tgz", @@ -16993,6 +17159,18 @@ "funding": { "url": "https://github.com/sponsors/isaacs" } + }, + "vendor/sensiolabs/storybook-bundle/storybook/node_modules/semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } } } } diff --git a/storybook/package.json b/storybook/package.json index dfb1f6d05..10f55a6a0 100644 --- a/storybook/package.json +++ b/storybook/package.json @@ -3,10 +3,15 @@ "@sensiolabs/storybook-symfony-webpack5": "file:vendor/sensiolabs/storybook-bundle/storybook", "@storybook/addon-essentials": "^8.0.0", "@storybook/addon-links": "^8.0.0", + "@storybook/addon-styling-webpack": "^1.0.0", "@storybook/addon-webpack5-compiler-swc": "^1.0.2", "@storybook/blocks": "^8.0.0", "@storybook/cli": "^8.0.0", + "css-loader": "^7.1.2", "prestashop-bo-themes": "PrestaShop/Prestashop-BO-themes-package#main", + "sass": "^1.78.0", + "sass-loader": "^16.0.1", + "style-loader": "^4.0.0", "typescript": "^5.4.2", "webpack": "^5.90.3" }, From 9981e0e959be93cecdf1b86f75ef01268d93c700 Mon Sep 17 00:00:00 2001 From: Alexis Guyomar Date: Wed, 4 Sep 2024 15:46:59 +0200 Subject: [PATCH 21/27] feat: move scss and ts to src and rename folders --- _dev/package.json | 4 ++-- _dev/{styles => src/scss}/_mixins.scss | 0 _dev/{styles => src/scss}/_variables.scss | 0 _dev/{styles => src/scss}/components/_alert.scss | 0 .../scss}/components/_backup-deletion.scss | 0 _dev/{styles => src/scss}/components/_button.scss | 0 .../scss}/components/_check-requirements.scss | 6 +++--- _dev/{styles => src/scss}/components/_content.scss | 0 _dev/{styles => src/scss}/components/_index.scss | 0 .../scss}/components/_local-archive.scss | 0 _dev/{styles => src/scss}/components/_logs.scss | 6 +++--- _dev/{styles => src/scss}/components/_modal.scss | 0 _dev/{styles => src/scss}/components/_privacy.scss | 0 _dev/{styles => src/scss}/components/_progress.scss | 0 _dev/{styles => src/scss}/components/_radio-card.scss | 0 _dev/{styles => src/scss}/components/_stepper.scss | 2 +- _dev/{styles => src/scss}/components/_typography.scss | 0 .../scss}/components/form/_checkbox.scss | 0 _dev/{styles => src/scss}/components/form/_form.scss | 2 +- _dev/{styles => src/scss}/components/form/_index.scss | 0 _dev/{styles => src/scss}/components/form/_radio.scss | 0 .../scss}/components/form/_render-field.scss | 0 _dev/{styles => src/scss}/components/form/_switch.scss | 0 _dev/{styles => src/scss}/layouts/_backup.scss | 0 _dev/{styles => src/scss}/layouts/_index.scss | 0 _dev/{styles => src/scss}/layouts/_layout.scss | 0 _dev/{styles => src/scss}/layouts/_page.scss | 0 _dev/{styles => src/scss}/layouts/_version-choice.scss | 0 _dev/{styles => src/scss}/layouts/_welcome.scss | 0 _dev/{styles => src/scss}/main.scss | 0 _dev/{scripts => src/ts}/main.ts | 0 _dev/tsconfig.json | 10 +++++++--- _dev/vite.config.ts | 4 ++-- storybook/.storybook/preview.ts | 2 +- 34 files changed, 20 insertions(+), 16 deletions(-) rename _dev/{styles => src/scss}/_mixins.scss (100%) rename _dev/{styles => src/scss}/_variables.scss (100%) rename _dev/{styles => src/scss}/components/_alert.scss (100%) rename _dev/{styles => src/scss}/components/_backup-deletion.scss (100%) rename _dev/{styles => src/scss}/components/_button.scss (100%) rename _dev/{styles => src/scss}/components/_check-requirements.scss (93%) rename _dev/{styles => src/scss}/components/_content.scss (100%) rename _dev/{styles => src/scss}/components/_index.scss (100%) rename _dev/{styles => src/scss}/components/_local-archive.scss (100%) rename _dev/{styles => src/scss}/components/_logs.scss (89%) rename _dev/{styles => src/scss}/components/_modal.scss (100%) rename _dev/{styles => src/scss}/components/_privacy.scss (100%) rename _dev/{styles => src/scss}/components/_progress.scss (100%) rename _dev/{styles => src/scss}/components/_radio-card.scss (100%) rename _dev/{styles => src/scss}/components/_stepper.scss (97%) rename _dev/{styles => src/scss}/components/_typography.scss (100%) rename _dev/{styles => src/scss}/components/form/_checkbox.scss (100%) rename _dev/{styles => src/scss}/components/form/_form.scss (93%) rename _dev/{styles => src/scss}/components/form/_index.scss (100%) rename _dev/{styles => src/scss}/components/form/_radio.scss (100%) rename _dev/{styles => src/scss}/components/form/_render-field.scss (100%) rename _dev/{styles => src/scss}/components/form/_switch.scss (100%) rename _dev/{styles => src/scss}/layouts/_backup.scss (100%) rename _dev/{styles => src/scss}/layouts/_index.scss (100%) rename _dev/{styles => src/scss}/layouts/_layout.scss (100%) rename _dev/{styles => src/scss}/layouts/_page.scss (100%) rename _dev/{styles => src/scss}/layouts/_version-choice.scss (100%) rename _dev/{styles => src/scss}/layouts/_welcome.scss (100%) rename _dev/{styles => src/scss}/main.scss (100%) rename _dev/{scripts => src/ts}/main.ts (100%) diff --git a/_dev/package.json b/_dev/package.json index 2b7ed9eb0..6f0b9cf11 100644 --- a/_dev/package.json +++ b/_dev/package.json @@ -8,8 +8,8 @@ "vite:build": "vite build", "lint": "eslint", "lint:fix": "eslint --fix", - "lint-scss": "npx stylelint 'styles/**/*.scss'", - "lint-scss:fix": "npx stylelint --fix 'styles/**/*.scss'", + "lint-scss": "npx stylelint 'src/scss/**/*.scss'", + "lint-scss:fix": "npx stylelint --fix 'src/scss/**/*.scss'", "prettier": "prettier --check \"**/*.{ts,js,scss}\"", "prettier:fix": "prettier --write \"**/*.{ts,js,scss}\"" }, diff --git a/_dev/styles/_mixins.scss b/_dev/src/scss/_mixins.scss similarity index 100% rename from _dev/styles/_mixins.scss rename to _dev/src/scss/_mixins.scss diff --git a/_dev/styles/_variables.scss b/_dev/src/scss/_variables.scss similarity index 100% rename from _dev/styles/_variables.scss rename to _dev/src/scss/_variables.scss diff --git a/_dev/styles/components/_alert.scss b/_dev/src/scss/components/_alert.scss similarity index 100% rename from _dev/styles/components/_alert.scss rename to _dev/src/scss/components/_alert.scss diff --git a/_dev/styles/components/_backup-deletion.scss b/_dev/src/scss/components/_backup-deletion.scss similarity index 100% rename from _dev/styles/components/_backup-deletion.scss rename to _dev/src/scss/components/_backup-deletion.scss diff --git a/_dev/styles/components/_button.scss b/_dev/src/scss/components/_button.scss similarity index 100% rename from _dev/styles/components/_button.scss rename to _dev/src/scss/components/_button.scss diff --git a/_dev/styles/components/_check-requirements.scss b/_dev/src/scss/components/_check-requirements.scss similarity index 93% rename from _dev/styles/components/_check-requirements.scss rename to _dev/src/scss/components/_check-requirements.scss index e671e7933..387ea6286 100644 --- a/_dev/styles/components/_check-requirements.scss +++ b/_dev/src/scss/components/_check-requirements.scss @@ -79,15 +79,15 @@ $e: ".check-requirements"; line-height: 1.4; &--error { - background-image: url("../img/close.svg"); + background-image: url("../../img/close.svg"); } &--warning { - background-image: url("../img/warning.svg"); + background-image: url("../../img/warning.svg"); } &--success { - background-image: url("../img/check.svg"); + background-image: url("../../img/check.svg"); } } diff --git a/_dev/styles/components/_content.scss b/_dev/src/scss/components/_content.scss similarity index 100% rename from _dev/styles/components/_content.scss rename to _dev/src/scss/components/_content.scss diff --git a/_dev/styles/components/_index.scss b/_dev/src/scss/components/_index.scss similarity index 100% rename from _dev/styles/components/_index.scss rename to _dev/src/scss/components/_index.scss diff --git a/_dev/styles/components/_local-archive.scss b/_dev/src/scss/components/_local-archive.scss similarity index 100% rename from _dev/styles/components/_local-archive.scss rename to _dev/src/scss/components/_local-archive.scss diff --git a/_dev/styles/components/_logs.scss b/_dev/src/scss/components/_logs.scss similarity index 89% rename from _dev/styles/components/_logs.scss rename to _dev/src/scss/components/_logs.scss index 7cba1f842..d9b0e8ae3 100644 --- a/_dev/styles/components/_logs.scss +++ b/_dev/src/scss/components/_logs.scss @@ -44,15 +44,15 @@ $e: ".logs"; line-height: 1.4; &--success { - background-image: url("../img/check.svg"); + background-image: url("../../img/check.svg"); } &--warning { - background-image: url("../img/warning.svg"); + background-image: url("../../img/warning.svg"); } &--error { - background-image: url("../img/close.svg"); + background-image: url("../../img/close.svg"); } } diff --git a/_dev/styles/components/_modal.scss b/_dev/src/scss/components/_modal.scss similarity index 100% rename from _dev/styles/components/_modal.scss rename to _dev/src/scss/components/_modal.scss diff --git a/_dev/styles/components/_privacy.scss b/_dev/src/scss/components/_privacy.scss similarity index 100% rename from _dev/styles/components/_privacy.scss rename to _dev/src/scss/components/_privacy.scss diff --git a/_dev/styles/components/_progress.scss b/_dev/src/scss/components/_progress.scss similarity index 100% rename from _dev/styles/components/_progress.scss rename to _dev/src/scss/components/_progress.scss diff --git a/_dev/styles/components/_radio-card.scss b/_dev/src/scss/components/_radio-card.scss similarity index 100% rename from _dev/styles/components/_radio-card.scss rename to _dev/src/scss/components/_radio-card.scss diff --git a/_dev/styles/components/_stepper.scss b/_dev/src/scss/components/_stepper.scss similarity index 97% rename from _dev/styles/components/_stepper.scss rename to _dev/src/scss/components/_stepper.scss index b566ce09a..e144b5852 100644 --- a/_dev/styles/components/_stepper.scss +++ b/_dev/src/scss/components/_stepper.scss @@ -62,7 +62,7 @@ $e: ".stepper"; &--done { #{$e}__step-number { background-color: var(--#{$ua-prefix}step-done-background-color); - background-image: url("../img/check.svg"); + background-image: url("../../img/check.svg"); background-repeat: no-repeat; background-position: center center; background-size: 1rem 1rem; diff --git a/_dev/styles/components/_typography.scss b/_dev/src/scss/components/_typography.scss similarity index 100% rename from _dev/styles/components/_typography.scss rename to _dev/src/scss/components/_typography.scss diff --git a/_dev/styles/components/form/_checkbox.scss b/_dev/src/scss/components/form/_checkbox.scss similarity index 100% rename from _dev/styles/components/form/_checkbox.scss rename to _dev/src/scss/components/form/_checkbox.scss diff --git a/_dev/styles/components/form/_form.scss b/_dev/src/scss/components/form/_form.scss similarity index 93% rename from _dev/styles/components/form/_form.scss rename to _dev/src/scss/components/form/_form.scss index c6f78608a..de22c8232 100644 --- a/_dev/styles/components/form/_form.scss +++ b/_dev/src/scss/components/form/_form.scss @@ -20,7 +20,7 @@ select { padding-inline-end: 2rem; - background-image: url("../img/unfold_more.svg"); + background-image: url("../../img/unfold_more.svg"); background-repeat: no-repeat; background-position: right 0.5rem center; background-size: 1.125rem 1.125rem; diff --git a/_dev/styles/components/form/_index.scss b/_dev/src/scss/components/form/_index.scss similarity index 100% rename from _dev/styles/components/form/_index.scss rename to _dev/src/scss/components/form/_index.scss diff --git a/_dev/styles/components/form/_radio.scss b/_dev/src/scss/components/form/_radio.scss similarity index 100% rename from _dev/styles/components/form/_radio.scss rename to _dev/src/scss/components/form/_radio.scss diff --git a/_dev/styles/components/form/_render-field.scss b/_dev/src/scss/components/form/_render-field.scss similarity index 100% rename from _dev/styles/components/form/_render-field.scss rename to _dev/src/scss/components/form/_render-field.scss diff --git a/_dev/styles/components/form/_switch.scss b/_dev/src/scss/components/form/_switch.scss similarity index 100% rename from _dev/styles/components/form/_switch.scss rename to _dev/src/scss/components/form/_switch.scss diff --git a/_dev/styles/layouts/_backup.scss b/_dev/src/scss/layouts/_backup.scss similarity index 100% rename from _dev/styles/layouts/_backup.scss rename to _dev/src/scss/layouts/_backup.scss diff --git a/_dev/styles/layouts/_index.scss b/_dev/src/scss/layouts/_index.scss similarity index 100% rename from _dev/styles/layouts/_index.scss rename to _dev/src/scss/layouts/_index.scss diff --git a/_dev/styles/layouts/_layout.scss b/_dev/src/scss/layouts/_layout.scss similarity index 100% rename from _dev/styles/layouts/_layout.scss rename to _dev/src/scss/layouts/_layout.scss diff --git a/_dev/styles/layouts/_page.scss b/_dev/src/scss/layouts/_page.scss similarity index 100% rename from _dev/styles/layouts/_page.scss rename to _dev/src/scss/layouts/_page.scss diff --git a/_dev/styles/layouts/_version-choice.scss b/_dev/src/scss/layouts/_version-choice.scss similarity index 100% rename from _dev/styles/layouts/_version-choice.scss rename to _dev/src/scss/layouts/_version-choice.scss diff --git a/_dev/styles/layouts/_welcome.scss b/_dev/src/scss/layouts/_welcome.scss similarity index 100% rename from _dev/styles/layouts/_welcome.scss rename to _dev/src/scss/layouts/_welcome.scss diff --git a/_dev/styles/main.scss b/_dev/src/scss/main.scss similarity index 100% rename from _dev/styles/main.scss rename to _dev/src/scss/main.scss diff --git a/_dev/scripts/main.ts b/_dev/src/ts/main.ts similarity index 100% rename from _dev/scripts/main.ts rename to _dev/src/ts/main.ts diff --git a/_dev/tsconfig.json b/_dev/tsconfig.json index cd625bbd3..0a03026fe 100644 --- a/_dev/tsconfig.json +++ b/_dev/tsconfig.json @@ -1,8 +1,6 @@ { "$schema": "https://json.schemastore.org/tsconfig", "compilerOptions": { - "composite": true, - "declaration": true, "declarationMap": true, "forceConsistentCasingInFileNames": true, "inlineSources": false, @@ -23,7 +21,13 @@ "skipLibCheck": true, "types": [], }, + "include": [ + "src/ts/**/*.ts", + "vite.config.ts", + "vite.dev.config.ts" + ], "exclude": [ - "node_modules" + "node_modules", + "dist", ] } diff --git a/_dev/vite.config.ts b/_dev/vite.config.ts index 57a339ac2..bd570652b 100644 --- a/_dev/vite.config.ts +++ b/_dev/vite.config.ts @@ -8,8 +8,8 @@ export default defineConfig({ cssCodeSplit: true, rollupOptions: { input: { - main: './scripts/main.ts', - theme: './styles/main.scss' + main: './src/ts/main.ts', + theme: './src/scss/main.scss' }, output: { dir: resolve(__dirname, '../views/'), diff --git a/storybook/.storybook/preview.ts b/storybook/.storybook/preview.ts index 12073c3d3..299b04663 100644 --- a/storybook/.storybook/preview.ts +++ b/storybook/.storybook/preview.ts @@ -24,7 +24,7 @@ */ import { Preview, twig } from "@sensiolabs/storybook-symfony-webpack5"; -import '../../_dev/styles/main.scss'; +import '../../_dev/src/scss/main.scss'; const cssEntrypoints = { "9.0.0": ["/9.0.0/default/theme.css"], From f6b995310a53061b6514729ff5457febba775603 Mon Sep 17 00:00:00 2001 From: Alexis Guyomar Date: Wed, 4 Sep 2024 15:53:05 +0200 Subject: [PATCH 22/27] fix: review code --- .github/workflows/build-release.yml | 2 +- .github/workflows/js.yml | 2 +- README.md | 2 +- _dev/package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 6f1fa0c48..e5b10afc3 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -23,7 +23,7 @@ jobs: - name: Setup node uses: actions/setup-node@v4 with: - node-version: '20.11.0' + node-version: '20.x' - name: Install and build npm dependencies run: diff --git a/.github/workflows/js.yml b/.github/workflows/js.yml index bde0d9be2..4d6b471df 100644 --- a/.github/workflows/js.yml +++ b/.github/workflows/js.yml @@ -14,7 +14,7 @@ jobs: - name: Setup node uses: actions/setup-node@v4 with: - node-version: '20.11.0' + node-version: '20.x' - name: Install npm dependencies run: diff --git a/README.md b/README.md index df63ce565..dc52784da 100644 --- a/README.md +++ b/README.md @@ -41,7 +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 commande `npm install` and `npm run build:vite` ([npm](https://docs.npmjs.com/)). +* Enter into folder **autoupgrade/_dev** and run the commands `npm install` and `npm run build:vite` ([npm](https://docs.npmjs.com/)). * 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. diff --git a/_dev/package.json b/_dev/package.json index 6f0b9cf11..7a9d24bb6 100644 --- a/_dev/package.json +++ b/_dev/package.json @@ -1,6 +1,6 @@ { "name": "autoupgrade", - "version": "7.0.0", + "private": true, "type": "module", "description": "Upgrade to the latest version of PrestaShop in a few clicks, thanks to this automated method.", "scripts": { From 95028ac90db0e18e6c02ff9786043f793f931454 Mon Sep 17 00:00:00 2001 From: Alexis Guyomar Date: Wed, 4 Sep 2024 16:47:43 +0200 Subject: [PATCH 23/27] fix: reformat twig templates --- views/templates/block/activityLog.html.twig | 20 +- views/templates/block/channelInfo.html.twig | 2 +- views/templates/block/checklist.html.twig | 182 ++++---- views/templates/block/footer.html.twig | 3 +- .../block/postRestoreChecklistBlock.html.twig | 3 +- .../block/postUpdateChecklistBlock.html.twig | 3 +- views/templates/block/rollbackForm.html.twig | 8 +- .../block/upgradeButtonBlock.html.twig | 63 ++- .../block/versionComparison.html.twig | 4 +- views/templates/components/alert.html.twig | 35 +- .../components/backup-selection.html.twig | 39 +- .../components/check-requirements.html.twig | 428 +++++++++--------- .../components/local-archive.html.twig | 108 ++--- .../components/logs-progress.html.twig | 23 +- views/templates/components/logs.html.twig | 100 ++-- views/templates/components/modal.html.twig | 84 ++-- views/templates/components/privacy.html.twig | 8 +- .../templates/components/radio-card.html.twig | 81 ++-- .../components/render-bool.html.twig | 8 +- .../components/render-field.html.twig | 31 +- .../components/render-select.html.twig | 6 +- views/templates/components/stepper.html.twig | 20 +- views/templates/form.html.twig | 3 +- views/templates/layouts/backup.html.twig | 86 ++-- views/templates/layouts/layout.html.twig | 6 +- views/templates/layouts/page.html.twig | 86 ++-- .../layouts/post-update-checklist.html.twig | 98 ++-- views/templates/layouts/restore.html.twig | 10 +- .../layouts/update-options.html.twig | 148 +++--- views/templates/layouts/update.html.twig | 18 +- .../layouts/version-choice.html.twig | 213 ++++----- views/templates/layouts/welcome.html.twig | 42 +- views/templates/macros/form-fields.html.twig | 16 +- views/templates/macros/icons.html.twig | 6 +- views/templates/main.html.twig | 14 +- .../modals/modal-backup-all.html.twig | 18 +- .../modals/modal-backup-delete.html.twig | 16 +- views/templates/modals/modal-backup.html.twig | 18 +- .../modals/modal-error-report.html.twig | 63 +-- views/templates/modals/modal-update.html.twig | 48 +- 40 files changed, 1108 insertions(+), 1060 deletions(-) diff --git a/views/templates/block/activityLog.html.twig b/views/templates/block/activityLog.html.twig index d415cf812..569011bc2 100644 --- a/views/templates/block/activityLog.html.twig +++ b/views/templates/block/activityLog.html.twig @@ -4,11 +4,15 @@ {{ 'Activity Log'|trans({}) }}
-
+
+ +
@@ -18,7 +22,8 @@ @@ -38,14 +43,17 @@ - + - + diff --git a/views/templates/components/alert.html.twig b/views/templates/components/alert.html.twig index c645961f1..333d4c4cb 100644 --- a/views/templates/components/alert.html.twig +++ b/views/templates/components/alert.html.twig @@ -1,20 +1,21 @@ {% if title or message %} -
-
- {% if title %} -

{{ title }}

- {% endif %} - {% if message %} -

{{ message|raw }}

- {% endif %} -
+
+
+ {% if title %} +

{{ title }}

+ {% endif %} + {% if message %} +

{{ message|raw }}

+ {% endif %} +
- {% if buttonLabel and buttonUrl %} - - {% endif %} -
+ {% if buttonLabel and buttonUrl %} + + {% endif %} +
{% endif %} diff --git a/views/templates/components/backup-selection.html.twig b/views/templates/components/backup-selection.html.twig index da5b4ef8a..2b9120754 100644 --- a/views/templates/components/backup-selection.html.twig +++ b/views/templates/components/backup-selection.html.twig @@ -1,22 +1,23 @@
-
- - -
+
+ + +
- {% if showDelete %} - - {% endif %} + {% if showDelete %} + + {% endif %}
diff --git a/views/templates/components/check-requirements.html.twig b/views/templates/components/check-requirements.html.twig index 513c0b13a..de13319ac 100644 --- a/views/templates/components/check-requirements.html.twig +++ b/views/templates/components/check-requirements.html.twig @@ -1,222 +1,222 @@ {% if not requirementsOk %} -
- {% if checkingForRequirements %} -
-
- -
- {{ "Checking requirements..."|trans({}) }} -
-
- {% else %} -

- {{ "Update requirements"|trans({}) }} -

- -

- {{ 'Once all the following conditions are met, you can continue with the update. Read more in the [1]developer documentation[/1].'|trans({ - '[1]' : '', - '[/1]' : '', - })|raw }} -

- -
- {# ERROR #} - {# Check for PHP compatibility error #} - {% if phpRequirementsState and phpRequirementsState != constant('PrestaShop\\Module\\AutoUpgrade\\UpgradeSelfCheck::PHP_REQUIREMENTS_VALID') %} - {% if phpRequirementsState == constant('PrestaShop\\Module\\AutoUpgrade\\UpgradeSelfCheck::PHP_REQUIREMENTS_INVALID') %} -
- {{ 'Your current PHP version isn\'t compatible with PrestaShop %max_version%. (Expected: %min_version% - %max_version% | Current: %current_version%)'|trans({ - '%min_version%': phpCompatibilityRange['php_min_version'], - '%max_version%': phpCompatibilityRange['php_max_version'], - '%current_version%': phpCompatibilityRange['php_current_version'] - }) }} +
+ {% if checkingForRequirements %} +
+
+ +
+ {{ "Checking requirements..."|trans({}) }} +
- {% endif %} - {% endif %} - - {# Check if root directory is writable #} - {% if not rootDirectoryIsWritable %} -
- {{ 'Your store\'s root directory (%root_directory%) isn\'t writable. Provide write access to the user running PHP with appropriate permission & ownership.'|trans({ - '%root_directory%': rootDirectory - }) }} -
- {% endif %} - - {# Check if admin directory is writable #} - {% if not adminDirectoryIsWritable %} -
- {{ 'The "/admin/autoupgrade" directory isn\'t writable. Provide write access to the user running PHP with appropriate permission & ownership.'|trans({}) }} -
- {% endif %} - - {# Check if safe mode is off #} - {% if not safeModeIsDisabled %} -
- {{ 'PHP\'s "Safe mode" needs to be disabled.'|trans({})|raw }} -
- {% endif %} - - {# Check if allow_url_fopen or cURL are enable #} - {% if not allowUrlFopenOrCurlIsEnabled %} -
- {{ 'Files can\'t be downloaded. Enable PHP\'s "allow_url_fopen" option or install PHP extension "cURL".'|trans({})|raw }} -
- {% endif %} - - {# Check if zip extension is enable #} - {% if not zipIsEnabled %} -
- {{ 'Missing PHP extension "zip".'|trans({})|raw }} -
- {% endif %} - - {# Check if environment is local #} - {% if not isLocalEnvironment %} - {# Check if maintenance is enable #} - {% if not storeIsInMaintenance %} -
- {{ 'Maintenance mode needs to be enabled. Enable maintenance mode and add your maintenance IP in [1]Shop parameters > General > Maintenance[/1].'|trans({ - '[1]' : '', - '[/1]' : '', - })|raw }} + {% else %} +

+ {{ "Update requirements"|trans({}) }} +

+ +

+ {{ 'Once all the following conditions are met, you can continue with the update. Read more in the [1]developer documentation[/1].'|trans({ + '[1]' : '', + '[/1]' : '', + })|raw }} +

+ +
+ {# ERROR #} + {# Check for PHP compatibility error #} + {% if phpRequirementsState and phpRequirementsState != constant('PrestaShop\\Module\\AutoUpgrade\\UpgradeSelfCheck::PHP_REQUIREMENTS_VALID') %} + {% if phpRequirementsState == constant('PrestaShop\\Module\\AutoUpgrade\\UpgradeSelfCheck::PHP_REQUIREMENTS_INVALID') %} +
+ {{ 'Your current PHP version isn\'t compatible with PrestaShop %max_version%. (Expected: %min_version% - %max_version% | Current: %current_version%)'|trans({ + '%min_version%': phpCompatibilityRange['php_min_version'], + '%max_version%': phpCompatibilityRange['php_max_version'], + '%current_version%': phpCompatibilityRange['php_current_version'] + }) }} +
+ {% endif %} + {% endif %} + + {# Check if root directory is writable #} + {% if not rootDirectoryIsWritable %} +
+ {{ 'Your store\'s root directory (%root_directory%) isn\'t writable. Provide write access to the user running PHP with appropriate permission & ownership.'|trans({ + '%root_directory%': rootDirectory + }) }} +
+ {% endif %} + + {# Check if admin directory is writable #} + {% if not adminDirectoryIsWritable %} +
+ {{ 'The "/admin/autoupgrade" directory isn\'t writable. Provide write access to the user running PHP with appropriate permission & ownership.'|trans({}) }} +
+ {% endif %} + + {# Check if safe mode is off #} + {% if not safeModeIsDisabled %} +
+ {{ 'PHP\'s "Safe mode" needs to be disabled.'|trans({})|raw }} +
+ {% endif %} + + {# Check if allow_url_fopen or cURL are enable #} + {% if not allowUrlFopenOrCurlIsEnabled %} +
+ {{ 'Files can\'t be downloaded. Enable PHP\'s "allow_url_fopen" option or install PHP extension "cURL".'|trans({})|raw }} +
+ {% endif %} + + {# Check if zip extension is enable #} + {% if not zipIsEnabled %} +
+ {{ 'Missing PHP extension "zip".'|trans({})|raw }} +
+ {% endif %} + + {# Check if environment is local #} + {% if not isLocalEnvironment %} + {# Check if maintenance is enable #} + {% if not storeIsInMaintenance %} +
+ {{ 'Maintenance mode needs to be enabled. Enable maintenance mode and add your maintenance IP in [1]Shop parameters > General > Maintenance[/1].'|trans({ + '[1]' : '', + '[/1]' : '', + })|raw }} +
+ {% endif %} + {% endif %} + + {# Check if cache is disabled #} + {% if not cachingIsDisabled %} +
+ {{ 'PrestaShop\'s caching features needs to be disabled. Disable caching features in [1]Advanced parameters > Performance > Caching[/1].'|trans({ + '[1]' : '', + '[/1]' : '', + })|raw }} +
+ {% endif %} + + {# Check if max_execution_time has high value #} + {% if maxExecutionTime <= 30 and maxExecutionTime != 0 %} +
+ {{ 'PHP\'s max_execution_time setting needs to have a high value or needs to be disabled entirely (current value: %s seconds).'|trans([maxExecutionTime]) }} +
+ {% endif %} + + + {# Check if apache mod_rewrite is enabled #} + {% if not checkApacheModRewrite %} +
+ {{ 'Apache mod_rewrite needs to be enabled.'|trans({}) }} +
+ {% endif %} + + {# Check PHP extensions that need to be enabled #} + {% if notLoadedPhpExtensions|length > 0 %} +
+ {% if notLoadedPhpExtensions|length > 1 %} + {{ 'The following PHP extensions need to be installed: %extensions%.'|trans({ + '%extensions%': '' ~ notLoadedPhpExtensions|join(', ') ~ '' + })|raw }} + {% else %} + {{ 'The following PHP extension needs to be installed: %extension%.'|trans({ + '%extension%': '' ~ notLoadedPhpExtensions|first ~ '' + })|raw }} + {% endif %} +
+ {% endif %} + + {# Check PHP functions that need to be allowed #} + {% if notExistsPhpFunctions|length > 0 %} +
+ {% if notExistsPhpFunctions|length > 1 %} + {{ 'The following PHP functions need to be allowed: %functions%.'|trans({ + '%functions%': '' ~ notExistsPhpFunctions|join(', ') ~ '' + })|raw }} + {% else %} + {{ 'The following PHP function needs to be allowed: %function%.'|trans({ + '%function%': '' ~ notExistsPhpFunctions|first ~ '' + })|raw }} + {% endif %} +
+ {% endif %} + + {# Check if PHP memory_limit is greater than 256 #} + {% if not checkMemoryLimit %} +
+ {{ 'PHP memory_limit needs to be greater than 256 MB.'|trans({}) }} +
+ {% endif %} + + {# Check if PHP file_uploads is enabled #} + {% if not checkFileUploads %} +
+ {{ 'PHP file_uploads configuration needs to be enabled.'|trans({}) }} +
+ {% endif %} + + {# Check for private keys generation #} + {% if not checkKeyGeneration %} +
+ {{ 'Unable to generate private keys using openssl_pkey_new. Check your OpenSSL configuration, especially the path to openssl.cafile.'|trans({}) }} +
+ {% endif %} + + {# Check for folders writing permissions #} + {% if notWritingDirectories|length > 0 %} +
+ {{ 'It\'s not possible to write in the following folders: %directories%.'|trans({ + '%directories%': '' ~ notWritingDirectories|join(', ') ~ '' + })|raw }} + {{ 'Provide write access to the user running PHP with appropriate permission & ownership.'|trans({}) }} +
+ {% endif %} + + {# Check PrestaShop version mismatch #} + {% if not isShopVersionMatchingVersionInDatabase %} +
+ {{ 'The version of PrestaShop does not match the one stored in database. Your database structure may not be up-to-date and/or the value of PS_VERSION_DB needs to be updated in the configuration table.'|trans({}) }} +
+ {% endif %} + + {# WARNING #} + {# Check if the module is up to date #} + {% if not moduleIsUpToDate %} +
+ {{ 'Your current version of the module is out of date. Update now %link%'|trans({ + '%link%': 'Modules > Module Manager > Updates' + })|raw }} +
+ {% endif %} + + {# Check for PHP compatibility warning #} + {% if phpRequirementsState and phpRequirementsState != constant('PrestaShop\\Module\\AutoUpgrade\\UpgradeSelfCheck::PHP_REQUIREMENTS_VALID') %} +
+ {% if phpRequirementsState != constant('PrestaShop\\Module\\AutoUpgrade\\UpgradeSelfCheck::PHP_REQUIREMENTS_INVALID') %} + {{ 'We were unable to check your PHP compatibility with the destination PrestaShop version.'|trans({}) }} + {% endif %} +
+ {% endif %} + + {# Check for missing core files #} + {% if not noMissingFiles %} +
+ {{ 'Some core files have been altered, customization made on these files will be lost during the update. See the list in %link%'|trans({ + '%link%': 'Advanced parameters > Information' + })|raw }} +
+ {% endif %}
- {% endif %} - {% endif %} - - {# Check if cache is disabled #} - {% if not cachingIsDisabled %} -
- {{ 'PrestaShop\'s caching features needs to be disabled. Disable caching features in [1]Advanced parameters > Performance > Caching[/1].'|trans({ - '[1]' : '', - '[/1]' : '', - })|raw }} -
- {% endif %} - - {# Check if max_execution_time has high value #} - {% if maxExecutionTime <= 30 and maxExecutionTime != 0 %} -
- {{ 'PHP\'s max_execution_time setting needs to have a high value or needs to be disabled entirely (current value: %s seconds).'|trans([maxExecutionTime]) }} -
- {% endif %} - - - {# Check if apache mod_rewrite is enabled #} - {% if not checkApacheModRewrite %} -
- {{ 'Apache mod_rewrite needs to be enabled.'|trans({}) }} -
- {% endif %} - {# Check PHP extensions that need to be enabled #} - {% if notLoadedPhpExtensions|length > 0 %} -
- {% if notLoadedPhpExtensions|length > 1 %} - {{ 'The following PHP extensions need to be installed: %extensions%.'|trans({ - '%extensions%': '' ~ notLoadedPhpExtensions|join(', ') ~ '' - })|raw }} - {% else %} - {{ 'The following PHP extension needs to be installed: %extension%.'|trans({ - '%extension%': '' ~ notLoadedPhpExtensions|first ~ '' - })|raw }} - {% endif %} -
+ {% endif %} - - {# Check PHP functions that need to be allowed #} - {% if notExistsPhpFunctions|length > 0 %} -
- {% if notExistsPhpFunctions|length > 1 %} - {{ 'The following PHP functions need to be allowed: %functions%.'|trans({ - '%functions%': '' ~ notExistsPhpFunctions|join(', ') ~ '' - })|raw }} - {% else %} - {{ 'The following PHP function needs to be allowed: %function%.'|trans({ - '%function%': '' ~ notExistsPhpFunctions|first ~ '' - })|raw }} - {% endif %} -
- {% endif %} - - {# Check if PHP memory_limit is greater than 256 #} - {% if not checkMemoryLimit %} -
- {{ 'PHP memory_limit needs to be greater than 256 MB.'|trans({}) }} -
- {% endif %} - - {# Check if PHP file_uploads is enabled #} - {% if not checkFileUploads %} -
- {{ 'PHP file_uploads configuration needs to be enabled.'|trans({}) }} -
- {% endif %} - - {# Check for private keys generation #} - {% if not checkKeyGeneration %} -
- {{ 'Unable to generate private keys using openssl_pkey_new. Check your OpenSSL configuration, especially the path to openssl.cafile.'|trans({}) }} -
- {% endif %} - - {# Check for folders writing permissions #} - {% if notWritingDirectories|length > 0 %} -
- {{ 'It\'s not possible to write in the following folders: %directories%.'|trans({ - '%directories%': '' ~ notWritingDirectories|join(', ') ~ '' - })|raw }} - {{ 'Provide write access to the user running PHP with appropriate permission & ownership.'|trans({}) }} -
- {% endif %} - - {# Check PrestaShop version mismatch #} - {% if not isShopVersionMatchingVersionInDatabase %} -
- {{ 'The version of PrestaShop does not match the one stored in database. Your database structure may not be up-to-date and/or the value of PS_VERSION_DB needs to be updated in the configuration table.'|trans({}) }} -
- {% endif %} - - {# WARNING #} - {# Check if the module is up to date #} - {% if not moduleIsUpToDate %} -
- {{ 'Your current version of the module is out of date. Update now %link%'|trans({ - '%link%': 'Modules > Module Manager > Updates' - })|raw }} -
- {% endif %} - - {# Check for PHP compatibility warning #} - {% if phpRequirementsState and phpRequirementsState != constant('PrestaShop\\Module\\AutoUpgrade\\UpgradeSelfCheck::PHP_REQUIREMENTS_VALID') %} -
- {% if phpRequirementsState != constant('PrestaShop\\Module\\AutoUpgrade\\UpgradeSelfCheck::PHP_REQUIREMENTS_INVALID') %} - {{ 'We were unable to check your PHP compatibility with the destination PrestaShop version.'|trans({}) }} - {% endif %} -
- {% endif %} - - {# Check for missing core files #} - {% if not noMissingFiles %} -
- {{ 'Some core files have been altered, customization made on these files will be lost during the update. See the list in %link%'|trans({ - '%link%': 'Advanced parameters > Information' - })|raw }} -
- {% endif %} -
- - - {% endif %} -
+
{% else %} -
-
- {{ 'The requirements check is complete, you can update your store (to this version of PrestaShop).'|trans({}) }} +
+
+ {{ 'The requirements check is complete, you can update your store (to this version of PrestaShop).'|trans({}) }} +
-
{% endif %} diff --git a/views/templates/components/local-archive.html.twig b/views/templates/components/local-archive.html.twig index c5e5ddc7e..2c30c40b8 100644 --- a/views/templates/components/local-archive.html.twig +++ b/views/templates/components/local-archive.html.twig @@ -1,61 +1,65 @@ {% if (archiveFiles is defined and archiveFiles is not empty) and (xmlFiles is defined and xmlFiles is not empty) %} -
-
- +
+
+ - + - {% if unableToFindVersion %} -
- error - {{ "We couldn't find a PrestaShop version in the .zip file you uploaded. Please try again."|trans({}) }} -
- {% endif %} -
+ {% if unableToFindVersion %} +
+ error + {{ "We couldn't find a PrestaShop version in the .zip file you uploaded. Please try again."|trans({}) }} +
+ {% endif %} +
-
- +
+ - + - {% if unableToFindVersionInXML %} -
- error - {{ "We couldn't find a PrestaShop version in the XML file that was uploaded in your local archive. Please try again."|trans({}) }} -
- {% endif %} + {% if unableToFindVersionInXML %} +
+ error + {{ "We couldn't find a PrestaShop version in the XML file that was uploaded in your local archive. Please try again."|trans({}) }} +
+ {% endif %} - {% if versionsMismatch and (not unableToFindVersionInXML and not unableToFindVersion) %} -
- {% include '@ModuleAutoUpgrade/components/alert.html.twig' with { - title: "", - message: "The PrestaShop version in your archive doesn’t match the one in XML file. Please fix this issue and try again.", - alertStatus: "warning", - buttonLabel: "", - buttonUrl: "", - } %} -
- {% endif %} -
-
+ {% if versionsMismatch and (not unableToFindVersionInXML and not unableToFindVersion) %} +
+ {% include '@ModuleAutoUpgrade/components/alert.html.twig' with { + title: "", + message: "The PrestaShop version in your archive doesn’t match the one in XML file. Please fix this issue and try again.", + alertStatus: "warning", + buttonLabel: "", + buttonUrl: "", + } %} +
+ {% endif %} +
+
{% else %} -
- {{ 'No archive found in your admin/autoupgrade/download directory'|trans({}) }} -
+
+ {{ 'No archive found in your admin/autoupgrade/download directory'|trans({}) }} +
{% endif %} diff --git a/views/templates/components/logs-progress.html.twig b/views/templates/components/logs-progress.html.twig index 60af1fbc1..b25ce645e 100644 --- a/views/templates/components/logs-progress.html.twig +++ b/views/templates/components/logs-progress.html.twig @@ -1,15 +1,16 @@
-
-
- loop -
+
+
+ loop +
-
- {{ progressStatus }} +
+ {{ progressStatus }} +
-
-
-
-
-
\ No newline at end of file +
+
+
+
diff --git a/views/templates/components/logs.html.twig b/views/templates/components/logs.html.twig index 9a3db5b01..052760c31 100644 --- a/views/templates/components/logs.html.twig +++ b/views/templates/components/logs.html.twig @@ -1,59 +1,61 @@ {% if logs %} -
-
-
- {% for log in logs %} -
- {{ log.message }} -
- {% endfor %} -
- - {% if logsSummaryWarning or logsSummaryError %} -
- {% if logsSummaryWarning %} -
-

{{ "Warning summary"|trans({}) }}

- - {% for log in logsSummaryWarning %} -
- {{ log.message }} - - {% if log.anchor is defined %} - {{ "See warning"|trans({}) }} - {% endif %} -
- {% endfor %} +
+
+
+ {% for log in logs %} +
+ {{ log.message }} +
+ {% endfor %}
- {% endif %} - {% if logsSummaryError %} -
-

{{ "Error summary"|trans({}) }}

+ {% if logsSummaryWarning or logsSummaryError %} +
+ {% if logsSummaryWarning %} +
+

{{ "Warning summary"|trans({}) }}

+ + {% for log in logsSummaryWarning %} +
+ {{ log.message }} + + {% if log.anchor is defined %} + {{ "See warning"|trans({}) }} + {% endif %} +
+ {% endfor %} +
+ {% endif %} + + {% if logsSummaryError %} +
+

{{ "Error summary"|trans({}) }}

- {% for log in logsSummaryError %} -
- {{ log.message }} + {% for log in logsSummaryError %} +
+ {{ log.message }} - {% if log.anchor is defined %} - {{ "See error"|trans({}) }} - {% endif %} + {% if log.anchor is defined %} + {{ "See error"|trans({}) }} + {% endif %} +
+ {% endfor %} +
+ {% endif %}
- {% endfor %} -
- {% endif %} + {% endif %}
- {% endif %} + + {% if downloadLogsButtonUrl and downloadLogsButtonLabel %} + + {% endif %}
- - {% if downloadLogsButtonUrl and downloadLogsButtonLabel %} - - {% endif %} -
{% endif %} diff --git a/views/templates/components/modal.html.twig b/views/templates/components/modal.html.twig index 703f4bef2..f246db074 100644 --- a/views/templates/components/modal.html.twig +++ b/views/templates/components/modal.html.twig @@ -1,50 +1,52 @@ -
diff --git a/views/templates/layouts/backup.html.twig b/views/templates/layouts/backup.html.twig index 8033dc1b8..1f72539ca 100644 --- a/views/templates/layouts/backup.html.twig +++ b/views/templates/layouts/backup.html.twig @@ -3,55 +3,55 @@ {% block page_class %}backup-page{% endblock %} {% block title %} -

{{ 'Back up your store'|trans({}) }}

+

{{ 'Back up your store'|trans({}) }}

{% endblock %} {% block content %} -
-
-

{{ 'Backing up your store\'s files, database, and images means you can restore to a previous version if something goes wrong during the update. This keeps your data safe and ensures your business stays up and running.'|trans({}) }}

-
- -
- {% include '@ModuleAutoUpgrade/components/render-bool.html.twig' with { - field: { - id: "backup_files_db", - title: "Back up files and database", - desc: "", - js: { - on: 'onclick="enableFeature()"', - off: 'onclick="disableFeature()"', - }, - type: 'bool', - required: true, - disabled: true, - }, - key: "PS_AUTOUP_BACKUP_FILES_DB", - val: true, - } %} +
+
+

{{ 'Backing up your store\'s files, database, and images means you can restore to a previous version if something goes wrong during the update. This keeps your data safe and ensures your business stays up and running.'|trans({}) }}

+
+ +
+ {% include '@ModuleAutoUpgrade/components/render-bool.html.twig' with { + field: { + id: "backup_files_db", + title: "Back up files and database", + desc: "", + js: { + on: 'onclick="enableFeature()"', + off: 'onclick="disableFeature()"', + }, + type: 'bool', + required: true, + disabled: true, + }, + key: "PS_AUTOUP_BACKUP_FILES_DB", + val: true, + } %} - {% include '@ModuleAutoUpgrade/components/render-bool.html.twig' with { - field: { - id: "backup_files_db", - title: "Include images", - desc: "", - js: { - on: 'onclick="enableFeature()"', - off: 'onclick="disableFeature()"', - }, - type: 'bool', - required: true, - disabled: true, - }, - key: "PS_AUTOUP_BACKUP_WITH_IMAGES", - val: false, - } %} + {% include '@ModuleAutoUpgrade/components/render-bool.html.twig' with { + field: { + id: "backup_files_db", + title: "Include images", + desc: "", + js: { + on: 'onclick="enableFeature()"', + off: 'onclick="disableFeature()"', + }, + type: 'bool', + required: true, + disabled: true, + }, + key: "PS_AUTOUP_BACKUP_WITH_IMAGES", + val: false, + } %} +
-
{% endblock %} {% block buttons_inner %} - + {% endblock %} diff --git a/views/templates/layouts/layout.html.twig b/views/templates/layouts/layout.html.twig index 2302afcf3..79aebb58b 100644 --- a/views/templates/layouts/layout.html.twig +++ b/views/templates/layouts/layout.html.twig @@ -1,5 +1,5 @@
- {% if page == "welcome" %} - {% include '@ModuleAutoUpgrade/layouts/welcome.html.twig' %} - {% endif %} + {% if page == "welcome" %} + {% include '@ModuleAutoUpgrade/layouts/welcome.html.twig' %} + {% endif %}
diff --git a/views/templates/layouts/page.html.twig b/views/templates/layouts/page.html.twig index 7364be2fc..a3b5f6f64 100644 --- a/views/templates/layouts/page.html.twig +++ b/views/templates/layouts/page.html.twig @@ -1,52 +1,52 @@ {% block update_assistant %} -
- {% block stepper %} -
- {% include '@ModuleAutoUpgrade/components/stepper.html.twig' %} -
- {% endblock %} +
+ {% block stepper %} +
+ {% include '@ModuleAutoUpgrade/components/stepper.html.twig' %} +
+ {% endblock %} - {% block container %} -
- {% block container_inner %} -
- {% block title %} - {# Default title or leave empty for child templates to provide #} - {% endblock %} -
+ {% block container %} +
+ {% block container_inner %} +
+ {% block title %} + {# Default title or leave empty for child templates to provide #} + {% endblock %} +
-
- {% block content %} - {# Default content or leave empty for child templates to provide #} - {# -
-
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc molestie efficitur tortor at feugiat. Donec pretium libero non tortor lobortis, eu cursus ligula tincidunt. -
+
+ {% block content %} + {# Default content or leave empty for child templates to provide #} + {# +
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc molestie efficitur tortor at feugiat. Donec pretium libero non tortor lobortis, eu cursus ligula tincidunt. +
-
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc molestie efficitur tortor at feugiat. Donec pretium libero non tortor lobortis, eu cursus ligula tincidunt. -
-
- #} - {% endblock %} -
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc molestie efficitur tortor at feugiat. Donec pretium libero non tortor lobortis, eu cursus ligula tincidunt. +
+
+ #} + {% endblock %} +
- {% block buttons %} -
- {% block buttons_inner %} - {# Default buttons or leave empty for child templates to provide #} - {% endblock %} + {% block buttons %} +
+ {% block buttons_inner %} + {# Default buttons or leave empty for child templates to provide #} + {% endblock %} +
+ {% endblock %} + {% endblock %}
- {% endblock %} {% endblock %} -
- {% endblock %} - {% block privacy %} -
- {% include '@ModuleAutoUpgrade/components/privacy.html.twig' %} -
- {% endblock %} -
+ {% block privacy %} +
+ {% include '@ModuleAutoUpgrade/components/privacy.html.twig' %} +
+ {% endblock %} +
{% endblock %} diff --git a/views/templates/layouts/post-update-checklist.html.twig b/views/templates/layouts/post-update-checklist.html.twig index 9542bf2b2..3e21d10da 100644 --- a/views/templates/layouts/post-update-checklist.html.twig +++ b/views/templates/layouts/post-update-checklist.html.twig @@ -3,60 +3,60 @@ {% block page_class %}post-update-checklist-page{% endblock %} {% block title %} -

{{ 'Post-update checklist'|trans({}) }}

+

{{ 'Post-update checklist'|trans({}) }}

{% endblock %} {% block content %} -
- {% include '@ModuleAutoUpgrade/components/alert.html.twig' with { - title: "Your store is up to date", - message: "Before continuing with your tasks, please review the following checklist to ensure smooth operation after recent updates.", - alertStatus: "success", - buttonLabel: "", - buttonUrl: "", - } %} - -
-

{{ 'Next steps'|trans({}) }}

- -
    -
  • {{ 'Open the developer documentation to keep this checklist at-hand.'|trans({})|raw }}
  • -
  • {{ 'Re-enable and check your modules one by one to prevent any compatibility issue.'|trans({})|raw }}
  • -
  • {{ 'Make sure your store’s front office is working properly: try to create an account, place an order, add a product, etc.'|trans({})|raw }}
  • -
  • {{ 'Disable the maintenance mode in General settings > Maintenance.'|trans({})|raw }}
  • -
+
+ {% include '@ModuleAutoUpgrade/components/alert.html.twig' with { + title: "Your store is up to date", + message: "Before continuing with your tasks, please review the following checklist to ensure smooth operation after recent updates.", + alertStatus: "success", + buttonLabel: "", + buttonUrl: "", + } %} + +
+

{{ 'Next steps'|trans({}) }}

+ +
    +
  • {{ 'Open the developer documentation to keep this checklist at-hand.'|trans({})|raw }}
  • +
  • {{ 'Re-enable and check your modules one by one to prevent any compatibility issue.'|trans({})|raw }}
  • +
  • {{ 'Make sure your store’s front office is working properly: try to create an account, place an order, add a product, etc.'|trans({})|raw }}
  • +
  • {{ 'Disable the maintenance mode in General settings > Maintenance.'|trans({})|raw }}
  • +
+
+ +
+

{{ 'Troubleshooting'|trans({}) }}

+ +
    +
  • {{ 'If some images don’t appear in the front office, try regenerating thumbnails in Preferences > Images.'|trans({}) }}
  • +
  • {{ 'If something\'s wrong, you can restore a backup with this module. Your backup is available at {admin}/autoupgrade/backup.'|trans({}) }}
  • +
  • {{ 'If you can\'t access your back office, try enabling the debug mode manually in config/defines.inc.php by setting _PS_MODE_DEV_ to true.'|trans({}) }}
  • +
+
+ +
- -
-

{{ 'Troubleshooting'|trans({}) }}

- -
    -
  • {{ 'If some images don’t appear in the front office, try regenerating thumbnails in Preferences > Images.'|trans({}) }}
  • -
  • {{ 'If something\'s wrong, you can restore a backup with this module. Your backup is available at {admin}/autoupgrade/backup.'|trans({}) }}
  • -
  • {{ 'If you can\'t access your back office, try enabling the debug mode manually in config/defines.inc.php by setting _PS_MODE_DEV_ to true.'|trans({}) }}
  • -
-
- - -
{% endblock %} {% block buttons_inner %} - - - + + + {% endblock %} diff --git a/views/templates/layouts/restore.html.twig b/views/templates/layouts/restore.html.twig index 8829df1ad..3f873c2f0 100644 --- a/views/templates/layouts/restore.html.twig +++ b/views/templates/layouts/restore.html.twig @@ -3,15 +3,15 @@ {% block page_class %}update-options-page{% endblock %} {% block title %} -

{{ 'Backup selection'|trans({}) }}

+

{{ 'Backup selection'|trans({}) }}

{% endblock %} {% block content %} - {% include '@ModuleAutoUpgrade/components/backup-selection.html.twig' %} + {% include '@ModuleAutoUpgrade/components/backup-selection.html.twig' %} {% endblock %} {% block buttons_inner %} - + {% endblock %} diff --git a/views/templates/layouts/update-options.html.twig b/views/templates/layouts/update-options.html.twig index da7592b16..e77f64329 100644 --- a/views/templates/layouts/update-options.html.twig +++ b/views/templates/layouts/update-options.html.twig @@ -3,87 +3,87 @@ {% block page_class %}update-options-page{% endblock %} {% block title %} -

{{ 'Update options'|trans({}) }}

+

{{ 'Update options'|trans({}) }}

{% endblock %} {% block content %} -
- {% include '@ModuleAutoUpgrade/components/render-bool.html.twig' with { - field: { - id: "deactivate_modules", - title: "Deactivate non-native modules", - desc: "All the modules installed after creating your store are considered non-native modules. They might be incompatible with the new version of PrestaShop. We recommend deactivating them during the update.", - js: { - on: 'onclick="enableFeature()"', - off: 'onclick="disableFeature()"', - }, - type: 'bool', - required: true, - disabled: true, - }, - key: "PS_AUTOUP_CUSTOM_MOD_DESACT", - val: true, - } %} +
+ {% include '@ModuleAutoUpgrade/components/render-bool.html.twig' with { + field: { + id: "deactivate_modules", + title: "Deactivate non-native modules", + desc: "All the modules installed after creating your store are considered non-native modules. They might be incompatible with the new version of PrestaShop. We recommend deactivating them during the update.", + js: { + on: 'onclick="enableFeature()"', + off: 'onclick="disableFeature()"', + }, + type: 'bool', + required: true, + disabled: true, + }, + key: "PS_AUTOUP_CUSTOM_MOD_DESACT", + val: true, + } %} - {% include '@ModuleAutoUpgrade/components/render-bool.html.twig' with { - field: { - id: "regen_email", - title: "Regenerate email templates", - desc: "If you've customized email templates, your changes will be lost if you activate this option.", - js: { - on: 'onclick="enableFeature()"', - off: 'onclick="disableFeature()"', - }, - type: 'bool', - required: true, - disabled: true, - }, - key: "PS_AUTOUP_REGEN_EMAIL", - val: true, - } %} + {% include '@ModuleAutoUpgrade/components/render-bool.html.twig' with { + field: { + id: "regen_email", + title: "Regenerate email templates", + desc: "If you've customized email templates, your changes will be lost if you activate this option.", + js: { + on: 'onclick="enableFeature()"', + off: 'onclick="disableFeature()"', + }, + type: 'bool', + required: true, + disabled: true, + }, + key: "PS_AUTOUP_REGEN_EMAIL", + val: true, + } %} - {% include '@ModuleAutoUpgrade/components/render-select.html.twig' with { - field: { - id: "regen_mail", - title: "Switch the theme", - desc: "Custom themes may cause compatibility issues. We recommend using a default theme during the update and change it afterwards.", - choices: { - 0: "Keep the actual theme", - 1: "Upgrade the default theme", - 2: "Do nothing", - }, - type: "select", - required: true, - disabled: false, - }, - key: "PS_AUTOUP_SWITCH_THEME", - val: "1", - } %} + {% include '@ModuleAutoUpgrade/components/render-select.html.twig' with { + field: { + id: "regen_mail", + title: "Switch the theme", + desc: "Custom themes may cause compatibility issues. We recommend using a default theme during the update and change it afterwards.", + choices: { + 0: "Keep the actual theme", + 1: "Upgrade the default theme", + 2: "Do nothing", + }, + type: "select", + required: true, + disabled: false, + }, + key: "PS_AUTOUP_SWITCH_THEME", + val: "1", + } %} - {% include '@ModuleAutoUpgrade/components/render-bool.html.twig' with { - field: { - id: "disable_override", - title: "Disable all overrides", - desc: "Overriding is a way to replace business behaviors (class files and controller files) to target only one method or as many as you need. This option disables all classes & controllers overrides, allowing you to avoid conflicts during and after updates.", - js: { - on: 'onclick="enableFeature()"', - off: 'onclick="disableFeature()"', - }, - type: 'bool', - required: true, - disabled: true, - }, - key: "PS_AUTOUP_DISABLE_OVERRIDE", - val: false, - } %} -
+ {% include '@ModuleAutoUpgrade/components/render-bool.html.twig' with { + field: { + id: "disable_override", + title: "Disable all overrides", + desc: "Overriding is a way to replace business behaviors (class files and controller files) to target only one method or as many as you need. This option disables all classes & controllers overrides, allowing you to avoid conflicts during and after updates.", + js: { + on: 'onclick="enableFeature()"', + off: 'onclick="disableFeature()"', + }, + type: 'bool', + required: true, + disabled: true, + }, + key: "PS_AUTOUP_DISABLE_OVERRIDE", + val: false, + } %} +
{% endblock %} {% block buttons_inner %} - + {% endblock %} diff --git a/views/templates/layouts/update.html.twig b/views/templates/layouts/update.html.twig index 3056848e7..895c8150e 100644 --- a/views/templates/layouts/update.html.twig +++ b/views/templates/layouts/update.html.twig @@ -3,20 +3,20 @@ {% block page_class %}update-page{% endblock %} {% block title %} -

{{ 'Update'|trans({}) }}

+

{{ 'Update'|trans({}) }}

{% endblock %} {% block content %} - {% include '@ModuleAutoUpgrade/components/logs-progress.html.twig' %} + {% include '@ModuleAutoUpgrade/components/logs-progress.html.twig' %} - {% include '@ModuleAutoUpgrade/components/logs.html.twig' %} + {% include '@ModuleAutoUpgrade/components/logs.html.twig' %} {% endblock %} {% block buttons_inner %} - + {% endblock %} diff --git a/views/templates/layouts/version-choice.html.twig b/views/templates/layouts/version-choice.html.twig index aae1bb56b..459fccdf7 100644 --- a/views/templates/layouts/version-choice.html.twig +++ b/views/templates/layouts/version-choice.html.twig @@ -3,125 +3,126 @@ {% block page_class %}version-page{% endblock %} {% block title %} -

{{ 'Version choice'|trans({}) }}

+

{{ 'Version choice'|trans({}) }}

{% endblock %} {% block content %} - {% if upToDate %} -
- {% if noLocalArchive %} - - {% endif %} + {% if upToDate %} +
+ {% if noLocalArchive %} + + {% endif %} -

- check_circle - {{ 'You’re up to date'|trans({}) }} -

+

+ check_circle + {{ 'You’re up to date'|trans({}) }} +

-

- {{ 'Current PrestaShop version:'|trans({}) }} {{ currentPrestashopVersion }}
- {{ 'Current PHP version:'|trans({}) }} {{ currentPhpVersion }} -

-
+

+ {{ 'Current PrestaShop version:'|trans({}) }} {{ currentPrestashopVersion }}
+ {{ 'Current PHP version:'|trans({}) }} {{ currentPhpVersion }} +

+
- {% if noLocalArchive %} - {% include '@ModuleAutoUpgrade/components/alert.html.twig' with { - title: "", - message: "Unlock the local update feature and manually update your store to your preferred upgrade by saving the archive and XML files of the PrestaShop version in the following directory on your server: /admin/autoupgrade/download/", - alertStatus: "info", - buttonLabel: "", - buttonUrl: "", - } %} + {% if noLocalArchive %} + {% include '@ModuleAutoUpgrade/components/alert.html.twig' with { + title: "", + message: "Unlock the local update feature and manually update your store to your preferred upgrade by saving the archive and XML files of the PrestaShop version in the following directory on your server: /admin/autoupgrade/download/", + alertStatus: "info", + buttonLabel: "", + buttonUrl: "", + } %} + {% else %} +
+

+ {{ 'You are already using the latest PrestaShop version available but you can update to the version of your choice from a local archive.'|trans({}) }} +

+ + {% include '@ModuleAutoUpgrade/components/radio-card.html.twig' with { + radioCardId: "", + checked: true, + title: "Local archive", + message: "Save the archive file of the version you want to update to in the following directory: /admin/autoUpdate/download/", + disabled: false, + disabledMessage: "", + badgeLabel: "", + releaseNote: "", + archiveCard: true, + } %} +
+ {% endif %} {% else %} -
-

- {{ 'You are already using the latest PrestaShop version available but you can update to the version of your choice from a local archive.'|trans({}) }} -

+
+

+ {{ 'A more recent version is available'|trans({}) }} +

- {% include '@ModuleAutoUpgrade/components/radio-card.html.twig' with { - radioCardId: "", - checked: true, - title: "Local archive", - message: "Save the archive file of the version you want to update to in the following directory: /admin/autoUpdate/download/", - disabled: false, - disabledMessage: "", - badgeLabel: "", - releaseNote: "", - archiveCard: true, - } %} -
- {% endif %} - {% else %} -
-

- {{ 'A more recent version is available'|trans({}) }} -

+

+ {{ 'Current PrestaShop version:'|trans({}) }} {{ currentPrestashopVersion }}
+ {{ 'Current PHP version:'|trans({}) }} {{ currentPhpVersion }} +

-

- {{ 'Current PrestaShop version:'|trans({}) }} {{ currentPrestashopVersion }}
- {{ 'Current PHP version:'|trans({}) }} {{ currentPhpVersion }} -

+ {% if not noLocalArchive %} +

+ + {{ 'Select version:'|trans({}) }} + +

- {% if not noLocalArchive %} -

- - {{ 'Select version:'|trans({}) }} - -

+

+ {{ 'A more recent version of PrestaShop is available. You can also use a local archive.'|trans({}) }} +

+ {% endif %} +
-

- {{ 'A more recent version of PrestaShop is available. You can also use a local archive.'|trans({}) }} -

- {% endif %} -
+
+ {% include '@ModuleAutoUpgrade/components/radio-card.html.twig' with { + radioCardId: "", + checked: false, + title: "PrestaShop 9.0.0", + message: "Released on 01/05/2024.", + disabled: false, + disabledMessage: "", + badgeLabel: "Major version", + badgeStatus: "major", + releaseNote: "https://github.com/PrestaShop/autoupgrade", + archiveCard: false, + checkRequirements: false, + } %} -
- {% include '@ModuleAutoUpgrade/components/radio-card.html.twig' with { - radioCardId: "", - checked: false, - title: "PrestaShop 9.0.0", - message: "Released on 01/05/2024.", - disabled: false, - disabledMessage: "", - badgeLabel: "Major version", - badgeStatus: "major", - releaseNote: "https://github.com/PrestaShop/autoupgrade", - archiveCard: false, - checkRequirements: false, - } %} - - {% if not noLocalArchive %} - {% include '@ModuleAutoUpgrade/components/radio-card.html.twig' with { - radioCardId: "", - checked: true, - title: "Local archive", - message: "Save the archive file of the version you want to update to in the following directory: /admin/autoUpdate/download/", - disabled: false, - disabledMessage: "", - badgeLabel: "", - releaseNote: "", - archiveCard: true, - } %} - {% else %} - {% include '@ModuleAutoUpgrade/components/alert.html.twig' with { - title: "", - message: "Unlock the local update feature and manually update your store to your preferred upgrade by saving the archive and XML files of the PrestaShop version in the following directory on your server: /admin/autoupgrade/download/", - alertStatus: "info", - buttonLabel: "", - buttonUrl: "", - } %} - {% endif %} -
- {% endif %} + {% if not noLocalArchive %} + {% include '@ModuleAutoUpgrade/components/radio-card.html.twig' with { + radioCardId: "", + checked: true, + title: "Local archive", + message: "Save the archive file of the version you want to update to in the following directory: /admin/autoUpdate/download/", + disabled: false, + disabledMessage: "", + badgeLabel: "", + releaseNote: "", + archiveCard: true, + } %} + {% else %} + {% include '@ModuleAutoUpgrade/components/alert.html.twig' with { + title: "", + message: "Unlock the local update feature and manually update your store to your preferred upgrade by saving the archive and XML files of the PrestaShop version in the following directory on your server: /admin/autoupgrade/download/", + alertStatus: "info", + buttonLabel: "", + buttonUrl: "", + } %} + {% endif %} +
+ {% endif %} {% endblock %} {% block buttons_inner %} - {% if ( upToDate and not noLocalArchive ) or ( not upToDate ) %} - - {% endif %} + {% if ( upToDate and not noLocalArchive ) or ( not upToDate ) %} + + {% endif %} {% endblock %} diff --git a/views/templates/layouts/welcome.html.twig b/views/templates/layouts/welcome.html.twig index efc913fe3..a92e088ac 100644 --- a/views/templates/layouts/welcome.html.twig +++ b/views/templates/layouts/welcome.html.twig @@ -5,31 +5,31 @@ {% block page_class %}welcome-page{% endblock %} {% block title %} -

{{ 'Welcome to PrestaShop Update Assistant'|trans({}) }}

+

{{ 'Welcome to PrestaShop Update Assistant'|trans({}) }}

{% endblock %} {% block content %} -
- {% include '@ModuleAutoUpgrade/components/radio-card.html.twig' with { - checked: true, - title: "Update your store", - message: "Update your store to benefit from the latest improvements, bug fixes and security patches.", - badgeLabel: "", - releaseNote: "", - } %} - {% include '@ModuleAutoUpgrade/components/radio-card.html.twig' with { - checked: true, - title: "Restore from a backup", - message: "Use this feature if the update failed or if your store or a module is no longer working properly.", - disabled: true, - badgeLabel: "", - releaseNote: "", - } %} -
+
+ {% include '@ModuleAutoUpgrade/components/radio-card.html.twig' with { + checked: true, + title: "Update your store", + message: "Update your store to benefit from the latest improvements, bug fixes and security patches.", + badgeLabel: "", + releaseNote: "", + } %} + {% include '@ModuleAutoUpgrade/components/radio-card.html.twig' with { + checked: true, + title: "Restore from a backup", + message: "Use this feature if the update failed or if your store or a module is no longer working properly.", + disabled: true, + badgeLabel: "", + releaseNote: "", + } %} +
{% endblock %} {% block buttons_inner %} - + {% endblock %} diff --git a/views/templates/macros/form-fields.html.twig b/views/templates/macros/form-fields.html.twig index 06bd02b63..93f2ac70e 100644 --- a/views/templates/macros/form-fields.html.twig +++ b/views/templates/macros/form-fields.html.twig @@ -1,10 +1,10 @@ {% macro select(labelText, inputId, options) %} -
- - -
+
+ + +
{% endmacro %} diff --git a/views/templates/macros/icons.html.twig b/views/templates/macros/icons.html.twig index 0cab17b0c..9a54d7d83 100644 --- a/views/templates/macros/icons.html.twig +++ b/views/templates/macros/icons.html.twig @@ -1,9 +1,9 @@ {% macro ok(psBaseUri) %} ok -{% endmacro %} +{% endmacro %} {% macro nok(psBaseUri) %} nok -{% endmacro %} +{% endmacro %} {% macro warning(psBaseUri) %} warn -{% endmacro %} +{% endmacro %} diff --git a/views/templates/main.html.twig b/views/templates/main.html.twig index dd757dcc1..813bccbae 100644 --- a/views/templates/main.html.twig +++ b/views/templates/main.html.twig @@ -1,13 +1,12 @@ -
@@ -35,7 +34,8 @@ {% include '@ModuleAutoUpgrade/block/rollbackForm.html.twig' %} -
+ {{ backupOptions|raw }} {{ upgradeOptions|raw }}
@@ -44,7 +44,7 @@ diff --git a/views/templates/modals/modal-backup-all.html.twig b/views/templates/modals/modal-backup-all.html.twig index 3a3955148..2bc627d21 100644 --- a/views/templates/modals/modal-backup-all.html.twig +++ b/views/templates/modals/modal-backup-all.html.twig @@ -3,14 +3,14 @@ {% block modal_extra_content %}{% endblock %} {% block modal_footer %} - {% endblock %} diff --git a/views/templates/modals/modal-backup-delete.html.twig b/views/templates/modals/modal-backup-delete.html.twig index c9256cded..65a7e1865 100644 --- a/views/templates/modals/modal-backup-delete.html.twig +++ b/views/templates/modals/modal-backup-delete.html.twig @@ -3,13 +3,13 @@ {% block modal_extra_content %}{% endblock %} {% block modal_footer %} - {% endblock %} diff --git a/views/templates/modals/modal-backup.html.twig b/views/templates/modals/modal-backup.html.twig index 3a3955148..2bc627d21 100644 --- a/views/templates/modals/modal-backup.html.twig +++ b/views/templates/modals/modal-backup.html.twig @@ -3,14 +3,14 @@ {% block modal_extra_content %}{% endblock %} {% block modal_footer %} - {% endblock %} diff --git a/views/templates/modals/modal-error-report.html.twig b/views/templates/modals/modal-error-report.html.twig index 145e29f33..e080d76c8 100644 --- a/views/templates/modals/modal-error-report.html.twig +++ b/views/templates/modals/modal-error-report.html.twig @@ -2,44 +2,45 @@ {% block modal_content %} - {% endblock %} {% block modal_extra_content_inner %} - {% endblock %} {% block modal_footer %} - {% endblock %} diff --git a/views/templates/modals/modal-update.html.twig b/views/templates/modals/modal-update.html.twig index d0bb331bc..c1842edd7 100644 --- a/views/templates/modals/modal-update.html.twig +++ b/views/templates/modals/modal-update.html.twig @@ -1,35 +1,35 @@ {% extends '@ModuleAutoUpgrade/components/modal.html.twig' %} {% block modal_content %} - {% if noBackUp %} -

- {{ 'Before starting the update, make sure you have a complete and recent backup of your store (database, files, and images).'|trans({}) }} -

- {% else %} - {{ parent() }} - {% endif %} + {% if noBackUp %} +

+ {{ 'Before starting the update, make sure you have a complete and recent backup of your store (database, files, and images).'|trans({}) }} +

+ {% else %} + {{ parent() }} + {% endif %} {% endblock %} {% block modal_extra_content %} - {% if noBackUp %} - - {% endif %} + {% if noBackUp %} + + {% endif %} {% endblock %} {% block modal_footer %} - {% endblock %} From 5c389ac6341bb2f71f9470d817c085dd567c7c2d Mon Sep 17 00:00:00 2001 From: Alexis Guyomar Date: Wed, 4 Sep 2024 17:08:12 +0200 Subject: [PATCH 24/27] fix: workflow steps name --- .github/workflows/js.yml | 4 ++-- storybook/stories/components/Logs.stories.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/js.yml b/.github/workflows/js.yml index 4d6b471df..4512166f0 100644 --- a/.github/workflows/js.yml +++ b/.github/workflows/js.yml @@ -20,10 +20,10 @@ jobs: run: npm install --prefix ./_dev - - name: Launch Eslint + - name: Launch typescript linter run: npm run lint --prefix ./_dev - - name: Launch Eslint + - name: Launch scss linter run: npm run lint-scss --prefix ./_dev diff --git a/storybook/stories/components/Logs.stories.js b/storybook/stories/components/Logs.stories.js index cbcc36fc0..ca8b35625 100644 --- a/storybook/stories/components/Logs.stories.js +++ b/storybook/stories/components/Logs.stories.js @@ -191,7 +191,7 @@ document.addEventListener("DOMContentLoaded", () => { const targetRect = targetElement.getBoundingClientRect(); const containerRect = logsScroll.getBoundingClientRect(); const offsetTop = targetRect.top - containerRect.top + logsScroll.scrollTop; - + logsScroll.scrollTo({ top: offsetTop, behavior: "smooth" @@ -204,4 +204,4 @@ document.addEventListener("DOMContentLoaded", () => { } }); }); -}); \ No newline at end of file +}); From c9618ed3c002e819fba10ea502a372f20283f0e1 Mon Sep 17 00:00:00 2001 From: Alexis Guyomar Date: Wed, 4 Sep 2024 18:06:19 +0200 Subject: [PATCH 25/27] fix: review issues --- controllers/admin/AdminSelfUpgradeController.php | 12 ++++++++++-- views/templates/layouts/page.html.twig | 11 ----------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/controllers/admin/AdminSelfUpgradeController.php b/controllers/admin/AdminSelfUpgradeController.php index c19d962f2..7dcf7491e 100644 --- a/controllers/admin/AdminSelfUpgradeController.php +++ b/controllers/admin/AdminSelfUpgradeController.php @@ -528,6 +528,16 @@ public function initContent() ->getJson() ); + $this->addNewUIAssets(); + + return parent::initContent(); + } + + /** + * @return void + */ + private function addNewUIAssets() + { if (!empty($_ENV['AUTOUPGRADE_DEV_WATCH_MODE']) && $_ENV['AUTOUPGRADE_DEV_WATCH_MODE'] === '1') { $vite_dev_url = 'http://localhost:5173/'; $this->context->controller->addCSS($vite_dev_url . 'styles/main.scss'); @@ -537,8 +547,6 @@ public function initContent() $this->context->controller->addCSS(_PS_ROOT_DIR_ . 'modules/autoupgrade/views/css/autoupgrade.css'); $this->context->controller->addJS(_PS_ROOT_DIR_ . 'modules/autoupgrade/views/js/autoupgrade.js?version=' . $this->module->version); } - - return parent::initContent(); } /** diff --git a/views/templates/layouts/page.html.twig b/views/templates/layouts/page.html.twig index a3b5f6f64..386e17880 100644 --- a/views/templates/layouts/page.html.twig +++ b/views/templates/layouts/page.html.twig @@ -18,17 +18,6 @@
{% block content %} {# Default content or leave empty for child templates to provide #} - {# -
-
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc molestie efficitur tortor at feugiat. Donec pretium libero non tortor lobortis, eu cursus ligula tincidunt. -
- -
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc molestie efficitur tortor at feugiat. Donec pretium libero non tortor lobortis, eu cursus ligula tincidunt. -
-
- #} {% endblock %}
From 285e58b730f67d0504ccf7d8adddf0d7e2534b0b Mon Sep 17 00:00:00 2001 From: Alexis Guyomar Date: Thu, 5 Sep 2024 09:45:13 +0200 Subject: [PATCH 26/27] feat: add readme commands for lint and test front and back --- README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/README.md b/README.md index dc52784da..147620123 100644 --- a/README.md +++ b/README.md @@ -93,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. 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! From 156a71776d488da6d2322617425f874dd7427f27 Mon Sep 17 00:00:00 2001 From: Alexis Guyomar Date: Thu, 5 Sep 2024 09:50:46 +0200 Subject: [PATCH 27/27] feat: add instruction for php stan installation --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 147620123..5d8284c64 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ This section outlines all the commands for code linting and testing. Before runn 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. Available version options: +- `./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`