0.0.26 • Published 6 years ago

rwt-migrate v0.0.26

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

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

0.0.26

6 years ago

0.0.25

6 years ago

0.0.24

6 years ago

0.0.23

6 years ago

0.0.22

6 years ago

0.0.21

6 years ago

0.0.20

6 years ago

0.0.19

6 years ago

0.0.18

6 years ago

0.0.17

6 years ago

0.0.16

6 years ago

0.0.15

6 years ago

0.0.14

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago