@geek-fun/serverlessinsight
Version:
Full life cycle cross providers serverless application management for your fast-growing business.
36 lines (35 loc) • 1.38 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.runLocal = void 0;
const common_1 = require("../common");
const localStack_1 = require("../stack/localStack");
const runLocal = async (stackName, opts) => {
const { stage, port, debug, watch } = opts;
await (0, common_1.setContext)({ stage });
common_1.logger.info(`run-local starting: stack=${stackName} stage=${stage} port=${port} debug=${debug} watch=${watch}`);
await (0, localStack_1.startLocalStack)();
// if (watch) {
// const cwd = process.cwd();
// try {
// fs.watch(cwd, { recursive: true }, (eventType, filename) => {
// if (!filename) return;
// const filePath = path.join(cwd, filename);
// logger.info(`file change detected: ${eventType} ${filePath}`);
// });
// logger.info(`watching files under ${process.cwd()}`);
// } catch (err) {
// logger.warn(`file watch not available: ${String(err)}`);
// }
// }
//
// const shutdown = () => {
// logger.info('shutting down run-local server');
// server.close(() => process.exit(0));
// };
// process.on('SIGINT', shutdown);
// process.on('SIGTERM', shutdown);
//
// // return server for tests if needed
// return { server, port, stage, debug, watch };
};
exports.runLocal = runLocal;