From c1c1d9d1ad393288dcfbac6a927c0130602c7af1 Mon Sep 17 00:00:00 2001 From: ctron Date: Mon, 14 Oct 2024 12:10:35 +0000 Subject: [PATCH] deploy: 403c96af8843b7a0a943afb9b9a4327fa3b9701b --- assets/index.html | 12 ++ configuration/index.html | 142 +++++++++++-- guide/.nojekyll | 1 - guide/404.html | 5 +- guide/advanced/index.html | 8 +- guide/advanced/initializer.html | 8 +- guide/advanced/javascript_interop.html | 8 +- guide/advanced/library.html | 8 +- guide/advanced/paths.html | 12 +- guide/advanced/proxy.html | 272 ++++++++++++++++++++++++ guide/advanced/startup_event.html | 8 +- guide/assets/index.html | 24 ++- guide/assets/minification.html | 8 +- guide/assets/sri.html | 8 +- guide/build/hooks.html | 20 +- guide/commands/index.html | 8 +- guide/configuration/index.html | 121 ++++++++--- guide/configuration/schema.html | 256 ++++++++++++++++++++++ guide/contributing.html | 12 +- guide/getting-started/index.html | 8 +- guide/getting-started/installation.html | 8 +- guide/getting-started/pre-reqs.html | 8 +- guide/getting-started/project.html | 8 +- guide/index.html | 8 +- guide/introduction.html | 8 +- guide/print.html | 194 ++++++++++++++--- guide/searchindex.js | 2 +- guide/searchindex.json | 2 +- guide/theme/pagetoc.css | 8 +- search_index.en.js | 2 +- 30 files changed, 1084 insertions(+), 113 deletions(-) delete mode 100644 guide/.nojekyll create mode 100644 guide/advanced/proxy.html create mode 100644 guide/configuration/schema.html diff --git a/assets/index.html b/assets/index.html index 47ced5ac..a06ee6c9 100644 --- a/assets/index.html +++ b/assets/index.html @@ -155,6 +155,10 @@ - Hook Environment & Execution +
+ - OS-specific overrides +
+
@@ -334,6 +338,14 @@

Hook Environment & Execution

  • TRUNK_DIST_DIR: the full path of the Trunk dist directory.
  • TRUNK_PUBLIC_URL: the configured public URL for Trunk.
  • +

    OS-specific overrides

    +

    Often times you will want to perform the same build step on different OSes, requiring different commands. +A typical example of this is using the sh command on Linux, but cmd on Windows. +To accomodate this, you can optionally create OS-specific overrides for each hook. +To do this, specify the default hook, then directly below it create a [hooks.<os>] entry where <os> +can be one of windows, macos, or linux. Within this entry you must specify only the command and +command_argumnets keys. You may provide multiple overrides for each hook. i.e. +One for windows, one for macos, and one for linux.

    Auto-Reload

    As of v0.14.0, Trunk now ships with the ability to automatically reload your web app as the Trunk build pipeline completes.

    Minification

    diff --git a/configuration/index.html b/configuration/index.html index 6ff56dc2..7579094f 100644 --- a/configuration/index.html +++ b/configuration/index.html @@ -78,6 +78,36 @@
    +
    + - Trunk Version +
    + +
    + - Build section +
    + +
    + - Watch section +
    + +
    + - Server section +
    + +
    + - Clean section +
    + +
    + - Proxy section +
    + +
    + - Hooks section +
    + + +
    Environment Variables
    @@ -97,10 +127,6 @@ - Proxy CLI Flags -
    - - Config File -
    - @@ -115,6 +141,96 @@

    Trunk.toml

    Trunk supports an optional Trunk.toml config file. An example config file is included in the Trunk repo, and shows all available config options along with their default values. By default, Trunk will look for a Trunk.toml config file in the current working directory. Trunk supports the global --config option to specify an alternative location for the file.

    Note that any relative paths declared in a Trunk.toml file will be treated as being relative to the Trunk.toml file itself.

    +

    Trunk Version

    +

    Starting with 0.19.0-alpha.2, it is possible to enforce having a certain +version of trunk building the project.

    +

    As new features get added to trunk, this might be helpful to ensure that the +version of trunk building the current is actually capable of doing so. This can +be done using the trunk-version (or using the alias trunk_version) on the +root level of the Trunk.toml file.

    +

    The version format is a "version requirement", the same format you might know +from Cargo's version field on dependencies as a Semantic Versioning +constraint.

    +

    This also supports pre-release requirements, which allows to adopt upcoming +features early.

    +

    NOTE: Versions prior do 0.19.0-alpha.2 currently do not support this +check, and so they will silently ignore such an error for now.

    +
    trunk-version = "^0.20.1"
    +
    +

    Build section

    +

    The build section has configuration settings for the build process. These +control the arguments passed to Cargo when building the application, and the +generation of the assets.

    +
    [build]
    +target = "index.html" # The index HTML file to drive the bundling process.
    +release = false       # Build in release mode.
    +dist = "dist"         # The output dir for all final assets.
    +public_url = "/"      # The public URL from which assets are to be served.
    +filehash = true       # Whether to include hash values in the output file names.
    +inject_scripts = true # Whether to inject scripts (and module preloads) into the finalized output.
    +offline = false       # Run without network access
    +frozen = false        # Require Cargo.lock and cache are up to date
    +locked = false        # Require Cargo.lock is up to date
    +minify = "never"      # Control minification: can be one of: never, on_release, always
    +no_sri = false        # Allow disabling sub-resource integrity (SRI)
    +
    +

    Watch section

    +

    Trunk has built-in support for watching for source file changes, which triggers +a rebuild and a refresh in the browser. In this section, you can override what +paths to watch and set files to be ignored.

    +
    [watch]
    +watch = []  # Paths to watch. The `build.target`'s parent folder is watched by default.
    +ignore = [] # Paths to ignore.
    +
    +

    Server section

    +

    Trunk has a built-in server for serving the application when running trunk serve. +This section lets you override how this works.

    +
    [serve]
    +addresses = ["127.0.0.1"]  # The address to serve on.
    +port = 8080                # The port to serve on.
    +aliases = ["http://localhost.mywebsite.com"] # The aliases to serve on.
    +open = false               # Open a browser tab once the initial build is complete.
    +no_spa = false             # Whether to disable fallback to index.html for missing files.
    +no_autoreload = false      # Disable auto-reload of the web app.
    +no_error_reporting = false # Disable error reporting
    +ws_protocol = "ws"         # Protocol used for autoreload WebSockets connection.
    +# Additional headers set for responses.
    +headers = { "test-header" = "header value", "test-header2" = "header value 2" }
    +# The certificate/private key pair to use for TLS, which is enabled if both are set.
    +tls_key_path = "self_signed_certs/key.pem"
    +tls_cert_path = "self_signed_certs/cert.pem"
    +
    +

    Clean section

    +

    The clean section controls the behaviour when running trunk clean, which will +remove build artifacts.

    +
    [clean]
    +dist = "dist" # The output dir for all final assets.
    +cargo = false # Optionally perform a cargo clean.
    +
    +

    Proxy section

    +

    The Trunk.toml config file accepts multiple [[proxy]] sections, which +allows for multiple proxies to be configured. Each section requires at least +the backend field, and optionally accepts the rewrite and ws fields, both +corresponding to the --proxy-* CLI flags discussed below.

    +

    As it is with other Trunk config, a proxy declared via CLI will take final +precedence and will cause any config file proxies to be ignored, even if there +are multiple proxies declared in the config file.

    +
    [[proxy]]
    +backend = "https://localhost:9000/api/v1" # Address to proxy requests to
    +ws = false                                # Use WebSocket for this proxy
    +insecure = false                          # Disable certificate validation
    +no_system_proxy = false                   # Disable system proxy
    +rewrite = ""                              # Strip the given prefix off paths
    +no_redirect = false                       # Disable following redirects of proxy responses
    +
    +

    Hooks section

    +

    Hooks are tasks that are run before, during or after the build. You can run +arbitrary commands here, and you can specify multiple hooks to run.

    +
    [[hooks]]
    +stage = "post_build"  # When to run hook, must be one of "pre_build", "build", "post_build"
    +command = "ls"        # Command to run
    +command_arguments = [] # Arguments to pass to command
    +

    Environment Variables

    Trunk environment variables mirror the Trunk.toml config schema. All Trunk environment variables have the following 3 part form TRUNK_<SECTION>_<ITEM>, where TRUNK_ is the required prefix, <SECTION> is one of the Trunk.toml sections, and <ITEM> is a specific configuration item from the corresponding section. E.G., TRUNK_SERVE_PORT=80 will cause trunk serve to listen on port 80. The equivalent CLI invocation would be trunk serve --port=80.

    In addition, there is the variable TRUNK_SKIP_VERSION_CHECK which allows to control the update check (if that is) @@ -130,24 +246,6 @@

    Proxy CLI Flags

    --proxy-insecure allows the --proxy-backend url to use a self signed certificate for https (or any officially invalid certs, including expired). This would be used when proxying to https such as trunk serve --proxy-backend=https://localhost:3001/ --proxy-insecure where the ssl cert was self signed, such as with mkcert, and routed through an https reverse proxy for the backend, such as local-ssl-proxy or caddy.

    --proxy-no-sytem-proxy bypasses the system proxy when contacting the proxy backend.

    --proxy-ws specifies that the proxy is for a WebSocket endpoint.

    -

    Config File

    -

    The Trunk.toml config file accepts multiple [[proxy]] sections, which allows for multiple proxies to be configured. Each section requires at least the backend field, and optionally accepts the rewrite and ws fields, both corresponding to the --proxy-* CLI flags discussed above.

    -

    As it is with other Trunk config, a proxy declared via CLI will take final precedence and will cause any config file proxies to be ignored, even if there are multiple proxies declared in the config file.

    -

    The following is a snippet from the Trunk.toml file in the Trunk repo:

    -
    [[proxy]]
    -rewrite = "/api/v1/"
    -backend = "http://localhost:9000/"
    -
    -

    Required version

    -

    Starting with 0.19.0-alpha.2, it is possible to enforce having a certain version of trunk building the project.

    -

    As new features get added to trunk, this might be helpful to ensure that the version of trunk building the current -is actually capable of doing so. This can be done using the trunk-version (or using the alias trunk_version) on -the root level of the Trunk.toml file.

    -

    The version format is a "version requirement", the same format you might know from Cargo's version field on -dependencies.

    -

    This also supports pre-release requirements, which allows to adopt upcoming features early.

    -

    NOTE: Versions prior do 0.19.0-alpha.2 currently do not support this check, and so they will silently ignore -such an error for now.

    diff --git a/guide/.nojekyll b/guide/.nojekyll deleted file mode 100644 index f1731109..00000000 --- a/guide/.nojekyll +++ /dev/null @@ -1 +0,0 @@ -This file makes sure that Github Pages doesn't process mdBook's output. diff --git a/guide/404.html b/guide/404.html index 487b64b8..56146316 100644 --- a/guide/404.html +++ b/guide/404.html @@ -91,7 +91,7 @@