MCPcopy Create free account
hub / github.com/Crain99/cc-reverse / generateProject

Function generateProject

src/core/projectGenerator.js:23–61  ·  view source on GitHub ↗

* 生成项目文件 * @returns {Promise }

()

Source from the content-addressed store, hash-verified

21 const project = this.createProjectConfig();
22 const jsconfig = this.createJSConfig();
23 const tsconfig = this.createTSConfig();
24 const settings = this.createProjectSettings();
25
26 const settingsDir = path.join(global.paths.output, 'settings');
27 await fsp.mkdir(settingsDir, { recursive: true });
28
29 await fsp.writeFile(
30 path.join(settingsDir, 'project.json'),
31 JSON.stringify(settings, null, 2),
32 );
33
34 await fsp.writeFile(
35 path.join(global.paths.output, 'project.json'),
36 JSON.stringify(project, null, 2),
37 );
38
39 await fsp.writeFile(
40 path.join(global.paths.output, 'jsconfig.json'),
41 JSON.stringify(jsconfig, null, 2),
42 );
43
44 await fsp.writeFile(
45 path.join(global.paths.output, 'tsconfig.json'),
46 JSON.stringify(tsconfig, null, 2),
47 );
48
49 logger.info('项目配置文件生成完成');
50 } catch (err) {
51 logger.error('生成项目配置文件时出错:', err);
52 throw err;
53 }
54 },
55
56 /**
57 * 生成项目配置
58 * @param {string} name 项目名称
59 * @returns {Object}
60 */
61 createProjectConfig(name = 'project') {
62 const version = this.getProjectVersion();
63
64 return {

Callers

nothing calls this directly

Calls 1

writeFileFunction · 0.50

Tested by

no test coverage detected