Releases: vapor/toolbox
Allow dynamic file names in template manifest
This patch was authored by @s-k and released by @0xTim.
By adding dynamic_name
parameters to files or folders in manifest.yml, their names in the created package can depend on variables or the name of the new package.
Example:
- folder: xcschemes
files:
- file: Server.xcscheme
dynamic_name: "{{name}}.xcscheme"
In this case, the original name of the file in the template repository is 'Server.xscheme'. In the created package, its name will be '[Package Name].xscheme'. The dynamic file name may also depend on variables defined in manifest.yml.
Allow not adding a Git repo when creating a new project
This patch was authored by @s-k and released by @0xTim.
This change allows users to create a project without automatically creating a Git repository in the new folder. This can be helpful when creating the project inside another project already using Git.
To use the new feature, add --no-git
to the vapor new
command.
Remove backslash from Procfile created by `vapor heroku init`
This patch was authored by @e28eta and released by @0xTim.
Running vapor heroku init
, and choosing to use the buildpack (vs docker), creates a Procfile with the following:
web: Run serve --env production --hostname 0.0.0.0 --port \$PORT
This works okay when deployed to heroku (note the --port \4386
):
2022-03-08T07:07:33.775125+00:00 heroku[web.1]: Starting process with command `Run serve --env production --hostname 0.0.0.0 --port \4386`
2022-03-08T07:07:35.820116+00:00 app[web.1]: [ NOTICE ] Server starting on http://0.0.0.0:4386
However, it doesn't work when using the heroku local
command:
$ heroku local
10:54:26 PM web.1 | [1/1] Planning build
10:54:31 PM web.1 | [0/0] Build complete!
10:54:31 PM web.1 | [ WARNING ] Could not convert option for `port` to Int
10:54:31 PM web.1 | Swift/ErrorType.swift:200: Fatal error: Error raised at top level: .invalidOptionType("port", type: Int)
[DONE] Killing all processes with signal SIGILL
10:54:31 PM web.1 Exited with exit code SIGILL
This PR removes the backslash. The new Procfile contents are simply:
web: Run serve --env production --hostname 0.0.0.0 --port $PORT
I've verified this works with heroku remote & local.
2022-03-08T07:18:31.543631+00:00 heroku[web.1]: Starting process with command `Run serve --env production --hostname 0.0.0.0 --port 32664`
2022-03-08T07:18:32.671361+00:00 app[web.1]: [ NOTICE ] Server starting on http://0.0.0.0:32664
2022-03-08T07:18:33.310530+00:00 heroku[web.1]: State changed from starting to up
2022-03-08T07:19:57.000000+00:00 app[api]: Build succeeded
18.3.5
What's Changed
- Changing info screen to instruct user to open Package.swift by @dannflor in #372
- Removed deprecated --enable-test-discovery flag from build and run commands by @Ventus218 in #373
New Contributors
- @dannflor made their first contribution in #372
- @Ventus218 made their first contribution in #373
Full Changelog: 18.3.4...18.3.5
Improve the messaging for the version command
This patch was authored by @BennyDeBock and released by @0xTim.
When using vapor --version, the output in a non vapor directory would be
# note: no Package.resolved was found.
# framework: not found
# toolbox: 18.3.3
This pr changes those framework and note texts to:
# note: no Package.resolved file was found. Possibly not currently in a Swift package directory
# framework: vapor framework for this project: no Package.resolved file found. Please ensure you are in a Vapor project directory. If you are, ensure you have built the project with 'swift build'. You can create a new project with 'vapor new MyProject'
in projects that have no Package.resolved.
in projects that do have a Package.resolved but that aren't Vapor projects it changes the framework text to:
# framework: vapor framework for this project: this Swift project does not depend on Vapor. Please ensure you are in a Vapor project directory. If you are, ensure you have built the project with 'swift build'. You can create a new project with 'vapor new MyProject'
closes #345
Add Kebab case support to TemplateScaffolder context
This patch was authored by @marzvrover and released by @0xTim.
This adds support for kebab_names
in templates to avoid issues where certain contexts require lowercase variables (such as Docker compose).
Fixes #334
Fix default branch name
Renames the branch used from master
to main
#356
Don't try to build the app when using only the `-h` or `--help` flags on the `run` command
This patch was authored by @tkrajacic and released by @0xTim.
Also add an explanatory line to the output with the equivalent swift package manager command.
Fixes #341
Add better support for --feature and --no-feature
In the past, "positive" options passed to vapor new
, such as --fluent
, would only work if the type of the variable in the manifest.yml
corresponding to the option was nested
. This update adds the following capabilities:
- Variables of type
bool
will now recognize positive option flags as well, and will no longer throw an error. - Both
bool
andnested
variables now also recognize an inverted "negative" option flag, e.g.--no-fluent
. A negative option flag has the same effect on a single variable that--no
has on all of them. bool
variables are now correctly handled by theif:
condition in amanifest.yml
, rather than acting as if they're alwaystrue
.
Not all of these changes are immediately visible in the toolbox by itself, but when combined with updates to vapor/template, it is now possible to request relatively complex configurations for a new Vapor project with no user interaction required at all. Some examples:
$ vapor new test_simple --no-fluent --no-leaf
Cloning template...
name: test_simple
fluent: No
leaf: No
Generating project files
$ vapor new test_with_db --fluent.db postgres --no-leaf
Cloning template...
name: test_with_db
fluent: Yes
db: Postgres
leaf: No
Generating project files
$ vapor new test_with_leaf --no-fluent --leaf
Cloning template...
name: test_with_leaf
fluent: No
leaf: Yes
Generating project files
$ vapor new test_with_everything --fluent.db sqlite --leaf
Cloning template...
name: test_with_everything
fluent: Yes
db: SQLite
leaf: Yes
Generating project files
Add Makefile + optional static version
This patch was authored and released by @tanner0101.
Adds a Makefile with build
, install
, and uninstall
commands (#340, #339, fixes #338)
Using make build
will attempt to infer the current toolbox version number and compile it into the executable for lookup via --version
.
Sample output:
$ vapor --version
framework: 4.27.1
toolbox: master (90e3d12)