@tinacms/cli 0.57.2 → 0.58.4
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,66 @@
|
|
|
1
1
|
# tinacms-cli
|
|
2
2
|
|
|
3
|
+
## 0.58.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 118524507: Fixed typo in admin link
|
|
8
|
+
- Updated dependencies [f46c6f987]
|
|
9
|
+
- @tinacms/graphql@0.59.1
|
|
10
|
+
|
|
11
|
+
## 0.58.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [bd4e1f802]
|
|
16
|
+
- Updated dependencies [62bea7019]
|
|
17
|
+
- @tinacms/graphql@0.59.0
|
|
18
|
+
|
|
19
|
+
## 0.58.2
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [fffce3af8]
|
|
24
|
+
- @tinacms/graphql@0.58.2
|
|
25
|
+
|
|
26
|
+
## 0.58.1
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- Updated dependencies [4700d7ae4]
|
|
31
|
+
- @tinacms/graphql@0.58.1
|
|
32
|
+
|
|
33
|
+
## 0.58.0
|
|
34
|
+
|
|
35
|
+
### Minor Changes
|
|
36
|
+
|
|
37
|
+
- 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.
|
|
38
|
+
- 8c14f29ef: Updated cli to include a new option, `--noSDK`. When this flag is present it will not generate the SDK.
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- 9c5f888a3: Modifies `tinacms init` for `TinaAdmin`-ready page
|
|
43
|
+
- Updated dependencies [eb5fbfac7]
|
|
44
|
+
- Updated dependencies [fa7a0419f]
|
|
45
|
+
- Updated dependencies [47d126029]
|
|
46
|
+
- @tinacms/graphql@0.58.0
|
|
47
|
+
|
|
48
|
+
## 0.57.2
|
|
49
|
+
|
|
50
|
+
### Patch Changes
|
|
51
|
+
|
|
52
|
+
- edb2f4011: Trim path property on collections during compilation
|
|
53
|
+
- Updated dependencies [edb2f4011]
|
|
54
|
+
- @tinacms/graphql@0.57.2
|
|
55
|
+
|
|
3
56
|
## 0.57.1
|
|
4
57
|
|
|
5
58
|
### Patch Changes
|
|
6
59
|
|
|
7
60
|
- 50710e1d0: Add no-check for Typescript-generated file
|
|
61
|
+
- c78d981e6: Reset entire **generated** folder on re-compile
|
|
62
|
+
- Updated dependencies [60729f60c]
|
|
63
|
+
- @tinacms/graphql@0.57.1
|
|
8
64
|
|
|
9
65
|
## 0.57.0
|
|
10
66
|
|
|
@@ -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 {
|
|
14
|
-
export declare const
|
|
15
|
-
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";
|
|
13
|
+
export declare const adminPage = "import { TinaAdmin } from 'tinacms';\nexport default TinaAdmin;\n";
|
|
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 [`/admin`](/admin) route. Then click the pencil icon in the bottom lefthand corner to start editing \uD83E\uDD99. \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
|
-
|
|
16
|
+
experimentalData?: boolean;
|
|
17
17
|
noWatch?: boolean;
|
|
18
|
+
noSDK: boolean;
|
|
18
19
|
}
|
|
19
|
-
export declare function startServer(_ctx: any, _next: any, { port, command,
|
|
20
|
+
export declare function startServer(_ctx: any, _next: any, { port, command, noWatch, experimentalData, noSDK }: Options): Promise<void>;
|
|
20
21
|
export {};
|
package/dist/codegen/index.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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.
|
|
70
|
-
|
|
67
|
+
const result = await gqlPackage.resolve({
|
|
68
|
+
database,
|
|
71
69
|
query,
|
|
72
70
|
variables
|
|
73
71
|
});
|
|
@@ -118,7 +116,7 @@ var commander = __toModule(require("commander"));
|
|
|
118
116
|
|
|
119
117
|
// pnp:/Users/jeffsee/code/tinacms/packages/@tinacms/cli/package.json
|
|
120
118
|
var name = "@tinacms/cli";
|
|
121
|
-
var version = "0.
|
|
119
|
+
var version = "0.58.4";
|
|
122
120
|
|
|
123
121
|
// pnp:/Users/jeffsee/code/tinacms/packages/@tinacms/cli/src/utils/theme.ts
|
|
124
122
|
var import_chalk = __toModule(require("chalk"));
|
|
@@ -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
|
|
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
|
-
|
|
298
|
-
|
|
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
|
-
|
|
312
|
-
|
|
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
|
|
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,
|
|
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: `${
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
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,51 +610,20 @@ 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
|
|
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 {
|
|
603
|
-
|
|
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
|
|
636
623
|
---
|
|
637
624
|
# Welcome to the blog.
|
|
638
625
|
|
|
639
|
-
> To edit this site head over to the [\`
|
|
640
|
-
admin\`](/admin) route. Then click the pencil icon in the bottom lefthand corner to start editing \u{1F999}.
|
|
641
|
-
|
|
626
|
+
> To edit this site head over to the [\`/admin\`](/admin) route. Then click the pencil icon in the bottom lefthand corner to start editing \u{1F999}.
|
|
642
627
|
|
|
643
628
|
# Dixi gaude Arethusa
|
|
644
629
|
|
|
@@ -934,7 +919,6 @@ const App = ({ Component, pageProps }) => {
|
|
|
934
919
|
<TinaCMS
|
|
935
920
|
clientId={process.env.NEXT_PUBLIC_TINA_CLIENT_ID}
|
|
936
921
|
branch={process.env.NEXT_PUBLIC_EDIT_BRANCH}
|
|
937
|
-
organization={process.env.NEXT_PUBLIC_ORGANIZATION_NAME}
|
|
938
922
|
isLocalClient={Boolean(
|
|
939
923
|
Number(process.env.NEXT_PUBLIC_USE_LOCAL_CLIENT ?? true)
|
|
940
924
|
)}
|
|
@@ -985,21 +969,21 @@ async function installDeps(ctx, next, options) {
|
|
|
985
969
|
next();
|
|
986
970
|
}
|
|
987
971
|
var baseDir = process.cwd();
|
|
988
|
-
var TinaWrapperPathDir =
|
|
989
|
-
var TinaWrapperPath =
|
|
990
|
-
var blogContentPath =
|
|
991
|
-
var blogPostPath =
|
|
972
|
+
var TinaWrapperPathDir = import_path4.default.join(baseDir, "components");
|
|
973
|
+
var TinaWrapperPath = import_path4.default.join(TinaWrapperPathDir, "tina-wrapper.tsx");
|
|
974
|
+
var blogContentPath = import_path4.default.join(baseDir, "content", "posts");
|
|
975
|
+
var blogPostPath = import_path4.default.join(blogContentPath, "HelloWorld.md");
|
|
992
976
|
async function tinaSetup(ctx, next, options) {
|
|
993
|
-
const useingSrc = import_fs_extra3.default.pathExistsSync(
|
|
977
|
+
const useingSrc = import_fs_extra3.default.pathExistsSync(import_path4.default.join(baseDir, "src"));
|
|
994
978
|
if (!import_fs_extra3.default.pathExistsSync(blogPostPath)) {
|
|
995
979
|
logger.info(logText("Adding a content folder..."));
|
|
996
980
|
import_fs_extra3.default.mkdirpSync(blogContentPath);
|
|
997
981
|
import_fs_extra3.default.writeFileSync(blogPostPath, blogPost);
|
|
998
982
|
}
|
|
999
983
|
logger.level = "info";
|
|
1000
|
-
const pagesPath =
|
|
1001
|
-
const appPath =
|
|
1002
|
-
const appPathTS =
|
|
984
|
+
const pagesPath = import_path4.default.join(baseDir, useingSrc ? "src" : "", "pages");
|
|
985
|
+
const appPath = import_path4.default.join(pagesPath, "_app.js");
|
|
986
|
+
const appPathTS = import_path4.default.join(pagesPath, "_app.tsx");
|
|
1003
987
|
const appExtension = import_fs_extra3.default.existsSync(appPath) ? ".js" : ".tsx";
|
|
1004
988
|
let wrapper = false;
|
|
1005
989
|
if (!import_fs_extra3.default.pathExistsSync(appPath) && !import_fs_extra3.default.pathExistsSync(appPathTS)) {
|
|
@@ -1013,7 +997,7 @@ async function tinaSetup(ctx, next, options) {
|
|
|
1013
997
|
});
|
|
1014
998
|
if (override.res) {
|
|
1015
999
|
logger.info(logText(`Adding _app${appExtension} ... \u2705`));
|
|
1016
|
-
const appPathWithExtension =
|
|
1000
|
+
const appPathWithExtension = import_path4.default.join(pagesPath, `_app${appExtension}`);
|
|
1017
1001
|
const fileContent = import_fs_extra3.default.pathExistsSync(appPath) ? (0, import_fs_extra3.readFileSync)(appPath) : (0, import_fs_extra3.readFileSync)(appPathTS);
|
|
1018
1002
|
const matches = [
|
|
1019
1003
|
...fileContent.toString().matchAll(/^.*import.*\.css("|').*$/gm)
|
|
@@ -1026,14 +1010,14 @@ async function tinaSetup(ctx, next, options) {
|
|
|
1026
1010
|
`, warnText(AppJsContent())));
|
|
1027
1011
|
}
|
|
1028
1012
|
}
|
|
1029
|
-
const tinaBlogPagePath =
|
|
1030
|
-
const tinaBlogPagePathFile =
|
|
1013
|
+
const tinaBlogPagePath = import_path4.default.join(pagesPath, "demo", "blog");
|
|
1014
|
+
const tinaBlogPagePathFile = import_path4.default.join(tinaBlogPagePath, "[filename].js");
|
|
1031
1015
|
if (!import_fs_extra3.default.pathExistsSync(tinaBlogPagePathFile)) {
|
|
1032
1016
|
import_fs_extra3.default.mkdirpSync(tinaBlogPagePath);
|
|
1033
1017
|
import_fs_extra3.default.writeFileSync(tinaBlogPagePathFile, nextPostPage());
|
|
1034
1018
|
}
|
|
1035
1019
|
logger.info("Adding a content folder... \u2705");
|
|
1036
|
-
const packagePath =
|
|
1020
|
+
const packagePath = import_path4.default.join(baseDir, "package.json");
|
|
1037
1021
|
const pack = JSON.parse((0, import_fs_extra3.readFileSync)(packagePath).toString());
|
|
1038
1022
|
const oldScripts = pack.scripts || {};
|
|
1039
1023
|
const newPack = JSON.stringify({
|
|
@@ -1046,52 +1030,13 @@ async function tinaSetup(ctx, next, options) {
|
|
|
1046
1030
|
}
|
|
1047
1031
|
}, null, 2);
|
|
1048
1032
|
(0, import_fs_extra3.writeFileSync)(packagePath, newPack);
|
|
1049
|
-
const adminPath =
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
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
|
-
}
|
|
1033
|
+
const adminPath = import_path4.default.join(pagesPath, "admin", "[[...tina]].js");
|
|
1034
|
+
if (import_fs_extra3.default.pathExistsSync(import_path4.default.join(pagesPath, "admin"))) {
|
|
1035
|
+
logger.warn(`Unable to add /pages/admin/[[...tina]].js, this path already exists.
|
|
1036
|
+
Learn more about toggling edit-mode at https://tina.io/docs/tinacms-context/#manually-toggling-edit-mode`);
|
|
1037
|
+
return next();
|
|
1094
1038
|
}
|
|
1039
|
+
(0, import_fs_extra3.outputFileSync)(adminPath, adminPage);
|
|
1095
1040
|
next();
|
|
1096
1041
|
}
|
|
1097
1042
|
async function successMessage(ctx, next, options) {
|
|
@@ -1112,40 +1057,50 @@ var startServerPortOption = {
|
|
|
1112
1057
|
name: "--port <port>",
|
|
1113
1058
|
description: "Specify a port to run the server on. (default 4001)"
|
|
1114
1059
|
};
|
|
1060
|
+
var experimentalDatalayer = {
|
|
1061
|
+
name: "--experimentalData",
|
|
1062
|
+
description: "Build the server with additional data querying capabilities"
|
|
1063
|
+
};
|
|
1115
1064
|
var subCommand = {
|
|
1116
1065
|
name: "-c, --command <command>",
|
|
1117
1066
|
description: "The sub-command to run"
|
|
1118
1067
|
};
|
|
1119
|
-
var experimentalCommand = {
|
|
1120
|
-
name: "--experimental",
|
|
1121
|
-
description: "Run the unstable version of this service"
|
|
1122
|
-
};
|
|
1123
1068
|
var noWatchOption = {
|
|
1124
1069
|
name: "--noWatch",
|
|
1125
1070
|
description: "Don't regenerate config on file changes"
|
|
1126
1071
|
};
|
|
1072
|
+
var noSDKCodegenOption = {
|
|
1073
|
+
name: "--noSDK",
|
|
1074
|
+
description: "Don't generate the generated client SDK"
|
|
1075
|
+
};
|
|
1127
1076
|
var baseCmds = [
|
|
1128
1077
|
{
|
|
1129
1078
|
command: CMD_START_SERVER,
|
|
1130
1079
|
description: "Start Filesystem Graphql Server",
|
|
1131
|
-
options: [
|
|
1080
|
+
options: [
|
|
1081
|
+
startServerPortOption,
|
|
1082
|
+
subCommand,
|
|
1083
|
+
experimentalDatalayer,
|
|
1084
|
+
noWatchOption,
|
|
1085
|
+
noSDKCodegenOption
|
|
1086
|
+
],
|
|
1132
1087
|
action: (options) => chain([startServer], options)
|
|
1133
1088
|
},
|
|
1134
1089
|
{
|
|
1135
1090
|
command: CMD_COMPILE_MODELS,
|
|
1136
1091
|
description: "Compile schema into static files for the server",
|
|
1137
|
-
options: [
|
|
1092
|
+
options: [experimentalDatalayer],
|
|
1138
1093
|
action: (options) => chain([compile], options)
|
|
1139
1094
|
},
|
|
1140
1095
|
{
|
|
1141
1096
|
command: CMD_GEN_TYPES,
|
|
1142
1097
|
description: "Generate a GraphQL query for your site's schema, (and optionally Typescript types)",
|
|
1143
|
-
options: [
|
|
1098
|
+
options: [experimentalDatalayer, noSDKCodegenOption],
|
|
1144
1099
|
action: (options) => chain([attachSchema, genTypes], options)
|
|
1145
1100
|
},
|
|
1146
1101
|
{
|
|
1147
1102
|
command: INIT,
|
|
1148
|
-
options: [
|
|
1103
|
+
options: [experimentalDatalayer],
|
|
1149
1104
|
description: "Add Tina Cloud to an existing project",
|
|
1150
1105
|
action: (options) => chain([
|
|
1151
1106
|
initTina,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.58.4",
|
|
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.
|
|
59
|
+
"@tinacms/graphql": "0.59.1",
|
|
60
60
|
"ajv": "^6.12.3",
|
|
61
61
|
"altair-express-middleware": "4.0.6",
|
|
62
62
|
"auto-bind": "^4.0.0",
|