@gql.tada/cli-utils 1.7.4 → 1.8.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.
@@ -1003,9 +1003,9 @@ ku.exports.default = pathKey$1;
1003
1003
 
1004
1004
  var Ou = E;
1005
1005
 
1006
- var Pu = Iu;
1006
+ var ju = Iu;
1007
1007
 
1008
- var ju = ku.exports;
1008
+ var Pu = ku.exports;
1009
1009
 
1010
1010
  function resolveCommandAttempt(D, e) {
1011
1011
  var r = D.options.env || process.env;
@@ -1019,8 +1019,8 @@ function resolveCommandAttempt(D, e) {
1019
1019
  }
1020
1020
  var a;
1021
1021
  try {
1022
- a = Pu.sync(D.command, {
1023
- path: r[ju({
1022
+ a = ju.sync(D.command, {
1023
+ path: r[Pu({
1024
1024
  env: r
1025
1025
  })],
1026
1026
  pathExt: e ? Ou.delimiter : void 0
@@ -2732,21 +2732,53 @@ async function run(D) {
2732
2732
  }
2733
2733
  }
2734
2734
  e.start("Writing to tsconfig.json.");
2735
+ var h = "tsconfig.json";
2735
2736
  try {
2736
- var h = s.resolve(D, "tsconfig.json");
2737
- var m = await G(h);
2738
- var g = r.endsWith(".json") || r.endsWith(".graphql");
2739
- m.compilerOptions = {
2740
- ...m.compilerOptions,
2737
+ var m = s.resolve(D, "tsconfig.json");
2738
+ var g = await G(m);
2739
+ if (Array.isArray(g.references) && Array.isArray(g.files) && !g.files.length && !g.include) {
2740
+ var B;
2741
+ var b;
2742
+ for (var w of g.references) {
2743
+ if (!w || "string" != typeof w.path) {
2744
+ continue;
2745
+ }
2746
+ var S = s.resolve(D, w.path);
2747
+ if (".json" !== s.extname(S)) {
2748
+ S = s.join(S, "tsconfig.json");
2749
+ }
2750
+ try {
2751
+ await a.access(S);
2752
+ } catch (D) {
2753
+ continue;
2754
+ }
2755
+ if ("tsconfig.app.json" === s.basename(S)) {
2756
+ b = S;
2757
+ break;
2758
+ } else if (!B) {
2759
+ B = S;
2760
+ }
2761
+ }
2762
+ var I = b || B;
2763
+ if (I) {
2764
+ m = I;
2765
+ g = await G(m);
2766
+ h = s.relative(D, m);
2767
+ }
2768
+ }
2769
+ var M = r.endsWith(".json") || r.endsWith(".graphql");
2770
+ var _ = s.dirname(m);
2771
+ g.compilerOptions = {
2772
+ ...g.compilerOptions,
2741
2773
  plugins: [ {
2742
2774
  name: i ? "gql.tada/ts-plugin" : "@0no-co/graphqlsp",
2743
- schema: g ? s.relative(D, r) : r,
2744
- tadaOutputLocation: s.relative(D, t)
2775
+ schema: M ? s.relative(_, s.resolve(D, r)) : r,
2776
+ tadaOutputLocation: s.relative(_, t)
2745
2777
  } ]
2746
2778
  };
2747
- await a.writeFile(h, JSON.stringify(m, null, 2));
2779
+ await a.writeFile(m, JSON.stringify(g, null, 2));
2748
2780
  } catch (D) {}
2749
- e.stop("Written to tsconfig.json.");
2781
+ e.stop(`Written to ${h}.`);
2750
2782
  ((D = "") => {
2751
2783
  process.stdout.write(`${Y.gray(Eu)}\n${Y.gray(fu)} ${D}\n\n`);
2752
2784
  })("Off to the races!");