!1077 watchmode类型是string,修正判断规则

Merge pull request !1077 from houhaoyu/cherry-pick-1662455601
This commit is contained in:
openharmony_ci
2022-09-07 15:39:46 +00:00
committed by Gitee
3 changed files with 14 additions and 14 deletions
+3 -3
View File
@@ -281,7 +281,7 @@ export class ResultStates {
}
private shouldWriteChangedList(watchModifiedFiles: string[], watchRemovedFiles: string[]): boolean {
return projectConfig.compileMode === ESMODULE && process.env.watchMode && !projectConfig.isPreview &&
return projectConfig.compileMode === ESMODULE && process.env.watchMode === 'true' && !projectConfig.isPreview &&
projectConfig.outChangedFileList && (watchRemovedFiles.length + watchModifiedFiles.length) &&
!(watchModifiedFiles.length === 1 && watchModifiedFiles[0] == projectConfig.projectPath);
}
@@ -372,13 +372,13 @@ export class ResultStates {
if (this.noteCount > 0) {
resultInfo += ` NOTE:${this.noteCount}`;
}
if (result === 'SUCCESS ' && process.env.watchMode) {
if (result === 'SUCCESS ' && process.env.watchMode === 'true') {
this.printPreviewResult(resultInfo);
} else {
logger.info(this.blue, 'COMPILE RESULT:' + result + `{${resultInfo}}`, this.reset);
}
} else {
if (process.env.watchMode) {
if (process.env.watchMode === 'true') {
this.printPreviewResult();
} else {
console.info(this.blue, 'COMPILE RESULT:SUCCESS ', this.reset);
+8 -8
View File
@@ -205,7 +205,7 @@ export class GenAbcPlugin {
function clearGlobalInfo() {
// fix bug of multi trigger
if (!process.env.watchMode) {
if (process.env.watchMode !== 'true') {
intermediateJsBundle = [];
}
moduleInfos = [];
@@ -535,7 +535,7 @@ export function initAbcEnv() : string[] {
}
function invokeCluterModuleToAbc(): void {
if (process.env.watchMode) {
if (process.env.watchMode === 'true') {
process.exitCode = SUCCESS;
}
filterIntermediateModuleByHashJson(buildPathInfo, moduleInfos);
@@ -579,7 +579,7 @@ function invokeCluterModuleToAbc(): void {
if (count_ === totalWorkerNumber) {
writeModuleHashJson();
clearGlobalInfo();
if (process.env.watchMode) {
if (process.env.watchMode === 'true') {
console.info(blue, 'COMPILE RESULT:SUCCESS ', reset);
}
}
@@ -663,7 +663,7 @@ function judgeModuleWorkersToGenAbc(callback): void {
}
function invokeWorkersToGenAbc(): void {
if (process.env.watchMode) {
if (process.env.watchMode === 'true') {
process.exitCode = SUCCESS;
}
let cmdPrefix: string = '';
@@ -715,7 +715,7 @@ function invokeWorkersToGenAbc(): void {
count_++;
if (count_ === workerNumber) {
// for preview of with incre compile
if (process.env.watchMode) {
if (process.env.watchMode === 'true') {
processExtraAssetForBundle();
console.info(red, 'COMPILE RESULT:SUCCESS ', reset);
}
@@ -729,7 +729,7 @@ function invokeWorkersToGenAbc(): void {
});
// for preview of without incre compile
if (workerNumber === 0 && process.env.watchMode) {
if (workerNumber === 0 && process.env.watchMode === 'true') {
processExtraAssetForBundle();
}
}
@@ -822,7 +822,7 @@ function writeModuleHashJson(): void {
return;
}
// fix bug of multi trigger
if (!process.env.watchMode || delayCount < 1) {
if (process.env.watchMode !== 'true' || delayCount < 1) {
fs.writeFileSync(hashFilePath, JSON.stringify(moduleHashJsonObject));
}
}
@@ -898,7 +898,7 @@ function writeHashJson(): void {
return;
}
// fix bug of multi trigger
if (!process.env.watchMode || delayCount < 1) {
if (process.env.watchMode !== 'true' || delayCount < 1) {
fs.writeFileSync(hashFilePath, JSON.stringify(hashJsonObject));
}
}
+3 -3
View File
@@ -192,7 +192,7 @@ function visitAllNode(node: ts.Node, sourceFile: ts.SourceFile, defaultNameFromP
if (ts.isExportDeclaration(node) && node.exportClause &&
ts.isNamedExports(node.exportClause) && node.exportClause.elements) {
node.exportClause.elements.forEach(item => {
if (process.env.watchMode) {
if (process.env.watchMode === 'true') {
exportCollection.add((item.propertyName ? item.propertyName : item.name).escapedText.toString());
}
if (item.name && ts.isIdentifier(item.name)) {
@@ -222,7 +222,7 @@ function visitAllNode(node: ts.Node, sourceFile: ts.SourceFile, defaultNameFromP
}
if (ts.isExportDeclaration(node) && node.moduleSpecifier &&
ts.isStringLiteral(node.moduleSpecifier)) {
if (process.env.watchMode && node.exportClause && ts.isNamedExports(node.exportClause) &&
if (process.env.watchMode === 'true' && node.exportClause && ts.isNamedExports(node.exportClause) &&
node.exportClause.elements) {
node.exportClause.elements.forEach(item => {
exportCollection.add((item.propertyName ? item.propertyName : item.name).escapedText.toString());
@@ -290,7 +290,7 @@ function collectSpecialFunctionNode(node: ts.FunctionDeclaration, asNameFromPare
function isExportEntry(node: ts.ClassDeclaration, log: LogInfo[], entryCollection: Set<string>,
exportCollection: Set<string>, defaultCollection: Set<string>, fileResolvePath: string,
sourceFile: ts.SourceFile): void {
if (process.env.watchMode && node && node.decorators) {
if (process.env.watchMode === 'true' && node && node.decorators) {
let existExport: boolean = false;
let existEntry: boolean = false;
if (node.modifiers) {