textrun-npm 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.
@@ -2,15 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.exportedExecutable = void 0;
4
4
  const color = require("colorette");
5
+ const fs = require("fs-extra");
5
6
  const trim_dollar_1 = require("../helpers/trim-dollar");
6
- function exportedExecutable(action) {
7
- const commandName = trim_dollar_1.trimDollar(action.region.text().trim());
7
+ async function exportedExecutable(action) {
8
+ const commandName = (0, trim_dollar_1.trimDollar)(action.region.text().trim());
8
9
  if (commandName === "") {
9
10
  throw new Error("No executable name specified");
10
11
  }
11
12
  action.name(`npm package exports executable ${color.cyan(commandName)}`);
12
- // eslint-disable-next-line @typescript-eslint/no-var-requires
13
- const pkgData = require(action.configuration.sourceDir.joinStr("package.json"));
13
+ const packageJsonPath = action.configuration.sourceDir.joinStr("package.json");
14
+ const pkgData = await fs.readJSON(packageJsonPath);
14
15
  if (!Object.keys(pkgData.bin).includes(commandName)) {
15
16
  throw new Error(`package.json does not export a "${commandName}" command`);
16
17
  }
@@ -6,7 +6,7 @@ const fs = require("fs-extra");
6
6
  const trim_dollar_1 = require("../helpers/trim-dollar");
7
7
  async function install(action) {
8
8
  var _a, _b;
9
- const installText = trim_dollar_1.trimDollar(action.region.text());
9
+ const installText = (0, trim_dollar_1.trimDollar)(action.region.text());
10
10
  if (installText === "") {
11
11
  throw new Error("no installation instructions found");
12
12
  }
@@ -7,7 +7,7 @@ const path = require("path");
7
7
  const tr = require("text-runner-core");
8
8
  const trim_dollar_1 = require("../helpers/trim-dollar");
9
9
  async function installedExecutable(action) {
10
- const commandName = trim_dollar_1.trimDollar(action.region.text().trim());
10
+ const commandName = (0, trim_dollar_1.trimDollar)(action.region.text().trim());
11
11
  if (commandName === "") {
12
12
  throw new tr.UserError("Executable name not specified", "This action checks for executables provided by npm modules that you have installed. They are typically inside node_modules/.bin. Please provide the name of the executable.", action.location);
13
13
  }
@@ -17,7 +17,7 @@ async function installedExecutable(action) {
17
17
  await fs_1.promises.stat(action.configuration.sourceDir.joinStr(fullPath));
18
18
  }
19
19
  catch (e) {
20
- if (e.code === "ENOENT") {
20
+ if (tr.isFsError(e) && e.code === "ENOENT") {
21
21
  throw new Error(`no installed executable ${color.cyan(fullPath)} found`);
22
22
  }
23
23
  else {
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=package-json.js.map
package/package.json CHANGED
@@ -1,24 +1,22 @@
1
1
  {
2
2
  "name": "textrun-npm",
3
- "version": "0.0.13",
4
- "main": "dist/index.js",
3
+ "version": "0.1.2",
5
4
  "license": "ISC",
5
+ "main": "dist/index.js",
6
6
  "files": [
7
7
  "dist/**/*.js"
8
8
  ],
9
9
  "dependencies": {
10
- "fs-extra": "9.0.1",
11
- "text-runner-core": "5.0.0-pre11"
10
+ "colorette": "2.0.19",
11
+ "fs-extra": "10.1.0",
12
+ "text-runner-core": "^5.0.2"
12
13
  },
13
14
  "devDependencies": {
14
- "colorette": "1.2.1",
15
- "cucumber": "6.0.5",
16
- "mocha": "8.0.1",
17
15
  "shared-cucumber-steps": "0.0.0",
18
- "text-runner": "5.0.0-pre11",
19
- "textrun-action": "0.0.13",
20
- "textrun-extension": "0.0.13",
21
- "textrun-workspace": "0.0.13"
16
+ "text-runner": "^5.0.2",
17
+ "textrun-action": "^0.1.2",
18
+ "textrun-extension": "^0.1.2",
19
+ "textrun-workspace": "^0.1.2"
22
20
  },
23
- "gitHead": "9c77c0177132534cac9bc4d89607f6ee8ee2c28d"
21
+ "gitHead": "1dca29620ef3189c64a62d706ded97c9b99deda3"
24
22
  }