mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-28 11:41:04 +00:00
fix: windows build issue and add prettier
This commit is contained in:
parent
a5a6bddc31
commit
8d8449079d
2 changed files with 16 additions and 2 deletions
|
|
@ -3,6 +3,7 @@ import { fileURLToPath } from 'node:url';
|
|||
import { dirname, join } from 'node:path';
|
||||
import { build } from 'esbuild';
|
||||
import { buildConfig } from './esbuild.config.mjs';
|
||||
import prettier from 'prettier';
|
||||
|
||||
const assetsDir = dirname(fileURLToPath(import.meta.url));
|
||||
const srcDir = join(assetsDir, 'src');
|
||||
|
|
@ -83,6 +84,15 @@ const templateModule = `/**
|
|||
export const HTML_TEMPLATE = ${JSON.stringify(htmlOutput)};
|
||||
`;
|
||||
|
||||
const formattedTemplateModule = await prettier.format(templateModule, {
|
||||
parser: 'typescript',
|
||||
singleQuote: true,
|
||||
semi: true,
|
||||
trailingComma: 'all',
|
||||
printWidth: 80,
|
||||
tabWidth: 2,
|
||||
});
|
||||
|
||||
await writeFile(join(assetsDistDir, 'index.html'), htmlOutput);
|
||||
await writeFile(join(packageDistDir, 'index.html'), htmlOutput);
|
||||
await writeFile(templateModulePath, templateModule);
|
||||
await writeFile(templateModulePath, formattedTemplateModule);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,11 @@ if (assetBuilds.length === 0) {
|
|||
|
||||
const runCommand = ({ command, args, cwd, label }) =>
|
||||
new Promise((resolve, reject) => {
|
||||
const child = spawn(command, args, { cwd, stdio: 'inherit' });
|
||||
const child = spawn(command, args, {
|
||||
cwd,
|
||||
stdio: 'inherit',
|
||||
shell: process.platform === 'win32',
|
||||
});
|
||||
|
||||
child.on('error', reject);
|
||||
child.on('exit', (code) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue