MCPcopy Create free account
hub / github.com/msgbyte/tailchat / buildTailchatServer

Function buildTailchatServer

server/scripts/build.ts:8–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6import execa from 'execa';
7
8async function buildTailchatServer() {
9 const spinner = ora({
10 prefixText: 'Tailchat Server',
11 });
12
13 try {
14 spinner.start('Start compiling');
15 await fs.remove('./dist');
16 spinner.info('Compiling TS code');
17 await compileTsCode();
18 spinner.info('Moving static resource files');
19 await Promise.all([
20 fs.copy('./public', './dist/public', { recursive: true }),
21 fs.copy('./locales', './dist/locales', { recursive: true }),
22 fs.copy('./views', './dist/views', { recursive: true }),
23 fs.copy(
24 './services/openapi/oidc/views',
25 './dist/services/openapi/oidc/views',
26 { recursive: true }
27 ),
28 ]);
29
30 if (process.platform !== 'win32' || (await isAdmin())) {
31 spinner.info('Building plugin dependent symlink');
32 const nodeModulesList = await glob('./plugins/*/node_modules/*');
33 for (const item of nodeModulesList) {
34 const src = path.resolve(__dirname, '../', item);
35 const dest = path.resolve(__dirname, '../dist', item);
36
37 spinner.text = `Building Symlink: ${src} -> ${dest}`;
38
39 await fs.createSymlink(src, dest, 'dir');
40 }
41 } else {
42 spinner.warn(
43 'You are run command in windows without admin permit, create symlink will be skip'
44 );
45 }
46
47 spinner.succeed('Compiled!');
48 } catch (e) {
49 console.error(e);
50 spinner.fail('Compilation failed!');
51 }
52}
53
54buildTailchatServer();
55

Callers 1

build.tsFile · 0.85

Calls 7

compileTsCodeFunction · 0.85
isAdminFunction · 0.85
startMethod · 0.80
infoMethod · 0.80
warnMethod · 0.80
errorMethod · 0.80
allMethod · 0.45

Tested by

no test coverage detected