harmonyc 0.14.0 → 0.14.1

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 +1 -1
  2. package/vitest/index.js +11 -3
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "harmonyc",
3
3
  "description": "Harmony Code - model-driven BDD for Vitest",
4
- "version": "0.14.0",
4
+ "version": "0.14.1",
5
5
  "author": "Bernát Kalló",
6
6
  "type": "module",
7
7
  "bin": {
package/vitest/index.js CHANGED
@@ -1,11 +1,9 @@
1
1
  import { watchFiles } from "../cli/watch.js";
2
2
  import c from 'tinyrainbow';
3
+ import { compileFiles } from "../compiler/compiler.js";
3
4
  export default function harmonyPlugin({ watchDir, }) {
4
5
  return {
5
6
  name: 'harmony',
6
- configureServer(server) {
7
- watchFiles([`${watchDir}/**/*.harmony`]);
8
- },
9
7
  config(config) {
10
8
  var _a, _b;
11
9
  var _c;
@@ -16,6 +14,16 @@ export default function harmonyPlugin({ watchDir, }) {
16
14
  }
17
15
  config.test.reporters.splice(0, 0, new HarmonyReporter());
18
16
  },
17
+ async configureServer(server) {
18
+ const isWatchMode = server.config.server.watch !== null;
19
+ const patterns = [`${watchDir}/**/*.harmony`];
20
+ if (isWatchMode) {
21
+ await watchFiles(patterns);
22
+ }
23
+ else {
24
+ await compileFiles(patterns);
25
+ }
26
+ },
19
27
  };
20
28
  }
21
29
  class HarmonyReporter {