Match-id-599b1f351f38afaf0126ce9149f1c9aad71655c4
This commit is contained in:
commit
e507035f8e
|
@ -53,7 +53,6 @@ class BasicGenerator extends Generator {
|
||||||
readStream.pipe(writeStream);
|
readStream.pipe(writeStream);
|
||||||
readStream.on('error', err => console.error(err));
|
readStream.on('error', err => console.error(err));
|
||||||
writeStream.on('error', err => console.error(err));
|
writeStream.on('error', err => console.error(err));
|
||||||
// writeStream.on('finish', () => console.log(`Copied ${src} to ${dest}`));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -28,7 +28,6 @@ export default (api: any) => {
|
||||||
api.applyHook({ name: 'beforeCompile', args: state });
|
api.applyHook({ name: 'beforeCompile', args: state });
|
||||||
state.forEach((s: any) => {
|
state.forEach((s: any) => {
|
||||||
webpack(s.config, (err: any, stats: any) => {
|
webpack(s.config, (err: any, stats: any) => {
|
||||||
// api.applyHook({ name: 'afterCompile' });
|
|
||||||
if (err || stats.hasErrors()) {
|
if (err || stats.hasErrors()) {
|
||||||
api.logger.error(`Build failed.err: ${err}, stats:${stats}`);
|
api.logger.error(`Build failed.err: ${err}, stats:${stats}`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ export default (api: API) => {
|
||||||
|
|
||||||
if (api.userConfig.devBuildConfig.devProxy) {
|
if (api.userConfig.devBuildConfig.devProxy) {
|
||||||
devServerOptions.onBeforeSetupMiddleware = (devServer: WebpackDevServer) => {
|
devServerOptions.onBeforeSetupMiddleware = (devServer: WebpackDevServer) => {
|
||||||
setupProxy(devServer.app, api)
|
setupProxy(devServer.app, api);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ export default (api: API) => {
|
||||||
api.applyHook({ name: 'afterStartDevServer' });
|
api.applyHook({ name: 'afterStartDevServer' });
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
api.logger.error("Can't find config");
|
api.logger.error('Can\'t find config');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'vite':
|
case 'vite':
|
||||||
|
@ -71,9 +71,10 @@ export default (api: API) => {
|
||||||
server.printUrls();
|
server.printUrls();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
api.logger.error("Can't find config");
|
api.logger.error('Can\'t find config');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -42,6 +42,8 @@ export default (api: API) => {
|
||||||
args._.shift();
|
args._.shift();
|
||||||
const isESM = api.packageJson['type'] === 'module';
|
const isESM = api.packageJson['type'] === 'module';
|
||||||
await generateJest(args, api.cwd, isESM);
|
await generateJest(args, api.cwd, isESM);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -191,13 +191,7 @@ export default class Hub {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.userConfig.buildConfig.forEach((userBuildConfig) => {
|
this.userConfig.buildConfig.forEach((userBuildConfig) => {
|
||||||
// if (typeof userBuildConfig === 'string') {
|
|
||||||
// const name = this.getConfigName(userBuildConfig);
|
|
||||||
// this.buildConfigPath.push({name, path: userBuildConfig});
|
|
||||||
// }
|
|
||||||
if (typeof userBuildConfig === 'object') {
|
if (typeof userBuildConfig === 'object') {
|
||||||
// const name = userBuildConfig.name;
|
|
||||||
// const path = userBuildConfig.path;
|
|
||||||
this.buildConfigPath.push(userBuildConfig);
|
this.buildConfigPath.push(userBuildConfig);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -18,7 +18,6 @@ import fs from 'fs';
|
||||||
import { build as esbuild, Plugin } from 'esbuild';
|
import { build as esbuild, Plugin } from 'esbuild';
|
||||||
|
|
||||||
const buildConfig = async (fileName: string, format: 'esm' | 'cjs' = 'esm'): Promise<string> => {
|
const buildConfig = async (fileName: string, format: 'esm' | 'cjs' = 'esm'): Promise<string> => {
|
||||||
|
|
||||||
// 外部依赖不构建参与构建,减少执行时间
|
// 外部依赖不构建参与构建,减少执行时间
|
||||||
const pluginExternalDeps: Plugin = {
|
const pluginExternalDeps: Plugin = {
|
||||||
name: 'plugin-external-deps',
|
name: 'plugin-external-deps',
|
||||||
|
|
|
@ -93,8 +93,8 @@ function generateRoutes(app: any) {
|
||||||
respond instanceof Function
|
respond instanceof Function
|
||||||
? respond
|
? respond
|
||||||
: (_req: any, res: { send: (arg0: any) => void }) => {
|
: (_req: any, res: { send: (arg0: any) => void }) => {
|
||||||
res.send(respond);
|
res.send(respond);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|
|
@ -127,7 +127,6 @@ function copyFiles(copyPairs) {
|
||||||
name: 'copy-files',
|
name: 'copy-files',
|
||||||
generateBundle() {
|
generateBundle() {
|
||||||
copyPairs.forEach(({ from, to }) => {
|
copyPairs.forEach(({ from, to }) => {
|
||||||
console.log(`copy files: ${from} → ${to}`);
|
|
||||||
fs.copyFileSync(from, to);
|
fs.copyFileSync(from, to);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -19,9 +19,9 @@ import { Props } from '../utils/Interface';
|
||||||
function getInitValue(dom: HTMLInputElement, props: Props) {
|
function getInitValue(dom: HTMLInputElement, props: Props) {
|
||||||
const { value, defaultValue, checked, defaultChecked } = props;
|
const { value, defaultValue, checked, defaultChecked } = props;
|
||||||
|
|
||||||
const defaultValueStr = defaultValue != null ? defaultValue : '';
|
const defaultValueStr = defaultValue !== null && defaultValue !== undefined ? defaultValue : '';
|
||||||
const initValue = value != null ? value : defaultValueStr;
|
const initValue = value !== null && value !== undefined ? value : defaultValueStr;
|
||||||
const initChecked = checked != null ? checked : defaultChecked;
|
const initChecked = checked !== null && checked !== undefined ? checked : defaultChecked;
|
||||||
|
|
||||||
return { initValue, initChecked };
|
return { initValue, initChecked };
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ function getInitValue(props: Props) {
|
||||||
let initValue = defaultValue;
|
let initValue = defaultValue;
|
||||||
|
|
||||||
// children content存在时,会覆盖defaultValue
|
// children content存在时,会覆盖defaultValue
|
||||||
if (children != null) {
|
if (children !== null && children !== undefined) {
|
||||||
// 子节点不是纯文本,则取第一个子节点
|
// 子节点不是纯文本,则取第一个子节点
|
||||||
initValue = children instanceof Array ? children[0] : children;
|
initValue = children instanceof Array ? children[0] : children;
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ export function updateTextareaValue(dom: HTMLTextAreaElement, props: Props, isIn
|
||||||
} else {
|
} else {
|
||||||
// 获取当前节点的 value 值
|
// 获取当前节点的 value 值
|
||||||
let value = props.value;
|
let value = props.value;
|
||||||
if (value != null) {
|
if (value !== null && value !== undefined) {
|
||||||
value = String(value);
|
value = String(value);
|
||||||
// 当且仅当值实际发生变化时才去设置节点的value值
|
// 当且仅当值实际发生变化时才去设置节点的value值
|
||||||
if (dom.value !== value) {
|
if (dom.value !== value) {
|
||||||
|
|
Loading…
Reference in New Issue