textrun-workspace 0.0.13 → 0.1.2
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.
|
@@ -17,6 +17,9 @@ async function existingFile(action) {
|
|
|
17
17
|
var actualContent = await fs_1.promises.readFile(fullPath, "utf-8");
|
|
18
18
|
}
|
|
19
19
|
catch (e) {
|
|
20
|
+
if (!tr.isFsError(e)) {
|
|
21
|
+
throw e;
|
|
22
|
+
}
|
|
20
23
|
if (e.code === "ENOENT") {
|
|
21
24
|
const files = await fs_1.promises.readdir(action.configuration.sourceDir.platformified());
|
|
22
25
|
throw new tr.UserError(`file not found: ${fileRelPath}`, `the workspace has these files: ${files.join(", ")}`);
|
|
@@ -29,7 +32,7 @@ async function existingFile(action) {
|
|
|
29
32
|
assertNoDiff.trimmedLines(actualContent.trim(), expectedContent.trim());
|
|
30
33
|
}
|
|
31
34
|
catch (err) {
|
|
32
|
-
throw new tr.UserError(`mismatching content in ${color.cyan(color.bold(fileRelPath))}`, err
|
|
35
|
+
throw new tr.UserError(`mismatching content in ${color.cyan(color.bold(fileRelPath))}`, tr.errorMessage(err));
|
|
33
36
|
}
|
|
34
37
|
}
|
|
35
38
|
exports.existingFile = existingFile;
|
package/dist/actions/new-file.js
CHANGED
|
@@ -11,6 +11,9 @@ async function newFile(action) {
|
|
|
11
11
|
var fileName = action.region.textInNodeOfType("em", "strong");
|
|
12
12
|
}
|
|
13
13
|
catch (e) {
|
|
14
|
+
if (!tr.isUserError(e)) {
|
|
15
|
+
throw e;
|
|
16
|
+
}
|
|
14
17
|
const guidance = `Cannot determine the name of the file to create.\n${e.guidance}`;
|
|
15
18
|
throw new tr.UserError(e.message, guidance);
|
|
16
19
|
}
|
|
@@ -18,6 +21,9 @@ async function newFile(action) {
|
|
|
18
21
|
var content = action.region.textInNodeOfType("fence", "code");
|
|
19
22
|
}
|
|
20
23
|
catch (e) {
|
|
24
|
+
if (!tr.isUserError(e)) {
|
|
25
|
+
throw e;
|
|
26
|
+
}
|
|
21
27
|
const guidance = `Cannot determine the content of the file to create.\n${e.guidance}`;
|
|
22
28
|
throw new tr.UserError(e.message, guidance);
|
|
23
29
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.workingDir = void 0;
|
|
4
4
|
const color = require("colorette");
|
|
5
|
+
const tr = require("text-runner-core");
|
|
5
6
|
/** The "cd" action changes the current working directory to the one given in the hyperlink or code block. */
|
|
6
7
|
function workingDir(action) {
|
|
7
8
|
const directory = action.region.text();
|
|
@@ -12,6 +13,9 @@ function workingDir(action) {
|
|
|
12
13
|
process.chdir(fullPath);
|
|
13
14
|
}
|
|
14
15
|
catch (e) {
|
|
16
|
+
if (!tr.isFsError(e)) {
|
|
17
|
+
throw e;
|
|
18
|
+
}
|
|
15
19
|
if (e.code === "ENOENT") {
|
|
16
20
|
throw new Error(`directory ${directory} not found`);
|
|
17
21
|
}
|
package/package.json
CHANGED
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "textrun-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Text-Runner actions for the Text-Runner workspace",
|
|
5
|
+
"license": "ISC",
|
|
5
6
|
"main": "dist/index.js",
|
|
6
7
|
"files": [
|
|
7
8
|
"dist/**/*.js"
|
|
8
9
|
],
|
|
9
|
-
"license": "ISC",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"assert-no-diff": "3.0.
|
|
12
|
-
"
|
|
13
|
-
"
|
|
11
|
+
"assert-no-diff": "3.0.6",
|
|
12
|
+
"colorette": "2.0.19",
|
|
13
|
+
"fs-extra": "10.1.0",
|
|
14
|
+
"text-runner-core": "^5.0.2"
|
|
14
15
|
},
|
|
15
16
|
"devDependencies": {
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"text-runner": "5.0.0-pre11",
|
|
20
|
-
"textrun-action": "0.0.13",
|
|
21
|
-
"textrun-extension": "0.0.13"
|
|
17
|
+
"text-runner": "^5.0.2",
|
|
18
|
+
"textrun-action": "^0.1.2",
|
|
19
|
+
"textrun-extension": "^0.1.2"
|
|
22
20
|
},
|
|
23
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "1dca29620ef3189c64a62d706ded97c9b99deda3"
|
|
24
22
|
}
|