UNPKG

@ma3-pro-plugins/ma3-ts-plugin-builder

Version:
72 lines 3.06 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.generateTSConfig = void 0; const logger_1 = __importDefault(require("../utils/logger")); const fs = __importStar(require("node:fs")); const path = __importStar(require("path")); const BASE_TSCONFIG_FILE_NAME = "tsconfig_base"; function generateTSConfig(entryPath, config, entryConfig, buildConfig) { /** * sourceMapTraceback is disabled since the line numbers are wrong */ const tsconfigContent = `{ "extends": "./${BASE_TSCONFIG_FILE_NAME}", "include": ["${config.relativePathToRoot}node_modules/@ma3-pro-plugins/grandma3-types/index.d.ts", "lib/**/*", "src/**/*"], "tstl": { "luaTarget": "5.3", "luaBundleEntry": "${entryPath}", "luaBundle": "${entryConfig.targetBundlePath}", "luaPlugins": [ { "name": "${config.relativePathToRoot}${buildConfig.tstlPluginPath}" } ], "sourceMapTraceback": true, "noResolvePaths": ["json", "lfs", "socket"] } } `; const tsconfigFilePath = path.join(config.pluginFolderPath, config.isDev ? "tsconfig_dev.json" : "tsconfig.json"); fs.writeFileSync(tsconfigFilePath, tsconfigContent, { encoding: `utf8` }); logger_1.default.debug(`Written ${tsconfigFilePath}`); // const tsconfigBaseContent = `{ // "compilerOptions": { // "target": "esnext", // "lib": ["esnext"], // "moduleResolution": "node", // "types": ["lua-types/5.3"], // "strict": true, // "baseUrl": "." // } // } // `; // const tsconfigBaseFilePath = path.join(config.pluginFolderPath, `${BASE_TSCONFIG_FILE_NAME}.json`); // fs.writeFileSync(tsconfigBaseFilePath, tsconfigBaseContent, { encoding: `utf8` }); // log.debug(`Written ${tsconfigBaseFilePath}`); } exports.generateTSConfig = generateTSConfig; //# sourceMappingURL=generateTSConfig.js.map