complete-cli 1.0.9 → 1.0.10
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.
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import { Command, Option } from "clipanion";
|
|
3
3
|
import { ReadonlySet } from "complete-common";
|
|
4
|
-
import { $, deleteFileOrDirectoryAsync, fatalError, isDirectory, isFileAsync,
|
|
4
|
+
import { $, deleteFileOrDirectoryAsync, fatalError, isDirectory, isFileAsync, readFileAsync, writeFileAsync, } from "complete-node";
|
|
5
5
|
import klawSync from "klaw-sync";
|
|
6
|
+
import os from "node:os";
|
|
6
7
|
import path from "node:path";
|
|
7
8
|
import { ACTION_YML, ACTION_YML_TEMPLATE_PATH, CWD, TEMPLATES_DYNAMIC_DIR, TEMPLATES_STATIC_DIR, } from "../constants.js";
|
|
8
9
|
import { getTruncatedText } from "./check/getTruncatedText.js";
|
|
@@ -108,8 +109,8 @@ async function compareTextFiles(projectFilePath, templateFilePath, verbose) {
|
|
|
108
109
|
console.log(`The contents of the following file do not match: ${chalk.red(projectFilePath)}`);
|
|
109
110
|
printTemplateLocation(templateFilePath);
|
|
110
111
|
if (verbose) {
|
|
111
|
-
const originalTemplateFile =
|
|
112
|
-
const originalProjectFile =
|
|
112
|
+
const originalTemplateFile = await readFileAsync(templateFilePath);
|
|
113
|
+
const originalProjectFile = await readFileAsync(projectFilePath);
|
|
113
114
|
console.log("--- Original template file: ---\n");
|
|
114
115
|
console.log(originalTemplateFile);
|
|
115
116
|
console.log();
|
|
@@ -123,8 +124,9 @@ async function compareTextFiles(projectFilePath, templateFilePath, verbose) {
|
|
|
123
124
|
console.log(projectFileObject.text);
|
|
124
125
|
console.log();
|
|
125
126
|
}
|
|
126
|
-
const
|
|
127
|
-
const
|
|
127
|
+
const tempDir = os.tmpdir();
|
|
128
|
+
const tempProjectFilePath = path.join(tempDir, "tempProjectFile.txt");
|
|
129
|
+
const tempTemplateFilePath = path.join(tempDir, "tempTemplateFile.txt");
|
|
128
130
|
await writeFileAsync(tempProjectFilePath, projectFileObject.text);
|
|
129
131
|
await writeFileAsync(tempTemplateFilePath, templateFileObject.text);
|
|
130
132
|
await $ `diff ${tempProjectFilePath} ${tempTemplateFilePath} --ignore-blank-lines`;
|
package/package.json
CHANGED
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
fatalError,
|
|
8
8
|
isDirectory,
|
|
9
9
|
isFileAsync,
|
|
10
|
-
readFile,
|
|
11
10
|
readFileAsync,
|
|
12
11
|
writeFileAsync,
|
|
13
12
|
} from "complete-node";
|
|
14
13
|
import klawSync from "klaw-sync";
|
|
14
|
+
import os from "node:os";
|
|
15
15
|
import path from "node:path";
|
|
16
16
|
import {
|
|
17
17
|
ACTION_YML,
|
|
@@ -203,8 +203,8 @@ async function compareTextFiles(
|
|
|
203
203
|
printTemplateLocation(templateFilePath);
|
|
204
204
|
|
|
205
205
|
if (verbose) {
|
|
206
|
-
const originalTemplateFile =
|
|
207
|
-
const originalProjectFile =
|
|
206
|
+
const originalTemplateFile = await readFileAsync(templateFilePath);
|
|
207
|
+
const originalProjectFile = await readFileAsync(projectFilePath);
|
|
208
208
|
|
|
209
209
|
console.log("--- Original template file: ---\n");
|
|
210
210
|
console.log(originalTemplateFile);
|
|
@@ -220,8 +220,9 @@ async function compareTextFiles(
|
|
|
220
220
|
console.log();
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
-
const
|
|
224
|
-
const
|
|
223
|
+
const tempDir = os.tmpdir();
|
|
224
|
+
const tempProjectFilePath = path.join(tempDir, "tempProjectFile.txt");
|
|
225
|
+
const tempTemplateFilePath = path.join(tempDir, "tempTemplateFile.txt");
|
|
225
226
|
|
|
226
227
|
await writeFileAsync(tempProjectFilePath, projectFileObject.text);
|
|
227
228
|
await writeFileAsync(tempTemplateFilePath, templateFileObject.text);
|