Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (lstatSync(path).isFile()) {
list.push(path);
} else {
if (!path.endsWith('/')) {
path += '/';
}
list.push(...[...new Set(globSync(path + '*.func.ts').concat(globSync(path + '**/*.func.ts')))]);
}
}
if (list.length < 1) throw Error('Not found files.');
// 单个云函数文件直接部署
if (list.length === 1) {
const deployer = new Deployer({
root: process.env.FaasRoot!,
filename: list[0]
});
await deployer.deploy();
} else {
console.log(`[${process.env.FaasEnv}] 是否要发布以下云函数?`);
console.log(list);
console.log('');
const readline = createInterface({
input: process.stdin,
output: process.stdout
});
readline.question('输入 y 确认:', async function (res) {
readline.close();
if (res !== 'y') {
readline.question('输入 y 确认:', async function (res) {
readline.close();
if (res !== 'y') {
console.error('停止发布');
return;
} else {
for (const file of list) {
const deployer = new Deployer({
root: process.env.FaasRoot!,
filename: file
});
await deployer.deploy();
}
}
});
}