myoperator-ui 0.0.207 → 0.0.208
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +12 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -18083,12 +18083,20 @@ async function update(components, options) {
|
|
|
18083
18083
|
for (const file of component.files) {
|
|
18084
18084
|
const relativePath = subDir ? path7.join(subDir, file.name) : file.name;
|
|
18085
18085
|
const filePath = path7.join(componentsDir, relativePath);
|
|
18086
|
-
const oldContent = await fs7.readFile(filePath, "utf-8");
|
|
18087
18086
|
const newContent = file.content;
|
|
18087
|
+
let oldContent;
|
|
18088
|
+
if (await fs7.pathExists(filePath)) {
|
|
18089
|
+
oldContent = await fs7.readFile(filePath, "utf-8");
|
|
18090
|
+
} else {
|
|
18091
|
+
oldContent = "";
|
|
18092
|
+
console.log(chalk6.green(` + ${relativePath} (new file)`));
|
|
18093
|
+
}
|
|
18088
18094
|
const hasChanges = hasRealChanges(oldContent, newContent);
|
|
18089
18095
|
changesInfo.push({ name: componentName, file: file.name, relativePath, oldContent, newContent, hasChanges });
|
|
18090
|
-
|
|
18091
|
-
|
|
18096
|
+
if (oldContent !== "") {
|
|
18097
|
+
const diff = generateDiff(oldContent, newContent, relativePath);
|
|
18098
|
+
console.log(diff);
|
|
18099
|
+
}
|
|
18092
18100
|
}
|
|
18093
18101
|
}
|
|
18094
18102
|
const componentsWithChanges = changesInfo.filter((c) => c.hasChanges);
|
|
@@ -18126,6 +18134,7 @@ async function update(components, options) {
|
|
|
18126
18134
|
await fs7.copy(filePath, backupPath);
|
|
18127
18135
|
backedUp.push(change.relativePath);
|
|
18128
18136
|
}
|
|
18137
|
+
await fs7.ensureDir(path7.dirname(filePath));
|
|
18129
18138
|
await fs7.writeFile(filePath, change.newContent);
|
|
18130
18139
|
updated.push(change.relativePath);
|
|
18131
18140
|
}
|