textrun-npm 0.3.0 → 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.
@@ -1,12 +1,12 @@
1
- import * as color from "colorette";
2
1
  import { promises as fs } from "fs";
2
+ import { styleText } from "node:util";
3
3
  import { trimDollar } from "../helpers/trim-dollar.js";
4
4
  export async function exportedExecutable(action) {
5
5
  const commandName = trimDollar(action.region.text().trim());
6
6
  if (commandName === "") {
7
7
  throw new Error("No executable name specified");
8
8
  }
9
- action.name(`npm package exports executable ${color.cyan(commandName)}`);
9
+ action.name(`npm package exports executable ${styleText("cyan", commandName)}`);
10
10
  const packageJsonPath = action.configuration.sourceDir.joinStr("package.json");
11
11
  const pkgText = await fs.readFile(packageJsonPath, "utf-8");
12
12
  const pkgData = JSON.parse(pkgText);
@@ -1,5 +1,5 @@
1
- import * as color from "colorette";
2
1
  import { promises as fs } from "fs";
2
+ import { styleText } from "node:util";
3
3
  import { trimDollar } from "../helpers/trim-dollar.js";
4
4
  export async function install(action) {
5
5
  var _a, _b;
@@ -7,13 +7,13 @@ export async function install(action) {
7
7
  if (installText === "") {
8
8
  throw new Error("no installation instructions found");
9
9
  }
10
- action.name(`check npm package name in ${color.cyan(installText)}`);
10
+ action.name(`check npm package name in ${styleText("cyan", installText)}`);
11
11
  const dir = ((_b = (_a = action.region[0]) === null || _a === void 0 ? void 0 : _a.attributes) === null || _b === void 0 ? void 0 : _b.dir) || "";
12
12
  const pkgJsonPath = action.configuration.sourceDir.joinStr(dir, "package.json");
13
13
  const pkgText = await fs.readFile(pkgJsonPath, "utf-8");
14
14
  const pkg = JSON.parse(pkgText);
15
15
  if (missesPackageName(installText, pkg.name)) {
16
- throw new Error(`installation instructions ${color.cyan(installText)} don't contain expected npm package name ${color.cyan(pkg.name)}`);
16
+ throw new Error(`installation instructions ${styleText("cyan", installText)} don't contain expected npm package name ${styleText("cyan", pkg.name)}`);
17
17
  }
18
18
  }
19
19
  function missesPackageName(installText, packageName) {
@@ -1,5 +1,5 @@
1
- import * as color from "colorette";
2
1
  import { promises as fsp } from "fs";
2
+ import { styleText } from "node:util";
3
3
  import * as path from "path";
4
4
  import * as textRunner from "text-runner-engine";
5
5
  import { trimDollar } from "../helpers/trim-dollar.js";
@@ -8,14 +8,14 @@ export async function installedExecutable(action) {
8
8
  if (commandName === "") {
9
9
  throw new textRunner.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);
10
10
  }
11
- action.name(`installed npm executable ${color.cyan(commandName)}`);
11
+ action.name(`installed npm executable ${styleText("cyan", commandName)}`);
12
12
  const fullPath = path.join("node_modules", ".bin", commandName);
13
13
  try {
14
14
  await fsp.stat(action.configuration.sourceDir.joinStr(fullPath));
15
15
  }
16
16
  catch (e) {
17
17
  if (textRunner.isFsError(e) && e.code === "ENOENT") {
18
- throw new Error(`no installed executable ${color.cyan(fullPath)} found`);
18
+ throw new Error(`no installed executable ${styleText("cyan", fullPath)} found`);
19
19
  }
20
20
  else {
21
21
  throw e;
@@ -1,5 +1,5 @@
1
- import * as color from "colorette";
2
1
  import { promises as fs } from "fs";
2
+ import { styleText } from "node:util";
3
3
  import { startsWithNpmRun } from "../helpers/starts-with-npm-run.js";
4
4
  import { trimNpmRun } from "../helpers/trim-npm-run.js";
5
5
  export async function scriptCall(action) {
@@ -11,7 +11,7 @@ export async function scriptCall(action) {
11
11
  throw new Error(`Does not start with "npm run": ${call}`);
12
12
  }
13
13
  const want = trimNpmRun(call);
14
- action.name(`verify call of npm package script ${color.cyan(want)}`);
14
+ action.name(`verify call of npm package script ${styleText("cyan", want)}`);
15
15
  const packageJsonPath = action.configuration.sourceDir.joinStr("package.json");
16
16
  const pkgText = await fs.readFile(packageJsonPath, "utf-8");
17
17
  const pkgData = JSON.parse(pkgText);
@@ -1,11 +1,11 @@
1
- import * as color from "colorette";
2
1
  import { promises as fs } from "fs";
2
+ import { styleText } from "node:util";
3
3
  export async function scriptName(action) {
4
4
  const want = action.region.text().trim();
5
5
  if (want === "") {
6
6
  throw new Error("No script name specified");
7
7
  }
8
- action.name(`npm package has script ${color.cyan(want)}`);
8
+ action.name(`npm package has script ${styleText("cyan", want)}`);
9
9
  const packageJsonPath = action.configuration.sourceDir.joinStr("package.json");
10
10
  const pkgText = await fs.readFile(packageJsonPath, "utf-8");
11
11
  const pkgData = JSON.parse(pkgText);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "textrun-npm",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",
@@ -9,24 +9,23 @@
9
9
  ],
10
10
  "scripts": {
11
11
  "build": "tsc -p tsconfig-build.json",
12
- "clean": "rm -rf dist",
13
12
  "cuke": "yarn run build && cucumber-js --format=progress",
14
13
  "doc": "yarn run build && text-runner --format=dot",
15
- "fix": "eslint --fix --ignore-pattern=dist/ . && dprint fmt && sort-package-json --quiet",
14
+ "fix": "eslint --fix --ignore-pattern=dist/ . && dprint fmt && sort-package-json --quiet && ../tools/rta ghokin fmt replace features",
16
15
  "lint": "dprint check && sort-package-json --check --quiet && eslint --ignore-pattern=dist/ . && depcheck --config=../.depcheckrc",
16
+ "reset": "rm -rf dist && yarn run build",
17
17
  "unit": "node --test --import tsx 'src/**/*.test.ts'"
18
18
  },
19
19
  "dependencies": {
20
- "colorette": "2.0.20",
21
- "text-runner-engine": "7.1.0"
20
+ "text-runner-engine": "7.2.0"
22
21
  },
23
22
  "devDependencies": {
24
23
  "shared-cucumber-steps": "*",
25
- "text-runner": "7.1.0",
26
- "textrun-action": "0.3.0",
27
- "textrun-extension": "0.3.0",
28
- "textrun-workspace": "0.3.0",
29
- "tsx": "4.19.3"
24
+ "text-runner": "7.2.0",
25
+ "textrun-action": "0.4.0",
26
+ "textrun-extension": "0.4.0",
27
+ "textrun-workspace": "0.4.0",
28
+ "tsx": "4.20.6"
30
29
  },
31
- "gitHead": "bdf119a8e549f679af14f88952f7353648b50759"
30
+ "gitHead": "aecf7efd5e22e88535fe97ad7341b1a057520268"
32
31
  }