@tinacms/cli 1.5.30 → 1.5.32

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/dist/index.js +58 -41
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ module.exports = __toCommonJS(src_exports);
31
31
  var import_clipanion8 = require("clipanion");
32
32
 
33
33
  // package.json
34
- var version = "1.5.30";
34
+ var version = "1.5.32";
35
35
 
36
36
  // src/next/commands/dev-command/index.ts
37
37
  var import_clipanion2 = require("clipanion");
@@ -890,7 +890,7 @@ var createConfig = async ({
890
890
  noWatch,
891
891
  rollupOptions
892
892
  }) => {
893
- var _a, _b, _c, _d, _e, _f;
893
+ var _a, _b, _c, _d, _e, _f, _g, _h;
894
894
  const publicEnv = {};
895
895
  Object.keys(process.env).forEach((key) => {
896
896
  if (key.startsWith("TINA_PUBLIC_") || key.startsWith("NEXT_PUBLIC_") || key === "NODE_ENV" || key === "HEAD") {
@@ -954,7 +954,7 @@ var createConfig = async ({
954
954
  "process.env": `new Object(${JSON.stringify(publicEnv)})`,
955
955
  "process.platform": `"${process.platform}"`,
956
956
  __API_URL__: `"${apiURL}"`,
957
- __TOKEN__: `"${configManager.config.token}"`,
957
+ __BASE_PATH__: `"${((_e = (_d = configManager.config) == null ? void 0 : _d.build) == null ? void 0 : _e.basePath) || ""}"`,
958
958
  __TINA_GRAPHQL_VERSION__: `"${configManager.getTinaGraphQLVersion()}"`
959
959
  },
960
960
  logLevel: "error",
@@ -963,7 +963,7 @@ var createConfig = async ({
963
963
  include: ["react/jsx-runtime", "react/jsx-dev-runtime"]
964
964
  },
965
965
  server: {
966
- host: (_f = (_e = (_d = configManager.config) == null ? void 0 : _d.build) == null ? void 0 : _e.host) != null ? _f : false,
966
+ host: (_h = (_g = (_f = configManager.config) == null ? void 0 : _f.build) == null ? void 0 : _g.host) != null ? _h : false,
967
967
  watch: noWatch ? {
968
968
  ignored: ["**/*"]
969
969
  } : {
@@ -1391,7 +1391,7 @@ const generateRequester = (
1391
1391
  url,
1392
1392
  })
1393
1393
 
1394
- return { data: data?.data, query: doc, variables: vars || {} }
1394
+ return { data: data?.data, errors: data?.errors, query: doc, variables: vars || {} }
1395
1395
  }
1396
1396
 
1397
1397
  return requester
@@ -1464,7 +1464,7 @@ var GenericSdkVisitor = class extends import_visitor_plugin_common.ClientSideBas
1464
1464
  node,
1465
1465
  documentVariableName,
1466
1466
  operationType,
1467
- operationResultType: `{data: ${operationResultType}, variables: ${operationVariablesTypes}, query: string}`,
1467
+ operationResultType: `{data: ${operationResultType}, errors?: { message: string, locations: { line: number, column: number }[], path: string[] }[], variables: ${operationVariablesTypes}, query: string}`,
1468
1468
  operationVariablesTypes
1469
1469
  });
1470
1470
  }
@@ -1718,12 +1718,13 @@ var Codegen = class {
1718
1718
  return this.apiURL;
1719
1719
  }
1720
1720
  async genClient() {
1721
- var _a;
1721
+ var _a, _b, _c;
1722
1722
  const token = (_a = this.configManager.config) == null ? void 0 : _a.token;
1723
+ const errorPolicy = (_c = (_b = this.configManager.config) == null ? void 0 : _b.client) == null ? void 0 : _c.errorPolicy;
1723
1724
  const apiURL = this.getApiURL();
1724
1725
  const clientString = `import { createClient } from "tinacms/dist/client";
1725
1726
  import { queries } from "./types";
1726
- export const client = createClient({ url: '${apiURL}', token: '${token}', queries });
1727
+ export const client = createClient({ url: '${apiURL}', token: '${token}', queries, ${errorPolicy ? `errorPolicy: '${errorPolicy}'` : ""} });
1727
1728
  export default client;
1728
1729
  `;
1729
1730
  return { apiURL, clientString };
@@ -1877,12 +1878,7 @@ async function localSpin({
1877
1878
  });
1878
1879
  spinner.setSpinnerString("\u280B\u2819\u2839\u2838\u283C\u2834\u2826\u2827\u2807\u280F");
1879
1880
  spinner.start();
1880
- let res;
1881
- try {
1882
- res = await waitFor();
1883
- } catch (e) {
1884
- console.error(e);
1885
- }
1881
+ const res = await waitFor();
1886
1882
  spinner.stop();
1887
1883
  console.log("");
1888
1884
  return res;
@@ -2133,7 +2129,7 @@ var DevCommand = class extends BaseCommand {
2133
2129
  lookup: lookupObject,
2134
2130
  graphql: graphqlSchemaObject
2135
2131
  });
2136
- await import_fs_extra6.default.writeFileSync(
2132
+ import_fs_extra6.default.writeFileSync(
2137
2133
  import_path7.default.join(configManager.tinaFolderPath, tinaLockFilename),
2138
2134
  tinaLockContent
2139
2135
  );
@@ -2160,14 +2156,17 @@ var DevCommand = class extends BaseCommand {
2160
2156
  }
2161
2157
  return { apiURL: apiURL2, database, graphQLSchema: graphQLSchema2, tinaSchema: tinaSchema2 };
2162
2158
  } catch (e) {
2163
- logger.error(dangerText(e.message));
2159
+ logger.error(`
2160
+
2161
+ ${dangerText(e.message)}
2162
+ `);
2164
2163
  if (this.verbose) {
2165
2164
  console.error(e);
2166
2165
  }
2167
2166
  if (firstTime) {
2168
2167
  logger.error(
2169
2168
  warnText(
2170
- "Unable to start dev server, please fix your Tina config and try again"
2169
+ "Unable to start dev server, please fix your Tina config / resolve any errors above and try again"
2171
2170
  )
2172
2171
  );
2173
2172
  process.exit(1);
@@ -2521,8 +2520,11 @@ var BuildCommand = class extends BaseCommand {
2521
2520
  try {
2522
2521
  await configManager.processConfig();
2523
2522
  } catch (e) {
2524
- logger.error(e.message);
2525
- logger.error("Unable to build, please fix your Tina config and try again");
2523
+ logger.error(`
2524
+ ${dangerText(e.message)}`);
2525
+ logger.error(
2526
+ dangerText("Unable to build, please fix your Tina config and try again")
2527
+ );
2526
2528
  process.exit(1);
2527
2529
  }
2528
2530
  let server;
@@ -2545,14 +2547,25 @@ var BuildCommand = class extends BaseCommand {
2545
2547
  const apiURL = await codegen2.execute();
2546
2548
  if ((configManager.hasSelfHostedConfig() || this.localOption) && !this.skipIndexing) {
2547
2549
  const text = this.localOption ? void 0 : "Indexing to self-hosted data layer";
2548
- await this.indexContentWithSpinner({
2549
- text,
2550
- database,
2551
- graphQLSchema,
2552
- tinaSchema,
2553
- configManager,
2554
- partialReindex: this.partialReindex
2555
- });
2550
+ try {
2551
+ await this.indexContentWithSpinner({
2552
+ text,
2553
+ database,
2554
+ graphQLSchema,
2555
+ tinaSchema,
2556
+ configManager,
2557
+ partialReindex: this.partialReindex
2558
+ });
2559
+ } catch (e) {
2560
+ logger.error(`
2561
+
2562
+ ${dangerText(e.message)}
2563
+ `);
2564
+ if (this.verbose) {
2565
+ console.error(e);
2566
+ }
2567
+ process.exit(1);
2568
+ }
2556
2569
  }
2557
2570
  if (this.localOption) {
2558
2571
  server = await createDevServer(
@@ -2641,22 +2654,26 @@ var BuildCommand = class extends BaseCommand {
2641
2654
  }
2642
2655
  }
2643
2656
  const summaryItems = [];
2657
+ const autogeneratedFiles = [];
2644
2658
  if (!configManager.shouldSkipSDK()) {
2645
- summaryItems.push({
2646
- emoji: "\u{1F916}",
2647
- heading: "Auto-generated files",
2648
- subItems: [
2649
- {
2650
- key: "GraphQL Client",
2651
- value: configManager.printGeneratedClientFilePath()
2652
- },
2653
- {
2654
- key: "Typescript Types",
2655
- value: configManager.printGeneratedTypesFilePath()
2656
- }
2657
- ]
2659
+ autogeneratedFiles.push({
2660
+ key: "GraphQL Client",
2661
+ value: configManager.printGeneratedClientFilePath()
2662
+ });
2663
+ autogeneratedFiles.push({
2664
+ key: "Typescript Types",
2665
+ value: configManager.printGeneratedTypesFilePath()
2658
2666
  });
2659
2667
  }
2668
+ autogeneratedFiles.push({
2669
+ key: "Static HTML file",
2670
+ value: configManager.printRelativePath(configManager.outputHTMLFilePath)
2671
+ });
2672
+ summaryItems.push({
2673
+ emoji: "\u{1F916}",
2674
+ heading: "Auto-generated files",
2675
+ subItems: autogeneratedFiles
2676
+ });
2660
2677
  summary({
2661
2678
  heading: "Tina build complete",
2662
2679
  items: [
@@ -2796,7 +2813,7 @@ Additional info: Branch: ${config3.branch}, Client ID: ${config3.clientId} `;
2796
2813
  bar2.tick({
2797
2814
  prog: "\u274C"
2798
2815
  });
2799
- let errorMessage = `The local GraphQL schema doesn't match the remote GraphQL schema. Please push up your changes to Github to update your remote GraphQL schema.`;
2816
+ let errorMessage = `The local GraphQL schema doesn't match the remote GraphQL schema. Please push up your changes to GitHub to update your remote GraphQL schema.`;
2800
2817
  if (config3 == null ? void 0 : config3.branch) {
2801
2818
  errorMessage += `
2802
2819
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/cli",
3
- "version": "1.5.30",
3
+ "version": "1.5.32",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "files": [
@@ -58,13 +58,13 @@
58
58
  "@tailwindcss/aspect-ratio": "^0.4.0",
59
59
  "@tailwindcss/line-clamp": "^0.3.1",
60
60
  "@tailwindcss/typography": "^0.5.9",
61
- "@tinacms/app": "1.2.28",
62
- "tinacms": "1.5.21",
63
- "@tinacms/datalayer": "1.2.26",
64
- "@tinacms/graphql": "1.4.26",
61
+ "@tinacms/app": "1.2.30",
62
+ "tinacms": "1.5.23",
63
+ "@tinacms/datalayer": "1.2.28",
64
+ "@tinacms/graphql": "1.4.28",
65
65
  "@tinacms/metrics": "1.0.2",
66
- "@tinacms/schema-tools": "1.4.12",
67
- "@tinacms/search": "1.0.11",
66
+ "@tinacms/schema-tools": "1.4.13",
67
+ "@tinacms/search": "1.0.13",
68
68
  "@vitejs/plugin-react": "3.1.0",
69
69
  "ajv": "^6.12.3",
70
70
  "altair-express-middleware": "4.0.6",