Match-id-599b1f351f38afaf0126ce9149f1c9aad71655c4

This commit is contained in:
* 2023-09-18 20:01:40 +08:00
commit e507035f8e
10 changed files with 13 additions and 20 deletions

View File

@ -53,7 +53,6 @@ class BasicGenerator extends Generator {
readStream.pipe(writeStream);
readStream.on('error', err => console.error(err));
writeStream.on('error', err => console.error(err));
// writeStream.on('finish', () => console.log(`Copied ${src} to ${dest}`));
}
/**

View File

@ -28,7 +28,6 @@ export default (api: any) => {
api.applyHook({ name: 'beforeCompile', args: state });
state.forEach((s: any) => {
webpack(s.config, (err: any, stats: any) => {
// api.applyHook({ name: 'afterCompile' });
if (err || stats.hasErrors()) {
api.logger.error(`Build failed.err: ${err}, stats:${stats}`);
}

View File

@ -45,7 +45,7 @@ export default (api: API) => {
if (api.userConfig.devBuildConfig.devProxy) {
devServerOptions.onBeforeSetupMiddleware = (devServer: WebpackDevServer) => {
setupProxy(devServer.app, api)
setupProxy(devServer.app, api);
}
}
@ -58,7 +58,7 @@ export default (api: API) => {
api.applyHook({ name: 'afterStartDevServer' });
});
} else {
api.logger.error("Can't find config");
api.logger.error('Can\'t find config');
}
break;
case 'vite':
@ -71,9 +71,10 @@ export default (api: API) => {
server.printUrls();
});
} else {
api.logger.error("Can't find config");
api.logger.error('Can\'t find config');
}
break;
default:
}
},
});

View File

@ -42,6 +42,8 @@ export default (api: API) => {
args._.shift();
const isESM = api.packageJson['type'] === 'module';
await generateJest(args, api.cwd, isESM);
break;
default:
}
},
});

View File

@ -191,13 +191,7 @@ export default class Hub {
}
} else {
this.userConfig.buildConfig.forEach((userBuildConfig) => {
// if (typeof userBuildConfig === 'string') {
// const name = this.getConfigName(userBuildConfig);
// this.buildConfigPath.push({name, path: userBuildConfig});
// }
if (typeof userBuildConfig === 'object') {
// const name = userBuildConfig.name;
// const path = userBuildConfig.path;
this.buildConfigPath.push(userBuildConfig);
}
})

View File

@ -18,7 +18,6 @@ import fs from 'fs';
import { build as esbuild, Plugin } from 'esbuild';
const buildConfig = async (fileName: string, format: 'esm' | 'cjs' = 'esm'): Promise<string> => {
// 外部依赖不构建参与构建,减少执行时间
const pluginExternalDeps: Plugin = {
name: 'plugin-external-deps',

View File

@ -93,8 +93,8 @@ function generateRoutes(app: any) {
respond instanceof Function
? respond
: (_req: any, res: { send: (arg0: any) => void }) => {
res.send(respond);
}
res.send(respond);
}
);
} catch (error) {
console.error(error);

View File

@ -127,7 +127,6 @@ function copyFiles(copyPairs) {
name: 'copy-files',
generateBundle() {
copyPairs.forEach(({ from, to }) => {
console.log(`copy files: ${from}${to}`);
fs.copyFileSync(from, to);
});
},

View File

@ -19,9 +19,9 @@ import { Props } from '../utils/Interface';
function getInitValue(dom: HTMLInputElement, props: Props) {
const { value, defaultValue, checked, defaultChecked } = props;
const defaultValueStr = defaultValue != null ? defaultValue : '';
const initValue = value != null ? value : defaultValueStr;
const initChecked = checked != null ? checked : defaultChecked;
const defaultValueStr = defaultValue !== null && defaultValue !== undefined ? defaultValue : '';
const initValue = value !== null && value !== undefined ? value : defaultValueStr;
const initChecked = checked !== null && checked !== undefined ? checked : defaultChecked;
return { initValue, initChecked };
}

View File

@ -24,7 +24,7 @@ function getInitValue(props: Props) {
let initValue = defaultValue;
// children content存在时会覆盖defaultValue
if (children != null) {
if (children !== null && children !== undefined) {
// 子节点不是纯文本,则取第一个子节点
initValue = children instanceof Array ? children[0] : children;
}
@ -53,7 +53,7 @@ export function updateTextareaValue(dom: HTMLTextAreaElement, props: Props, isIn
} else {
// 获取当前节点的 value 值
let value = props.value;
if (value != null) {
if (value !== null && value !== undefined) {
value = String(value);
// 当且仅当值实际发生变化时才去设置节点的value值
if (dom.value !== value) {