diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 0000000..69b4d96
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,188 @@
+# 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
+
+ - uses: actions/setup-node@v1
+ with:
+ node-version: 12
+ registry-url: https://registry.npmjs.org/
+
+ - 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
+ path: ./__test-project__.tar.gz
+
+ phpcs:
+ name: PHPCS
+ runs-on: ubuntu-latest
+ needs: build
+ strategy:
+ fail-fast: false
+ matrix:
+ # @todo PHP 8.0
+ php-versions: ['7.4']
+ composer-versions: ['v1', 'v2']
+ steps:
+ - uses: actions/download-artifact@v2
+ with:
+ name: test-project
+
+ - name: Extract archive
+ run: tar -xf __test-project__.tar.gz && ls -al
+
+ - name: Setup PHP, with composer and xdebug
+ uses: shivammathur/setup-php@v2 # https://github.com/shivammathur/setup-php
+ with:
+ php-version: ${{ matrix.php-versions }}
+ tools: composer:${{ matrix.composer-versions }}
+
+ - name: Get composer cache directory
+ id: composer-cache
+ run: echo "::set-output name=dir::$(composer config cache-files-dir)"
+
+ - name: Cache composer dependencies
+ uses: actions/cache@v2
+ with:
+ path: ${{ steps.composer-cache.outputs.dir }}
+ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
+ restore-keys: ${{ runner.os }}-composer-
+
+ - name: Install Composer dependencies
+ run: composer install --no-progress --prefer-dist --optimize-autoloader
+
+ - name: PHPCS
+ run: composer run phpcs
+
+ phpstan:
+ name: PHPStan
+ runs-on: ubuntu-latest
+ needs: build
+ steps:
+ - uses: actions/download-artifact@v2
+ with:
+ name: test-project
+
+ - name: Extract archive
+ run: tar -xf __test-project__.tar.gz && ls -al
+
+ - name: Setup PHP, with composer and xdebug
+ uses: shivammathur/setup-php@v2 # https://github.com/shivammathur/setup-php
+ with:
+ php-version: '7.3'
+ tools: composer:v2
+
+ - name: Get composer cache directory
+ id: composer-cache
+ run: echo "::set-output name=dir::$(composer config cache-files-dir)"
+
+ - name: Cache composer dependencies
+ uses: actions/cache@v2
+ with:
+ path: ${{ steps.composer-cache.outputs.dir }}
+ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
+ restore-keys: ${{ runner.os }}-composer-
+
+ - name: Install Composer dependencies
+ run: composer install --no-progress --prefer-dist --optimize-autoloader
+
+ - name: PHPStan
+ run: composer run phpstan
+
+ eslint:
+ name: ESLint
+ 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 lint:scripts
+
+ stylelint:
+ name: Stylelint
+ 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 lint:styles
+
+ prettier:
+ name: Twig Prettier
+ 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 lint:templates
+
+ 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
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/package-lock.json b/package-lock.json
index 9ef8b89..e513e61 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",
@@ -406,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",
@@ -420,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",
@@ -846,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",
@@ -1286,12 +1440,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",
@@ -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",
@@ -2662,9 +2842,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",
@@ -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 37f7d68..b6eeb37 100644
--- a/package.json
+++ b/package.json
@@ -35,7 +35,9 @@
"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"
+ "prettier": "^2.3.0",
+ "prettier-plugin-twig-melody": "^0.4.6"
}
}
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);
+ });
diff --git a/template/.nvmrc b/template/.nvmrc
index 8351c19..b6a7d89 100644
--- a/template/.nvmrc
+++ b/template/.nvmrc
@@ -1 +1 @@
-14
+16
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/_gitignore b/template/_gitignore
index 3d44a82..10cd236 100644
--- a/template/_gitignore
+++ b/template/_gitignore
@@ -19,6 +19,8 @@ node_modules/
# Ignore dynamic files that might be edited by WordPress
/web/.htaccess
+/web/wp-content/db.php
+/web/wp-content/advanced-cache.php
# Ignore mu-plugins, plugins and themes installed via composer
# but do not ignore custom ones for the current project
diff --git a/template/composer.json b/template/composer.json
index d432697..e784784 100644
--- a/template/composer.json
+++ b/template/composer.json
@@ -26,10 +26,10 @@
"wpackagist-plugin/seo-by-rank-math": "^1.0",
<%_ } _%>
<%_ if (acf) { _%>
- "studiometa/advanced-custom-fields-pro": "dev-master",
+ "studiometa/advanced-custom-fields-pro": "^5.9.6",
"stoutlogic/acf-builder": "^1.10",
<%_ } _%>
- "lkwdwrd/wp-muplugin-loader": "^1.0",
+ "boxuk/wp-muplugin-loader": "^1.0",
"djboris88/twig-commented-include": "^1.2",
"studiometa/twig-toolkit": "^1.0"
},
@@ -38,7 +38,7 @@
"squizlabs/php_codesniffer": "^3.4",
"wp-coding-standards/wpcs": "^2.1",
"wp-cli/wp-cli-bundle": "^2.2",
- "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0",
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
"phpstan/phpstan": "^0.12.50",
"szepeviktor/phpstan-wordpress": "^0.7.5",
"satesh/phpcs-gitlab-report": "^1.0"
@@ -47,14 +47,6 @@
{
"type": "composer",
"url": "https://wpackagist.org"
- },
- {
- "type": "vcs",
- "url": "https://github.com/tabrisrp/wp-background-processing"
- },
- {
- "type": "vcs",
- "url": "https://github.com/studiometa/wp-assets"
}
],
"scripts": {
diff --git a/template/package.json b/template/package.json
index e3fe7aa..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",
@@ -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",
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 @@