textrun-repo 0.3.1 → 0.4.0
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/executable.js +4 -4
- package/dist/existing-file-content.js +4 -4
- package/dist/existing-file.js +4 -4
- package/package.json +9 -10
package/dist/executable.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import * as color from "colorette";
|
|
2
1
|
import * as fs from "fs";
|
|
3
2
|
import { promises as fsp } from "fs";
|
|
3
|
+
import { styleText } from "node:util";
|
|
4
4
|
import * as path from "path";
|
|
5
5
|
import * as textRunner from "text-runner-engine";
|
|
6
6
|
export async function executable(action) {
|
|
7
7
|
const fileName = action.region.text();
|
|
8
8
|
const filePath = path.join(action.location.file.directory().platformified(), fileName);
|
|
9
|
-
action.name(`repository contains executable ${
|
|
9
|
+
action.name(`repository contains executable ${styleText("cyan", filePath)}`);
|
|
10
10
|
const fullPath = action.configuration.sourceDir.joinStr(filePath);
|
|
11
11
|
action.log(`ls ${fullPath}`);
|
|
12
12
|
try {
|
|
@@ -18,9 +18,9 @@ export async function executable(action) {
|
|
|
18
18
|
}
|
|
19
19
|
switch (err.code) {
|
|
20
20
|
case "EACCES":
|
|
21
|
-
throw new textRunner.UserError(`file is not executable: ${
|
|
21
|
+
throw new textRunner.UserError(`file is not executable: ${styleText("cyan", filePath)}`, "", action.location);
|
|
22
22
|
case "ENOENT":
|
|
23
|
-
throw new textRunner.UserError(`file not found: ${
|
|
23
|
+
throw new textRunner.UserError(`file not found: ${styleText("cyan", filePath)}`, "", action.location);
|
|
24
24
|
default:
|
|
25
25
|
throw err;
|
|
26
26
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as assertNoDiff from "assert-no-diff";
|
|
2
|
-
import * as color from "colorette";
|
|
3
2
|
import eol from "eol";
|
|
4
3
|
import { promises as fs } from "fs";
|
|
4
|
+
import { styleText } from "node:util";
|
|
5
5
|
import * as path from "path";
|
|
6
6
|
import * as textRunner from "text-runner-engine";
|
|
7
7
|
export async function existingFileContent(action) {
|
|
@@ -13,7 +13,7 @@ export async function existingFileContent(action) {
|
|
|
13
13
|
}
|
|
14
14
|
let expectedContent = action.region.textInNodeOfTypes("fence", "code");
|
|
15
15
|
const filePath = path.join(action.location.file.directory().platformified(), relativeBaseDir, fileName);
|
|
16
|
-
action.name(`document content matches source code file ${
|
|
16
|
+
action.name(`document content matches source code file ${styleText("cyan", filePath)}`);
|
|
17
17
|
const fullPath = action.configuration.sourceDir.joinStr(filePath);
|
|
18
18
|
action.log(`cat ${fullPath}`);
|
|
19
19
|
let actualContent;
|
|
@@ -25,7 +25,7 @@ export async function existingFileContent(action) {
|
|
|
25
25
|
throw err;
|
|
26
26
|
}
|
|
27
27
|
if (err.code === "ENOENT") {
|
|
28
|
-
throw new Error(`file not found: ${
|
|
28
|
+
throw new Error(`file not found: ${styleText("cyan", filePath)}`);
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
31
|
throw err;
|
|
@@ -37,7 +37,7 @@ export async function existingFileContent(action) {
|
|
|
37
37
|
assertNoDiff.trimmedLines(actualContent, expectedContent);
|
|
38
38
|
}
|
|
39
39
|
catch (err) {
|
|
40
|
-
throw new textRunner.UserError(`mismatching content in ${
|
|
40
|
+
throw new textRunner.UserError(`mismatching content in ${styleText("cyan", styleText("bold", filePath))}`, textRunner.errorMessage(err));
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
//# sourceMappingURL=existing-file-content.js.map
|
package/dist/existing-file.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as color from "colorette";
|
|
2
1
|
import { promises as fs } from "fs";
|
|
2
|
+
import { styleText } from "node:util";
|
|
3
3
|
import * as textRunner from "text-runner-engine";
|
|
4
4
|
export async function existingFile(action) {
|
|
5
5
|
const fileName = action.region.text();
|
|
6
|
-
action.name(`document mentions source code file ${
|
|
6
|
+
action.name(`document mentions source code file ${styleText("cyan", fileName)}`);
|
|
7
7
|
const fullPath = action.configuration.sourceDir.joinStr(fileName);
|
|
8
8
|
action.log(`ls ${fullPath}`);
|
|
9
9
|
try {
|
|
@@ -14,14 +14,14 @@ export async function existingFile(action) {
|
|
|
14
14
|
throw err;
|
|
15
15
|
}
|
|
16
16
|
if (err.code === "ENOENT") {
|
|
17
|
-
throw new Error(`file not found: ${
|
|
17
|
+
throw new Error(`file not found: ${styleText("cyan", fileName)}`);
|
|
18
18
|
}
|
|
19
19
|
else {
|
|
20
20
|
throw err;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
if (stats.isDirectory()) {
|
|
24
|
-
throw new Error(`expected ${
|
|
24
|
+
throw new Error(`expected ${styleText("cyan", fileName)} to be a file but is a directory`);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
//# sourceMappingURL=existing-file.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "textrun-repo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Text-Runner actions for verifying the content of the current repository",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"type": "module",
|
|
@@ -12,23 +12,22 @@
|
|
|
12
12
|
"build": "tsc -p tsconfig-build.json",
|
|
13
13
|
"cuke": "cucumber-js --format=progress",
|
|
14
14
|
"doc": "text-runner",
|
|
15
|
-
"fix": "eslint --fix --ignore-pattern=dist/ . && dprint fmt && sort-package-json --quiet",
|
|
15
|
+
"fix": "eslint --fix --ignore-pattern=dist/ . && dprint fmt && sort-package-json --quiet && ../tools/rta ghokin fmt replace features",
|
|
16
16
|
"lint": "dprint check && sort-package-json --check --quiet && eslint --ignore-pattern=dist/ . && depcheck --config=../.depcheckrc",
|
|
17
17
|
"reset": "rm -rf dist && yarn run build"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"assert-no-diff": "4.1.0",
|
|
21
|
-
"colorette": "2.0.20",
|
|
22
21
|
"eol": "0.10.0",
|
|
23
|
-
"text-runner-engine": "7.
|
|
22
|
+
"text-runner-engine": "7.2.0"
|
|
24
23
|
},
|
|
25
24
|
"devDependencies": {
|
|
26
25
|
"shared-cucumber-steps": "*",
|
|
27
|
-
"text-runner": "7.
|
|
28
|
-
"textrun-action": "0.
|
|
29
|
-
"textrun-extension": "0.
|
|
30
|
-
"textrun-npm": "0.
|
|
31
|
-
"tsx": "4.
|
|
26
|
+
"text-runner": "7.2.0",
|
|
27
|
+
"textrun-action": "0.4.0",
|
|
28
|
+
"textrun-extension": "0.4.0",
|
|
29
|
+
"textrun-npm": "0.4.0",
|
|
30
|
+
"tsx": "4.20.6"
|
|
32
31
|
},
|
|
33
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "aecf7efd5e22e88535fe97ad7341b1a057520268"
|
|
34
33
|
}
|