From 09d266460d3bfe6e75787801da97f24742421a09 Mon Sep 17 00:00:00 2001 From: GoodM4ven Date: Mon, 2 Oct 2023 08:13:08 +0300 Subject: [PATCH] v2.2.0 - Fixed Livewire Hot-Reload Vite plugin - Updated [README.md] - Added a TODO to install Lunar TALL package as an option - Fixed a consistency global JS variable naming for AutoAnimate - Set Graphite to install during setup script - Removed NPM to rely solely on NVM - Updated Prettier's preferences - Updated VSC extensions list - Updated VSC keybindings - Updated VSC settings --- README.md | 5 +- files/.opinionated/.prettierrc | 1 + files/.opinionated/extensions.md | 5 +- files/.opinionated/keybindings.json | 60 +++++++------------ files/.opinionated/settings.json | 37 ++++++++---- files/_stubs/tall/resources/js/app.js | 6 +- .../resources/js/core/livewire-hot-reload.js | 4 +- .../resources/js/packages/auto-animate.js | 2 +- files/_stubs/tall/vite.config.js | 30 +++------- files/vite.config.js | 4 +- scripts/create.sh | 3 +- scripts/setup.sh | 11 ++-- 12 files changed, 78 insertions(+), 90 deletions(-) diff --git a/README.md b/README.md index 57a5d68..ebbca59 100755 --- a/README.md +++ b/README.md @@ -27,7 +27,6 @@ This way, I don't have to worry about the things I've mentioned, plus I gain the - [php](https://www.php.net/) - [apache2](https://httpd.apache.org/) - [composer](https://getcomposer.org/) - - [npm](https://nodejs.org/en/download/package-manager) - [nvm](https://github.com/nvm-sh/nvm) - [libnss3-tools](https://packages.ubuntu.com/focal/libnss3-tools) - [libgbm-dev](https://packages.debian.org/sid/libgbm-dev) @@ -126,6 +125,7 @@ This way, I don't have to worry about the things I've mentioned, plus I gain the - [tailwindcss](https://tailwindcss.com/) [Dev] - [postcss](https://github.com/postcss/postcss) [Dev] - [autoprefixer](https://github.com/postcss/autoprefixer) [Dev] + - [@formkit/auto-animate](https://github.com/formkit/auto-animate) [Dev] - [@tailwindcss/typography](https://tailwindcss.com/docs/typography-plugin) [Dev] - [@tailwindcss/forms](https://github.com/tailwindlabs/tailwindcss-forms) [Dev] - [@tailwindcss/aspect-ratio](https://github.com/tailwindlabs/tailwindcss-aspect-ratio) [Dev] @@ -141,7 +141,7 @@ This way, I don't have to worry about the things I've mentioned, plus I gain the - [@alpinejs/morph](https://alpinejs.dev/plugins/morph) - [@ryangjchandler/alpine-hooks](https://github.com/ryangjchandler/alpine-hooks) - [@ralphjsmit/alpine-animate](https://github.com/ralphjsmit/alpine-animate) - - [@defstudio/vite-livewire-plugin](https://github.com/defstudio/vite-livewire-plugin) [Dev] (Disabled again until a fix!) + - [@defstudio/vite-livewire-plugin](https://github.com/defstudio/vite-livewire-plugin) [Dev] - [alpinejs-breakpoints](https://github.com/wrsdesign/alpinejs-breakpoints) [Dev] - [tailwind-easing](https://github.com/wrsdesign/tailwind-easing) [Dev] @@ -183,6 +183,7 @@ That's it. You'll have your first project accessible in the end (displaying the ## Todos For Development: +- [ ] Add an option to install Lunar framework TALL packege - [ ] Consider `phpredis` extension instead of `predis` for both setup and creation scripts - [ ] Turn the main skeleton scripter into a NativePHP app - [ ] Selective installation process as a self-deleting Composer package diff --git a/files/.opinionated/.prettierrc b/files/.opinionated/.prettierrc index c7bae8b..fe867a8 100644 --- a/files/.opinionated/.prettierrc +++ b/files/.opinionated/.prettierrc @@ -1,4 +1,5 @@ { + "printWidth": 130, "proseWrap": "always", "singleQuote": true, "tabWidth": 4 diff --git a/files/.opinionated/extensions.md b/files/.opinionated/extensions.md index f269827..e1cf13c 100755 --- a/files/.opinionated/extensions.md +++ b/files/.opinionated/extensions.md @@ -29,6 +29,7 @@ - [ctf0.laravel-goto-config](https://github.com/ctf0/laravel-goto-config) [Not on VSX yet] - [ctf0.laravel-goto-env](https://github.com/ctf0/laravel-goto-env) [Not on VSX yet] - [ctf0.laravel-goto-lang](https://github.com/ctf0/laravel-goto-lang) [Not on VSX yet] +- [ctf0.laravel-goto-path](https://github.com/ctf0/laravel-goto-path) [Not on VSX yet] - [ctf0.laravel-goto-view](https://github.com/ctf0/laravel-goto-view) [Not on VSX yet] - [naoray.laravel-goto-components](https://github.com/Naoray/laravel-goto-components) [Not on VSX yet] - [austenc.livewire-docs](https://github.com/austenc/vscode-livewire-docs) [Not on VSX yet] @@ -47,7 +48,7 @@ - [jeff-hykin.polacode-2019](https://github.com/jeff-hykin/polacode) [Not on VSX yet] - [csstools.postcss](https://github.com/csstools/postcss-language) - [esbenp.prettier-vscode](https://github.com/prettier/prettier-vscode) -- [sainoba.px-to-rem](https://github.com/sainoba/vscode-px-to-rem) [Not on VSX yet] +- [sainoba.px-to-rem](https://github.com/sainoba/vscode-px-to-rem) - [dbankier.vscode-quick-select](https://github.com/dbankier/vscode-quick-select) [Not on VSX yet] - [jock.svg](https://github.com/lishu/vscode-svg2) - [albert.TabOut](https://github.com/albertromkes/tabout) @@ -56,4 +57,4 @@ - [bourhaouta.tailwindshades](https://github.com/bourhaouta/vscode-tailwindshades) [Not on VSX yet] - [jkjustjoshing.vscode-text-pastry](https://github.com/jkjustjoshing/vscode-text-pastry) [Not on VSX yet] - [Gruntfuggly.todo-tree](https://github.com/Gruntfuggly/todo-tree) -- [hideoo.trailing](https://github.com/HiDeoo/trailing) +- [hideoo.trailing](https://github.com/HiDeoo/trailing) \ No newline at end of file diff --git a/files/.opinionated/keybindings.json b/files/.opinionated/keybindings.json index f070c5c..dfca357 100755 --- a/files/.opinionated/keybindings.json +++ b/files/.opinionated/keybindings.json @@ -356,6 +356,16 @@ "command": "-scm.acceptInput", "when": "scmRepository" }, + { + "key": "ctrl+k m", + "command": "-workbench.action.editor.changeLanguageMode", + "when": "!notebookEditorFocused" + }, + { + "key": "ctrl+shift+alt+l", + "command": "workbench.action.editor.changeLanguageMode", + "when": "!notebookEditorFocused" + }, // * =========== // * Extensions // * ========= @@ -390,6 +400,14 @@ "key": "ctrl+shift+meta+c", "command": "foldersCompare.compareFoldersAgainstEachOther" }, + { + "key": "alt+5", + "command": "-workbench.action.openEditorAtIndex5" + }, + { + "key": "alt+5", + "command": "workbench.view.extension.foldersCompare" + }, // [Polacode] { "key": "ctrl+alt+p", @@ -596,51 +614,13 @@ "key": "ctrl+alt+g", "command": "namespaceResolver.generateNamespace" }, - // [PHP Resolver] - { - "key": "ctrl+alt+a", - "command": "-phpResolver.importAll", - "when": "editorTextFocus" - }, - { - "key": "ctrl+alt+i", - "command": "-phpResolver.import", - "when": "editorTextFocus" - }, - { - "key": "ctrl+alt+n", - "command": "-phpResolver.highlightNotImported", - "when": "editorTextFocus" - }, { "key": "ctrl+alt+e", - "command": "-phpResolver.expand", - "when": "editorTextFocus" - }, - { - "key": "ctrl+alt+u", - "command": "-phpResolver.highlightNotUsed", - "when": "editorTextFocus" - }, - { - "key": "ctrl+alt+s", - "command": "-phpResolver.sort", + "command": "-namespaceResolver.expand", "when": "editorTextFocus" }, - { - "key": "ctrl+alt+g", - "command": "-phpResolver.generateNamespace" - }, { "key": "ctrl+alt+e", - "command": "phpResolver.expand" - }, - { - "key": "alt+5", - "command": "-workbench.action.openEditorAtIndex5" + "command": "namespaceResolver.expand" }, - { - "key": "alt+5", - "command": "workbench.view.extension.foldersCompare" - } ] diff --git a/files/.opinionated/settings.json b/files/.opinionated/settings.json index 1c8cf84..500c3d3 100755 --- a/files/.opinionated/settings.json +++ b/files/.opinionated/settings.json @@ -24,10 +24,12 @@ "explorer.confirmDelete": false, "diffEditor.ignoreTrimWhitespace": false, "workbench.localHistory.maxFileEntries": 500, - "files.exclude": { - "**/.git": true, - "**/storage/framework/**": true - }, + // "files.exclude": { + // "**/.git": true, + // "**/node_modules": true, + // "**/vendor": true, + // }, + "editor.codeLens": false, "javascript.updateImportsOnFileMove.enabled": "always", // * Format "editor.wordWrap": "wordWrapColumn", @@ -61,7 +63,12 @@ "todo-tree.tree.showBadges": true, "todo-tree.tree.showCountsInTree": true, "todo-tree.general.tags": ["BUG", "HACK", "TODO", "[ ]"], - "todo-tree.filtering.excludeGlobs": ["**/node_modules", "**/vendor"], + "todo-tree.filtering.excludeGlobs": [ + "**/node_modules", + "**/vendor" + ], + // [Behavior - Compare Folders] + "diffEditor.maxComputationTime": 0, // [INTEL - shell-format] "[shellscript]": { "editor.defaultFormatter": "foxundermoon.shell-format" @@ -81,7 +88,7 @@ }, // [Format - Laravel Blade formatter] "[blade]": { - "editor.defaultFormatter": "shufo.vscode-blade-formatter" + "editor.defaultFormatter": "shufo.vscode-blade-formatter", }, "bladeFormatter.format.noMultipleEmptyLines": true, "bladeFormatter.format.wrapAttributes": "force-expand-multiline", @@ -92,7 +99,15 @@ // [Format - Prettier - Code formatter] "editor.defaultFormatter": "esbenp.prettier-vscode", "prettier.requireConfig": true, + // [INTEL - PHP Intelephense] + // ! Disable @builtin php > PHP Language Features + // ! Enter your Intelephense licence key in your application's [settings.json] (not workspace, not the user) + "intelephense.telemetry.enabled": false, // [INTEL - Tailwind CSS IntelliSense] + "files.associations": { + "*.module": "php", + "*.css": "tailwindcss" + }, "tailwindCSS.classAttributes": [ "class", "x-transition:enter", @@ -102,10 +117,12 @@ "x-transition:leave-start", "x-transition:leave-end" ], + "tailwindCSS.experimental.classRegex": [ + ["(?:@class|\\$attributes->class)\\(\\[?([^\\]]*)\\]?\\)", "'([^']*)'"], + ["(?:@twMerge|\\$attributes->twMerge)\\(\"([^\"]*)\",?[^)]*\\)", "'([^']*)'"], + ["twMerge\\(\\[?([^\\]]*)\\]?\\)", "'([^']*)'"], + ["TailwindMerge::merge\\(\\[?([^\\]]*)\\]?\\)", "'([^']*)'"] + ], // // [INTEL - Alpine.js IntelliSense] // "alpine-intellisense.settings.languageScopes": "blade", // TODO uncomment when intel shows within elements only - // [INTEL - PHP Intelephense] - // ! Disable @builtin php > PHP Language Features - // ! Enter your Intelephense licence key in your application's [settings.json] (not workspace, not the user) - "intelephense.telemetry.enabled": false } diff --git a/files/_stubs/tall/resources/js/app.js b/files/_stubs/tall/resources/js/app.js index eddfe1a..30bae13 100755 --- a/files/_stubs/tall/resources/js/app.js +++ b/files/_stubs/tall/resources/js/app.js @@ -1,6 +1,5 @@ +import './core/livewire-hot-reload'; import './core/alpine-livewire'; -// TODO reimplement after livewire v3 fix -// import './core/livewire-hot-reload'; // import './core/echo'; import './packages/alpine-animate'; @@ -14,6 +13,3 @@ import './data/colors-manager'; import './bindings/breakpointer'; Livewire.start(); - -// TODO reimplement after livewire v3 fix -// LivewireHotReload(); diff --git a/files/_stubs/tall/resources/js/core/livewire-hot-reload.js b/files/_stubs/tall/resources/js/core/livewire-hot-reload.js index 318bd98..9e201d0 100755 --- a/files/_stubs/tall/resources/js/core/livewire-hot-reload.js +++ b/files/_stubs/tall/resources/js/core/livewire-hot-reload.js @@ -1,3 +1,3 @@ -import { livewire_hot_reload } from 'virtual:livewire-hot-reload'; +import {livewire_hot_reload} from 'virtual:livewire-hot-reload'; -window.LivewireHotReload = livewire_hot_reload; +livewire_hot_reload(); diff --git a/files/_stubs/tall/resources/js/packages/auto-animate.js b/files/_stubs/tall/resources/js/packages/auto-animate.js index 0648b13..9d467fd 100644 --- a/files/_stubs/tall/resources/js/packages/auto-animate.js +++ b/files/_stubs/tall/resources/js/packages/auto-animate.js @@ -1,3 +1,3 @@ import autoAnimate from '@formkit/auto-animate'; -window.autoAnimate = autoAnimate; +window.AutoAnimate = autoAnimate; diff --git a/files/_stubs/tall/vite.config.js b/files/_stubs/tall/vite.config.js index e38d424..f9e4caa 100644 --- a/files/_stubs/tall/vite.config.js +++ b/files/_stubs/tall/vite.config.js @@ -1,9 +1,9 @@ import path from "path"; import { defineConfig } from 'vite'; import laravel from 'laravel-vite-plugin'; -// TODO reimplement after livewire v3 fix -// import livewire from '@defstudio/vite-livewire-plugin'; +import livewire from '@defstudio/vite-livewire-plugin'; +const host = ".test"; const certPath = path.resolve(__dirname, "./certs/.test.pem"); const keyPath = path.resolve(__dirname, "./certs/.test-key.pem"); @@ -15,7 +15,11 @@ export default defineConfig({ 'resources/css/filament/admin/theme.css', 'resources/js/app.js', ], - refresh: [ + refresh: false, + }), + livewire({ + refresh: ['resources/css/app.css'], + watch: [ "app/Filament/**/*.php", "app/Forms/**/*.php", "app/Infolists/**/*.php", @@ -24,33 +28,17 @@ export default defineConfig({ "app/Tables/**/*.php", "app/View/Components/**/*.php", "lang/**", - "resources/views/**/*.blade.php", "resources/lang/**", "routes/**", ], }), - // livewire({ - // refresh: ['resources/css/app.css'], - // watch: [ - // "app/Filament/**/*.php", - // "app/Forms/**/*.php", - // "app/Infolists/**/*.php", - // "app/Livewire/**/*.php", - // "app/Providers/Filament/**/*.php", - // "app/Tables/**/*.php", - // "app/View/Components/**/*.php", - // "lang/**", - // "resources/views/**/*.blade.php", - // "resources/lang/**", - // "routes/**", - // ], - // }), ], server: { + host, + hmr: { host }, https: { cert: certPath, key: keyPath, }, - host: ".test", }, }); diff --git a/files/vite.config.js b/files/vite.config.js index 103f0de..39a4bc3 100644 --- a/files/vite.config.js +++ b/files/vite.config.js @@ -2,6 +2,7 @@ import path from "path"; import { defineConfig } from 'vite'; import laravel, { refreshPaths } from 'laravel-vite-plugin'; +const host = ".test"; const certPath = path.resolve(__dirname, "./certs/.test.pem"); const keyPath = path.resolve(__dirname, "./certs/.test-key.pem"); @@ -18,10 +19,11 @@ export default defineConfig({ }), ], server: { + host, + hmr: { host }, https: { cert: certPath, key: keyPath, }, - host: ".test", }, }); diff --git a/scripts/create.sh b/scripts/create.sh index 8572d61..f5ad857 100755 --- a/scripts/create.sh +++ b/scripts/create.sh @@ -835,8 +835,7 @@ use App\\Http\\Controllers\\LoginRedirect;\ sed -i "s~~$escaped_project_name~g" ./vite.config.js - # TODO Uncomment once fixed - # echo -e "\nConfigured Livewire Hot-Reload watcher." >&3 + echo -e "\nConfigured Livewire Hot-Reload watcher." >&3 # Blurred Image package php artisan blurred-image:install $conditional_quiet diff --git a/scripts/setup.sh b/scripts/setup.sh index ad7327e..3be2465 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -82,7 +82,7 @@ esac # git, php, apache2, redis and npm echo -e "Installing system packages..." >&3 -sudo apt install git curl php apache2 php-curl php-xml php-dom php-bcmath php-zip redis-server npm -y +sudo apt install git curl php apache2 php-curl php-xml php-dom php-bcmath php-zip redis-server -y sudo sed -i "s~post_max_size = 8M~post_max_size = 100M~g" /etc/php/8.1/apache2/php.ini sudo sed -i "s~upload_max_filesize = 2M~upload_max_filesize = 100M~g" /etc/php/8.1/apache2/php.ini @@ -132,15 +132,18 @@ sudo apt install libgbm-dev libnotify-dev libgconf-2-4 xvfb -y # NodeJS Upgrades echo -e "\nInstalling NVM to support installing custom NodeJS and NPM versions..." >&3 +# ? Check without: npm install -g npm@9.8.1 sudo -i -u $USERNAME bash <&3