@bf6mods/cli 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/README.md +72 -0
  2. package/dist/cli/index.js +541 -76
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/resources/prepare/bf6.d.ts +2 -0
  5. package/dist/resources/prepare/tsconfig.json +14 -15
  6. package/dist/resources/prepare/types/config.ts +139 -4
  7. package/dist/resources/templates/All/package.json +1 -1
  8. package/dist/resources/templates/Basic/bf6.config.ts +5 -1
  9. package/package.json +48 -41
  10. package/dist/resources/templates/AcePursuit/src/index.ts +0 -3421
  11. package/dist/resources/templates/AcePursuit/src/levels.tscn +0 -6922
  12. package/dist/resources/templates/AcePursuit/src/strings.json +0 -191
  13. package/dist/resources/templates/All/bf6.config.ts +0 -6
  14. package/dist/resources/templates/BombSquad/src/index.ts +0 -3683
  15. package/dist/resources/templates/BombSquad/src/levels.tscn +0 -3212
  16. package/dist/resources/templates/BombSquad/src/strings.json +0 -123
  17. package/dist/resources/templates/Exfil/src/index.ts +0 -2393
  18. package/dist/resources/templates/Exfil/src/levels.tscn +0 -5600
  19. package/dist/resources/templates/Exfil/src/strings.json +0 -185
  20. package/dist/resources/templates/Vertigo/src/index.ts +0 -1948
  21. package/dist/resources/templates/Vertigo/src/levels.tscn +0 -6387
  22. package/dist/resources/templates/Vertigo/src/strings.json +0 -308
  23. /package/dist/resources/templates/{AcePursuit/src/config.json → AcePursuit.json} +0 -0
  24. /package/dist/resources/templates/{BombSquad/src/config.json → BombSquad.json} +0 -0
  25. /package/dist/resources/templates/{Exfil/src/config.json → Exfil.json} +0 -0
  26. /package/dist/resources/templates/{Vertigo/src/config.json → Vertigo.json} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/cli/index.ts","../../package.json","../../src/cli/init.ts","../../src/cli/build.ts","../../src/cli/prepare.ts","../../../../node_modules/ansi-regex/index.js","../../../../node_modules/strip-ansi/index.js","../../src/cli/utils.ts"],"sourcesContent":["#!/usr/bin/env node\r\nimport { Command } from 'commander';\r\nimport pkg from \"../../package.json\" with { type: \"json\" };\r\nimport { init } from './init.js';\r\nimport { build } from './build.js';\r\nimport { prepare } from './prepare.js';\r\n\r\nconst program = new Command();\r\n\r\nprogram\r\n .name(Object.keys(pkg.bin)[0])\r\n .description(pkg.description)\r\n .version(pkg.version);\r\n\r\nprogram.command('init')\r\n .description('Create a new bf6 mod')\r\n .action(async () => {\r\n await init();\r\n });\r\n\r\nprogram.command('build')\r\n .description('build the bf6 mod')\r\n .action(async () => {\r\n await build();\r\n });\r\n\r\nprogram.command('prepare')\r\n .description('prepare the types for bf6 mod')\r\n .action(async () => {\r\n await prepare();\r\n });\r\n\r\nprogram.exitOverride((_err) => {\r\n if (process.env.EXIT_CODE === 'none') process.exit(0);\r\n});\r\n\r\nprogram.parse();\r\n","{\r\n \"name\": \"@bf6mods/cli\",\r\n \"version\": \"1.0.0\",\r\n \"description\": \"CLI and library for bundling BF6 mods\",\r\n \"license\": \"MIT\",\r\n \"type\": \"module\",\r\n \"bin\": {\r\n \"bf6mods\": \"./dist/cli/index.js\"\r\n },\r\n \"main\": \"./dist/index.js\",\r\n \"types\": \"./dist/index.d.ts\",\r\n \"scripts\": {\r\n \"build\": \"tsup\",\r\n \"start\": \"cross-env EXIT_CODE=none tsx ./src/cli/index.ts\"\r\n },\r\n \"exports\": {\r\n \".\": {\r\n \"types\": \"./dist/index.d.ts\",\r\n \"import\": \"./dist/index.js\"\r\n }\r\n },\r\n \"files\": [\r\n \"dist/\"\r\n ],\r\n \"dependencies\": {\r\n \"@bf6mods/sdk\": \"1.0.1\",\r\n \"chokidar\": \"^4.0.3\",\r\n \"colors\": \"^1.4.0\",\r\n \"commander\": \"^14.0.1\",\r\n \"inquirer\": \"^12.9.6\",\r\n \"jiti\": \"^2.6.1\",\r\n \"knitwork\": \"^1.2.0\"\r\n },\r\n \"publishConfig\": {\r\n \"access\": \"public\"\r\n },\r\n \"devDependencies\": {\r\n \"cross-env\": \"^10.1.0\",\r\n \"tsx\": \"^4.20.6\"\r\n }\r\n}\r\n","import inquirer from 'inquirer';\r\nimport path from 'path';\r\nimport { fileURLToPath } from 'url';\r\nimport fs from 'fs';\r\n\r\nconst __filename = fileURLToPath(import.meta.url);\r\nconst __dirname = path.dirname(__filename);\r\n\r\nconst templates = path.resolve(__dirname, '../resources/templates');\r\n\r\nfunction renameFilesRecursively(dir: string, modName: string) {\r\n const entries = fs.readdirSync(dir, { withFileTypes: true });\r\n for (const entry of entries) {\r\n const oldPath = path.join(dir, entry.name);\r\n let newPath = oldPath;\r\n\r\n // Rename file or folder if it includes {name}\r\n if (entry.name.includes('{name}')) {\r\n const newName = entry.name.replace('{name}', modName);\r\n newPath = path.join(dir, newName);\r\n fs.renameSync(oldPath, newPath);\r\n }\r\n\r\n // If it's a package.json, rewrite the \"name\" field\r\n if (entry.name === 'package.json') {\r\n const pkg = JSON.parse(fs.readFileSync(newPath, 'utf-8'));\r\n pkg.name = modName;\r\n fs.writeFileSync(newPath, JSON.stringify(pkg, null, 2));\r\n }\r\n\r\n // Recurse into directories (using the new name if renamed)\r\n if (fs.statSync(newPath).isDirectory()) {\r\n renameFilesRecursively(newPath, modName);\r\n }\r\n }\r\n}\r\n\r\nexport async function init() {\r\n inquirer\r\n .prompt([\r\n {\r\n type: 'input',\r\n name: 'mod_name',\r\n message: \"What's your mod's name\",\r\n validate: ((value: string) => {\r\n if (value.trim() === '') return 'Please provide a value';\r\n return true;\r\n })\r\n },\r\n {\r\n type: 'list',\r\n name: 'template',\r\n message: \"Which template should be used\",\r\n choices: ['Basic', 'AcePursuit', 'BombSquad', 'Exfil', 'Vertigo'],\r\n },\r\n ])\r\n .then((answers) => {\r\n const template = path.resolve(templates, answers.template);\r\n const newProject = path.resolve('.', answers.mod_name);\r\n\r\n console.log('template:', template);\r\n console.log('newProject:', newProject);\r\n\r\n fs.cpSync(path.resolve(templates, 'All'), newProject, { recursive: true })\r\n fs.cpSync(template, newProject, { recursive: true });\r\n\r\n renameFilesRecursively(newProject, answers.mod_name);\r\n })\r\n .catch((error) => {\r\n if (error.isTtyError) {\r\n console.error('TTY Error:', error);\r\n } else {\r\n console.error('Error occurred:', error);\r\n }\r\n });\r\n\r\n}\r\n","import { createJiti } from \"jiti\";\r\nimport path from \"path\";\r\n\r\nexport const getBf6Config = async (rootDir: string) => {\r\n const jiti = createJiti(rootDir, { interopDefault: true });\r\n const result = await jiti.import('./bf6.config', { default: true })\r\n\treturn result;\r\n}\r\n\r\n\r\nexport async function build() {\r\n const workingDir = path.resolve('.');\r\n getBf6Config(workingDir)\r\n}\r\n","import path from \"path\";\r\nimport { fileURLToPath } from \"url\";\r\nimport fs from 'fs';\r\nimport { genExport } from \"knitwork\";\r\nimport * as colors from 'colors'\r\nimport { printToConsole } from \"./utils.js\";\r\n\r\nexport async function prepare() {\r\n try {\r\n const __filename = fileURLToPath(import.meta.url);\r\n const __dirname = path.dirname(__filename);\r\n\r\n const workingDir = path.resolve('.');\r\n const buildDir = path.resolve('.bf6');\r\n\r\n const resources = path.resolve(__dirname, '../../resources/prepare');\r\n\r\n fs.cpSync(path.resolve(resources, 'tsconfig.json'), path.resolve(buildDir, 'tsconfig.json'));\r\n fs.cpSync(path.resolve(resources, 'bf6.d.ts'), path.resolve(buildDir, 'bf6.d.ts'));\r\n fs.cpSync(path.resolve(resources, 'types', 'config.ts'), path.resolve(buildDir, 'types', 'config.ts'));\r\n\r\n const ConfigFileExports = genExport('./types/config', ['defineBf6Config']);\r\n fs.writeFileSync(path.resolve(buildDir, 'imports.d.ts'), `${ConfigFileExports}\\n`);\r\n\r\n printToConsole(`${'✔'.green} Types generated in .bf6`)\r\n } catch (error) {\r\n\t\tconsole.error(error)\r\n\t\tprintToConsole(`${'✗'.red} Types failed to generate in .bf6`)\r\n\t}\r\n}\r\n","export default function ansiRegex({onlyFirst = false} = {}) {\n\t// Valid string terminator sequences are BEL, ESC\\, and 0x9c\n\tconst ST = '(?:\\\\u0007|\\\\u001B\\\\u005C|\\\\u009C)';\n\n\t// OSC sequences only: ESC ] ... ST (non-greedy until the first ST)\n\tconst osc = `(?:\\\\u001B\\\\][\\\\s\\\\S]*?${ST})`;\n\n\t// CSI and related: ESC/C1, optional intermediates, optional params (supports ; and :) then final byte\n\tconst csi = '[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:\\\\d{1,4}(?:[;:]\\\\d{0,4})*)?[\\\\dA-PR-TZcf-nq-uy=><~]';\n\n\tconst pattern = `${osc}|${csi}`;\n\n\treturn new RegExp(pattern, onlyFirst ? undefined : 'g');\n}\n","import ansiRegex from 'ansi-regex';\n\nconst regex = ansiRegex();\n\nexport default function stripAnsi(string) {\n\tif (typeof string !== 'string') {\n\t\tthrow new TypeError(`Expected a \\`string\\`, got \\`${typeof string}\\``);\n\t}\n\n\t// Even though the regex is global, we don't need to reset the `.lastIndex`\n\t// because unlike `.exec()` and `.test()`, `.replace()` does it automatically\n\t// and doing it manually has a performance penalty.\n\treturn string.replace(regex, '');\n}\n","import stripAnsi from 'strip-ansi';\r\nimport colors from 'colors';\r\n\r\nexport const printToConsole = (message: string) => {\r\n const now = new Date();\r\n const formattedTime = colors.grey(now.toLocaleTimeString());\r\n\r\n const terminalWidth = process.stdout.columns || 80; // Default to 80 if terminal width is not available\r\n const timeLength = stripAnsi(formattedTime).length;\r\n const messageLength = stripAnsi(message).length;\r\n\r\n console.log(`${message}${' '.repeat(terminalWidth - (messageLength + timeLength))}${formattedTime}`);\r\n};\r\n"],"mappings":";;;AACA,SAAS,eAAe;;;ACDxB;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,SAAW;AAAA,EACX,MAAQ;AAAA,EACR,KAAO;AAAA,IACL,SAAW;AAAA,EACb;AAAA,EACA,MAAQ;AAAA,EACR,OAAS;AAAA,EACT,SAAW;AAAA,IACT,OAAS;AAAA,IACT,OAAS;AAAA,EACX;AAAA,EACA,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AK,QAAQ,UAAU,UAAU,CAAC;AACjF,IAAAC,IAAG,OAAOD,MAAK,QAAQ,WAAW,SAAS,WAAW,GAAGA,MAAK,QAAQ,UAAU,SAAS,WAAW,CAAC;AAErG,UAAM,oBAAoB,UAAU,kBAAkB,CAAC,iBAAiB,CAAC;AACzE,IAAAC,IAAG,cAAcD,MAAK,QAAQ,UAAU,cAAc,GAAG,GAAG,iBAAiB;AAAA,CAAI;AAEjF,mBAAe,GAAG,SAAI,KAAK,0BAA0B;AAAA,EACzD,SAAS,OAAO;AAClB,YAAQ,MAAM,KAAK;AACnB,mBAAe,GAAG,SAAI,GAAG,mCAAmC;AAAA,EAC7D;AACD;;;AJtBA,IAAM,UAAU,IAAI,QAAQ;AAE5B,QACK,KAAK,OAAO,KAAK,gBAAI,GAAG,EAAE,CAAC,CAAC,EAC5B,YAAY,gBAAI,WAAW,EAC3B,QAAQ,gBAAI,OAAO;AAExB,QAAQ,QAAQ,MAAM,EACjB,YAAY,sBAAsB,EAClC,OAAO,YAAY;AAChB,QAAM,KAAK;AACf,CAAC;AAEL,QAAQ,QAAQ,OAAO,EAClB,YAAY,mBAAmB,EAC/B,OAAO,YAAY;AAChB,QAAM,MAAM;AAChB,CAAC;AAEL,QAAQ,QAAQ,SAAS,EACpB,YAAY,+BAA+B,EAC3C,OAAO,YAAY;AAChB,QAAM,QAAQ;AAClB,CAAC;AAEL,QAAQ,aAAa,CAAC,SAAS;AAC3B,MAAI,QAAQ,IAAI,cAAc,OAAQ,SAAQ,KAAK,CAAC;AACxD,CAAC;AAED,QAAQ,MAAM;","names":["path","path","fileURLToPath","fs","__filename","fileURLToPath","__dirname","path","fs"]}
1
+ {"version":3,"sources":["../../src/cli/index.ts","../../package.json","../../src/cli/build.ts","../../src/resources/prepare/types/config.ts","../../src/cli/dev.ts","../../src/cli/import.ts","../../src/cli/init.ts","../../src/cli/prepare.ts","../../src/cli/utils.ts","../../../../node_modules/ansi-regex/index.js","../../../../node_modules/strip-ansi/index.js"],"sourcesContent":["#!/usr/bin/env node\r\nimport { Command } from \"commander\";\r\nimport pkg from \"../../package.json\" with { type: \"json\" };\r\nimport { build } from \"./build.js\";\r\nimport { dev } from \"./dev.ts\";\r\nimport { importFile } from \"./import.ts\";\r\nimport { init, installDependencies } from \"./init.js\";\r\nimport { prepare } from \"./prepare.js\";\r\n\r\nconst program = new Command();\r\n\r\nprogram\r\n\t.name(Object.keys(pkg.bin)[0])\r\n\t.description(pkg.description)\r\n\t.version(pkg.version);\r\n\r\nprogram\r\n\t.command(\"init\")\r\n\t.argument(\"[directory]\")\r\n\t.description(\"Create a new bf6 mod\")\r\n\t.action(async (directory) => {\r\n\t\tawait init(directory);\r\n\t});\r\n\r\nprogram\r\n\t.command(\"build\")\r\n\t.description(\"build the bf6 mod\")\r\n\t.action(async () => {\r\n\t\tawait build();\r\n\t});\r\n\r\nprogram\r\n\t.command(\"prepare\")\r\n\t.description(\"prepare the types for bf6 mod\")\r\n\t.action(async () => {\r\n\t\tawait prepare();\r\n\t});\r\n\r\nprogram\r\n\t.command(\"dev\")\r\n\t.description(\"watch the changes in src, and recompile as needed\")\r\n\t.action(async () => {\r\n\t\tawait dev();\r\n\t});\r\n\r\nprogram\r\n\t.command(\"import\")\r\n\t.argument(\"<input>\")\r\n\t.argument(\"<output>\")\r\n\t.description(\"decompiles the json config of a mod into a new project\")\r\n\t.action(async (input, output) => {\r\n\t\tawait importFile(input as string, output as string);\r\n\t\tinstallDependencies(output);\r\n\t});\r\n\r\nprogram.exitOverride((_err) => {\r\n\tif (process.env.EXIT_CODE === \"none\") process.exit(0);\r\n});\r\n\r\nprogram.parse();\r\n","{\r\n\t\"name\": \"@bf6mods/cli\",\r\n\t\"version\": \"1.0.1\",\r\n\t\"description\": \"CLI and library for bundling BF6 mods\",\r\n\t\"license\": \"MIT\",\r\n\t\"type\": \"module\",\r\n\t\"bin\": {\r\n\t\t\"bf6mods\": \"./dist/cli/index.js\"\r\n\t},\r\n\t\"main\": \"./dist/index.js\",\r\n\t\"types\": \"./dist/index.d.ts\",\r\n\t\"scripts\": {\r\n\t\t\"build\": \"tsup\",\r\n\t\t\"start\": \"cross-env EXIT_CODE=none tsx ./src/cli/index.ts\"\r\n\t},\r\n\t\"exports\": {\r\n\t\t\".\": {\r\n\t\t\t\"types\": \"./dist/index.d.ts\",\r\n\t\t\t\"import\": \"./dist/index.js\"\r\n\t\t}\r\n\t},\r\n\t\"files\": [\r\n\t\t\"dist/\"\r\n\t],\r\n\t\"dependencies\": {\r\n\t\t\"@bf6mods/sdk\": \"1.0.1\",\r\n\t\t\"@clack/prompts\": \"^0.11.0\",\r\n\t\t\"chokidar\": \"^4.0.3\",\r\n\t\t\"colors\": \"^1.4.0\",\r\n\t\t\"commander\": \"^14.0.1\",\r\n\t\t\"jiti\": \"^2.6.1\",\r\n\t\t\"knitwork\": \"^1.2.0\",\r\n\t\t\"rolldown\": \"^1.0.0-beta.43\",\r\n\t\t\"stringify-object\": \"^6.0.0\"\r\n\t},\r\n\t\"publishConfig\": {\r\n\t\t\"access\": \"public\"\r\n\t},\r\n\t\"devDependencies\": {\r\n\t\t\"@types/stringify-object\": \"^4.0.5\",\r\n\t\t\"cross-env\": \"^10.1.0\",\r\n\t\t\"tsx\": \"^4.20.6\"\r\n\t}\r\n}\r\n","import fs from \"node:fs\";\r\nimport path from \"node:path\";\r\nimport {\r\n\ttype Attachment,\r\n\tAttachmentType,\r\n\ttype ConfigType,\r\n\ttype MapType,\r\n} from \"@bf6mods/sdk\";\r\nimport { createJiti } from \"jiti\";\r\nimport { rolldown } from \"rolldown\";\r\nimport {\r\n\ttype Bf6Config,\r\n\tMapId as MapIdEnum,\r\n} from \"../resources/prepare/types/config.ts\";\r\n\r\ndeclare global {\r\n\tvar defineBf6Config: ((config: Bf6Config) => Bf6Config) | undefined;\r\n\tvar MapId: typeof MapIdEnum | undefined;\r\n}\r\n\r\n/**\r\n * Dynamically imports and validates bf6.config.ts\r\n */\r\nexport async function getBf6Config(rootDir: string): Promise<Bf6Config> {\r\n\tglobalThis.defineBf6Config = (c) => c;\r\n\tglobalThis.MapId = MapIdEnum;\r\n\tconst jiti = createJiti(rootDir, { interopDefault: true });\r\n\tconst result = await jiti.import(\"./bf6.config\", { default: true });\r\n\tdelete globalThis.defineBf6Config;\r\n\tdelete globalThis.MapId;\r\n\treturn result as Bf6Config;\r\n}\r\n\r\n/**\r\n * Builds the entire mod project once (for production or single run).\r\n */\r\nexport async function build() {\r\n\tconst workingDir = path.resolve(\".\");\r\n\tconst config = await getBf6Config(workingDir);\r\n\r\n\tconst outDir = path.resolve(workingDir, config.outDir);\r\n\tif (fs.existsSync(outDir))\r\n\t\tfs.rmSync(outDir, { recursive: true, force: true });\r\n\tfs.mkdirSync(outDir, { recursive: true });\r\n\r\n\tconst minifyJson =\r\n\t\ttypeof config.minify === \"boolean\"\r\n\t\t\t? config.minify\r\n\t\t\t: (config.minify?.json ?? false);\r\n\r\n\tlet tsAttachment: Attachment | undefined;\r\n\tif (config.entrypoint) {\r\n\t\tconst entryAbs = path.resolve(workingDir, config.entrypoint);\r\n\t\tconst compiled = await buildEntrypoint(\r\n\t\t\tentryAbs,\r\n\t\t\toutDir,\r\n\t\t\t!!config.outputArtifacts,\r\n\t\t);\r\n\t\ttsAttachment = createTsAttachment(entryAbs, compiled);\r\n\t}\r\n\r\n\tconst { attachments, mapRotation } = await collectAttachments(\r\n\t\tconfig,\r\n\t\tworkingDir,\r\n\t\ttsAttachment,\r\n\t);\r\n\r\n\tawait writeModJson(config, outDir, attachments, mapRotation, minifyJson);\r\n\tconsole.log(`✔ Built mod: ${config.name}`);\r\n}\r\n\r\n/**\r\n * Compiles the TypeScript entrypoint using rolldown and returns the compiled code.\r\n */\r\nexport async function buildEntrypoint(\r\n\tentry: string,\r\n\toutDir: string,\r\n\temit: boolean,\r\n): Promise<string> {\r\n\tconst bundle = await rolldown({\r\n\t\tinput: entry,\r\n\t});\r\n\tconst result = await bundle.generate({\r\n\t\tformat: \"esm\",\r\n\t\tinlineDynamicImports: true,\r\n\t});\r\n\tconst code = result.output[0].code;\r\n\tif (emit) {\r\n\t\tawait fs.promises.writeFile(path.resolve(outDir, \"index.js\"), code);\r\n\t}\r\n\treturn code;\r\n}\r\n\r\n/**\r\n * Collects all attachments (TS, scenes, strings) and returns them + mapRotation.\r\n */\r\nexport async function collectAttachments(\r\n\tconfig: Bf6Config,\r\n\tworkingDir: string,\r\n\ttsAttachment?: Attachment,\r\n) {\r\n\tconst attachments: Attachment[] = [];\r\n\tconst mapRotation: MapType[] = [];\r\n\r\n\tif (tsAttachment) attachments.push(tsAttachment);\r\n\r\n\t// Strings\r\n\tif (config.strings) {\r\n\t\tconst strPath = path.resolve(workingDir, config.strings);\r\n\t\tif (!fs.existsSync(strPath)) throw new Error(\"Cannot find strings file\");\r\n\t\tconst raw = await fs.promises.readFile(strPath, \"utf8\");\r\n\t\tattachments.push(createStringsAttachment(strPath, raw));\r\n\t}\r\n\r\n\t// Scenes\r\n\tif (config.scenes) {\r\n\t\tlet mapIdx = 0;\r\n\t\tfor (const [mapId, scene] of config.scenes) {\r\n\t\t\tconst scenePath = path.resolve(workingDir, scene);\r\n\t\t\tif (!fs.existsSync(scenePath))\r\n\t\t\t\tthrow new Error(`Cannot find spatial data file: ${scene}`);\r\n\t\t\tconst raw = await fs.promises.readFile(scenePath, \"utf8\");\r\n\t\t\tconst spatial = createSpatialAttachment(scenePath, raw, mapIdx++);\r\n\t\t\tattachments.push(spatial);\r\n\t\t\tmapRotation.push({ id: mapId, spatialAttachment: spatial });\r\n\t\t}\r\n\t}\r\n\r\n\treturn { attachments, mapRotation };\r\n}\r\n\r\n/**\r\n * Writes the mod.json output to disk.\r\n */\r\nexport async function writeModJson(\r\n\tconfig: Bf6Config,\r\n\toutDir: string,\r\n\tattachments: ConfigType[\"attachments\"],\r\n\tmapRotation: MapType[],\r\n\tminify: boolean,\r\n) {\r\n\tconst baseGame = config.game;\r\n\tconst finalJson: ConfigType = {\r\n\t\tname: config.name,\r\n\t\tdescription: config.description,\r\n\t\tgameMode: \"ModBuilderCustom\",\r\n\t\tmutators: baseGame.mutators ?? {},\r\n\t\tassetRestrictions: baseGame.assetRestrictions ?? {},\r\n\t\tteamComposition: baseGame.teamComposition ?? [],\r\n\t\tmapRotation,\r\n\t\tattachments,\r\n\t};\r\n\r\n\tconst jsonOutput = minify\r\n\t\t? JSON.stringify(finalJson)\r\n\t\t: JSON.stringify(finalJson, null, 2);\r\n\tawait fs.promises.writeFile(path.resolve(outDir, \"mod.json\"), jsonOutput);\r\n}\r\n\r\nexport function createTsAttachment(\r\n\tfilePath: string,\r\n\tcompiled: string,\r\n): Attachment {\r\n\treturn {\r\n\t\tid: crypto.randomUUID(),\r\n\t\tversion: \"1.0\",\r\n\t\tfilename: `${path.parse(filePath).name}.js`,\r\n\t\tisProcessable: true,\r\n\t\tprocessingStatus: 2,\r\n\t\tattachmentType: AttachmentType.TypeScript,\r\n\t\tattachmentData: { original: toBase64(compiled), compiled: \"\" },\r\n\t\terrors: [],\r\n\t};\r\n}\r\n\r\nexport function createStringsAttachment(\r\n\tfilePath: string,\r\n\traw: string,\r\n): Attachment {\r\n\treturn {\r\n\t\tid: crypto.randomUUID(),\r\n\t\tversion: \"1.0\",\r\n\t\tfilename: path.basename(filePath),\r\n\t\tisProcessable: true,\r\n\t\tprocessingStatus: 2,\r\n\t\tattachmentType: AttachmentType.Strings,\r\n\t\tattachmentData: { original: toBase64(raw), compiled: \"\" },\r\n\t\terrors: [],\r\n\t};\r\n}\r\n\r\nexport function createSpatialAttachment(\r\n\tfilePath: string,\r\n\traw: string,\r\n\tmapIdx: number,\r\n): MapType[\"spatialAttachment\"] {\r\n\treturn {\r\n\t\tid: crypto.randomUUID(),\r\n\t\tversion: \"1.0\",\r\n\t\tfilename: path.basename(filePath),\r\n\t\tisProcessable: true,\r\n\t\tprocessingStatus: 2,\r\n\t\tattachmentType: AttachmentType.SpatialData,\r\n\t\tattachmentData: { original: toBase64(raw), compiled: \"\" },\r\n\t\tmetadata: `mapIdx=${mapIdx}`,\r\n\t\terrors: [],\r\n\t};\r\n}\r\n\r\nexport function toBase64(input: string | Buffer): string {\r\n\treturn Buffer.isBuffer(input)\r\n\t\t? input.toString(\"base64\")\r\n\t\t: Buffer.from(input, \"utf8\").toString(\"base64\");\r\n}\r\n","import type { ConfigType } from \"@bf6mods/sdk\";\r\n\r\nexport enum MapId {\r\n\tFireStorm = \"MP_FireStorm-ModBuilderCustom0\",\r\n\tSiegeOfCairo = \"MP_Abbasid-ModBuilderCustom0\",\r\n\tEmpireState = \"MP_Aftermath-ModBuilderCustom0\",\r\n\tIberianOffensive = \"MP_Battery-ModBuilderCustom0\",\r\n\tLiberationPeak = \"MP_Capstone-ModBuilderCustom0\",\r\n\tManhattanBridge = \"MP_Dumbo-ModBuilderCustom0\",\r\n\tSaintsQuarter = \"MP_Limestone-ModBuilderCustom0\",\r\n\tNewSobekCity = \"MP_Outskirts-ModBuilderCustom0\",\r\n\tMirakValley = \"MP_Tungsten-ModBuilderCustom0\",\r\n}\r\n\r\n/**\r\n * Represents the root configuration for a Battlefield 6 mod project.\r\n *\r\n * This file combines both build-level settings (like entrypoints and output directories)\r\n * and in-game configuration data (such as mutators and asset restrictions)\r\n * under the `game` key.\r\n *\r\n * Use {@link defineBf6Config} to define and validate this structure\r\n * in your `bf6.config.ts` file.\r\n */\r\nexport type Bf6Config = {\r\n\t/**\r\n\t * The human-readable name of the mod.\r\n\t *\r\n\t * Typically matches the project name used in the BF6 mod editor or\r\n\t * the display name shown in the in-game mod browser.\r\n\t */\r\n\tname: string;\r\n\r\n\t/**\r\n\t * A short description of the mod’s purpose or content.\r\n\t * Used for display and metadata purposes.\r\n\t */\r\n\tdescription: string;\r\n\r\n\t/**\r\n\t * The output directory where compiled or bundled files are written.\r\n\t * Usually something like `\"dist\"` or `\"build\"`.\r\n\t */\r\n\toutDir: string;\r\n\r\n\t/**\r\n\t * Whether or not to output the built files like the entrypoint typescript file\r\n\t */\r\n\toutputArtifacts?: boolean;\r\n\r\n\t/**\r\n\t * The main entrypoint for your mod’s TypeScript source file.\r\n\t *\r\n\t * This is typically something like `\"src/index.ts\"` or `\"src/main.ts\"`.\r\n\t */\r\n\tentrypoint?: string;\r\n\r\n\t/**\r\n\t * One or more scene file paths (.json) that the mod includes.\r\n\t * Can be a single string or an array of paths.\r\n\t * Can be a directory if single string provided\r\n\t */\r\n\tscenes?: [MapId, string][];\r\n\r\n\t/**\r\n\t * Path to a JSON file or other source that defines localized strings\r\n\t * used by the mod (optional).\r\n\t */\r\n\tstrings?: string;\r\n\r\n\t/**\r\n\t * Generate strings automatically\r\n\t */\r\n\tgenerateStrings?: boolean;\r\n\r\n\t/**\r\n\t * Controls whether build output should be minified.\r\n\t *\r\n\t * Can be a boolean (to toggle all minification),\r\n\t * or an object specifying independent settings for JS and JSON files.\r\n\t *\r\n\t * @example\r\n\t * ```ts\r\n\t * minify: true\r\n\t * // or\r\n\t * minify: { js: true, json: false }\r\n\t * ```\r\n\t */\r\n\tminify?:\r\n\t\t| {\r\n\t\t\t\t/** Whether to minify JavaScript output. */\r\n\t\t\t\tjs?: boolean;\r\n\t\t\t\t/** Whether to minify JSON output. */\r\n\t\t\t\tjson?: boolean;\r\n\t\t }\r\n\t\t/** Enables or disables all minification. */\r\n\t\t| boolean;\r\n\r\n\t/**\r\n\t * The underlying in-game configuration derived from `ConfigType`\r\n\t * in the BF6 SDK. Includes gameplay-level details like mutators,\r\n\t * asset restrictions, and team compositions.\r\n\t *\r\n\t * The following properties are **excluded**:\r\n\t * - `attachments`\r\n\t * - `workspace`\r\n\t * - `mapRotation`\r\n\t * - `name`\r\n\t * - `description`\r\n\t *\r\n\t * since those are either redundant or handled elsewhere.\r\n\t */\r\n\tgame: Omit<\r\n\t\tConfigType,\r\n\t\t\"attachments\" | \"workspace\" | \"mapRotation\" | \"name\" | \"description\"\r\n\t>;\r\n};\r\n\r\n/**\r\n * Defines and validates a Battlefield 6 mod configuration object.\r\n *\r\n * This helper ensures your config is properly typed and can be\r\n * statically analyzed by TypeScript.\r\n *\r\n * @example\r\n * ```ts\r\n * export default defineBf6Config({\r\n * name: \"My Custom Mod\",\r\n * description: \"Adds custom rules\",\r\n * outDir: \"dist\",\r\n * entrypoint: \"src/main.ts\",\r\n * game: {\r\n * mutators: [],\r\n * assetRestrictions: {},\r\n * teamComposition: [],\r\n * },\r\n * });\r\n * ```\r\n *\r\n * @param bf6Config The configuration object to validate and return.\r\n * @returns The validated Battlefield 6 configuration object.\r\n */\r\nexport function defineBf6Config(bf6Config: Bf6Config): Bf6Config {\r\n\treturn bf6Config;\r\n}\r\n","import fs from \"node:fs\";\r\nimport { glob } from \"node:fs/promises\";\r\nimport path from \"node:path\";\r\nimport chokidar, { type FSWatcher } from \"chokidar\";\r\nimport colors from \"colors\";\r\nimport { build, getBf6Config } from \"./build.ts\";\r\n\r\nexport async function dev() {\r\n\tconst workingDir = path.resolve(\".\");\r\n\tlet config = await getBf6Config(workingDir);\r\n\tconst outDir = path.resolve(workingDir, config.outDir);\r\n\tif (!fs.existsSync(outDir)) fs.mkdirSync(outDir, { recursive: true });\r\n\r\n\tconsole.log(colors.cyan(`▶ Starting dev for ${config.name}`));\r\n\r\n\tlet watcher: FSWatcher | undefined;\r\n\r\n\tasync function rebuild(trigger: string) {\r\n\t\tconsole.log(\r\n\t\t\tcolors.yellow(\r\n\t\t\t\t`↻ Change detected in ${path.basename(trigger)}, rebuilding...`,\r\n\t\t\t),\r\n\t\t);\r\n\t\tconst start = performance.now();\r\n\t\ttry {\r\n\t\t\tawait build();\r\n\t\t\tconst end = performance.now();\r\n\t\t\tconst duration = ((end - start) / 1000).toFixed(2);\r\n\t\t\tconsole.log(colors.green(`✔ Updated mod.json (${duration}s)`));\r\n\t\t} catch (err) {\r\n\t\t\tconsole.error(colors.red(`✖ Rebuild failed: ${(err as Error).message}`));\r\n\t\t}\r\n\t}\r\n\r\n\tasync function collectWatchTargets(): Promise<string[]> {\r\n\t\tconst targets: string[] = [];\r\n\r\n\t\tif (config.entrypoint)\r\n\t\t\ttargets.push(path.resolve(workingDir, config.entrypoint));\r\n\t\tif (config.scenes) {\r\n\t\t\tfor (const [, scene] of config.scenes) {\r\n\t\t\t\ttargets.push(path.resolve(workingDir, scene));\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (config.strings) targets.push(path.resolve(workingDir, config.strings));\r\n\r\n\t\tconst srcDir = path.resolve(workingDir, \"src\");\r\n\t\tfor await (const entry of glob(`${srcDir}/**/*`)) targets.push(entry);\r\n\r\n\t\tfor await (const entry of glob(\"bf6.config.*\")) targets.push(entry);\r\n\r\n\t\treturn targets;\r\n\t}\r\n\r\n\tasync function setupWatcher() {\r\n\t\tif (watcher) {\r\n\t\t\tawait watcher.close();\r\n\t\t\tconsole.log(colors.grey(\"♻ Reloading watcher due to config change...\"));\r\n\t\t}\r\n\r\n\t\tconst watchTargets = await collectWatchTargets();\r\n\r\n\t\twatcher = chokidar.watch(watchTargets, {\r\n\t\t\tpersistent: true,\r\n\t\t\tignoreInitial: true,\r\n\t\t\tawaitWriteFinish: true,\r\n\t\t\tignored: [path.resolve(outDir), `${path.resolve(outDir)}/**`],\r\n\t\t});\r\n\r\n\t\twatcher.on(\"change\", async (file) => {\r\n\t\t\tif (file.includes(\"bf6.config.\")) {\r\n\t\t\t\tconsole.log(\r\n\t\t\t\t\tcolors.magenta(\r\n\t\t\t\t\t\t\"⚙ Config changed — reloading and rebuilding watcher...\",\r\n\t\t\t\t\t),\r\n\t\t\t\t);\r\n\t\t\t\ttry {\r\n\t\t\t\t\tconfig = await getBf6Config(workingDir);\r\n\t\t\t\t\tawait setupWatcher();\r\n\t\t\t\t} catch (err) {\r\n\t\t\t\t\tconsole.error(\r\n\t\t\t\t\t\tcolors.red(`✖ Failed to reload config: ${(err as Error).message}`),\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tawait rebuild(file);\r\n\t\t});\r\n\r\n\t\twatcher.on(\"add\", async (file) => await rebuild(file));\r\n\r\n\t\tawait rebuild(\"initial\");\r\n\t}\r\n\r\n\tawait setupWatcher();\r\n}\r\n","import fs from \"node:fs\";\r\nimport path from \"node:path\";\r\nimport { AttachmentType, type ConfigType } from \"@bf6mods/sdk\";\r\nimport stringifyObject from \"stringify-object\";\r\nimport { MapId as MapIdEnum } from \"../resources/prepare/types/config.ts\";\r\nimport { startProject } from \"./init.ts\";\r\n\r\nasync function writeFileSafe(filePath: string, data: string | Buffer) {\r\n\tconst dir = path.dirname(filePath);\r\n\tawait fs.promises.mkdir(dir, { recursive: true });\r\n\tawait fs.promises.writeFile(filePath, data);\r\n}\r\n\r\nfunction getMapKeyByValue(value: string): keyof typeof MapIdEnum | undefined {\r\n\treturn Object.keys(MapIdEnum).find(\r\n\t\t(k) => MapIdEnum[k as keyof typeof MapIdEnum] === value,\r\n\t) as keyof typeof MapIdEnum | undefined;\r\n}\r\n\r\nexport async function importFile(input: string, output: string, name?: string) {\r\n\tconst workingDir = path.resolve(\".\");\r\n\tconst entrypoint = path.resolve(workingDir, input);\r\n\tconst outDir = path.resolve(workingDir, output);\r\n\r\n\tif (!fs.existsSync(entrypoint)) throw new Error(\"Cannot find strings file\");\r\n\r\n\tconst config = JSON.parse(\r\n\t\tawait fs.promises.readFile(entrypoint, { encoding: \"utf8\" }),\r\n\t) as ConfigType;\r\n\r\n\tif (!fs.existsSync(outDir))\r\n\t\tawait fs.promises.mkdir(outDir, { recursive: true });\r\n\r\n\tawait startProject(outDir, \"None\", name ?? config.name);\r\n\r\n\tlet typescriptFile: string | undefined;\r\n\tlet stringsFile: string | undefined;\r\n\tconst scenes: [string, string][] = [];\r\n\tconst promises: Promise<unknown>[] = [];\r\n\r\n\tif (config.attachments) {\r\n\t\tfor (const attachment of config.attachments) {\r\n\t\t\tif (attachment.attachmentType === AttachmentType.TypeScript)\r\n\t\t\t\ttypescriptFile = attachment.filename;\r\n\r\n\t\t\tif (attachment.attachmentType === AttachmentType.Strings)\r\n\t\t\t\tstringsFile = attachment.filename;\r\n\r\n\t\t\tif (attachment.attachmentType === AttachmentType.SpatialData) {\r\n\t\t\t\t// We'll just use the data attached to mapRotation instead\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\tpromises.push(\r\n\t\t\t\twriteFileSafe(\r\n\t\t\t\t\tpath.resolve(outDir, \"src\", attachment.filename),\r\n\t\t\t\t\tatob(attachment.attachmentData.original),\r\n\t\t\t\t),\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\r\n\t// Extract spatial scenes from mapRotation instead of guessing\r\n\tif (config.mapRotation?.length) {\r\n\t\tfor (const map of config.mapRotation) {\r\n\t\t\tpromises.push(\r\n\t\t\t\twriteFileSafe(\r\n\t\t\t\t\tpath.resolve(outDir, \"src\", \"scenes\", map.spatialAttachment.filename),\r\n\t\t\t\t\tatob(map.spatialAttachment.attachmentData.original),\r\n\t\t\t\t),\r\n\t\t\t);\r\n\r\n\t\t\tscenes.push([map.id, `src/scenes/${map.spatialAttachment.filename}`]);\r\n\t\t}\r\n\t}\r\n\r\n\t// build the new bf6.config.ts structure\r\n\tconst bf6Config = {\r\n\t\tname: name ?? config.name,\r\n\t\tdescription: config.description,\r\n\t\toutDir: \"dist\",\r\n\t\tentrypoint: typescriptFile ? `src/${typescriptFile}` : undefined,\r\n\t\tscenes: scenes\r\n\t\t\t? scenes.map(([id, path]) => [\r\n\t\t\t\t\t`MapId.${getMapKeyByValue(id) ?? id}`,\r\n\t\t\t\t\tpath,\r\n\t\t\t\t])\r\n\t\t\t: undefined,\r\n\t\tstrings: stringsFile ? `src/${stringsFile}` : undefined,\r\n\t\tgame: {\r\n\t\t\tmutators: config.mutators,\r\n\t\t\tassetRestrictions: config.assetRestrictions,\r\n\t\t\tgameMode: config.gameMode,\r\n\t\t\tteamComposition: config.teamComposition,\r\n\t\t},\r\n\t};\r\n\r\n\tconst bf6ConfigContent = `export default defineBf6Config(${stringifyWithRaw(\r\n\t\tbf6Config,\r\n\t)});\\n`;\r\n\r\n\tpromises.push(\r\n\t\twriteFileSafe(path.resolve(outDir, \"bf6.config.ts\"), bf6ConfigContent),\r\n\t);\r\n\r\n\tawait Promise.all(promises);\r\n}\r\n\r\nfunction stringifyWithRaw(value: unknown, options = {}) {\r\n\treturn stringifyObject(value, {\r\n\t\tindent: \" \", // 4 spaces\r\n\t\tsingleQuotes: true,\r\n\t\ttransform: (_obj, _prop, originalResult) => {\r\n\t\t\t// Remove quotes from MapId.* expressions\r\n\t\t\tif (/^['\"]MapId\\.[A-Za-z0-9_]+['\"]$/.test(originalResult)) {\r\n\t\t\t\treturn originalResult.slice(1, -1); // remove surrounding quotes\r\n\t\t\t}\r\n\t\t\treturn originalResult;\r\n\t\t},\r\n\t\t...options,\r\n\t});\r\n}\r\n","import child_process from \"node:child_process\";\r\nimport fs from \"node:fs\";\r\nimport path from \"node:path\";\r\nimport { fileURLToPath } from \"node:url\";\r\nimport * as prompts from \"@clack/prompts\";\r\nimport { importFile } from \"./import.ts\";\r\n\r\nconst __filename = fileURLToPath(import.meta.url);\r\nconst __dirname = path.dirname(__filename);\r\n\r\nconst templatesDir = path.resolve(__dirname, \"../resources/templates\");\r\n\r\nfunction renameFilesRecursively(dir: string, modName: string) {\r\n\tconst entries = fs.readdirSync(dir, { withFileTypes: true });\r\n\tfor (const entry of entries) {\r\n\t\tconst oldPath = path.join(dir, entry.name);\r\n\t\tlet newPath = oldPath;\r\n\r\n\t\t// Rename file or folder if it includes {name}\r\n\t\tif (entry.name.includes(\"{name}\")) {\r\n\t\t\tconst newName = entry.name.replace(\"{name}\", modName);\r\n\t\t\tnewPath = path.join(dir, newName);\r\n\t\t\tfs.renameSync(oldPath, newPath);\r\n\t\t}\r\n\r\n\t\t// If it's a bf6.config.ts, replace the {bf6ConfigName} placeholder\r\n\t\tif (entry.name === \"bf6.config.ts\") {\r\n\t\t\tlet content = fs.readFileSync(newPath, \"utf-8\");\r\n\t\t\tcontent = content.replace(/{bf6ConfigName}/g, modName);\r\n\t\t\tfs.writeFileSync(newPath, content, \"utf-8\");\r\n\t\t}\r\n\r\n\t\t// If it's a package.json, rewrite the \"name\" field\r\n\t\tif (entry.name === \"package.json\") {\r\n\t\t\tconst pkg = JSON.parse(fs.readFileSync(newPath, \"utf-8\"));\r\n\t\t\tpkg.name = modName;\r\n\t\t\tfs.writeFileSync(newPath, JSON.stringify(pkg, null, 2));\r\n\t\t}\r\n\r\n\t\t// Recurse into directories (using the new name if renamed)\r\n\t\tif (fs.statSync(newPath).isDirectory()) {\r\n\t\t\trenameFilesRecursively(newPath, modName);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport const templates = [\r\n\t\"Basic\",\r\n\t\"AcePursuit\",\r\n\t\"BombSquad\",\r\n\t\"Exfil\",\r\n\t\"Vertigo\",\r\n] as const;\r\n\r\nexport async function startProject(\r\n\tdestination: string,\r\n\ttemplate: (typeof templates)[number] | \"None\",\r\n\tname?: string,\r\n) {\r\n\tif ([\"AcePursuit\", \"BombSquad\", \"Exfil\", \"Vertigo\"].includes(template)) {\r\n\t\tconst importPath = path.resolve(templatesDir, `${template}.json`);\r\n\t\tawait importFile(importPath, destination, name);\r\n\t} else if (template === \"None\") {\r\n\t\t// Do nothing if none\r\n\t} else {\r\n\t\t// Handles the Basic and any other template provided\r\n\t\tconst templateDir = path.resolve(templatesDir, template);\r\n\t\tfs.cpSync(templateDir, destination, { recursive: true });\r\n\t}\r\n\r\n\tfs.cpSync(path.resolve(templatesDir, \"All\"), destination, {\r\n\t\trecursive: true,\r\n\t});\r\n\r\n\tif (name) renameFilesRecursively(destination, name);\r\n}\r\n\r\nexport function installDependencies(projectDir: string) {\r\n\ttry {\r\n\t\tchild_process.execSync(`npm install`, {\r\n\t\t\tstdio: \"inherit\",\r\n\t\t\tcwd: projectDir,\r\n\t\t});\r\n\t\treturn true;\r\n\t} catch (_err) {\r\n\t\treturn false;\r\n\t}\r\n}\r\n\r\nconst _defaultTargetDir = \"bf6-mod\";\r\nconst cancel = () => prompts.cancel(\"Operation cancelled\");\r\n\r\nfunction isEmpty(path: string) {\r\n\tconst files = fs.readdirSync(path);\r\n\treturn files.length === 0 || (files.length === 1 && files[0] === \".git\");\r\n}\r\n\r\nfunction emptyDir(dir: string) {\r\n\tif (!fs.existsSync(dir)) {\r\n\t\treturn;\r\n\t}\r\n\tfor (const file of fs.readdirSync(dir)) {\r\n\t\tif (file === \".git\") {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\tfs.rmSync(path.resolve(dir, file), { recursive: true, force: true });\r\n\t}\r\n}\r\n\r\nexport async function init(argTargetDir?: string) {\r\n\tprompts.intro(\"Initialize Bf6 Mod\");\r\n\r\n\tconst path = argTargetDir\r\n\t\t? argTargetDir\r\n\t\t: await prompts.text({\r\n\t\t\t\tmessage: \"Where should we create your project?\",\r\n\t\t\t\tplaceholder: \"./ace-pursuit\",\r\n\t\t\t\tvalidate: (value) => {\r\n\t\t\t\t\tif (!value) return \"Please enter a path.\";\r\n\t\t\t\t\tif (value[0] !== \".\") return \"Please enter a relative path.\";\r\n\t\t\t\t},\r\n\t\t\t});\r\n\tif (prompts.isCancel(path)) return cancel();\r\n\r\n\tlet name = await prompts.text({\r\n\t\tmessage: \"What is the name of your mod?\",\r\n\t\tplaceholder: \"Ace Pursuit\",\r\n\t\tvalidate: (value) => {\r\n\t\t\tif (!value.trim()) return \"Please enter a name.\";\r\n\t\t},\r\n\t});\r\n\tif (prompts.isCancel(name)) return cancel();\r\n\tname = name.trim();\r\n\r\n\tif (fs.existsSync(path) && !isEmpty(path)) {\r\n\t\tlet overwrite: \"yes\" | \"no\" | \"ignore\" | undefined;\r\n\t\tconst res = await prompts.select({\r\n\t\t\tmessage:\r\n\t\t\t\t(path === \".\" ? \"Current directory\" : `Target directory \"${path}\"`) +\r\n\t\t\t\t` is not empty. Please choose how to proceed:`,\r\n\t\t\toptions: [\r\n\t\t\t\t{\r\n\t\t\t\t\tlabel: \"Cancel operation\",\r\n\t\t\t\t\tvalue: \"no\",\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\tlabel: \"Remove existing files and continue\",\r\n\t\t\t\t\tvalue: \"yes\",\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\tlabel: \"Ignore files and continue\",\r\n\t\t\t\t\tvalue: \"ignore\",\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t});\r\n\t\tif (prompts.isCancel(res)) return cancel();\r\n\t\toverwrite = res;\r\n\r\n\t\tswitch (overwrite) {\r\n\t\t\tcase \"yes\":\r\n\t\t\t\temptyDir(path);\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"no\":\r\n\t\t\t\tcancel();\r\n\t\t\t\treturn;\r\n\t\t}\r\n\t}\r\n\r\n\tconst template = await prompts.select({\r\n\t\tmessage: \"Select a template:\",\r\n\t\toptions: templates.map((template) => {\r\n\t\t\treturn {\r\n\t\t\t\tlabel: template,\r\n\t\t\t\tvalue: template,\r\n\t\t\t};\r\n\t\t}),\r\n\t});\r\n\tif (prompts.isCancel(template)) return cancel();\r\n\r\n\tawait startProject(path, template, name);\r\n\r\n\tconst s = prompts.spinner();\r\n\ts.start(\"Installing via npm\");\r\n\tconst installed = installDependencies(path);\r\n\tif (installed) s.stop(\"Installed via npm\");\r\n\telse s.stop(\"Failed to install via npm\", 1);\r\n\r\n\tconst nextSteps = `cd ${path}\\nnpm run build`;\r\n\r\n\tprompts.note(nextSteps, \"Next steps.\");\r\n}\r\n","import fs from \"node:fs\";\r\nimport path from \"node:path\";\r\nimport { fileURLToPath } from \"node:url\";\r\nimport colors from \"colors\";\r\nimport { genExport, genInlineTypeImport } from \"knitwork\";\r\nimport { printToConsole } from \"./utils.js\";\r\n\r\nexport async function prepare() {\r\n\ttry {\r\n\t\tconst __filename = fileURLToPath(import.meta.url);\r\n\t\tconst __dirname = path.dirname(__filename);\r\n\r\n\t\tconst _workingDir = path.resolve(\".\");\r\n\t\tconst buildDir = path.resolve(\".bf6\");\r\n\r\n\t\tconst resources = path.resolve(__dirname, \"../resources/prepare\");\r\n\r\n\t\tfs.cpSync(\r\n\t\t\tpath.resolve(resources, \"tsconfig.json\"),\r\n\t\t\tpath.resolve(buildDir, \"tsconfig.json\"),\r\n\t\t);\r\n\t\tfs.cpSync(\r\n\t\t\tpath.resolve(resources, \"bf6.d.ts\"),\r\n\t\t\tpath.resolve(buildDir, \"bf6.d.ts\"),\r\n\t\t);\r\n\t\tfs.cpSync(\r\n\t\t\tpath.resolve(resources, \"types\", \"config.ts\"),\r\n\t\t\tpath.resolve(buildDir, \"types\", \"config.ts\"),\r\n\t\t);\r\n\r\n\t\tconst ConfigFileExports = genExport(\"./types/config.ts\", [\r\n\t\t\t\"defineBf6Config\",\r\n\t\t]);\r\n\t\tfs.writeFileSync(\r\n\t\t\tpath.resolve(buildDir, \"imports.d.ts\"),\r\n\t\t\t`${ConfigFileExports}\\n`,\r\n\t\t);\r\n\r\n\t\tconst augmentations: Record<string, string> = {\r\n\t\t\tdefineBf6Config: genInlineTypeImport(\r\n\t\t\t\t\"./types/config.ts\",\r\n\t\t\t\t`defineBf6Config`,\r\n\t\t\t),\r\n\t\t\tMapId: genInlineTypeImport(\"./types/config.ts\", `MapId`),\r\n\t\t};\r\n\r\n\t\tconst args = genNamespaceAugmentation(\"global\", augmentations);\r\n\t\tfs.writeFileSync(\r\n\t\t\tpath.resolve(buildDir, \"globals.d.ts\"),\r\n\t\t\t`export {}\\n\\n${args}\\n`,\r\n\t\t);\r\n\r\n\t\tprintToConsole(`${colors.green(\"✔\")} Types generated in .bf6`);\r\n\t} catch (error) {\r\n\t\tconsole.error(error);\r\n\t\tprintToConsole(`${colors.red(\"✗\")} Types failed to generate in .bf6`);\r\n\t}\r\n}\r\n\r\nconst genNamespaceAugmentation = (\r\n\tname: string,\r\n\tcontents: Record<string, string>,\r\n) => {\r\n\tif (!contents || Object.keys(contents).length === 0)\r\n\t\treturn `declare ${name} {}`;\r\n\tconst decls = Object.entries(contents)\r\n\t\t.map(([k, v]) => `\\tconst ${k}: ${v};`)\r\n\t\t.join(\"\\n\");\r\n\treturn `declare ${name} {\\n${decls}\\n}`;\r\n};\r\n","import colors from \"colors\";\r\nimport stripAnsi from \"strip-ansi\";\r\n\r\n/**\r\n * Safely prints a message with a right-aligned timestamp.\r\n */\r\nexport const printToConsole = (message: string) => {\r\n\tconst now = new Date();\r\n\tconst formattedTime = colors.grey(now.toLocaleTimeString());\r\n\tconst terminalWidth = process.stdout.columns || 80;\r\n\r\n\tconst timeLength = stripAnsi(formattedTime).length;\r\n\tconst messageLength = stripAnsi(message).length;\r\n\tconst available = terminalWidth - (messageLength + timeLength);\r\n\r\n\tconst spacing = available > 1 ? \" \".repeat(available) : \" \";\r\n\r\n\tconsole.log(`${message}${spacing}${formattedTime}`);\r\n};\r\n","export default function ansiRegex({onlyFirst = false} = {}) {\n\t// Valid string terminator sequences are BEL, ESC\\, and 0x9c\n\tconst ST = '(?:\\\\u0007|\\\\u001B\\\\u005C|\\\\u009C)';\n\n\t// OSC sequences only: ESC ] ... ST (non-greedy until the first ST)\n\tconst osc = `(?:\\\\u001B\\\\][\\\\s\\\\S]*?${ST})`;\n\n\t// CSI and related: ESC/C1, optional intermediates, optional params (supports ; and :) then final byte\n\tconst csi = '[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:\\\\d{1,4}(?:[;:]\\\\d{0,4})*)?[\\\\dA-PR-TZcf-nq-uy=><~]';\n\n\tconst pattern = `${osc}|${csi}`;\n\n\treturn new RegExp(pattern, onlyFirst ? undefined : 'g');\n}\n","import ansiRegex from 'ansi-regex';\n\nconst regex = ansiRegex();\n\nexport default function stripAnsi(string) {\n\tif (typeof string !== 'string') {\n\t\tthrow new TypeError(`Expected a \\`string\\`, got \\`${typeof string}\\``);\n\t}\n\n\t// Even though the regex is global, we don't need to reset the `.lastIndex`\n\t// because unlike `.exec()` and `.test()`, `.replace()` does it automatically\n\t// and doing it manually has a performance penalty.\n\treturn string.replace(regex, '');\n}\n"],"mappings":";;;AACA,SAAS,eA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AI;AACX,SAAO,WAAW,IAAI;AAAA,EAAO,KAAK;AAAA;AACnC;;;AP5DA,IAAM,UAAU,IAAI,QAAQ;AAE5B,QACE,KAAK,OAAO,KAAK,gBAAI,GAAG,EAAE,CAAC,CAAC,EAC5B,YAAY,gBAAI,WAAW,EAC3B,QAAQ,gBAAI,OAAO;AAErB,QACE,QAAQ,MAAM,EACd,SAAS,aAAa,EACtB,YAAY,sBAAsB,EAClC,OAAO,OAAO,cAAc;AAC5B,QAAM,KAAK,SAAS;AACrB,CAAC;AAEF,QACE,QAAQ,OAAO,EACf,YAAY,mBAAmB,EAC/B,OAAO,YAAY;AACnB,QAAM,MAAM;AACb,CAAC;AAEF,QACE,QAAQ,SAAS,EACjB,YAAY,+BAA+B,EAC3C,OAAO,YAAY;AACnB,QAAM,QAAQ;AACf,CAAC;AAEF,QACE,QAAQ,KAAK,EACb,YAAY,mDAAmD,EAC/D,OAAO,YAAY;AACnB,QAAM,IAAI;AACX,CAAC;AAEF,QACE,QAAQ,QAAQ,EAChB,SAAS,SAAS,EAClB,SAAS,UAAU,EACnB,YAAY,wDAAwD,EACpE,OAAO,OAAO,OAAO,WAAW;AAChC,QAAM,WAAW,OAAiB,MAAgB;AAClD,sBAAoB,MAAM;AAC3B,CAAC;AAEF,QAAQ,aAAa,CAAC,SAAS;AAC9B,MAAI,QAAQ,IAAI,cAAc,OAAQ,SAAQ,KAAK,CAAC;AACrD,CAAC;AAED,QAAQ,MAAM;","names":["MapId","fs","path","path","fs","fs","path","AttachmentType","fs","path","path","fs","cancel","path","fs","template","path","fs","AttachmentType","fs","path","fileURLToPath","colors","colors","colors","__filename","fileURLToPath","__dirname","path","fs","colors"]}
@@ -0,0 +1,2 @@
1
+ /// <reference path="imports.d.ts" />
2
+ /// <reference path="globals.d.ts" />
@@ -1,15 +1,14 @@
1
- {
2
- "compilerOptions": {
3
- "baseUrl": "..",
4
- "paths": { "#imports": ["./.bf6/imports"] },
5
- "target": "ES2020",
6
- "module": "NodeNext",
7
- "moduleResolution": "nodenext",
8
- "strict": true,
9
- "outDir": "dist",
10
- "types": [
11
- "@bf6mods/sdk"
12
- ],
13
- },
14
- "include": ["../**/*", "./bf6.d.ts"]
15
- }
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": "..",
4
+ "paths": { "#imports": ["./.bf6/imports"] },
5
+ "target": "ES2021",
6
+ "module": "NodeNext",
7
+ "moduleResolution": "nodenext",
8
+ "strict": true,
9
+ "allowImportingTsExtensions": true,
10
+ "noEmit": true,
11
+ "types": ["@bf6mods/sdk"]
12
+ },
13
+ "include": ["../**/*", "./bf6.d.ts"]
14
+ }
@@ -1,10 +1,145 @@
1
+ import type { ConfigType } from "@bf6mods/sdk";
2
+
3
+ export enum MapId {
4
+ FireStorm = "MP_FireStorm-ModBuilderCustom0",
5
+ SiegeOfCairo = "MP_Abbasid-ModBuilderCustom0",
6
+ EmpireState = "MP_Aftermath-ModBuilderCustom0",
7
+ IberianOffensive = "MP_Battery-ModBuilderCustom0",
8
+ LiberationPeak = "MP_Capstone-ModBuilderCustom0",
9
+ ManhattanBridge = "MP_Dumbo-ModBuilderCustom0",
10
+ SaintsQuarter = "MP_Limestone-ModBuilderCustom0",
11
+ NewSobekCity = "MP_Outskirts-ModBuilderCustom0",
12
+ MirakValley = "MP_Tungsten-ModBuilderCustom0",
13
+ }
14
+
15
+ /**
16
+ * Represents the root configuration for a Battlefield 6 mod project.
17
+ *
18
+ * This file combines both build-level settings (like entrypoints and output directories)
19
+ * and in-game configuration data (such as mutators and asset restrictions)
20
+ * under the `game` key.
21
+ *
22
+ * Use {@link defineBf6Config} to define and validate this structure
23
+ * in your `bf6.config.ts` file.
24
+ */
1
25
  export type Bf6Config = {
26
+ /**
27
+ * The human-readable name of the mod.
28
+ *
29
+ * Typically matches the project name used in the BF6 mod editor or
30
+ * the display name shown in the in-game mod browser.
31
+ */
32
+ name: string;
33
+
34
+ /**
35
+ * A short description of the mod’s purpose or content.
36
+ * Used for display and metadata purposes.
37
+ */
38
+ description: string;
39
+
40
+ /**
41
+ * The output directory where compiled or bundled files are written.
42
+ * Usually something like `"dist"` or `"build"`.
43
+ */
44
+ outDir: string;
45
+
46
+ /**
47
+ * Whether or not to output the built files like the entrypoint typescript file
48
+ */
49
+ outputArtifacts?: boolean;
50
+
51
+ /**
52
+ * The main entrypoint for your mod’s TypeScript source file.
53
+ *
54
+ * This is typically something like `"src/index.ts"` or `"src/main.ts"`.
55
+ */
2
56
  entrypoint?: string;
3
- tscn?: string;
57
+
58
+ /**
59
+ * One or more scene file paths (.json) that the mod includes.
60
+ * Can be a single string or an array of paths.
61
+ * Can be a directory if single string provided
62
+ */
63
+ scenes?: [MapId, string][];
64
+
65
+ /**
66
+ * Path to a JSON file or other source that defines localized strings
67
+ * used by the mod (optional).
68
+ */
4
69
  strings?: string;
5
- config?: string;
6
- }
7
70
 
71
+ /**
72
+ * Generate strings automatically
73
+ */
74
+ generateStrings?: boolean;
75
+
76
+ /**
77
+ * Controls whether build output should be minified.
78
+ *
79
+ * Can be a boolean (to toggle all minification),
80
+ * or an object specifying independent settings for JS and JSON files.
81
+ *
82
+ * @example
83
+ * ```ts
84
+ * minify: true
85
+ * // or
86
+ * minify: { js: true, json: false }
87
+ * ```
88
+ */
89
+ minify?:
90
+ | {
91
+ /** Whether to minify JavaScript output. */
92
+ js?: boolean;
93
+ /** Whether to minify JSON output. */
94
+ json?: boolean;
95
+ }
96
+ /** Enables or disables all minification. */
97
+ | boolean;
98
+
99
+ /**
100
+ * The underlying in-game configuration derived from `ConfigType`
101
+ * in the BF6 SDK. Includes gameplay-level details like mutators,
102
+ * asset restrictions, and team compositions.
103
+ *
104
+ * The following properties are **excluded**:
105
+ * - `attachments`
106
+ * - `workspace`
107
+ * - `mapRotation`
108
+ * - `name`
109
+ * - `description`
110
+ *
111
+ * since those are either redundant or handled elsewhere.
112
+ */
113
+ game: Omit<
114
+ ConfigType,
115
+ "attachments" | "workspace" | "mapRotation" | "name" | "description"
116
+ >;
117
+ };
118
+
119
+ /**
120
+ * Defines and validates a Battlefield 6 mod configuration object.
121
+ *
122
+ * This helper ensures your config is properly typed and can be
123
+ * statically analyzed by TypeScript.
124
+ *
125
+ * @example
126
+ * ```ts
127
+ * export default defineBf6Config({
128
+ * name: "My Custom Mod",
129
+ * description: "Adds custom rules",
130
+ * outDir: "dist",
131
+ * entrypoint: "src/main.ts",
132
+ * game: {
133
+ * mutators: [],
134
+ * assetRestrictions: {},
135
+ * teamComposition: [],
136
+ * },
137
+ * });
138
+ * ```
139
+ *
140
+ * @param bf6Config The configuration object to validate and return.
141
+ * @returns The validated Battlefield 6 configuration object.
142
+ */
8
143
  export function defineBf6Config(bf6Config: Bf6Config): Bf6Config {
9
144
  return bf6Config;
10
- };
145
+ }
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "type": "module",
9
9
  "devDependencies": {
10
- "@bf6mods/cli": "^1.0.0",
10
+ "@bf6mods/cli": "^1.0.1",
11
11
  "@bf6mods/sdk": "^1.0.1"
12
12
  }
13
13
  }
@@ -1,3 +1,7 @@
1
1
  export default defineBf6Config({
2
- entrypoint: 'src/index.ts',
2
+ outDir: 'dist',
3
+ entrypoint: 'src/index.ts',
4
+ name: '{bf6ConfigName}',
5
+ description: 'A basic example',
6
+ game: {},
3
7
  })
package/package.json CHANGED
@@ -1,41 +1,48 @@
1
- {
2
- "name": "@bf6mods/cli",
3
- "version": "1.0.0",
4
- "description": "CLI and library for bundling BF6 mods",
5
- "license": "MIT",
6
- "type": "module",
7
- "bin": {
8
- "bf6mods": "./dist/cli/index.js"
9
- },
10
- "main": "./dist/index.js",
11
- "types": "./dist/index.d.ts",
12
- "scripts": {
13
- "build": "tsup",
14
- "start": "cross-env EXIT_CODE=none tsx ./src/cli/index.ts"
15
- },
16
- "exports": {
17
- ".": {
18
- "types": "./dist/index.d.ts",
19
- "import": "./dist/index.js"
20
- }
21
- },
22
- "files": [
23
- "dist/"
24
- ],
25
- "dependencies": {
26
- "@bf6mods/sdk": "1.0.1",
27
- "chokidar": "^4.0.3",
28
- "colors": "^1.4.0",
29
- "commander": "^14.0.1",
30
- "inquirer": "^12.9.6",
31
- "jiti": "^2.6.1",
32
- "knitwork": "^1.2.0"
33
- },
34
- "publishConfig": {
35
- "access": "public"
36
- },
37
- "devDependencies": {
38
- "cross-env": "^10.1.0",
39
- "tsx": "^4.20.6"
40
- }
41
- }
1
+ {
2
+ "name": "@bf6mods/cli",
3
+ "version": "1.0.2",
4
+ "description": "CLI and library for bundling BF6 mods",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "bin": {
8
+ "bf6mods": "./dist/cli/index.js"
9
+ },
10
+ "main": "./dist/index.js",
11
+ "types": "./dist/index.d.ts",
12
+ "scripts": {
13
+ "build": "tsup",
14
+ "start": "cross-env EXIT_CODE=none tsx ./src/cli/index.ts"
15
+ },
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "import": "./dist/index.js"
20
+ }
21
+ },
22
+ "files": [
23
+ "dist/"
24
+ ],
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/bf6mods/bf6mods.git"
28
+ },
29
+ "dependencies": {
30
+ "@bf6mods/sdk": "1.0.2",
31
+ "@clack/prompts": "^0.11.0",
32
+ "chokidar": "^4.0.3",
33
+ "colors": "^1.4.0",
34
+ "commander": "^14.0.1",
35
+ "jiti": "^2.6.1",
36
+ "knitwork": "^1.2.0",
37
+ "rolldown": "^1.0.0-beta.43",
38
+ "stringify-object": "^6.0.0"
39
+ },
40
+ "publishConfig": {
41
+ "access": "public"
42
+ },
43
+ "devDependencies": {
44
+ "@types/stringify-object": "^4.0.5",
45
+ "cross-env": "^10.1.0",
46
+ "tsx": "^4.20.6"
47
+ }
48
+ }