@hackwaly/task 0.3.4 → 0.3.5

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.
Files changed (2) hide show
  1. package/package.json +5 -2
  2. package/src/config.js +20 -11
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@hackwaly/task",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
- "repository": "github:hackwaly/task",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/hackwaly/task.git"
9
+ },
7
10
  "bin": {
8
11
  "task": "bin/task"
9
12
  },
package/src/config.js CHANGED
@@ -33,19 +33,28 @@ export function configInit(importMeta) {
33
33
  interruptible: config.interruptible ?? false,
34
34
  };
35
35
  const def = {
36
- run: config.run
37
- ? async (ctx) => {
38
- process.stdout.write(`▪▪▪▪ ${styles.bold.open}${meta.name}${styles.bold.close}\n`);
39
- await config.run(ctx);
40
- }
41
- : command !== undefined
42
- ? async (ctx) => {
43
- process.stdout.write(`▪▪▪▪ ${styles.bold.open}${meta.name}${styles.bold.close}\n`);
36
+ run: async (ctx) => {
37
+ process.stdout.write(`▪▪▪▪ ${styles.bold.open}${meta.name}${styles.bold.close}\n`);
38
+ try {
39
+ if (typeof config.run === "function") {
40
+ await config.run(ctx);
41
+ }
42
+ else if (command !== undefined) {
44
43
  await runCommand(command, meta, ctx);
45
44
  }
46
- : async () => {
47
- process.stdout.write(`▪▪▪▪ ${styles.bold.open}${meta.name}${styles.bold.close}\n`);
48
- },
45
+ else {
46
+ // No-op
47
+ }
48
+ }
49
+ catch (err) {
50
+ if (err instanceof DOMException && err.name === "AbortError") {
51
+ process.stdout.write(`✖✖✖✖ ${styles.bold.open}${meta.name} aborted${styles.bold.close}\n`);
52
+ }
53
+ else {
54
+ throw err;
55
+ }
56
+ }
57
+ },
49
58
  meta: meta,
50
59
  deps: new Set(),
51
60
  invDeps: new Set(),