@tinacms/cli 0.57.2 → 0.58.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/CHANGELOG.md CHANGED
@@ -1,10 +1,36 @@
1
1
  # tinacms-cli
2
2
 
3
+ ## 0.58.0
4
+
5
+ ### Minor Changes
6
+
7
+ - fa7a0419f: Adds experimental support for a data layer between file-based content and the GraphQL API. This allows documents to be indexed so the CMS can behave more like a traditional CMS, with the ability enforce foreign reference constraints and filtering/pagination capabilities.
8
+ - 8c14f29ef: Updated cli to include a new option, `--noSDK`. When this flag is present it will not generate the SDK.
9
+
10
+ ### Patch Changes
11
+
12
+ - 9c5f888a3: Modifies `tinacms init` for `TinaAdmin`-ready page
13
+ - Updated dependencies [eb5fbfac7]
14
+ - Updated dependencies [fa7a0419f]
15
+ - Updated dependencies [47d126029]
16
+ - @tinacms/graphql@0.58.0
17
+
18
+ ## 0.57.2
19
+
20
+ ### Patch Changes
21
+
22
+ - edb2f4011: Trim path property on collections during compilation
23
+ - Updated dependencies [edb2f4011]
24
+ - @tinacms/graphql@0.57.2
25
+
3
26
  ## 0.57.1
4
27
 
5
28
  ### Patch Changes
6
29
 
7
30
  - 50710e1d0: Add no-check for Typescript-generated file
31
+ - c78d981e6: Reset entire **generated** folder on re-compile
32
+ - Updated dependencies [60729f60c]
33
+ - @tinacms/graphql@0.57.1
8
34
 
9
35
  ## 0.57.0
10
36
 
@@ -10,8 +10,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
10
  See the License for the specific language governing permissions and
11
11
  limitations under the License.
12
12
  */
13
- export declare const adminPage = "import { useEffect } from \"react\";\nimport { useRouter } from \"next/router\";\nimport { useEditState } from \"tinacms/dist/edit-state\";\n\nconst GoToEditPage = () => {\n const { setEdit } = useEditState();\n const router = useRouter();\n useEffect(() => {\n setEdit(true);\n router.back();\n }, []);\n return <div>Entering edit mode..</div>;\n};\n\nexport default GoToEditPage;\n";
14
- export declare const exitAdminPage = "import { useEffect } from \"react\";\nimport { useRouter } from \"next/router\";\nimport { useEditState } from \"tinacms/dist/edit-state\";\n\nconst GoToEditPage = () => {\n const { setEdit } = useEditState();\n const router = useRouter();\n useEffect(() => {\n setEdit(false);\n router.back();\n }, []);\n return <div>Exiting edit mode..</div>;;\n};\n\nexport default GoToEditPage;\n";
13
+ export declare const adminPage = "import { TinaAdmin } from 'tinacms';\nexport default TinaAdmin;\n";
15
14
  export declare const blogPost = "---\ntitle: Vote For Pedro\n---\n# Welcome to the blog.\n\n> To edit this site head over to the [` /\n admin`](/admin) route. Then click the pencil icon in the bottom lefthand corner to start editing \uD83E\uDD99. \n\n\n# Dixi gaude Arethusa\n\n## Oscula mihi\n\nLorem markdownum numerabilis armentorum platanus, cultros coniunx sibi per\nsilvas, nostris clausit sequemur diverso scopulosque. Fecit tum alta sed non\nfalcato murmura, geminas donata Amyntore, quoque Nox. Invitam inquit, modo\nnocte; ut ignis faciemque manes in imagine sinistra ut mucrone non ramos\nsepulcro supplex. Crescentesque populos motura, fit cumque. Verumque est; retro\nsibi tristia bracchia Aetola telae caruerunt et.\n\n\n## Mutato fefellimus sit demisit aut alterius sollicito\n\nPhaethonteos vestes quem involvite iuvenca; furiali anne: sati totumque,\n**corpora** cum rapacibus nunc! Nervis repetatne, miserabile doleas, deprensum\nhunc, fluctus Threicio, ad urbes, magicaeque, quid. Per credensque series adicis\npoteram [quidem](#)! Iam uni mensas victrix\nvittas ut flumina Satyri adulter; bellum iacet domitae repercusso truncis urnis\nmille rigidi sub taurum.\n\n\n";
16
15
  export declare const nextPostPage: () => string;
17
16
  export declare const AppJsContent: (extraImports?: string) => string;
@@ -13,8 +13,9 @@ limitations under the License.
13
13
  interface Options {
14
14
  port?: number;
15
15
  command?: string;
16
- experimental?: boolean;
16
+ experimentalData?: boolean;
17
17
  noWatch?: boolean;
18
+ noSDK: boolean;
18
19
  }
19
- export declare function startServer(_ctx: any, _next: any, { port, command, experimental, noWatch }: Options): Promise<void>;
20
+ export declare function startServer(_ctx: any, _next: any, { port, command, noWatch, experimentalData, noSDK }: Options): Promise<void>;
20
21
  export {};
@@ -12,5 +12,5 @@ limitations under the License.
12
12
  */
13
13
  /// <reference types="node" />
14
14
  import http from 'http';
15
- declare const gqlServer: () => Promise<http.Server>;
15
+ declare const gqlServer: (database: any) => Promise<http.Server>;
16
16
  export default gqlServer;
@@ -11,4 +11,6 @@ See the License for the specific language governing permissions and
11
11
  limitations under the License.
12
12
  */
13
13
  import { GraphQLSchema } from 'graphql';
14
- export declare const generateTypes: (schema: GraphQLSchema, queryPathGlob?: string, fragDocPath?: string) => Promise<string>;
14
+ export declare const generateTypes: (schema: GraphQLSchema, queryPathGlob?: string, fragDocPath?: string, options?: {
15
+ noSDK: boolean;
16
+ }) => Promise<string>;
package/dist/index.js CHANGED
@@ -30,17 +30,16 @@ var server_exports = {};
30
30
  __export(server_exports, {
31
31
  default: () => server_default
32
32
  });
33
- var import_path3, import_cors, import_http, import_express, import_altair_express_middleware, import_body_parser, GITHUB_ACCESS_TOKEN, gqlServer, server_default;
33
+ var import_cors, import_http, import_express, import_altair_express_middleware, import_body_parser, GITHUB_ACCESS_TOKEN, gqlServer, server_default;
34
34
  var init_server = __esm({
35
35
  "pnp:/Users/jeffsee/code/tinacms/packages/@tinacms/cli/src/cmds/start-server/server.ts"() {
36
- import_path3 = __toModule(require("path"));
37
36
  import_cors = __toModule(require("cors"));
38
37
  import_http = __toModule(require("http"));
39
38
  import_express = __toModule(require("express"));
40
39
  import_altair_express_middleware = __toModule(require("altair-express-middleware"));
41
40
  import_body_parser = __toModule(require("body-parser"));
42
41
  GITHUB_ACCESS_TOKEN = process.env.GITHUB_PERSONAL_ACCESS_TOKEN;
43
- gqlServer = async () => {
42
+ gqlServer = async (database) => {
44
43
  const gqlPackage = require("@tinacms/graphql");
45
44
  const app = (0, import_express.default)();
46
45
  const server = import_http.default.createServer(app);
@@ -63,11 +62,10 @@ var init_server = __esm({
63
62
  }
64
63
  }`
65
64
  }));
66
- const rootPath = import_path3.default.join(process.cwd());
67
65
  app.post("/graphql", async (req, res) => {
68
66
  const { query, variables } = req.body;
69
- const result = await gqlPackage.gql({
70
- rootPath,
67
+ const result = await gqlPackage.resolve({
68
+ database,
71
69
  query,
72
70
  variables
73
71
  });
@@ -168,7 +166,10 @@ logger.level = "info";
168
166
  async function attachSchema(ctx, next, options) {
169
167
  logger.info(logText("Building schema..."));
170
168
  const rootPath = process.cwd();
171
- const schema = await (0, import_graphql.buildSchema)(rootPath);
169
+ const bridge = new import_graphql.FilesystemBridge(rootPath);
170
+ const store = new import_graphql.FilesystemStore({ rootPath });
171
+ const database = await (0, import_graphql.createDatabase)({ store, bridge });
172
+ const schema = await (0, import_graphql.buildSchema)(rootPath, database);
172
173
  ctx.schema = schema;
173
174
  next();
174
175
  }
@@ -288,15 +289,17 @@ var plugin = (schema, documents, config) => {
288
289
  // pnp:/Users/jeffsee/code/tinacms/packages/@tinacms/cli/src/codegen/index.ts
289
290
  var import_load = __toModule(require("@graphql-tools/load"));
290
291
  var import_graphql_file_loader = __toModule(require("@graphql-tools/graphql-file-loader"));
291
- var generateTypes = async (schema, queryPathGlob = process.cwd(), fragDocPath = process.cwd()) => {
292
+ var generateTypes = async (schema, queryPathGlob = process.cwd(), fragDocPath = process.cwd(), options = { noSDK: false }) => {
292
293
  logger.info("Generating types...");
293
294
  try {
294
295
  let docs = [];
295
296
  let fragDocs = [];
296
297
  try {
297
- docs = await (0, import_load.loadDocuments)(queryPathGlob, {
298
- loaders: [new import_graphql_file_loader.GraphQLFileLoader()]
299
- });
298
+ if (!options.noSDK) {
299
+ docs = await (0, import_load.loadDocuments)(queryPathGlob, {
300
+ loaders: [new import_graphql_file_loader.GraphQLFileLoader()]
301
+ });
302
+ }
300
303
  } catch (e) {
301
304
  let showErrorMessage = true;
302
305
  const message = e.message || "";
@@ -308,9 +311,11 @@ var generateTypes = async (schema, queryPathGlob = process.cwd(), fragDocPath =
308
311
  }
309
312
  }
310
313
  try {
311
- fragDocs = await (0, import_load.loadDocuments)(fragDocPath, {
312
- loaders: [new import_graphql_file_loader.GraphQLFileLoader()]
313
- });
314
+ if (!options.noSDK) {
315
+ fragDocs = await (0, import_load.loadDocuments)(fragDocPath, {
316
+ loaders: [new import_graphql_file_loader.GraphQLFileLoader()]
317
+ });
318
+ }
314
319
  } catch (error) {
315
320
  console.error(error);
316
321
  }
@@ -356,7 +361,7 @@ async function genTypes({ schema }, next, options) {
356
361
  const typesPath = process.cwd() + "/.tina/__generated__/types.ts";
357
362
  const fragPath = process.cwd() + "/.tina/__generated__/*.{graphql,gql}";
358
363
  const queryPathGlob = process.cwd() + "/.tina/queries/**/*.{graphql,gql}";
359
- const typescriptTypes = await generateTypes(schema, queryPathGlob, fragPath);
364
+ const typescriptTypes = await generateTypes(schema, queryPathGlob, fragPath, options);
360
365
  await import_fs_extra.default.outputFile(typesPath, `//@ts-nocheck
361
366
  // DO NOT MODIFY THIS FILE. This file is automatically generated by Tina
362
367
  ${typescriptTypes}
@@ -377,7 +382,7 @@ schema {
377
382
 
378
383
  // pnp:/Users/jeffsee/code/tinacms/packages/@tinacms/cli/src/cmds/start-server/index.ts
379
384
  var import_child_process = __toModule(require("child_process"));
380
- var import_path4 = __toModule(require("path"));
385
+ var import_path3 = __toModule(require("path"));
381
386
  var import_graphql7 = __toModule(require("@tinacms/graphql"));
382
387
 
383
388
  // pnp:/Users/jeffsee/code/tinacms/packages/@tinacms/cli/src/cmds/compile/index.ts
@@ -445,7 +450,6 @@ var compile = async (_ctx, _next) => {
445
450
  await import_fs_extra2.default.ensureFile(file);
446
451
  await import_fs_extra2.default.writeFile(file, defaultSchema);
447
452
  }
448
- await resetGeneratedFolder;
449
453
  await transpile2(tinaPath, tinaTempPath);
450
454
  Object.keys(require.cache).map((key) => {
451
455
  if (key.startsWith(tinaTempPath)) {
@@ -481,7 +485,15 @@ var defineSchema = (config) => {
481
485
  // pnp:/Users/jeffsee/code/tinacms/packages/@tinacms/cli/src/cmds/start-server/index.ts
482
486
  var import_chokidar = __toModule(require("chokidar"));
483
487
  var gqlPackageFile = require.resolve("@tinacms/graphql");
484
- async function startServer(_ctx, _next, { port = 4001, command, experimental, noWatch }) {
488
+ async function startServer(_ctx, _next, { port = 4001, command, noWatch, experimentalData, noSDK }) {
489
+ const rootPath = process.cwd();
490
+ if (!process.env.CI && !noWatch) {
491
+ await resetGeneratedFolder();
492
+ }
493
+ const bridge = new import_graphql7.FilesystemBridge(rootPath);
494
+ const store = experimentalData ? new import_graphql7.LevelStore(rootPath) : new import_graphql7.FilesystemStore({ rootPath });
495
+ const shouldBuild = bridge.supportsBuilding();
496
+ const database = await (0, import_graphql7.createDatabase)({ store, bridge });
485
497
  const startSubprocess = () => {
486
498
  if (typeof command === "string") {
487
499
  const commands = command.split(" ");
@@ -504,38 +516,42 @@ stack: ${code.stack || "No stack was provided"}`);
504
516
  });
505
517
  }
506
518
  };
507
- const rootPath = process.cwd();
508
519
  let ready = false;
509
520
  if (!noWatch && !process.env.CI) {
510
- import_chokidar.default.watch(`${rootPath}/**/*.{ts,gql,graphql}`, {
511
- ignored: `${import_path4.default.resolve(rootPath)}/.tina/__generated__/**/*`
521
+ import_chokidar.default.watch([`${rootPath}/**/*.{ts,gql,graphql}`], {
522
+ ignored: `${import_path3.default.resolve(rootPath)}/.tina/__generated__/**/*`
512
523
  }).on("ready", async () => {
513
524
  console.log("Generating Tina config");
514
525
  try {
515
- await build();
526
+ if (shouldBuild) {
527
+ await build(noSDK);
528
+ }
516
529
  ready = true;
517
530
  startSubprocess();
518
531
  } catch (e) {
519
532
  logger.info(dangerText(`${e.message}`));
533
+ console.log(e);
520
534
  process.exit(0);
521
535
  }
522
536
  }).on("all", async () => {
523
537
  if (ready) {
524
538
  logger.info("Tina change detected, regenerating config");
525
539
  try {
526
- await build();
540
+ if (shouldBuild) {
541
+ await build(noSDK);
542
+ }
527
543
  } catch (e) {
528
- logger.info(dangerText("Compilation failed with errors. Server has not been restarted.") + `see error below
544
+ logger.info(dangerText("Compilation failed with errors. Server has not been restarted.") + ` see error below
529
545
  ${e.message}`);
530
546
  }
531
547
  }
532
548
  });
533
549
  }
534
- const build = async () => {
550
+ const build = async (noSDK2) => {
535
551
  await compile(null, null);
536
- const schema = await (0, import_graphql7.buildSchema)(rootPath);
552
+ const schema = await (0, import_graphql7.buildSchema)(rootPath, database);
537
553
  await genTypes({ schema }, () => {
538
- }, {});
554
+ }, { noSDK: noSDK2 });
539
555
  };
540
556
  const state = {
541
557
  server: null,
@@ -544,7 +560,7 @@ stack: ${code.stack || "No stack was provided"}`);
544
560
  let isReady = false;
545
561
  const start = async () => {
546
562
  const s = (init_server(), server_exports);
547
- state.server = await s.default(experimental);
563
+ state.server = await s.default(database);
548
564
  state.server.listen(port, () => {
549
565
  logger.info(`Started Filesystem GraphQL server on port: ${port}`);
550
566
  logger.info(`Visit the playground at http://localhost:${port}/altair/`);
@@ -594,42 +610,13 @@ stack: ${code.stack || "No stack was provided"}`);
594
610
 
595
611
  // pnp:/Users/jeffsee/code/tinacms/packages/@tinacms/cli/src/cmds/init/index.ts
596
612
  var import_fs_extra3 = __toModule(require("fs-extra"));
597
- var import_path5 = __toModule(require("path"));
613
+ var import_path4 = __toModule(require("path"));
598
614
  var import_progress = __toModule(require("progress"));
599
615
  var import_prompts = __toModule(require("prompts"));
600
616
 
601
617
  // pnp:/Users/jeffsee/code/tinacms/packages/@tinacms/cli/src/cmds/init/setup-files/index.ts
602
- var adminPage = `import { useEffect } from "react";
603
- import { useRouter } from "next/router";
604
- import { useEditState } from "tinacms/dist/edit-state";
605
-
606
- const GoToEditPage = () => {
607
- const { setEdit } = useEditState();
608
- const router = useRouter();
609
- useEffect(() => {
610
- setEdit(true);
611
- router.back();
612
- }, []);
613
- return <div>Entering edit mode..</div>;
614
- };
615
-
616
- export default GoToEditPage;
617
- `;
618
- var exitAdminPage = `import { useEffect } from "react";
619
- import { useRouter } from "next/router";
620
- import { useEditState } from "tinacms/dist/edit-state";
621
-
622
- const GoToEditPage = () => {
623
- const { setEdit } = useEditState();
624
- const router = useRouter();
625
- useEffect(() => {
626
- setEdit(false);
627
- router.back();
628
- }, []);
629
- return <div>Exiting edit mode..</div>;;
630
- };
631
-
632
- export default GoToEditPage;
618
+ var adminPage = `import { TinaAdmin } from 'tinacms';
619
+ export default TinaAdmin;
633
620
  `;
634
621
  var blogPost = `---
635
622
  title: Vote For Pedro
@@ -934,7 +921,6 @@ const App = ({ Component, pageProps }) => {
934
921
  <TinaCMS
935
922
  clientId={process.env.NEXT_PUBLIC_TINA_CLIENT_ID}
936
923
  branch={process.env.NEXT_PUBLIC_EDIT_BRANCH}
937
- organization={process.env.NEXT_PUBLIC_ORGANIZATION_NAME}
938
924
  isLocalClient={Boolean(
939
925
  Number(process.env.NEXT_PUBLIC_USE_LOCAL_CLIENT ?? true)
940
926
  )}
@@ -985,21 +971,21 @@ async function installDeps(ctx, next, options) {
985
971
  next();
986
972
  }
987
973
  var baseDir = process.cwd();
988
- var TinaWrapperPathDir = import_path5.default.join(baseDir, "components");
989
- var TinaWrapperPath = import_path5.default.join(TinaWrapperPathDir, "tina-wrapper.tsx");
990
- var blogContentPath = import_path5.default.join(baseDir, "content", "posts");
991
- var blogPostPath = import_path5.default.join(blogContentPath, "HelloWorld.md");
974
+ var TinaWrapperPathDir = import_path4.default.join(baseDir, "components");
975
+ var TinaWrapperPath = import_path4.default.join(TinaWrapperPathDir, "tina-wrapper.tsx");
976
+ var blogContentPath = import_path4.default.join(baseDir, "content", "posts");
977
+ var blogPostPath = import_path4.default.join(blogContentPath, "HelloWorld.md");
992
978
  async function tinaSetup(ctx, next, options) {
993
- const useingSrc = import_fs_extra3.default.pathExistsSync(import_path5.default.join(baseDir, "src"));
979
+ const useingSrc = import_fs_extra3.default.pathExistsSync(import_path4.default.join(baseDir, "src"));
994
980
  if (!import_fs_extra3.default.pathExistsSync(blogPostPath)) {
995
981
  logger.info(logText("Adding a content folder..."));
996
982
  import_fs_extra3.default.mkdirpSync(blogContentPath);
997
983
  import_fs_extra3.default.writeFileSync(blogPostPath, blogPost);
998
984
  }
999
985
  logger.level = "info";
1000
- const pagesPath = import_path5.default.join(baseDir, useingSrc ? "src" : "", "pages");
1001
- const appPath = import_path5.default.join(pagesPath, "_app.js");
1002
- const appPathTS = import_path5.default.join(pagesPath, "_app.tsx");
986
+ const pagesPath = import_path4.default.join(baseDir, useingSrc ? "src" : "", "pages");
987
+ const appPath = import_path4.default.join(pagesPath, "_app.js");
988
+ const appPathTS = import_path4.default.join(pagesPath, "_app.tsx");
1003
989
  const appExtension = import_fs_extra3.default.existsSync(appPath) ? ".js" : ".tsx";
1004
990
  let wrapper = false;
1005
991
  if (!import_fs_extra3.default.pathExistsSync(appPath) && !import_fs_extra3.default.pathExistsSync(appPathTS)) {
@@ -1013,7 +999,7 @@ async function tinaSetup(ctx, next, options) {
1013
999
  });
1014
1000
  if (override.res) {
1015
1001
  logger.info(logText(`Adding _app${appExtension} ... \u2705`));
1016
- const appPathWithExtension = import_path5.default.join(pagesPath, `_app${appExtension}`);
1002
+ const appPathWithExtension = import_path4.default.join(pagesPath, `_app${appExtension}`);
1017
1003
  const fileContent = import_fs_extra3.default.pathExistsSync(appPath) ? (0, import_fs_extra3.readFileSync)(appPath) : (0, import_fs_extra3.readFileSync)(appPathTS);
1018
1004
  const matches = [
1019
1005
  ...fileContent.toString().matchAll(/^.*import.*\.css("|').*$/gm)
@@ -1026,14 +1012,14 @@ async function tinaSetup(ctx, next, options) {
1026
1012
  `, warnText(AppJsContent())));
1027
1013
  }
1028
1014
  }
1029
- const tinaBlogPagePath = import_path5.default.join(pagesPath, "demo", "blog");
1030
- const tinaBlogPagePathFile = import_path5.default.join(tinaBlogPagePath, "[filename].js");
1015
+ const tinaBlogPagePath = import_path4.default.join(pagesPath, "demo", "blog");
1016
+ const tinaBlogPagePathFile = import_path4.default.join(tinaBlogPagePath, "[filename].js");
1031
1017
  if (!import_fs_extra3.default.pathExistsSync(tinaBlogPagePathFile)) {
1032
1018
  import_fs_extra3.default.mkdirpSync(tinaBlogPagePath);
1033
1019
  import_fs_extra3.default.writeFileSync(tinaBlogPagePathFile, nextPostPage());
1034
1020
  }
1035
1021
  logger.info("Adding a content folder... \u2705");
1036
- const packagePath = import_path5.default.join(baseDir, "package.json");
1022
+ const packagePath = import_path4.default.join(baseDir, "package.json");
1037
1023
  const pack = JSON.parse((0, import_fs_extra3.readFileSync)(packagePath).toString());
1038
1024
  const oldScripts = pack.scripts || {};
1039
1025
  const newPack = JSON.stringify({
@@ -1046,52 +1032,13 @@ async function tinaSetup(ctx, next, options) {
1046
1032
  }
1047
1033
  }, null, 2);
1048
1034
  (0, import_fs_extra3.writeFileSync)(packagePath, newPack);
1049
- const adminPath = import_path5.default.join(pagesPath, "admin.tsx");
1050
- const adminPathJS = import_path5.default.join(pagesPath, "admin.js");
1051
- if (!import_fs_extra3.default.existsSync(adminPath) && !import_fs_extra3.default.existsSync(adminPathJS)) {
1052
- import_fs_extra3.default.writeFileSync(adminPathJS, adminPage);
1053
- } else {
1054
- const extension = import_fs_extra3.default.existsSync(adminPath) ? ".tsx" : "js";
1055
- const override = await (0, import_prompts.default)({
1056
- name: "override",
1057
- type: "confirm",
1058
- message: `Whoops... looks like you already have an admin${extension} do you want to override it?`
1059
- });
1060
- if (override.override) {
1061
- import_fs_extra3.default.writeFileSync(import_path5.default.join(pagesPath, "admin" + extension), adminPage);
1062
- } else {
1063
- const res = await (0, import_prompts.default)({
1064
- name: "name",
1065
- type: "text",
1066
- message: warnText("What would you like the route to be named that enters edit mode?: ")
1067
- });
1068
- const adminName = res.name || "admin";
1069
- import_fs_extra3.default.writeFileSync(import_path5.default.join(pagesPath, adminName + extension), adminPage);
1070
- }
1071
- }
1072
- const exitAdminPath = import_path5.default.join(pagesPath, "exit-admin.tsx");
1073
- const exitAdminPathJS = import_path5.default.join(pagesPath, "exit-admin.js");
1074
- if (!import_fs_extra3.default.existsSync(exitAdminPath) && !import_fs_extra3.default.existsSync(exitAdminPathJS)) {
1075
- import_fs_extra3.default.writeFileSync(exitAdminPathJS, exitAdminPage);
1076
- } else {
1077
- const extension = import_fs_extra3.default.existsSync(exitAdminPath) ? ".tsx" : "js";
1078
- const override = await (0, import_prompts.default)({
1079
- name: "override",
1080
- type: "confirm",
1081
- message: `Whoops... looks like you already have an exit-admin${extension} do you want to override it?`
1082
- });
1083
- if (override.override) {
1084
- import_fs_extra3.default.writeFileSync(import_path5.default.join(pagesPath, "exit-admin" + extension), exitAdminPage);
1085
- } else {
1086
- const res = await (0, import_prompts.default)({
1087
- name: "name",
1088
- type: "text",
1089
- message: warnText("What would you like the route to be named that exits edit mode?: ")
1090
- });
1091
- const adminName = res.name || "exit-admin";
1092
- import_fs_extra3.default.writeFileSync(import_path5.default.join(pagesPath, adminName + extension), exitAdminPage);
1093
- }
1035
+ const adminPath = import_path4.default.join(pagesPath, "admin", "[[...tina]].js");
1036
+ if (import_fs_extra3.default.pathExistsSync(import_path4.default.join(pagesPath, "admin"))) {
1037
+ logger.warn(`Unable to add /pages/admin/[[...tina]].js, this path already exists.
1038
+ Learn more about toggling edit-mode at https://tina.io/docs/tinacms-context/#manually-toggling-edit-mode`);
1039
+ return next();
1094
1040
  }
1041
+ (0, import_fs_extra3.outputFileSync)(adminPath, adminPage);
1095
1042
  next();
1096
1043
  }
1097
1044
  async function successMessage(ctx, next, options) {
@@ -1112,40 +1059,50 @@ var startServerPortOption = {
1112
1059
  name: "--port <port>",
1113
1060
  description: "Specify a port to run the server on. (default 4001)"
1114
1061
  };
1062
+ var experimentalDatalayer = {
1063
+ name: "--experimentalData",
1064
+ description: "Build the server with additional data querying capabilities"
1065
+ };
1115
1066
  var subCommand = {
1116
1067
  name: "-c, --command <command>",
1117
1068
  description: "The sub-command to run"
1118
1069
  };
1119
- var experimentalCommand = {
1120
- name: "--experimental",
1121
- description: "Run the unstable version of this service"
1122
- };
1123
1070
  var noWatchOption = {
1124
1071
  name: "--noWatch",
1125
1072
  description: "Don't regenerate config on file changes"
1126
1073
  };
1074
+ var noSDKCodegenOption = {
1075
+ name: "--noSDK",
1076
+ description: "Don't generate the generated client SDK"
1077
+ };
1127
1078
  var baseCmds = [
1128
1079
  {
1129
1080
  command: CMD_START_SERVER,
1130
1081
  description: "Start Filesystem Graphql Server",
1131
- options: [startServerPortOption, subCommand, experimentalCommand, noWatchOption],
1082
+ options: [
1083
+ startServerPortOption,
1084
+ subCommand,
1085
+ experimentalDatalayer,
1086
+ noWatchOption,
1087
+ noSDKCodegenOption
1088
+ ],
1132
1089
  action: (options) => chain([startServer], options)
1133
1090
  },
1134
1091
  {
1135
1092
  command: CMD_COMPILE_MODELS,
1136
1093
  description: "Compile schema into static files for the server",
1137
- options: [experimentalCommand],
1094
+ options: [experimentalDatalayer],
1138
1095
  action: (options) => chain([compile], options)
1139
1096
  },
1140
1097
  {
1141
1098
  command: CMD_GEN_TYPES,
1142
1099
  description: "Generate a GraphQL query for your site's schema, (and optionally Typescript types)",
1143
- options: [experimentalCommand],
1100
+ options: [experimentalDatalayer, noSDKCodegenOption],
1144
1101
  action: (options) => chain([attachSchema, genTypes], options)
1145
1102
  },
1146
1103
  {
1147
1104
  command: INIT,
1148
- options: [experimentalCommand],
1105
+ options: [experimentalDatalayer],
1149
1106
  description: "Add Tina Cloud to an existing project",
1150
1107
  action: (options) => chain([
1151
1108
  initTina,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/cli",
3
- "version": "0.57.2",
3
+ "version": "0.58.0",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "files": [
@@ -56,7 +56,7 @@
56
56
  "@graphql-codegen/visitor-plugin-common": "^2.4.0",
57
57
  "@graphql-tools/graphql-file-loader": "^7.2.0",
58
58
  "@graphql-tools/load": "^7.3.2",
59
- "@tinacms/graphql": "0.57.0",
59
+ "@tinacms/graphql": "0.58.0",
60
60
  "ajv": "^6.12.3",
61
61
  "altair-express-middleware": "4.0.6",
62
62
  "auto-bind": "^4.0.0",