mirror of
https://gitee.com/bootx/dax-pay-ui.git
synced 2025-09-09 05:29:32 +00:00
fix: correct debugger code
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
/**
|
||||
* Generate additional configuration files when used for packaging. The file can be configured with some global variables, so that it can be changed directly externally without repackaging
|
||||
*/
|
||||
import { GLOB_CONFIG_FILE_NAME } from '../constant';
|
||||
import { GLOB_CONFIG_FILE_NAME, OUTPUT_DIR } from '../constant';
|
||||
import fs, { writeFileSync } from 'fs-extra';
|
||||
import chalk from 'chalk';
|
||||
|
||||
import { getCwdPath, getEnvConfig } from '../utils';
|
||||
import { getShortName } from '../getShortName';
|
||||
|
||||
import pkg from '../../package.json';
|
||||
|
||||
function createConfig(
|
||||
{
|
||||
configName,
|
||||
@@ -17,21 +19,19 @@ function createConfig(
|
||||
) {
|
||||
try {
|
||||
const windowConf = `window.${configName}`;
|
||||
const outDir = 'dist';
|
||||
// Ensure that the variable will not be modified
|
||||
const configStr = `${windowConf}=${JSON.stringify(config)};
|
||||
|
||||
Object.freeze(${windowConf});
|
||||
Object.defineProperty(window, "${configName}", {
|
||||
configurable: false,
|
||||
writable: false,
|
||||
});
|
||||
`;
|
||||
fs.mkdirp(getCwdPath(outDir));
|
||||
writeFileSync(getCwdPath(`${outDir}/${configFileName}`), configStr);
|
||||
`.replace(/\s/g, '');
|
||||
fs.mkdirp(getCwdPath(OUTPUT_DIR));
|
||||
writeFileSync(getCwdPath(`${OUTPUT_DIR}/${configFileName}`), configStr);
|
||||
|
||||
console.log(chalk.cyan('✨ configuration file is build successfully:'));
|
||||
console.log(chalk.gray(outDir + '/' + chalk.green(configFileName)) + '\n');
|
||||
console.log(chalk.cyan(`✨ [${pkg.name}]`) + ` - configuration file is build successfully:`);
|
||||
console.log(chalk.gray(OUTPUT_DIR + '/' + chalk.green(configFileName)) + '\n');
|
||||
} catch (error) {
|
||||
console.log(chalk.red('configuration file configuration file failed to package:\n' + error));
|
||||
}
|
||||
|
@@ -4,6 +4,8 @@ import { argv } from 'yargs';
|
||||
import { runBuildConfig } from './buildConf';
|
||||
import chalk from 'chalk';
|
||||
|
||||
import pkg from '../../package.json';
|
||||
|
||||
export const runBuild = async () => {
|
||||
try {
|
||||
const argvList = argv._;
|
||||
@@ -12,7 +14,7 @@ export const runBuild = async () => {
|
||||
if (!argvList.includes('no-conf')) {
|
||||
await runBuildConfig();
|
||||
}
|
||||
console.log(chalk.green.bold('✨ vite build successfully!\n'));
|
||||
console.log(`✨ ${chalk.cyan(`[${pkg.name}]`)}` + ' - build successfully!');
|
||||
} catch (error) {
|
||||
console.log(chalk.red('vite build error:\n' + error));
|
||||
process.exit(1);
|
||||
|
Reference in New Issue
Block a user