From e10c5448540959e98a8cfdd0982b8da163ef151a Mon Sep 17 00:00:00 2001 From: Jeremy Date: Thu, 23 Apr 2026 16:41:43 -0700 Subject: [PATCH] Bumping up all of the min versions of everything. Updting the intial guides with the latest information. Fixed bug with the setup script running bun before Lucky bake was ready --- script/setup.cr | 10 +- shard.lock | 18 ++-- shard.yml | 2 +- .../guides/getting-started/concepts.cr | 2 +- .../guides/getting-started/installing.cr | 12 +-- .../getting-started/starting_project.cr | 100 ++---------------- src/models/lucky_cli_version.cr | 6 +- src/models/lucky_dependency_versions.cr | 8 +- 8 files changed, 40 insertions(+), 118 deletions(-) diff --git a/script/setup.cr b/script/setup.cr index 14c02a64..de73fe55 100644 --- a/script/setup.cr +++ b/script/setup.cr @@ -6,17 +6,19 @@ require "./system_check" print_done +notice "Installing shards" +run_command "shards", "install" + +print_done + notice "Installing JS dependencies" -run_command "bun", "install" +run_command "bun", "install", "--no-progress" notice "Compiling assets" run_command "bun", "run", "build" print_done -notice "Installing shards" -run_command "shards", "install" - if !File.exists?(".env") notice "No .env found. Creating one." File.touch ".env" diff --git a/shard.lock b/shard.lock index 9c442560..55eed0f0 100644 --- a/shard.lock +++ b/shard.lock @@ -18,7 +18,7 @@ shards: cadmium_transliterator: git: https://github.com/cadmiumcr/transliterator.git - version: 0.1.0+git.commit.46c4c14594057dbcfaf27e7e7c8c164d3f0ce3f1 + version: 0.1.0+git.commit.0dcedb98cbac7dd5827f204a0714b62f25c6515a carbon: git: https://github.com/luckyframework/carbon.git @@ -48,17 +48,13 @@ shards: git: https://github.com/crystal-loot/exception_page.git version: 0.5.0 - fnv: - git: https://github.com/naqvis/crystal-fnv.git - version: 0.1.3 - habitat: git: https://github.com/luckyframework/habitat.git version: 0.4.9 html5: git: https://github.com/naqvis/crystal-html5.git - version: 0.5.0 + version: 0.5.1 lexbor: git: https://github.com/kostya/lexbor.git @@ -66,7 +62,7 @@ shards: lucky: git: https://github.com/luckyframework/lucky.git - version: 1.4.0+git.commit.93e9d9e32a5bd68c2219bf470f87b5977653dc3a + version: 1.5.0 lucky_cache: git: https://github.com/luckyframework/lucky_cache.git @@ -78,7 +74,7 @@ shards: lucky_flow: git: https://github.com/luckyframework/lucky_flow.git - version: 0.10.0 + version: 0.10.2 lucky_router: git: https://github.com/luckyframework/lucky_router.git @@ -114,11 +110,11 @@ shards: webdrivers: git: https://github.com/crystal-loot/webdrivers.cr.git - version: 0.4.4 + version: 0.4.5 webless: git: https://github.com/crystal-loot/webless.git - version: 0.1.0 + version: 0.2.0 wordsmith: git: https://github.com/luckyframework/wordsmith.git @@ -126,5 +122,5 @@ shards: xpath2: git: https://github.com/naqvis/crystal-xpath2.git - version: 0.1.3 + version: 0.2.0 diff --git a/shard.yml b/shard.yml index 4a11c063..3b954f6c 100644 --- a/shard.yml +++ b/shard.yml @@ -13,7 +13,7 @@ crystal: ">= 1.10.0" dependencies: lucky: github: luckyframework/lucky - branch: main + version: ~> 1.5.0 carbon: github: luckyframework/carbon version: ~> 0.6.0 diff --git a/src/actions/guides/getting-started/concepts.cr b/src/actions/guides/getting-started/concepts.cr index 8099819f..57765b8b 100644 --- a/src/actions/guides/getting-started/concepts.cr +++ b/src/actions/guides/getting-started/concepts.cr @@ -71,7 +71,7 @@ class Guides::GettingStarted::Concepts < GuideAction ### `script` folder - This folder contains a setup script for bootstrapping your app by default. Place any other bash style scripts or executables you may need for your app in here. + This folder contains a setup script for bootstrapping your app by default. Place any other scripts or executables you may need for your app in here. ### `spec` folder diff --git a/src/actions/guides/getting-started/installing.cr b/src/actions/guides/getting-started/installing.cr index e404966f..cbcac42b 100644 --- a/src/actions/guides/getting-started/installing.cr +++ b/src/actions/guides/getting-started/installing.cr @@ -272,7 +272,7 @@ class Guides::GettingStarted::Installing < GuideAction psql --version ``` - Should return `psql (PostgreSQL) 10.x` or higher. + Should return `psql (PostgreSQL) #{LuckyDependencyVersions.min_compatible_postgres_version}` or higher. ### 3. Create a database user and set a password @@ -319,23 +319,21 @@ class Guides::GettingStarted::Installing < GuideAction ``` #{permalink(ANCHOR_NODE)} - ## Node and Yarn (optional) + ## Bun (optional) > You can skip this if you only plan to build APIs. ### 1. Install - * [Node](https://nodejs.org/en/download/). Requires at least v11 - * [Yarn](https://yarnpkg.com/lang/en/docs/install/) + * [Bun](https://bun.sh). Requires at least #{LuckyDependencyVersions.min_compatible_bun_version} ### 2. Check installation ```bash - node -v - yarn -v + bun -v ``` - Node should return greater than v11. Yarn should return greater than 1.x. + Bun should return at least #{LuckyDependencyVersions.min_compatible_bun_version}. ## Chrome Browser (optional) diff --git a/src/actions/guides/getting-started/starting_project.cr b/src/actions/guides/getting-started/starting_project.cr index a9a2af70..c716e971 100644 --- a/src/actions/guides/getting-started/starting_project.cr +++ b/src/actions/guides/getting-started/starting_project.cr @@ -61,30 +61,26 @@ class Guides::GettingStarted::StartingProject < GuideAction To start the server and run your project, * first change into the directory for your newly created app with `cd {project_name}`. * Next, you may need to update your database settings in `config/database.cr`. - * Then run `script/setup` to install dependencies + * Then run `crystal script/setup.cr` to install dependencies * and finally `lucky dev` to start the server. - Running `lucky dev` will use an installed process manager (Overmind, Foreman, - etc.) to start the processes defined in `Procfile.dev`. By default + Running `lucky dev` will use an built-in process manager [Nox](https://github.com/crystal-loot/nox) + to start the processes defined in `Procfile.dev`. By default `Procfile.dev` will start the lucky server, start asset compilation (browser app only), and run a [system check](##{ANCHOR_SYSTEM_CHECK}). - > Lucky will look for a number of process managers. So if you prefer Forego - and someone else on your team prefers to use Overmind, `lucky dev` will work - for both of you. - ## Script Helpers Your new Lucky project comes with a few helper scripts located in the `script/` folder. ### Setup script - The first script you will use is the `script/setup`. You should run this after you + The first script you will use is the `script/setup.cr`. You should run this after you first create your project. It will do a few things for you. * Run a [system check](##{ANCHOR_SYSTEM_CHECK}) script first. - * Install Javascript dependencies. (browser app only) * Install Crystal dependencies. + * Install Javascript dependencies. (browser app only) * Add a `.env` file if you don't already have one. * Create your database. (Note: the configuration settings are in `config/database.cr`) * Verify the connection to your database. @@ -94,97 +90,23 @@ class Guides::GettingStarted::StartingProject < GuideAction #{permalink(ANCHOR_SYSTEM_CHECK)} ### System check script - The `script/system_check` script is called when you run `script/setup`. It is also called every + The `script/system_check.cr` script is called when you run `crystal script/setup.cr`. It is also called every time you run `lucky dev` because Lucky defines a `system_check` process in your `Procfile.dev`. The purpose of this script is to check that your system has everything it needs in order to run this application for local development. By default we check these things: - * Ensure `yarn` is installed. (browser apps only) - * Ensure you have a process manager (Overmind, Foreman, etc.) + * Ensure `bun` is installed. (browser apps only) * Check that postgres client tools are installed. You can also extend this script to include checks for additional systems you may need. (i.e. redis, elasticsearch, etc.). - ## Bash function helpers - - Located in `script/helpers/function_helpers` is a set of Bash functions used for writing a few - simple checks for your Lucky app. - - ### The `command_not_found` function - - return `true` if the command passed to it is not found. - - ```bash - if command_not_found "yarn"; then - echo "Yarn is not installed" - fi - ``` - - ### The `command_not_running` function - - return `true` if the command passed to it is not currently running. - - ```bash - if command_not_running "redis-cli ping"; then - echo "Redis is not running" - fi - ``` - - ### The `is_mac` function - - return `true` if you run this script on macOS. - - ```bash - if is_mac; then - echo "Running on macOS" - fi - ``` - - ### The `is_linux` function - - return `true` if you run this script on linux. - - ```bash - if is_linux; then - echo "Running on Linux" - fi - ``` - - > There are a lot of Linux flavors out there. This should catch the most common ones at least. - - ### The `print_error` function + ## Function helpers - print your custom error message and exit to allow for stopping your process manager. - - ```bash - print_error "Redis is not running. Be sure to start it with 'brew services start redis'" - ``` - - ### Full example - - You can use a combination of these functions to remind you of which services you need - running every time you start your application for local development. For example, - if your app uses background job processing, and you need redis running for that to work, - then you could add this to your `script/system_check`. - - ```bash - if command_not_found "redis-cli"; then - print_error "Redis is required, and must be installed" - fi - - if command_not_running "redis-cli ping"; then - if is_mac; then - booting_guide = "brew services start redis" - fi - if is_linux; then - booting_guide = "sudo systemctl start redis-server" - fi - - print_error "Redis is not currently running. Try using " $booting_guide - fi - ``` + Located in `script/helpers/function_helpers.cr` is a set of functions used for writing a few + simple checks for your Lucky app. These are just helper methods you can use to streamline your + setup. These are not required by Lucky, so you are free to alter these as you need. MD end end diff --git a/src/models/lucky_cli_version.cr b/src/models/lucky_cli_version.cr index e86076b4..76eb65f9 100644 --- a/src/models/lucky_cli_version.cr +++ b/src/models/lucky_cli_version.cr @@ -8,14 +8,14 @@ module LuckyCliVersion end def current_version : SemanticVersion - SemanticVersion.new(1, 4, 1) + SemanticVersion.new(1, 5, 0) end def min_compatible_crystal_version : SemanticVersion - SemanticVersion.new(1, 10, 0) + SemanticVersion.new(1, 16, 0) end def max_compatible_crystal_version : SemanticVersion - SemanticVersion.new(1, 16, 3) + SemanticVersion.new(1, 20, 0) end end diff --git a/src/models/lucky_dependency_versions.cr b/src/models/lucky_dependency_versions.cr index 12cc0895..1a0a7bae 100644 --- a/src/models/lucky_dependency_versions.cr +++ b/src/models/lucky_dependency_versions.cr @@ -4,10 +4,14 @@ module LuckyDependencyVersions extend self def min_compatible_postgres_version - SemanticVersion.new(12, 12, 0) + SemanticVersion.new(14, 0, 0) end def min_compatible_node_version - SemanticVersion.new(16, 5, 0) + SemanticVersion.new(20, 20, 2) + end + + def min_compatible_bun_version + SemanticVersion.new(1, 3, 0) end end