From f00a3407bbc01798e586939af62dd5b5a6234ed0 Mon Sep 17 00:00:00 2001 From: Titouan Mathis Date: Wed, 19 May 2021 18:53:48 +0200 Subject: [PATCH 01/22] Register the Twig Toolkit extension --- .../themes/<%= slug %>/app/Managers/TwigManager.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/template/web/wp-content/themes/<%= slug %>/app/Managers/TwigManager.php b/template/web/wp-content/themes/<%= slug %>/app/Managers/TwigManager.php index 75658e8..5bac3cf 100644 --- a/template/web/wp-content/themes/<%= slug %>/app/Managers/TwigManager.php +++ b/template/web/wp-content/themes/<%= slug %>/app/Managers/TwigManager.php @@ -16,12 +16,25 @@ class TwigManager implements ManagerInterface { * @inheritDoc */ public function run() { + add_filter( 'timber/twig', array( $this, 'add_twig_toolkit' ) ); add_filter( 'timber/twig', array( $this, 'add_twig_template_from_string' ) ); add_filter( 'timber/twig', array( $this, 'add_twig_template_include_comments' ) ); add_filter( 'timber/output', array( $this, 'add_twig_template_render_comments' ), 10, 3 ); add_filter( 'timber/loader/loader', array( $this, 'add_svg_path' ), 10, 1 ); } + /** + * Add Studio Meta's Twig Toolkit extension. + * + * @link https://github.com/studiometa/twig-toolkit/ + * @param \Twig\Environment $twig The Twig environment. + * @return \Twig\Environment + */ + public function add_twig_toolkit( \Twig\Environment $twig ) { + $twig->addExtension( new \Studiometa\TwigToolkit\Extension() ); + return $twig; + } + /** * Adds template_from_string to Twig. * From 4ef18f12ae0f25166969dd40e136025118117a5f Mon Sep 17 00:00:00 2001 From: Titouan Mathis Date: Tue, 1 Jun 2021 15:25:15 +0200 Subject: [PATCH 02/22] Allow usage of the `@inheritdoc` tag in doc blocks See https://github.com/squizlabs/PHP_CodeSniffer/wiki/Customisable-Sniff-Properties#squizcommentingfunctioncomment --- template/phpcs.xml | 7 +++++++ .../themes/<%= slug %>/app/Managers/ACFManager.php | 3 +-- .../themes/<%= slug %>/app/Managers/AssetsManager.php | 3 +-- .../<%= slug %>/app/Managers/CustomPostTypesManager.php | 3 +-- .../themes/<%= slug %>/app/Managers/TaxonomiesManager.php | 3 +-- .../themes/<%= slug %>/app/Managers/ThemeManager.php | 3 +-- .../themes/<%= slug %>/app/Managers/TinyMCEManager.php | 3 +-- .../themes/<%= slug %>/app/Managers/TwigManager.php | 3 +-- .../themes/<%= slug %>/app/Managers/WordPressManager.php | 3 +-- 9 files changed, 15 insertions(+), 16 deletions(-) diff --git a/template/phpcs.xml b/template/phpcs.xml index 5cce32f..4a32070 100644 --- a/template/phpcs.xml +++ b/template/phpcs.xml @@ -38,4 +38,11 @@ /app/ + + + + + + + diff --git a/template/web/wp-content/themes/<%= slug %>/app/Managers/ACFManager.php b/template/web/wp-content/themes/<%= slug %>/app/Managers/ACFManager.php index b57bdfa..3c394ec 100644 --- a/template/web/wp-content/themes/<%= slug %>/app/Managers/ACFManager.php +++ b/template/web/wp-content/themes/<%= slug %>/app/Managers/ACFManager.php @@ -15,9 +15,8 @@ /** Class **/ class ACFManager implements ManagerInterface { - // phpcs:ignore Generic.Commenting.DocComment.MissingShort /** - * @inheritDoc + * {@inheritdoc} */ public function run() { add_action( 'acf/init', array( $this, 'register_acf_example_group' ) ); diff --git a/template/web/wp-content/themes/<%= slug %>/app/Managers/AssetsManager.php b/template/web/wp-content/themes/<%= slug %>/app/Managers/AssetsManager.php index 7fe8e4f..1480c26 100644 --- a/template/web/wp-content/themes/<%= slug %>/app/Managers/AssetsManager.php +++ b/template/web/wp-content/themes/<%= slug %>/app/Managers/AssetsManager.php @@ -13,9 +13,8 @@ /** Class */ class AssetsManager implements ManagerInterface { - // phpcs:ignore Generic.Commenting.DocComment.MissingShort /** - * @inheritDoc + * {@inheritdoc} */ public function run() { new Assets( get_template_directory() ); diff --git a/template/web/wp-content/themes/<%= slug %>/app/Managers/CustomPostTypesManager.php b/template/web/wp-content/themes/<%= slug %>/app/Managers/CustomPostTypesManager.php index bfb56ef..4b13b85 100644 --- a/template/web/wp-content/themes/<%= slug %>/app/Managers/CustomPostTypesManager.php +++ b/template/web/wp-content/themes/<%= slug %>/app/Managers/CustomPostTypesManager.php @@ -11,9 +11,8 @@ /** Class **/ class CustomPostTypesManager implements ManagerInterface { - // phpcs:ignore Generic.Commenting.DocComment.MissingShort /** - * @inheritDoc + * {@inheritdoc} */ public function run() { add_action( 'init', array( $this, 'register_custom_post_types' ), 1 ); diff --git a/template/web/wp-content/themes/<%= slug %>/app/Managers/TaxonomiesManager.php b/template/web/wp-content/themes/<%= slug %>/app/Managers/TaxonomiesManager.php index 57936fb..b601327 100644 --- a/template/web/wp-content/themes/<%= slug %>/app/Managers/TaxonomiesManager.php +++ b/template/web/wp-content/themes/<%= slug %>/app/Managers/TaxonomiesManager.php @@ -11,9 +11,8 @@ /** Class **/ class TaxonomiesManager implements ManagerInterface { - // phpcs:ignore Generic.Commenting.DocComment.MissingShort /** - * @inheritDoc + * {@inheritdoc} */ public function run() { add_action( 'init', array( $this, 'register_taxonomies' ), 1 ); diff --git a/template/web/wp-content/themes/<%= slug %>/app/Managers/ThemeManager.php b/template/web/wp-content/themes/<%= slug %>/app/Managers/ThemeManager.php index aba37f4..b8622a2 100644 --- a/template/web/wp-content/themes/<%= slug %>/app/Managers/ThemeManager.php +++ b/template/web/wp-content/themes/<%= slug %>/app/Managers/ThemeManager.php @@ -13,9 +13,8 @@ /** Class */ class ThemeManager implements ManagerInterface { - // phpcs:ignore Generic.Commenting.DocComment.MissingShort /** - * @inheritDoc + * {@inheritdoc} */ public function run() { add_theme_support( 'post-thumbnails' ); diff --git a/template/web/wp-content/themes/<%= slug %>/app/Managers/TinyMCEManager.php b/template/web/wp-content/themes/<%= slug %>/app/Managers/TinyMCEManager.php index eee44f8..4992699 100644 --- a/template/web/wp-content/themes/<%= slug %>/app/Managers/TinyMCEManager.php +++ b/template/web/wp-content/themes/<%= slug %>/app/Managers/TinyMCEManager.php @@ -12,9 +12,8 @@ /** Class */ class TinyMCEManager implements ManagerInterface { - // phpcs:ignore Generic.Commenting.DocComment.MissingShort /** - * @inheritDoc + * {@inheritdoc} */ public function run() { add_filter( 'tiny_mce_before_init', array( $this, 'set_editor_config' ) ); diff --git a/template/web/wp-content/themes/<%= slug %>/app/Managers/TwigManager.php b/template/web/wp-content/themes/<%= slug %>/app/Managers/TwigManager.php index 5bac3cf..513d899 100644 --- a/template/web/wp-content/themes/<%= slug %>/app/Managers/TwigManager.php +++ b/template/web/wp-content/themes/<%= slug %>/app/Managers/TwigManager.php @@ -11,9 +11,8 @@ /** Class */ class TwigManager implements ManagerInterface { - // phpcs:ignore Generic.Commenting.DocComment.MissingShort /** - * @inheritDoc + * {@inheritdoc} */ public function run() { add_filter( 'timber/twig', array( $this, 'add_twig_toolkit' ) ); diff --git a/template/web/wp-content/themes/<%= slug %>/app/Managers/WordPressManager.php b/template/web/wp-content/themes/<%= slug %>/app/Managers/WordPressManager.php index 9fc684b..8de7bd6 100644 --- a/template/web/wp-content/themes/<%= slug %>/app/Managers/WordPressManager.php +++ b/template/web/wp-content/themes/<%= slug %>/app/Managers/WordPressManager.php @@ -11,9 +11,8 @@ /** Class **/ class WordPressManager implements ManagerInterface { - // phpcs:ignore Generic.Commenting.DocComment.MissingShort /** - * @inheritDoc + * {@inheritdoc} */ public function run() { add_action( 'wp_head', array( $this, 'add_no_index' ), 10 ); From c9877075a3fc1dab069b8ab7e3d2710494e66cdc Mon Sep 17 00:00:00 2001 From: Titouan Mathis Date: Tue, 1 Jun 2021 16:18:15 +0200 Subject: [PATCH 03/22] Add tests on the generated project --- .github/workflows/tests.yml | 111 ++++++++++++++++++++++++++++++++++++ package-lock.json | 6 ++ package.json | 1 + saofile.js | 6 +- scripts/setup-test.js | 15 +++++ 5 files changed, 135 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/tests.yml create mode 100755 scripts/setup-test.js diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..d4d9ecf --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,111 @@ +# This workflow will run tests using node and then publish +# a package to NPM Packages when a release is created. +# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages + +name: Tests + +on: + push: + branches: + - master + - develop + pull_request: + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + path: create-wordpress-project + - uses: actions/setup-node@v1 + with: + node-version: 12 + registry-url: https://registry.npmjs.org/ + - run: npm ci && node ./scripts/setup-test.js + - uses: actions/upload-artifact@v2 + with: + name: test-project-folder + path: ./__test-project__ + + phpcs: + name: PHPCS + runs-on: ubuntu-latest + needs: build + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + path: create-wordpress-project + + - uses: actions/download-artifact@v2 + with: + name: test-project-folder + + - name: Determine composer cache directory + shell: bash + run: "echo \"COMPOSER_CACHE_DIR=$(composer config cache-dir)\" >> $GITHUB_ENV" + + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ${{ env.COMPOSER_CACHE_DIR }} + key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - uses: php-actions/composer@v5 + with: + php_version: 7.3 + + - name: PHPCS + uses: chekalsky/phpcs-action@v1 + with: + phpcs_bin_path: ./vendor/bin/phpcs + + phpstan: + name: PHPStan + runs-on: ubuntu-latest + needs: build + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + path: create-wordpress-project + + - uses: actions/download-artifact@v2 + with: + name: test-project-folder + + - uses: php-actions/composer@v5 + with: + php_version: 7.3 + + - name: PHPStan + uses: docker://oskarstark/phpstan-ga + env: + REQUIRE_DEV: true + with: + args: analyse + + lint: + name: ESLint & Stylelint + runs-on: ubuntu-latest + needs: build + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + path: create-wordpress-project + + - uses: actions/setup-node@v1 + with: + node-version: 12 + registry-url: https://registry.npmjs.org/ + + - uses: actions/download-artifact@v2 + with: + name: test-project-folder + + - run: npm ci && npm run lint diff --git a/package-lock.json b/package-lock.json index 9ef8b89..e29dc1f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -276,6 +276,12 @@ "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", "dev": true }, + "@types/node": { + "version": "15.6.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-15.6.1.tgz", + "integrity": "sha512-7EIraBEyRHEe7CH+Fm1XvgqU6uwZN8Q7jppJGcqjROMT29qhAuuOxYB1uEY5UMYQKEmA5D+5tBnhdaPXSsLONA==", + "dev": true + }, "acorn": { "version": "7.4.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", diff --git a/package.json b/package.json index 37f7d68..d9696a6 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "devDependencies": { "@studiometa/eslint-config": "^2.1.3", "@studiometa/prettier-config": "^2.0.1", + "@types/node": "^15.6.1", "eslint": "^7.26.0", "prettier": "^2.3.0" } diff --git a/saofile.js b/saofile.js index 2ad14b4..ded4c3d 100644 --- a/saofile.js +++ b/saofile.js @@ -35,7 +35,7 @@ module.exports = { { name: 'GitLab', value: 'git@gitlab.com:studiometa' }, { name: 'GitHub', value: 'git@github.com:studiometa' }, ], - default: 0, + default: 'git@gitlab.com:studiometa', }, { name: 'repository', @@ -127,9 +127,7 @@ module.exports = { }); // Execute installation related shell scripts - [ - 'bin/generate-wp-config.sh', - ].forEach((file) => { + ['bin/generate-wp-config.sh'].forEach((file) => { exec(path.resolve(outDir, file)); }); diff --git a/scripts/setup-test.js b/scripts/setup-test.js new file mode 100755 index 0000000..aed6f27 --- /dev/null +++ b/scripts/setup-test.js @@ -0,0 +1,15 @@ +#!/usr/bin/env node +const path = require('path'); +const sao = require('sao'); + +const generator = path.resolve(__dirname, '../'); +const outDir = path.resolve(__dirname, '../__test-project__/'); + +process.env.NODE_ENV = 'test'; + +sao({ generator, outDir, logLevel: 4, debug: true, yes: true }) + .run() + .catch((err) => { + console.trace(err); + process.exit(1); + }); From 4d61cc2fb0c588828eb80bfded9598aba04171e9 Mon Sep 17 00:00:00 2001 From: Titouan Mathis Date: Tue, 1 Jun 2021 16:21:22 +0200 Subject: [PATCH 04/22] Fix tests CI --- .github/workflows/tests.yml | 49 +++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d4d9ecf..4fcc7c4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,31 +18,34 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v2 - with: - path: create-wordpress-project + - uses: actions/setup-node@v1 with: node-version: 12 registry-url: https://registry.npmjs.org/ - - run: npm ci && node ./scripts/setup-test.js + + - name: Create test project + run: npm ci && node ./scripts/setup-test.js + + - name: Create archive + run: tar -zcf __test-project__.tar.gz --directory=./__test-project__ . + - uses: actions/upload-artifact@v2 with: - name: test-project-folder - path: ./__test-project__ + name: test-project + path: ./__test-project__.tar.gz phpcs: name: PHPCS runs-on: ubuntu-latest needs: build steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - path: create-wordpress-project - - uses: actions/download-artifact@v2 with: - name: test-project-folder + name: test-project + + - name: Extract archive + run: tar -xvf __test-project__.tar.gz && ls -al - name: Determine composer cache directory shell: bash @@ -58,6 +61,7 @@ jobs: - uses: php-actions/composer@v5 with: php_version: 7.3 + version: 1 - name: PHPCS uses: chekalsky/phpcs-action@v1 @@ -69,18 +73,17 @@ jobs: runs-on: ubuntu-latest needs: build steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - path: create-wordpress-project - - uses: actions/download-artifact@v2 with: - name: test-project-folder + name: test-project + + - name: Extract archive + run: tar -xvf __test-project__.tar.gz && ls -al - uses: php-actions/composer@v5 with: php_version: 7.3 + version: 1 - name: PHPStan uses: docker://oskarstark/phpstan-ga @@ -94,11 +97,6 @@ jobs: runs-on: ubuntu-latest needs: build steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - path: create-wordpress-project - - uses: actions/setup-node@v1 with: node-version: 12 @@ -106,6 +104,9 @@ jobs: - uses: actions/download-artifact@v2 with: - name: test-project-folder + name: test-project + + - name: Extract archive + run: tar -xvf __test-project__.tar.gz && ls -al - - run: npm ci && npm run lint + - run: npm run lint From 0e6f777b78825e537bd894dfdfdc57e20d0fd211 Mon Sep 17 00:00:00 2001 From: Titouan Mathis Date: Tue, 1 Jun 2021 16:57:35 +0200 Subject: [PATCH 05/22] Fix PHPStan and PHPCS jobs --- .github/workflows/tests.yml | 37 +++++++++++-------- .gitignore | 5 ++- .../app/Managers/AssetsManager.php | 22 ----------- .../app/Managers/TinyMCEManager.php | 11 +++--- .../app/Repositories/PostRepository.php | 5 +-- .../app/Repositories/Repository.php | 4 +- .../app/Repositories/TermRepository.php | 4 +- .../themes/<%= slug %>/functions.php | 2 +- 8 files changed, 38 insertions(+), 52 deletions(-) delete mode 100644 template/web/wp-content/themes/<%= slug %>/app/Managers/AssetsManager.php diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4fcc7c4..7ff0406 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -45,12 +45,17 @@ jobs: name: test-project - name: Extract archive - run: tar -xvf __test-project__.tar.gz && ls -al + run: tar -xf __test-project__.tar.gz && ls -al - name: Determine composer cache directory shell: bash run: "echo \"COMPOSER_CACHE_DIR=$(composer config cache-dir)\" >> $GITHUB_ENV" + - uses: php-actions/composer@v5 + with: + php_version: 7.3 + version: 1 + - name: Cache dependencies uses: actions/cache@v2 with: @@ -58,15 +63,8 @@ jobs: key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }} restore-keys: ${{ runner.os }}-composer- - - uses: php-actions/composer@v5 - with: - php_version: 7.3 - version: 1 - - name: PHPCS - uses: chekalsky/phpcs-action@v1 - with: - phpcs_bin_path: ./vendor/bin/phpcs + run: composer run phpcs phpstan: name: PHPStan @@ -78,19 +76,26 @@ jobs: name: test-project - name: Extract archive - run: tar -xvf __test-project__.tar.gz && ls -al + run: tar -xf __test-project__.tar.gz && ls -al + + - name: Determine composer cache directory + shell: bash + run: "echo \"COMPOSER_CACHE_DIR=$(composer config cache-dir)\" >> $GITHUB_ENV" - uses: php-actions/composer@v5 with: php_version: 7.3 version: 1 - - name: PHPStan - uses: docker://oskarstark/phpstan-ga - env: - REQUIRE_DEV: true + - name: Cache dependencies + uses: actions/cache@v2 with: - args: analyse + path: ${{ env.COMPOSER_CACHE_DIR }} + key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - name: PHPStan + run: composer run phpstan lint: name: ESLint & Stylelint @@ -107,6 +112,6 @@ jobs: name: test-project - name: Extract archive - run: tar -xvf __test-project__.tar.gz && ls -al + run: tar -xf __test-project__.tar.gz && ls -al - run: npm run lint diff --git a/.gitignore b/.gitignore index a30f54d..e07a8a9 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,7 @@ node_modules/ # Template files -template/package-lock.json \ No newline at end of file +template/package-lock.json + +# Test files +/__test-project__/ diff --git a/template/web/wp-content/themes/<%= slug %>/app/Managers/AssetsManager.php b/template/web/wp-content/themes/<%= slug %>/app/Managers/AssetsManager.php deleted file mode 100644 index 1480c26..0000000 --- a/template/web/wp-content/themes/<%= slug %>/app/Managers/AssetsManager.php +++ /dev/null @@ -1,22 +0,0 @@ -/app/Managers/TinyMCEManager.php b/template/web/wp-content/themes/<%= slug %>/app/Managers/TinyMCEManager.php index 4992699..b9dfbbb 100644 --- a/template/web/wp-content/themes/<%= slug %>/app/Managers/TinyMCEManager.php +++ b/template/web/wp-content/themes/<%= slug %>/app/Managers/TinyMCEManager.php @@ -1,5 +1,4 @@ /app/Repositories/PostRepository.php b/template/web/wp-content/themes/<%= slug %>/app/Repositories/PostRepository.php index 42d9f71..288ba16 100644 --- a/template/web/wp-content/themes/<%= slug %>/app/Repositories/PostRepository.php +++ b/template/web/wp-content/themes/<%= slug %>/app/Repositories/PostRepository.php @@ -15,10 +15,9 @@ class PostRepository extends Repository { const POST_TYPES = array( 'post' ); // Main post types. /** - * Implement do_query + * Implement do_query. * - * @param array $params for the query. - * @param string $class_type to return. + * @param array $params for the query. * @return \Timber\PostQuery */ public function do_query( $params ) { diff --git a/template/web/wp-content/themes/<%= slug %>/app/Repositories/Repository.php b/template/web/wp-content/themes/<%= slug %>/app/Repositories/Repository.php index f0b6a4f..2cb59d8 100644 --- a/template/web/wp-content/themes/<%= slug %>/app/Repositories/Repository.php +++ b/template/web/wp-content/themes/<%= slug %>/app/Repositories/Repository.php @@ -64,7 +64,7 @@ public function slice( $start ) { /** * Runs a query. * - * @param array $params Query params. + * @param array $params Query params. * * @return Repository */ @@ -95,7 +95,7 @@ protected function query( array $params ) { * * Define the query the Repository will run. * - * @param array $params Query params. + * @param array $params Query params. * @return mixed */ abstract protected function do_query( $params ); diff --git a/template/web/wp-content/themes/<%= slug %>/app/Repositories/TermRepository.php b/template/web/wp-content/themes/<%= slug %>/app/Repositories/TermRepository.php index 59d8792..00b1026 100644 --- a/template/web/wp-content/themes/<%= slug %>/app/Repositories/TermRepository.php +++ b/template/web/wp-content/themes/<%= slug %>/app/Repositories/TermRepository.php @@ -16,8 +16,8 @@ final class TermRepository extends Repository { /** * Set what the Query will return * - * @param array $params Query params. - * @return Timber\Term + * @param array $params Query params. + * @return \Timber\Term */ public function do_query( $params ) { return TermGetter::get_terms( $params, array(), static::CLASS_TYPE ); diff --git a/template/web/wp-content/themes/<%= slug %>/functions.php b/template/web/wp-content/themes/<%= slug %>/functions.php index f8f12a0..01b494e 100644 --- a/template/web/wp-content/themes/<%= slug %>/functions.php +++ b/template/web/wp-content/themes/<%= slug %>/functions.php @@ -63,7 +63,7 @@ function () { new ThemeManager(), new WordPressManager(), new TwigManager(), - new AssetsManager( get_template_directory() ), + new AssetsManager(), new CleanupManager(), new CustomPostTypesManager(), new TaxonomiesManager(), From 3a746dc356dd4e6f0a0566e2eea36e2b7ed6dc73 Mon Sep 17 00:00:00 2001 From: Titouan Mathis Date: Tue, 1 Jun 2021 17:43:39 +0200 Subject: [PATCH 06/22] Test the assets build command --- .github/workflows/tests.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7ff0406..b95280c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -115,3 +115,22 @@ jobs: run: tar -xf __test-project__.tar.gz && ls -al - run: npm run lint + + build-assets: + name: Build assets + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/setup-node@v1 + with: + node-version: 12 + registry-url: https://registry.npmjs.org/ + + - uses: actions/download-artifact@v2 + with: + name: test-project + + - name: Extract archive + run: tar -xf __test-project__.tar.gz && ls -al + + - run: npm run build From e7fec3b58ba0e813e31a96b391d382ba5546a7ae Mon Sep 17 00:00:00 2001 From: Titouan Mathis Date: Tue, 1 Jun 2021 17:48:26 +0200 Subject: [PATCH 07/22] Fix caching of composer dependencies --- .github/workflows/tests.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b95280c..f06dae5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -47,15 +47,15 @@ jobs: - name: Extract archive run: tar -xf __test-project__.tar.gz && ls -al - - name: Determine composer cache directory - shell: bash - run: "echo \"COMPOSER_CACHE_DIR=$(composer config cache-dir)\" >> $GITHUB_ENV" - - uses: php-actions/composer@v5 with: php_version: 7.3 version: 1 + - name: Determine composer cache directory + shell: bash + run: "echo \"COMPOSER_CACHE_DIR=$(composer config cache-dir)\" >> $GITHUB_ENV" + - name: Cache dependencies uses: actions/cache@v2 with: @@ -78,15 +78,15 @@ jobs: - name: Extract archive run: tar -xf __test-project__.tar.gz && ls -al - - name: Determine composer cache directory - shell: bash - run: "echo \"COMPOSER_CACHE_DIR=$(composer config cache-dir)\" >> $GITHUB_ENV" - - uses: php-actions/composer@v5 with: php_version: 7.3 version: 1 + - name: Determine composer cache directory + shell: bash + run: "echo \"COMPOSER_CACHE_DIR=$(composer config cache-dir)\" >> $GITHUB_ENV" + - name: Cache dependencies uses: actions/cache@v2 with: From cb3749e51aa9e3a1f5dd7fd95c97906d0c3fcf68 Mon Sep 17 00:00:00 2001 From: Titouan Mathis Date: Mon, 14 Jun 2021 14:06:24 +0200 Subject: [PATCH 08/22] Replace the meta package with its dependencies It is more clear which package is installed when they are all listed in the project's dependencies. --- template/package.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/template/package.json b/template/package.json index e3fe7aa..f3a4f08 100644 --- a/template/package.json +++ b/template/package.json @@ -20,7 +20,12 @@ "@babel/plugin-proposal-class-properties": "^7.13.0", "@babel/plugin-transform-runtime": "^7.14.3", "@babel/preset-env": "^7.14.2", - "@studiometa/meta-configs": "^1.0.2", + "@studiometa/browserslist-config": "^1.0.1", + "@studiometa/eslint-config": "^2.1.3", + "@studiometa/prettier-config": "^2.0.1", + "@studiometa/stylelint-config": "^2.0.0", + "@studiometa/tailwind-config": "^1.0.2", + "@studiometa/webpack-config": "^2.9.0", "@studiometa/prettier-formatter-gitlab": "^1.1.1", "eslint": "^7.26.0", "eslint-formatter-gitlab": "^2.2.0", From 4a22804055f1b9e7ab8a1fa7352b068e27aff0de Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Jun 2021 12:28:14 +0000 Subject: [PATCH 09/22] Bump lodash from 4.17.19 to 4.17.21 Bumps [lodash](https://github.com/lodash/lodash) from 4.17.19 to 4.17.21. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.19...4.17.21) --- updated-dependencies: - dependency-name: lodash dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index e29dc1f..3036f02 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1292,12 +1292,6 @@ "type-fest": "^0.20.2" } }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true - }, "lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -2668,9 +2662,9 @@ } }, "lodash": { - "version": "4.17.19", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", - "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==" + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, "lodash.clonedeep": { "version": "4.5.0", From 12c5ead924a42efb07899ff9fc2c7fa45527a80e Mon Sep 17 00:00:00 2001 From: Titouan Mathis Date: Tue, 15 Jun 2021 16:20:25 +0200 Subject: [PATCH 10/22] Fix Prettier configuration for Twig templates --- template/.prettierrc.js | 6 +++++- template/package.json | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/template/.prettierrc.js b/template/.prettierrc.js index 240caf5..772b163 100644 --- a/template/.prettierrc.js +++ b/template/.prettierrc.js @@ -1 +1,5 @@ -module.exports = require('@studiometa/prettier-config'); +module.exports = { + ...require('@studiometa/prettier-config'), + twigPrintWidth: 100, + twigAlwaysBreakObjects: false, +}; diff --git a/template/package.json b/template/package.json index f3a4f08..e0fd1b9 100644 --- a/template/package.json +++ b/template/package.json @@ -5,10 +5,10 @@ "scripts": { "dev": "meta dev", "build": "meta build", - "lint": "npm run lint:scripts && npm run lint:styles", + "lint": "npm run lint:scripts && npm run lint:styles && npm run lint:templates", "lint:scripts": "eslint web/wp-content/themes/<%= slug %>/src/js --ext=.js,.vue", "lint:styles": "stylelint 'web/wp-content/themes/<%= slug %>/src/**/*.(scss|vue)'", - "lint:templates": "prettier -c web/wp-content/themes/<%= slug %>/templates/", + "lint:templates": "prettier -c web/wp-content/themes/<%= slug %>/templates/**/*.twig", "fix": "npm run fix:scripts && npm run fix:styles && npm run fix:templates", "fix:scripts": "npm run lint:scripts -- --fix", "fix:styles": "npm run lint:styles -- --fix", From 105fba6f39521b6522b1caf7a3a9bf54ab29e3e2 Mon Sep 17 00:00:00 2001 From: Titouan Mathis Date: Tue, 15 Jun 2021 18:14:39 +0200 Subject: [PATCH 11/22] Format Twig files --- package-lock.json | 280 ++++++++++++++++++ package.json | 3 +- .../templates/components/header.twig | 8 +- .../templates/components/menu.twig | 8 +- .../templates/components/pagination.twig | 25 +- .../<%= slug %>/templates/pages/index.twig | 11 +- .../<%= slug %>/templates/pages/search.twig | 11 +- 7 files changed, 296 insertions(+), 50 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3036f02..e513e61 100644 --- a/package-lock.json +++ b/package-lock.json @@ -412,6 +412,65 @@ "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==" }, + "babel-code-frame": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "dev": true, + "requires": { + "chalk": "^1.1.3", + "esutils": "^2.0.2", + "js-tokens": "^3.0.2" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, "babel-eslint": { "version": "10.1.0", "resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-10.1.0.tgz", @@ -426,6 +485,89 @@ "resolve": "^1.12.0" } }, + "babel-messages": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", + "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "dev": true, + "requires": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + } + }, + "babel-template": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz", + "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", + "dev": true, + "requires": { + "babel-runtime": "^6.26.0", + "babel-traverse": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "lodash": "^4.17.4" + } + }, + "babel-traverse": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", + "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", + "dev": true, + "requires": { + "babel-code-frame": "^6.26.0", + "babel-messages": "^6.23.0", + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "debug": "^2.6.8", + "globals": "^9.18.0", + "invariant": "^2.2.2", + "lodash": "^4.17.4" + }, + "dependencies": { + "globals": { + "version": "9.18.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", + "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", + "dev": true + } + } + }, + "babel-types": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", + "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", + "dev": true, + "requires": { + "babel-runtime": "^6.26.0", + "esutils": "^2.0.2", + "lodash": "^4.17.4", + "to-fast-properties": "^1.0.3" + }, + "dependencies": { + "to-fast-properties": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", + "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", + "dev": true + } + } + }, + "babylon": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", + "dev": true + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -852,6 +994,12 @@ "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=" }, + "core-js": { + "version": "2.6.12", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz", + "integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==", + "dev": true + }, "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", @@ -2048,6 +2196,23 @@ "function-bind": "^1.1.1" } }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + } + } + }, "has-bigints": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", @@ -2112,6 +2277,12 @@ "resolved": "https://registry.npmjs.org/hash-sum/-/hash-sum-1.0.2.tgz", "integrity": "sha1-M7QHd3VMZDJXPBIMw4CLvRDUfwQ=" }, + "he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true + }, "hosted-git-info": { "version": "2.8.9", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", @@ -2242,6 +2413,15 @@ } } }, + "invariant": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", + "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", + "dev": true, + "requires": { + "loose-envify": "^1.0.0" + } + }, "is-accessor-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", @@ -2742,6 +2922,15 @@ "wrap-ansi": "^3.0.1" } }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, "lowercase-keys": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", @@ -2793,6 +2982,53 @@ "object-visit": "^1.0.0" } }, + "melody-code-frame": { + "version": "1.7.5", + "resolved": "https://registry.npmjs.org/melody-code-frame/-/melody-code-frame-1.7.5.tgz", + "integrity": "sha512-q/Do+7ZFxRHLN7IhT5RIJrTKh7xNmX3JG4+AD1ZST9iB8gUPYs6yfgGexDRDvtOAAGgLfFbT1DlMWJtldqYaPQ==", + "dev": true, + "requires": { + "lodash": "^4.15.0" + } + }, + "melody-extension-core": { + "version": "1.7.5", + "resolved": "https://registry.npmjs.org/melody-extension-core/-/melody-extension-core-1.7.5.tgz", + "integrity": "sha512-eu/ji2sxpKvob03+1bdtuRr9XTW/VdogjHXvHiMYIK5DslpREcdGLVDEVAa1dfnnzoKGso76XCOHTJy0pImRfg==", + "dev": true, + "requires": { + "babel-template": "^6.8.0", + "babel-types": "^6.8.1", + "lodash": "^4.12.0", + "shortid": "^2.2.6" + } + }, + "melody-parser": { + "version": "1.7.5", + "resolved": "https://registry.npmjs.org/melody-parser/-/melody-parser-1.7.5.tgz", + "integrity": "sha512-ffWDWl76G3lgTQUZ3SqGY0oZeul9FrKAnV+8+j3+afrS7AjBC32w5H+Imi00+qcOgdkpoU3eWwisqKc+pQmQ8g==", + "dev": true, + "requires": { + "he": "^1.1.0", + "lodash": "^4.12.0", + "melody-code-frame": "^1.7.5" + } + }, + "melody-traverse": { + "version": "1.7.5", + "resolved": "https://registry.npmjs.org/melody-traverse/-/melody-traverse-1.7.5.tgz", + "integrity": "sha512-k9agECp5qEyIDybedgMNHPalb6wfwy5WlczJriOAn/swggeoq3+HojXSABo3uKM7K8xXNmpVhW/wOJA86oqjIQ==", + "dev": true + }, + "melody-types": { + "version": "1.7.5", + "resolved": "https://registry.npmjs.org/melody-types/-/melody-types-1.7.5.tgz", + "integrity": "sha512-KkZmYlkmHtK10Hyx0mVNBZg1OXctIzZo2w3Vyc5AOV+KLA5lRiG6Z3Lp+G8o1LD6UZY0PC83/57hw3gs2Qj+Tg==", + "dev": true, + "requires": { + "babel-types": "^6.8.1" + } + }, "merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -2873,6 +3109,12 @@ "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=" }, + "nanoid": { + "version": "2.1.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.11.tgz", + "integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA==", + "dev": true + }, "nanomatch": { "version": "1.2.13", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", @@ -3337,6 +3579,29 @@ "fast-diff": "^1.1.2" } }, + "prettier-plugin-twig-melody": { + "version": "0.4.6", + "resolved": "https://registry.npmjs.org/prettier-plugin-twig-melody/-/prettier-plugin-twig-melody-0.4.6.tgz", + "integrity": "sha512-5/sk+0efzxQ4r4hiZiWVQ6mxqaekeOIbGpwLUUtNjcKpAO4HmWsEzXpCEIdq2GjqrgjuPDlknJaa5g4B5Qx/jg==", + "dev": true, + "requires": { + "babel-types": "^6.26.0", + "melody-extension-core": "^1.7.5", + "melody-parser": "^1.7.5", + "melody-traverse": "^1.7.5", + "melody-types": "^1.7.5", + "prettier": "^1.8.2", + "resolve": "^1.12.0" + }, + "dependencies": { + "prettier": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", + "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", + "dev": true + } + } + }, "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -3432,6 +3697,12 @@ } } }, + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==", + "dev": true + }, "regex-not": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", @@ -3691,6 +3962,15 @@ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" }, + "shortid": { + "version": "2.2.16", + "resolved": "https://registry.npmjs.org/shortid/-/shortid-2.2.16.tgz", + "integrity": "sha512-Ugt+GIZqvGXCIItnsL+lvFJOiN7RYqlGy7QE41O3YC1xbNSeDGIRO7xg2JJXIAj1cAGnOeC1r7/T9pgrtQbv4g==", + "dev": true, + "requires": { + "nanoid": "^2.1.0" + } + }, "signal-exit": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", diff --git a/package.json b/package.json index d9696a6..b6eeb37 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "@studiometa/prettier-config": "^2.0.1", "@types/node": "^15.6.1", "eslint": "^7.26.0", - "prettier": "^2.3.0" + "prettier": "^2.3.0", + "prettier-plugin-twig-melody": "^0.4.6" } } diff --git a/template/web/wp-content/themes/<%= slug %>/templates/components/header.twig b/template/web/wp-content/themes/<%= slug %>/templates/components/header.twig index 94ae263..51bb41f 100644 --- a/template/web/wp-content/themes/<%= slug %>/templates/components/header.twig +++ b/template/web/wp-content/themes/<%= slug %>/templates/components/header.twig @@ -1,15 +1,11 @@

- - {{ site.name }} - + {{ site.name }}

diff --git a/template/web/wp-content/themes/<%= slug %>/templates/components/menu.twig b/template/web/wp-content/themes/<%= slug %>/templates/components/menu.twig index 040e308..54cfafe 100644 --- a/template/web/wp-content/themes/<%= slug %>/templates/components/menu.twig +++ b/template/web/wp-content/themes/<%= slug %>/templates/components/menu.twig @@ -2,12 +2,8 @@
    {% for item in menu %}
  • - - {{ item.title }} - - {% include 'components/menu.twig' with { - menu: item.children - } %} + {{ item.title }} + {% include 'components/menu.twig' with { menu: item.children } %}
  • {% endfor %}
diff --git a/template/web/wp-content/themes/<%= slug %>/templates/components/pagination.twig b/template/web/wp-content/themes/<%= slug %>/templates/components/pagination.twig index 0fe6ac5..947ae80 100644 --- a/template/web/wp-content/themes/<%= slug %>/templates/components/pagination.twig +++ b/template/web/wp-content/themes/<%= slug %>/templates/components/pagination.twig @@ -2,34 +2,23 @@ {% with posts %}