@geek-fun/serverlessinsight
Version:
Full life cycle cross providers serverless application management for your fast-growing business.
39 lines (38 loc) • 1.57 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.runLocal = void 0;
const common_1 = require("../common");
const localStack_1 = require("../stack/localStack");
const parser_1 = require("../parser");
const runLocal = async (stackName, opts) => {
const { stage, port, debug, watch, location } = opts;
await (0, common_1.setContext)({ stage, location });
const ctx = (0, common_1.getContext)();
const iac = (0, parser_1.revalYaml)((0, common_1.getIacLocation)(location), ctx);
common_1.logger.info(`run-local starting: stack=${stackName} stage=${stage} port=${port} debug=${debug} watch=${watch}`);
await (0, localStack_1.startLocalStack)(iac);
// 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;