Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@shopify/oxygen-cli

Package Overview
Dependencies
Maintainers
24
Versions
453
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shopify/oxygen-cli

`@shopify/oxygen-cli` is a command-line tool for deploying your Oxygen projects. It provides a simple a way to deploy your Oxygen applications, including workers and assets, to the Oxygen platform.

  • 1.2.0
  • npm
  • Socket score

Version published
Weekly downloads
16K
increased by26.02%
Maintainers
24
Weekly downloads
 
Created
Source

Oxygen-cli

@shopify/oxygen-cli is a command-line tool for deploying your Oxygen projects. It provides a simple a way to deploy your Oxygen applications, including workers and assets, to the Oxygen platform.

Getting Started

The oxygen-cli can be run locally, or it can be used from within CI/CD environments such as Github Actions.

The common route to launch oxygen-cli's deploy command locally is through hydrogen-cli. When this is installed globally, the command is available via the h2 deploy.

You can also install oxygen-cli as plugin for @shopify/cli. When this is installed globally, running the following will install oxygen-cli:

shopify plugins install @shopify/oxygen-cli

The CLI will now expose its commands under shopify oxygen.

Finally, it is also possible to install the oxygen-cli independently, which is preferable when run from within a CI/CD environment.

npm install -g @shopify/oxygen-cli

The CLI can then be activated using the command oxygen-cli.

Command overview

  • oxygen deploy command initiates a deployment to Oxygen.
oxygen:deploy [options]

Options

  • -t, --token : (required) Oxygen deployment token. Can also be set using the OXYGEN_DEPLOYMENT_TOKEN environment variable (see below).
  • -r, --rootPath : Root path (defaults to the current working directory).
  • -e, --environmentTag : Tag of the environment to deploy to. Defaults to branch name in supported CI environments (see below).
  • -w, --workerFolder : Worker folder (default: dist/worker/).
  • -a, --assetsFolder : Assets folder (default: dist/client/).
  • -o, --workerOnly: Worker only deployment.
  • -s, --skipBuild: Skip running build command.
  • -p, --publicDeployment: set the deployment to be publicly accessible.
  • -b, --buildCommand : Build command (default: yarn build).
  • --metadataUrl : URL that links to the deployment.
  • --metadataUser : User that initiated the deployment.
  • --metadataVersion : A version identifier for the deployment.

Note: All metadata options (--metadataUrl, --metadataUser, and --metadataVersion) have a maximum character limit of 90.

Example:

oxygen:deploy -t my-deployment-token -e staging --rootPath="/my-project" --workerOnly

This command will deploy your Oxygen project to the staging environment with the provided deployment token and root path. No static assets will be uploaded.

The environmentTag option and the metadata options serve as overrides for values that can be retrieved from supported CI environments, see the section on environment variables below.

Environment variables

The Oxygen deployment token can be specified with the token option. Alternatively, you can use the environment variable OXYGEN_DEPLOYMENT_TOKEN for this. In CI environments this is recommended. For example, when using CircleCI you can define a custom environment variable in your project settings which holds the token. The OXYGEN_DEPLOYMENT_TOKEN can then be populated with this variable's value in your config.yml file:

environment:
  OXYGEN_DEPLOYMENT_TOKEN: ${YOUR_ENV_VARIABLE}

When run from a supported CI/CD environment, the tool will automatically retrieve metadata from relevant environment variables. Metadata describes the author making the deployment (user), the version (commit Sha) and the deployment URL (workflow URL).

The following environment variables are relevant, depending on your environment:

-BitbucketCircleCIGithubGitlab
UserBITBUCKET_COMMIT_AUTHORCIRCLE_USERNAMEGITHUB_ACTORGITLAB_USER_LOGIN
VersionBITBUCKET_COMMITCIRCLE_SHA1GITHUB_SHACI_COMMIT_SHA
URLBITBUCKET_BUILD_URLCIRCLE_BUILD_URL${GITHUB_SERVER_URL}${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}CI_PROJECT_URL

These values can be overruled by the command line flags metadataUser, metadataUrl and metadataVersion respectively.

The tag of the environment to deploy to, will be derived from the following variables:

ServiceBranch
BitbucketBITBUCKET_BRANCH
CircleCICIRCLE_BRANCH
GithubGITHUB_REF_NAME
GitlabCI_COMMIT_REF_NAME

The environmentTag command line option can be used to override this, and is required when the tool is run from outside a supported CI environment.

FAQs

Package last updated on 30 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc