Skip to content

A Node package for deploying a script to CloudFlare Workers without the use of Wrangler

License

Notifications You must be signed in to change notification settings

TomasHubelbauer/cf-workers-deploy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CloudFlare Workers Deploy

Installation

npm install TomasHubelbauer/cf-workers-deploy

Usage

const deploy = require('cf-worker-deploy');
await deploy(accountId, workerName, apiToken, script, ...bindings);

For argument values, see the Testing section below.

Testing

This will replace your existing worker at the configured secrets!

secrets.json:

{
  "accountId": "",
  "workerName": "",
  "apiToken": "",
  "bindings": [
    {
      "name": "",
      "namespaceId": ""
    }
  ],
  "userName": ""
}

npm test

Changelog

5.0.0 2020-03-04

Rewritten to use the CloudFlare API:

https://developers.cloudflare.com/workers/tooling/api/scripts

4.0.0 2020-03-01

Accept all the secrets and the script using function arguments instead of doing file I/O in the method. This gives greated flexibility to the callers.

3.0.0 2020-03-01

Dropped support for passing in the secrets using command line arguments and exported the method correctly.

Added a destructive (!) test for verifying the deployment works.

2.0.0 2020-03-01

Added support for the namespaceId and bindingName secrets which enable using KV with the worker.

Fixed a bug where the session cookie was read from the access token command line argument instead of its own.

1.0.0 2020-03-01

The initial release with support for deploying a worker with no bindings based on secrets.json with manually obtained values.

To-Do

About

A Node package for deploying a script to CloudFlare Workers without the use of Wrangler

Topics

Resources

License

Stars

Watchers

Forks