sparkflare
v0.0.4
Published
CLI to interact with Cloudflare and improve the DX for cloudflare pages
Downloads
89
Readme
Sparkflare CLI
Sparkflare CLI is a command-line interface for manage your Cloudflare Pages projects.
Installation
npm install -g sparkflare
Usage
Initialize
To initialize the CLI, run the following command:
sparkflare init
This command will ask you for your Cloudflare API token, the account ID, the project name, and which package manager you are using. You can also don't provide the values and set them later in the .config.vars
file.
[!TIP] You can read the Cloudflare API documentation to learn how to get your API token and account ID.
Pull Environment Variables
To pull environment variables from Cloudflare Pages, run the following command:
sparkflare environment:pull
This will pull the environment variables from the selected environment and save them locally, after pulling the environment variables, you can use the sparkflare environment:switch
command to select the environment you want to use.
Switch Environment
To switch between environments, run the following command:
sparkflare environment:switch
This will prompt you to select an environment from the list of environments you have set up.
Deploy
To deploy your project, run the following command:
sparkflare deploy
This command will build your project and deploy it to Cloudflare Pages.
Flags and Environment Variables
Global
| Flag | Variable | Description | Used on |
| -------------------------- | ---------------------------------------- | --------------------------------------------------------------------------------- | -------------------------------- |
| -y, --yes
| SPARKFLARE_SKIP_CONFIRMATION | If present or true, indicates to skip all user confirmations | init, deploy
|
| -t, --token
| SPARKFLARE_CLOUDFLARE_TOKEN | If present, prefer the specified token instead of the one in the config | init, deploy, environment:pull
|
| -a, --account-identifier
| SPARKFLARE_CLOUDFLARE_ACCOUNT_IDENTIFIER | If present, prefer the specified account ID instead of the one in the config | init, deploy, environment:pull
|
| -n, --project-name
| SPARKFLARE_CLOUDFLARE_PROJECT_NAME | If present, prefer the specified project name instead of the one in the config | init, deploy, environment:pull
|
| -p, --package-manager
| SPARKFLARE_PACKAGE_MANAGER | If present, prefer the specified package manager instead of the one in the config | init, deploy
|
Subcommand
init
| Flag | Variable | Description |
| ------------- | --------------------- | ---------------------------------------------------- |
| -f, --force
| SPARKFLARE_FORCE_INIT | If present, it will override the .config.vars
file |
deploy
| Flag | Variable | Description |
| ------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| -e, --environment
| SPARKFLARE_ENVIRONMENT | If present, it will switch and deploy to the specified environment with this flag/env. Possible values: preview, production
. Requires environment:pull |
environment:switch
| Flag | Variable | Description |
| ------------------- | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| -e, --environment
| SPARKFLARE_ENVIRONMENT | If present, prefer the specified environment instead of the one in the config. Possible values: local, preview, production
|