Skip to content
This repository was archived by the owner on Aug 3, 2023. It is now read-only.

πŸ› 1.3.1

Choose a tag to compare

@ashleygwilliams ashleygwilliams released this 17 Sep 17:52
  • Features

    • Environments - EverlastingBugstopper, issue/385

      Wrangler 1.3.0 includes supports for environments, allowing developers to deploy Workers projects to multiple places. For instance, an application can be deployed to a production URL and a staging URL, without having to juggle multiple configuration files.

      To use environments, you can now pass in [env.$env_name] properties in your wrangler.toml. Here's an example:

      type = "webpack"
      name = "my-worker-dev"
      account_id = "12345678901234567890"
      zone_id = "09876543210987654321"
      workers_dot_dev = false
      [env.staging]
      name = "my-worker-staging"
      route = "staging.example.com/*"
      [env.production]
      name = "my-worker"
      route = "example.com/*"

      With multiple environments defined, wrangler build, wrangler preview, and wrangler publish now accept a --env flag to indicate what environment you'd like to use, for instance, wrangler publish --env production.

      To support developers transitioning to environments, we've written documentation for the feature, including further information about deprecations and advanced usage. Check out the documentation here!

    • KV commands - ashleymichal, gabbifish, issue/339

      Wrangler 1.3.0 includes commands for managing and updating Workers KV namespaces, keys, and values directly from the CLI.

      • wrangler kv:namespace

        wrangler kv:namespace allows developers to create, list, and delete KV namespaces, from the CLI. This allows Wrangler users to configure new namespaces without having to navigate into the Cloudflare Web UI to manage namespaces. Once a namespace has been created, Wrangler will even give you the exact configuration to copy into your wrangler.toml to begin using your new namespace in your project. Neat!

        $ wrangler kv:namespace create "MY_KV"
        πŸŒ€  Creating namespace with title "worker-MY_KV"
        ✨  Success: WorkersKvNamespace {
          id: "e29b263ab50e42ce9b637fa8370175e8",
          title: "worker-MY_KV",
        }
        ✨  Add the following to your wrangler.toml:
        kv-namespaces = [
          { binding = "MY_KV", id = "e29b263ab50e42ce9b637fa8370175e8" }
        ]
      • wrangler kv:key

        wrangler kv:key gives CLI users access to reading, listing, and updating KV keys inside of a namespace. For instance, given a namespace with the binding KV, you can directly set keys and values from the CLI, including passing expiration data, such as below:

        $ wrangler kv:key put --binding=KV "key" "value" --ttl=10000
        ✨  Success
      • wrangler kv:bulk

        wrangler kv:bulk can be used to quickly upload or remove a large number of values from Workers KV, by accepting a JSON file containing KV data. Let's define a JSON file, data.json:

        [
          {
            "key": "test_key",
            "value": "test_value",
            "expiration_ttl": 3600
          },
          {
            "key": "test_key2",
            "value": "test_value2",
            "expiration_ttl": 3600
          }
        ]

        By calling wrangler kv:bulk put --binding=KV data.json, I can quickly create two new keys in Workers KV - test_key and test_key2, with the corresponding values test_value and test_value2:

        $ wrangler kv:bulk put --binding=KV data.json
        ✨  Success

      The KV subcommands in Wrangler 1.3.0 make it super easy to comfortably query and manage your Workers KV data without ever having to leave the command-line. For more information on the available commands and their usage, see the documentation. 🀯

    • Reduce output from publish command - EverlastingBugstopper, issue/523

      This PR improves the messaging of wrangler publish.

      Before:

      ✨  Built successfully, built project size is 517 bytes.
      ✨  Successfully published your script.
      ✨  Success! Your worker was successfully published. You can view it at example.com/*

      After:

      $ wrangler publish
      ✨  Built successfully, built project size is 523 bytes.
      ✨  Successfully published your script to example.com/*
    • feat #323: Allow fn & promise from webpack config - [third774], [issue/323][pull/325]

      This PR fixes Wrangler's handling of webpack.config.js files to support functions and promises, as per the Webpack documentation.
      [xtuc]: https://github.com/xtuc
      [issue/477]: #477
      [pull/490]: #490

  • Fixes

    • Have live reload preview watch over entire rust worker directory - gabbifish, pull/535

      This change updates the live reload functionality to watch over the entire Rust worker directory, and does not look for package.json files that do not typically exist for Rust and WASM projects.

    • Fix javascript live preview for linux - gabbifish, issue/517

      This PR fixes an issue with Wrangler's live preview (wrangler preview --watch) functionality on Linux. In addition, it simplifies the console output for a live preview instance, which could get pretty noisy during development!

    • Different emojis for different commands - EverlastingBugstopper, pull/605

      KV subcommands would return the same emoji value in --help output. This PR updates the command-line output to use different emoji, making the output easier to read!

  • Maintenance

    • Add keywords for npm SEO - EverlastingBugstopper, pull/583

      This PR improves the discoverability for wrangler on npm by adding keywords to the installer's package.json.

    • Clean up emoji - xortive, pull/455

      This PR removes some extraneous unicode that keeps our emoji from displaying correctly in certain terminal emulators, especially for multi-codepoint emoji.

  • Documentation

    • Add documentation for init to the README - EverlastingBugstopper, pull/585

      This PR adds documentation in our README for wrangler init, which allows you to begin using an existing project with Wrangler.

    • Remove link to docs for installation because they link back to wrangler README - EverlastingBugstopper, pull/494

    • Minor formatting fix in README.md - kentonv, pull/515

      This PR fixes a small syntax issue in the Wrangler README, causing Markdown lists to render incorrectly.

    • Fix link to Cloudflare Workers preview service - dentarg, pull/472

      This PR fixes a link to the Cloudflare Workers preview service in the Wrangler README.