跳到主要内容

支持多runtime(@serverless-cd/setup-runtime)

安装

$ npm install @serverless-cd/setup-runtime --save

示例

import Setup from "@serverless-cd/setup-runtime";

const setup = new Setup(
credentials: {
accountId: "accountId",
accessKeyId: "accessKeyId",
accessKeySecret: "accessKeySecret",
},
dest: '/opt',
region: 'cn-hongkong',
runtimes: ["nodejs14"],
);

await setup.run();

参数解析

参数说明类型必填默认值
credentials密钥信息配置Credentials-
region需要加载的地区stringcn-hongkong
dest环境包下载路径string/opt
runtimes需要加载的环境包Array<Runtimes>/opt

Credentials

参数说明类型必填默认值
accessKeyIdaliyun 密钥 accessKeyIdstring-
accessKeySecretaliyun 密钥 accessKeySecretstring-
securityTokenaliyun 密钥 securityTokenstring-
accountIdaliyun 主账号 IDstring-

Runtimes

支持环境包信息,类型 string

enum RUNTIME {
PYTHON310 = "python3.10", // Python 3.10.5
PYTHON39 = "python3.9", // Python 3.9.13
PYTHON38 = "python3.8", // Python 3.8.13
PYTHON36 = "python3.6", // Python 3.6.15
NODEJA17 = "nodejs17", // Node.js 17.9.1
NODEJA16 = "nodejs16", // Node.js 16.17.0
NODEJA14 = "nodejs14", // Node.js 14.20.0
NODEJA12 = "nodejs12", // Node.js 12.22.12
PHP81 = "php8.1", // PHP 8.1.9
PHP80 = "php8.0", // PHP 8.0.22
PHP72 = "php7.2", // PHP 7.2.8
JAVA11 = "java11", // openjdk 11.0.13
JAVA17 = "java17", // openjdk 17.0.2
DOTNET6 = ".net6", // .net6 6.0.5
}