Socket
Socket
Sign inDemoInstall

rwt-migrate

Package Overview
Dependencies
58
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    rwt-migrate

Migrate webtasks between deployments


Version published
Weekly downloads
0
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Migrate Webtasks between deployments

Usage

const { Token, TokenStore, Deployment, WebtaskAnalyzer } = require('webtask-migrate');

// inputs
const tenantTokenString = process.env.TENANT_TOKEN;
const fromDeploymentUrl = process.env.FROM_DEPLOYMENT_URL;
const toDeploymentUrl = process.env.TO_DEPLOYMENT_URL;
const tenantName = process.env.TENANT_NAME;
const webtaskName = process.env.WEBTASK_NAME;

// Setup
const tokenStore = new TokenStore();
tokenStore.addToken(new Token(tenantTokenString));

const fromDeployment = new Deployment(tokenStore, fromDeploymentUrl);
const toDeployment = new Deployment(tokenStore, toDeploymentUrl);

const webtaskAnalyzer = new WebtaskAnalyzer(fromDeployment, tenantName);

// Download the webtask
const downloadOptions = {
  includeCron: true,
  includeStorage: true,
  includeSecrets: true
};
const webtask = await fromDeployment.downloadWebtask(tenantName, webtaskName, downloadOptions);

// Run analysis on the webtask
const analysis = await webtaskAnalyzer.analyze(webtaskName, webtask);

// Update the webtask with any missing dependencies
webtask.addDependencies(analysis.dependencies);

// Ensure that all module dependencies are provisioned on the new deployment
await toDeployment.provisionModules(webtask.getDependencies(), tenantName);

// Upload the webtask to the new deployment
await toDeployment.uploadWebtask(tenantName, webtaskName, webtask);

// Write out an warnings detected during the analysis
console.log(analysis.warnings)

See the samples folder for examples that provide batch processing of webtasks migration

FAQs

Last updated on 20 Apr 2018

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc