textrun-action 0.1.2 → 0.2.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/index.js CHANGED
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.textrunActions = void 0;
4
- const name_full_1 = require("./name-full");
5
- const name_short_1 = require("./name-short");
6
- exports.textrunActions = {
7
- nameFull: name_full_1.nameFull,
8
- nameShort: name_short_1.nameShort,
1
+ import { nameFull } from "./name-full.js";
2
+ import { nameShort } from "./name-short.js";
3
+ export const textrunActions = {
4
+ nameFull,
5
+ nameShort,
9
6
  };
10
7
  //# sourceMappingURL=index.js.map
package/dist/name-full.js CHANGED
@@ -1,21 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.nameFull = void 0;
4
- const fs_1 = require("fs");
5
- const tr = require("text-runner-core");
6
- async function nameFull(action) {
1
+ import { promises as fs } from "fs";
2
+ import * as textRunner from "text-runner-core";
3
+ export async function nameFull(action) {
7
4
  const want = action.region.text();
8
5
  action.name(`verify full name of action "${want}"`);
9
- const wantStd = tr.actions.name(want);
6
+ const wantStd = textRunner.actions.name(want);
10
7
  const pkgJsonPath = action.configuration.sourceDir.joinStr("package.json");
11
- const pkgJson = JSON.parse(await fs_1.promises.readFile(pkgJsonPath, "utf-8"));
12
- const mainPath = action.configuration.sourceDir.joinStr(pkgJson.main);
13
- const main = await Promise.resolve().then(() => require(mainPath));
8
+ const pkgJson = JSON.parse(await fs.readFile(pkgJsonPath, "utf-8"));
9
+ const exportsPath = action.configuration.sourceDir.joinStr(pkgJson.exports);
10
+ const main = await import(exportsPath);
14
11
  const allNames = Object.keys(main.textrunActions);
15
- const allNamesStd = allNames.map(tr.actions.name);
12
+ const allNamesStd = allNames.map(textRunner.actions.name);
16
13
  if (!allNamesStd.includes(wantStd)) {
17
14
  throw new Error(`This module does not export action "${want}. Found [${allNames.join(", ")}] `);
18
15
  }
19
16
  }
20
- exports.nameFull = nameFull;
21
17
  //# sourceMappingURL=name-full.js.map
@@ -1,21 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.nameShort = void 0;
4
- const fs_1 = require("fs");
5
- const tr = require("text-runner-core");
6
- async function nameShort(action) {
1
+ import { promises as fs } from "fs";
2
+ import * as textRunner from "text-runner-core";
3
+ export async function nameShort(action) {
7
4
  const want = action.region.text();
8
5
  action.name(`verify short name of action "${want}"`);
9
- const wantStd = tr.actions.name(want);
6
+ const wantStd = textRunner.actions.name(want);
10
7
  const pkgJsonPath = action.configuration.sourceDir.joinStr("package.json");
11
- const pkgJson = JSON.parse(await fs_1.promises.readFile(pkgJsonPath, "utf-8"));
12
- const mainPath = action.configuration.sourceDir.joinStr(pkgJson.main);
13
- const main = await Promise.resolve().then(() => require(mainPath));
8
+ const pkgJson = JSON.parse(await fs.readFile(pkgJsonPath, "utf-8"));
9
+ const exportsPath = action.configuration.sourceDir.joinStr(pkgJson.exports);
10
+ const main = await import(exportsPath);
14
11
  const allNames = Object.keys(main.textrunActions);
15
- const allNamesStd = allNames.map(tr.actions.name);
12
+ const allNamesStd = allNames.map(textRunner.actions.name);
16
13
  if (!allNamesStd.includes(wantStd)) {
17
14
  throw new Error(`This module does not export action "${want}. Found [${allNames.join(", ")}] `);
18
15
  }
19
16
  }
20
- exports.nameShort = nameShort;
21
17
  //# sourceMappingURL=name-short.js.map
package/package.json CHANGED
@@ -1,16 +1,25 @@
1
1
  {
2
2
  "name": "textrun-action",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "license": "ISC",
5
- "main": "dist/index.js",
5
+ "type": "module",
6
+ "exports": "./dist/index.js",
6
7
  "files": [
7
8
  "dist/**/*.js"
8
9
  ],
10
+ "scripts": {
11
+ "build": "tsc -p tsconfig-build.json",
12
+ "clean": "rm -rf dist",
13
+ "doc": "text-run static --format=summary && text-run dynamic --format=progress",
14
+ "fix": "eslint . --fix --ext=.ts --ignore-path=../.eslintignore && prettier --write .",
15
+ "lint": "prettier -l . && eslint . --ext=.ts --ignore-path=../.eslintignore && depcheck --config=../.depcheckrc"
16
+ },
9
17
  "dependencies": {
10
- "text-runner-core": "^5.0.2"
18
+ "text-runner-core": "6.0.0"
11
19
  },
12
20
  "devDependencies": {
13
- "text-runner": "^5.0.2"
21
+ "text-runner": "6.0.0",
22
+ "ts-node": "10.9.1"
14
23
  },
15
- "gitHead": "1dca29620ef3189c64a62d706ded97c9b99deda3"
24
+ "gitHead": "5434976346f2e02bc08c0a6ea9f7cbfa67d68c4e"
16
25
  }