@tinacms/cli 0.60.0 → 0.60.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 +43 -0
- package/dist/cmds/start-server/index.d.ts +2 -1
- package/dist/index.js +141 -71
- package/package.json +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# tinacms-cli
|
|
2
2
|
|
|
3
|
+
## 0.60.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a05546eb4: Added basic open source telemetry
|
|
8
|
+
|
|
9
|
+
See [this discussion](https://github.com/tinacms/tinacms/discussions/2451) for more information and how to opt out.
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [8bf0ac832]
|
|
12
|
+
- Updated dependencies [a05546eb4]
|
|
13
|
+
- @tinacms/metrics@0.0.2
|
|
14
|
+
- @tinacms/datalayer@0.0.2
|
|
15
|
+
- @tinacms/graphql@0.59.6
|
|
16
|
+
|
|
17
|
+
## 0.60.3
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- 43b40cc8b: Implement useTina in CLI init
|
|
22
|
+
- b399c734c: Fixes support for collection.templates in graphql
|
|
23
|
+
- Updated dependencies [b399c734c]
|
|
24
|
+
- @tinacms/datalayer@0.0.2
|
|
25
|
+
- @tinacms/graphql@0.59.6
|
|
26
|
+
|
|
27
|
+
## 0.60.2
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- d17de356a: Update CLI to use apiUrl
|
|
32
|
+
- a67b0c1d7: Dont reinstantiate bridge and store
|
|
33
|
+
|
|
34
|
+
## 0.60.1
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- Updated dependencies [8ad8f03fd]
|
|
39
|
+
- Updated dependencies [04b7988d5]
|
|
40
|
+
- Updated dependencies [e3c41f69d]
|
|
41
|
+
- Updated dependencies [f5390e841]
|
|
42
|
+
- Updated dependencies [32082e0b3]
|
|
43
|
+
- @tinacms/graphql@0.59.5
|
|
44
|
+
- @tinacms/datalayer@0.0.1
|
|
45
|
+
|
|
3
46
|
## 0.60.0
|
|
4
47
|
|
|
5
48
|
### Minor Changes
|
|
@@ -16,6 +16,7 @@ interface Options {
|
|
|
16
16
|
experimentalData?: boolean;
|
|
17
17
|
noWatch?: boolean;
|
|
18
18
|
noSDK: boolean;
|
|
19
|
+
noTelemetry: boolean;
|
|
19
20
|
}
|
|
20
|
-
export declare function startServer(_ctx: any, _next: any, { port, command, noWatch, experimentalData, noSDK }: Options): Promise<void>;
|
|
21
|
+
export declare function startServer(_ctx: any, _next: any, { port, command, noWatch, experimentalData, noSDK, noTelemetry, }: Options): Promise<void>;
|
|
21
22
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,39 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
8
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
7
24
|
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
25
|
+
var __objRest = (source, exclude) => {
|
|
26
|
+
var target = {};
|
|
27
|
+
for (var prop in source)
|
|
28
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
if (source != null && __getOwnPropSymbols)
|
|
31
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
+
target[prop] = source[prop];
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
8
37
|
var __esm = (fn, res) => function __init() {
|
|
9
38
|
return fn && (res = (0, fn[Object.keys(fn)[0]])(fn = 0)), res;
|
|
10
39
|
};
|
|
@@ -25,14 +54,14 @@ var __toModule = (module2) => {
|
|
|
25
54
|
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
26
55
|
};
|
|
27
56
|
|
|
28
|
-
// pnp:/
|
|
57
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/start-server/server.ts
|
|
29
58
|
var server_exports = {};
|
|
30
59
|
__export(server_exports, {
|
|
31
60
|
default: () => server_default
|
|
32
61
|
});
|
|
33
62
|
var import_cors, import_http, import_express, import_altair_express_middleware, import_body_parser, gqlServer, server_default;
|
|
34
63
|
var init_server = __esm({
|
|
35
|
-
"pnp:/
|
|
64
|
+
"pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/start-server/server.ts"() {
|
|
36
65
|
import_cors = __toModule(require("cors"));
|
|
37
66
|
import_http = __toModule(require("http"));
|
|
38
67
|
import_express = __toModule(require("express"));
|
|
@@ -76,18 +105,18 @@ var init_server = __esm({
|
|
|
76
105
|
}
|
|
77
106
|
});
|
|
78
107
|
|
|
79
|
-
// pnp:/
|
|
108
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/index.ts
|
|
80
109
|
__export(exports, {
|
|
81
110
|
defineSchema: () => defineSchema,
|
|
82
111
|
init: () => init
|
|
83
112
|
});
|
|
84
113
|
var commander = __toModule(require("commander"));
|
|
85
114
|
|
|
86
|
-
// pnp:/
|
|
115
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/package.json
|
|
87
116
|
var name = "@tinacms/cli";
|
|
88
|
-
var version = "0.
|
|
117
|
+
var version = "0.60.4";
|
|
89
118
|
|
|
90
|
-
// pnp:/
|
|
119
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/utils/theme.ts
|
|
91
120
|
var import_chalk = __toModule(require("chalk"));
|
|
92
121
|
var successText = import_chalk.default.bold.green;
|
|
93
122
|
var dangerText = import_chalk.default.bold.red;
|
|
@@ -98,7 +127,7 @@ var logText = import_chalk.default.italic.gray;
|
|
|
98
127
|
var warnText = import_chalk.default.yellowBright.bgBlack;
|
|
99
128
|
var CONFIRMATION_TEXT = import_chalk.default.dim("enter to confirm");
|
|
100
129
|
|
|
101
|
-
// pnp:/
|
|
130
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/middleware.ts
|
|
102
131
|
var chain = async (cmds, options) => {
|
|
103
132
|
const ctx = {};
|
|
104
133
|
const next = async (middlewareIndex) => {
|
|
@@ -117,11 +146,11 @@ var chain = async (cmds, options) => {
|
|
|
117
146
|
}
|
|
118
147
|
};
|
|
119
148
|
|
|
120
|
-
// pnp:/
|
|
149
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/query-gen/attachSchema.ts
|
|
121
150
|
var import_graphql = __toModule(require("@tinacms/graphql"));
|
|
122
151
|
var import_datalayer = __toModule(require("@tinacms/datalayer"));
|
|
123
152
|
|
|
124
|
-
// pnp:/
|
|
153
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/logger/index.ts
|
|
125
154
|
var import_log4js = __toModule(require("log4js"));
|
|
126
155
|
var logger = import_log4js.default.getLogger();
|
|
127
156
|
import_log4js.default.configure({
|
|
@@ -132,7 +161,7 @@ import_log4js.default.configure({
|
|
|
132
161
|
});
|
|
133
162
|
logger.level = "info";
|
|
134
163
|
|
|
135
|
-
// pnp:/
|
|
164
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/query-gen/attachSchema.ts
|
|
136
165
|
async function attachSchema(ctx, next, options) {
|
|
137
166
|
logger.info(logText("Building schema..."));
|
|
138
167
|
const rootPath2 = process.cwd();
|
|
@@ -144,13 +173,13 @@ async function attachSchema(ctx, next, options) {
|
|
|
144
173
|
next();
|
|
145
174
|
}
|
|
146
175
|
|
|
147
|
-
// pnp:/
|
|
176
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/codegen/index.ts
|
|
148
177
|
var import_graphql5 = __toModule(require("graphql"));
|
|
149
178
|
var import_core = __toModule(require("@graphql-codegen/core"));
|
|
150
179
|
var import_typescript = __toModule(require("@graphql-codegen/typescript"));
|
|
151
180
|
var import_typescript_operations = __toModule(require("@graphql-codegen/typescript-operations"));
|
|
152
181
|
|
|
153
|
-
// pnp:/
|
|
182
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/codegen/plugin.ts
|
|
154
183
|
var AddGeneratedClientFunc = (_schema, _documents, _config, _info) => {
|
|
155
184
|
return `
|
|
156
185
|
// TinaSDK generated code
|
|
@@ -185,12 +214,12 @@ var AddGeneratedClient = {
|
|
|
185
214
|
plugin: AddGeneratedClientFunc
|
|
186
215
|
};
|
|
187
216
|
|
|
188
|
-
// pnp:/
|
|
217
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/codegen/sdkPlugin/index.ts
|
|
189
218
|
var import_graphql3 = __toModule(require("graphql"));
|
|
190
219
|
var import_graphql4 = __toModule(require("graphql"));
|
|
191
220
|
var import_path = __toModule(require("path"));
|
|
192
221
|
|
|
193
|
-
// pnp:/
|
|
222
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/codegen/sdkPlugin/visitor.ts
|
|
194
223
|
var import_visitor_plugin_common = __toModule(require("@graphql-codegen/visitor-plugin-common"));
|
|
195
224
|
var import_auto_bind = __toModule(require("auto-bind"));
|
|
196
225
|
var import_graphql2 = __toModule(require("graphql"));
|
|
@@ -240,7 +269,7 @@ var GenericSdkVisitor = class extends import_visitor_plugin_common.ClientSideBas
|
|
|
240
269
|
}
|
|
241
270
|
};
|
|
242
271
|
|
|
243
|
-
// pnp:/
|
|
272
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/codegen/sdkPlugin/index.ts
|
|
244
273
|
var plugin = (schema, documents, config) => {
|
|
245
274
|
const allAst = (0, import_graphql4.concatAST)(documents.reduce((prev, v) => {
|
|
246
275
|
return [...prev, v.document];
|
|
@@ -266,7 +295,7 @@ var plugin = (schema, documents, config) => {
|
|
|
266
295
|
};
|
|
267
296
|
};
|
|
268
297
|
|
|
269
|
-
// pnp:/
|
|
298
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/codegen/index.ts
|
|
270
299
|
var import_load = __toModule(require("@graphql-tools/load"));
|
|
271
300
|
var import_graphql_file_loader = __toModule(require("@graphql-tools/graphql-file-loader"));
|
|
272
301
|
var generateTypes = async (schema, queryPathGlob = process.cwd(), fragDocPath = process.cwd(), options = { noSDK: false }) => {
|
|
@@ -334,7 +363,7 @@ var generateTypes = async (schema, queryPathGlob = process.cwd(), fragDocPath =
|
|
|
334
363
|
}
|
|
335
364
|
};
|
|
336
365
|
|
|
337
|
-
// pnp:/
|
|
366
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/query-gen/genTypes.ts
|
|
338
367
|
var import_graphql6 = __toModule(require("graphql"));
|
|
339
368
|
var import_fs_extra = __toModule(require("fs-extra"));
|
|
340
369
|
async function genTypes({ schema }, next, options) {
|
|
@@ -360,20 +389,20 @@ schema {
|
|
|
360
389
|
next();
|
|
361
390
|
}
|
|
362
391
|
|
|
363
|
-
// pnp:/
|
|
392
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/start-server/index.ts
|
|
364
393
|
var import_child_process = __toModule(require("child_process"));
|
|
365
394
|
var import_path3 = __toModule(require("path"));
|
|
366
395
|
var import_graphql7 = __toModule(require("@tinacms/graphql"));
|
|
367
396
|
var import_datalayer2 = __toModule(require("@tinacms/datalayer"));
|
|
368
397
|
|
|
369
|
-
// pnp:/
|
|
398
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/compile/index.ts
|
|
370
399
|
var import_fast_glob = __toModule(require("fast-glob"));
|
|
371
400
|
var import_normalize_path = __toModule(require("normalize-path"));
|
|
372
401
|
var import_path2 = __toModule(require("path"));
|
|
373
402
|
var import_fs_extra2 = __toModule(require("fs-extra"));
|
|
374
403
|
var ts = __toModule(require("typescript"));
|
|
375
404
|
|
|
376
|
-
// pnp:/
|
|
405
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/compile/defaultSchema.ts
|
|
377
406
|
var defaultSchema = `
|
|
378
407
|
import { defineSchema } from "@tinacms/cli";
|
|
379
408
|
|
|
@@ -404,7 +433,7 @@ export default defineSchema({
|
|
|
404
433
|
});
|
|
405
434
|
`;
|
|
406
435
|
|
|
407
|
-
// pnp:/
|
|
436
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/compile/index.ts
|
|
408
437
|
var tinaPath = import_path2.default.join(process.cwd(), ".tina");
|
|
409
438
|
var tinaGeneratedPath = import_path2.default.join(tinaPath, "__generated__");
|
|
410
439
|
var tinaTempPath = import_path2.default.join(tinaGeneratedPath, "temp");
|
|
@@ -463,11 +492,25 @@ var defineSchema = (config) => {
|
|
|
463
492
|
return config;
|
|
464
493
|
};
|
|
465
494
|
|
|
466
|
-
// pnp:/
|
|
495
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/start-server/index.ts
|
|
467
496
|
var import_chokidar = __toModule(require("chokidar"));
|
|
497
|
+
var import_metrics = __toModule(require("@tinacms/metrics"));
|
|
468
498
|
var gqlPackageFile = require.resolve("@tinacms/graphql");
|
|
469
|
-
async function startServer(_ctx, _next, {
|
|
499
|
+
async function startServer(_ctx, _next, {
|
|
500
|
+
port = 4001,
|
|
501
|
+
command,
|
|
502
|
+
noWatch,
|
|
503
|
+
experimentalData,
|
|
504
|
+
noSDK,
|
|
505
|
+
noTelemetry
|
|
506
|
+
}) {
|
|
470
507
|
const rootPath2 = process.cwd();
|
|
508
|
+
const t = new import_metrics.Telemetry({ disabled: Boolean(noTelemetry) });
|
|
509
|
+
t.submitRecord({
|
|
510
|
+
event: {
|
|
511
|
+
name: "tinacms:cli:server:start:invoke"
|
|
512
|
+
}
|
|
513
|
+
});
|
|
471
514
|
if (!process.env.CI && !noWatch) {
|
|
472
515
|
await resetGeneratedFolder();
|
|
473
516
|
}
|
|
@@ -524,6 +567,12 @@ stack: ${code.stack || "No stack was provided"}`);
|
|
|
524
567
|
} catch (e) {
|
|
525
568
|
logger.info(dangerText("Compilation failed with errors. Server has not been restarted.") + ` see error below
|
|
526
569
|
${e.message}`);
|
|
570
|
+
t.submitRecord({
|
|
571
|
+
event: {
|
|
572
|
+
name: "tinacms:cli:server:error",
|
|
573
|
+
errorMessage: e.message
|
|
574
|
+
}
|
|
575
|
+
});
|
|
527
576
|
}
|
|
528
577
|
}
|
|
529
578
|
});
|
|
@@ -532,9 +581,7 @@ stack: ${code.stack || "No stack was provided"}`);
|
|
|
532
581
|
if (!process.env.CI && !noWatch) {
|
|
533
582
|
await resetGeneratedFolder();
|
|
534
583
|
}
|
|
535
|
-
const
|
|
536
|
-
const store2 = experimentalData ? new import_datalayer2.LevelStore(rootPath2) : new import_datalayer2.FilesystemStore({ rootPath: rootPath2 });
|
|
537
|
-
const database2 = await (0, import_graphql7.createDatabase)({ store: store2, bridge: bridge2 });
|
|
584
|
+
const database2 = await (0, import_graphql7.createDatabase)({ store, bridge });
|
|
538
585
|
await compile(null, null);
|
|
539
586
|
const schema = await (0, import_graphql7.buildSchema)(rootPath2, database2);
|
|
540
587
|
await genTypes({ schema }, () => {
|
|
@@ -595,13 +642,14 @@ stack: ${code.stack || "No stack was provided"}`);
|
|
|
595
642
|
}
|
|
596
643
|
}
|
|
597
644
|
|
|
598
|
-
// pnp:/
|
|
645
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/init/index.ts
|
|
599
646
|
var import_fs_extra3 = __toModule(require("fs-extra"));
|
|
600
647
|
var import_path4 = __toModule(require("path"));
|
|
601
648
|
var import_progress = __toModule(require("progress"));
|
|
602
649
|
var import_prompts = __toModule(require("prompts"));
|
|
650
|
+
var import_metrics2 = __toModule(require("@tinacms/metrics"));
|
|
603
651
|
|
|
604
|
-
// pnp:/
|
|
652
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/init/setup-files/index.ts
|
|
605
653
|
var adminPage = `import { TinaAdmin } from 'tinacms';
|
|
606
654
|
export default TinaAdmin;
|
|
607
655
|
`;
|
|
@@ -641,7 +689,19 @@ var nextPostPage = () => `// THIS FILE HAS BEEN GENERATED WITH THE TINA CLI.
|
|
|
641
689
|
import { staticRequest, gql } from "tinacms";
|
|
642
690
|
import Head from "next/head";
|
|
643
691
|
import { createGlobalStyle } from "styled-components";
|
|
644
|
-
|
|
692
|
+
import { useTina } from "tinacms/dist/edit-state";
|
|
693
|
+
|
|
694
|
+
const query = gql\`
|
|
695
|
+
query BlogPostQuery($relativePath: String!) {
|
|
696
|
+
getPostsDocument(relativePath: $relativePath) {
|
|
697
|
+
data {
|
|
698
|
+
title
|
|
699
|
+
body
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
\`
|
|
704
|
+
|
|
645
705
|
// Styles for markdown
|
|
646
706
|
const GlobalStyle = createGlobalStyle\`
|
|
647
707
|
h1,h2,h3,h4,h5 {
|
|
@@ -678,6 +738,12 @@ var nextPostPage = () => `// THIS FILE HAS BEEN GENERATED WITH THE TINA CLI.
|
|
|
678
738
|
const defaultMarked = (markdown) => markdown;
|
|
679
739
|
// Use the props returned by get static props (this can be deleted when the edit provider and tina-wrapper are moved to _app.js)
|
|
680
740
|
const BlogPage = (props) => {
|
|
741
|
+
const { data } = useTina({
|
|
742
|
+
query,
|
|
743
|
+
variables: props.variables,
|
|
744
|
+
data: props.data,
|
|
745
|
+
});
|
|
746
|
+
|
|
681
747
|
return (
|
|
682
748
|
<>
|
|
683
749
|
<Head>
|
|
@@ -703,12 +769,12 @@ var nextPostPage = () => `// THIS FILE HAS BEEN GENERATED WITH THE TINA CLI.
|
|
|
703
769
|
}}
|
|
704
770
|
>
|
|
705
771
|
<h1 className="text-3xl m-8 text-center leading-8 font-extrabold tracking-tight text-gray-900 sm:text-4xl">
|
|
706
|
-
{
|
|
772
|
+
{data.getPostsDocument.data.title}
|
|
707
773
|
</h1>
|
|
708
774
|
{/* Convert markdown to html in the browser only */}
|
|
709
775
|
{typeof window !== "undefined" && (
|
|
710
776
|
<ContentSection
|
|
711
|
-
content={window.marked.parse(
|
|
777
|
+
content={window.marked.parse(data.getPostsDocument.data.body)}
|
|
712
778
|
></ContentSection>
|
|
713
779
|
)}
|
|
714
780
|
</div>
|
|
@@ -729,16 +795,6 @@ var nextPostPage = () => `// THIS FILE HAS BEEN GENERATED WITH THE TINA CLI.
|
|
|
729
795
|
};
|
|
730
796
|
|
|
731
797
|
export const getStaticProps = async ({ params }) => {
|
|
732
|
-
const query = gql\`
|
|
733
|
-
query BlogPostQuery($relativePath: String!) {
|
|
734
|
-
getPostsDocument(relativePath: $relativePath) {
|
|
735
|
-
data {
|
|
736
|
-
title
|
|
737
|
-
body
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
\`
|
|
742
798
|
const variables = { relativePath: \`\${params.filename}.md\` }
|
|
743
799
|
let data = {}
|
|
744
800
|
try {
|
|
@@ -752,7 +808,6 @@ var nextPostPage = () => `// THIS FILE HAS BEEN GENERATED WITH THE TINA CLI.
|
|
|
752
808
|
|
|
753
809
|
return {
|
|
754
810
|
props: {
|
|
755
|
-
query,
|
|
756
811
|
variables,
|
|
757
812
|
data,
|
|
758
813
|
//myOtherProp: 'some-other-data',
|
|
@@ -909,20 +964,22 @@ import { TinaEditProvider } from 'tinacms/dist/edit-state'
|
|
|
909
964
|
const TinaCMS = dynamic(() => import('tinacms'), { ssr: false })
|
|
910
965
|
${extraImports || ""}
|
|
911
966
|
|
|
967
|
+
const branch = process.env.NEXT_PUBLIC_EDIT_BRANCH || "main";
|
|
968
|
+
const apiURL =
|
|
969
|
+
process.env.NODE_ENV == "development"
|
|
970
|
+
? "http://localhost:4001/graphql"
|
|
971
|
+
: \`https://content.tinajs.io/content/\${process.env.NEXT_PUBLIC_TINA_CLIENT_ID}/github/\${branch}\`;
|
|
972
|
+
|
|
912
973
|
const App = ({ Component, pageProps }) => {
|
|
913
974
|
return (
|
|
914
975
|
<>
|
|
915
976
|
<TinaEditProvider
|
|
916
977
|
editMode={
|
|
917
978
|
<TinaCMS
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
isLocalClient={Boolean(
|
|
921
|
-
Number(process.env.NEXT_PUBLIC_USE_LOCAL_CLIENT ?? true)
|
|
922
|
-
)}
|
|
923
|
-
{...pageProps}
|
|
979
|
+
apiURL={apiURL}
|
|
980
|
+
|
|
924
981
|
>
|
|
925
|
-
|
|
982
|
+
<Component {...pageProps} />
|
|
926
983
|
</TinaCMS>
|
|
927
984
|
}
|
|
928
985
|
>
|
|
@@ -935,11 +992,11 @@ const App = ({ Component, pageProps }) => {
|
|
|
935
992
|
export default App
|
|
936
993
|
`;
|
|
937
994
|
|
|
938
|
-
// pnp:/
|
|
995
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/init/index.ts
|
|
939
996
|
var import_chalk2 = __toModule(require("chalk"));
|
|
940
997
|
function execShellCommand(cmd) {
|
|
941
998
|
const exec = require("child_process").exec;
|
|
942
|
-
return new Promise((resolve2,
|
|
999
|
+
return new Promise((resolve2, _reject) => {
|
|
943
1000
|
exec(cmd, (error, stdout, stderr) => {
|
|
944
1001
|
if (error) {
|
|
945
1002
|
console.warn(error);
|
|
@@ -949,6 +1006,8 @@ function execShellCommand(cmd) {
|
|
|
949
1006
|
});
|
|
950
1007
|
}
|
|
951
1008
|
async function initTina(ctx, next, options) {
|
|
1009
|
+
const telemetry = new import_metrics2.Telemetry({ disabled: options.noTelemetry });
|
|
1010
|
+
await telemetry.submitRecord({ event: { name: "tinacms:cli:init:invoke" } });
|
|
952
1011
|
logger.info(successText("Setting up Tina..."));
|
|
953
1012
|
next();
|
|
954
1013
|
}
|
|
@@ -1018,15 +1077,13 @@ async function tinaSetup(ctx, next, options) {
|
|
|
1018
1077
|
const packagePath = import_path4.default.join(baseDir, "package.json");
|
|
1019
1078
|
const pack = JSON.parse((0, import_fs_extra3.readFileSync)(packagePath).toString());
|
|
1020
1079
|
const oldScripts = pack.scripts || {};
|
|
1021
|
-
const newPack = JSON.stringify({
|
|
1022
|
-
|
|
1023
|
-
scripts: {
|
|
1024
|
-
...oldScripts,
|
|
1080
|
+
const newPack = JSON.stringify(__spreadProps(__spreadValues({}, pack), {
|
|
1081
|
+
scripts: __spreadProps(__spreadValues({}, oldScripts), {
|
|
1025
1082
|
"tina-dev": 'yarn tinacms server:start -c "next dev"',
|
|
1026
1083
|
"tina-build": 'yarn tinacms server:start -c "next build"',
|
|
1027
1084
|
"tina-start": 'yarn tinacms server:start -c "next start"'
|
|
1028
|
-
}
|
|
1029
|
-
}, null, 2);
|
|
1085
|
+
})
|
|
1086
|
+
}), null, 2);
|
|
1030
1087
|
(0, import_fs_extra3.writeFileSync)(packagePath, newPack);
|
|
1031
1088
|
const adminPath = import_path4.default.join(pagesPath, "admin", "[[...tina]].js");
|
|
1032
1089
|
if (import_fs_extra3.default.pathExistsSync(import_path4.default.join(pagesPath, "admin"))) {
|
|
@@ -1038,7 +1095,6 @@ async function tinaSetup(ctx, next, options) {
|
|
|
1038
1095
|
next();
|
|
1039
1096
|
}
|
|
1040
1097
|
async function successMessage(ctx, next, options) {
|
|
1041
|
-
const baseDir2 = process.cwd();
|
|
1042
1098
|
logger.info(`Tina setup ${import_chalk2.default.underline.green("done")} \u2705
|
|
1043
1099
|
Start your dev server with ${successText(`yarn tina-dev`)} and go to http://localhost:3000/demo/blog/HelloWorld to ${successText("check it out the page that was created for you")}
|
|
1044
1100
|
Enjoy Tina \u{1F999} !
|
|
@@ -1046,11 +1102,11 @@ Enjoy Tina \u{1F999} !
|
|
|
1046
1102
|
next();
|
|
1047
1103
|
}
|
|
1048
1104
|
|
|
1049
|
-
// pnp:/
|
|
1105
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/audit/index.ts
|
|
1050
1106
|
var import_graphql10 = __toModule(require("@tinacms/graphql"));
|
|
1051
1107
|
var import_datalayer3 = __toModule(require("@tinacms/datalayer"));
|
|
1052
1108
|
|
|
1053
|
-
// pnp:/
|
|
1109
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/audit/audit.ts
|
|
1054
1110
|
var import_graphql8 = __toModule(require("@tinacms/graphql"));
|
|
1055
1111
|
var import_path5 = __toModule(require("path"));
|
|
1056
1112
|
var import_graphql9 = __toModule(require("@tinacms/graphql"));
|
|
@@ -1181,10 +1237,10 @@ var auditDocuments = async (args) => {
|
|
|
1181
1237
|
return error;
|
|
1182
1238
|
};
|
|
1183
1239
|
var transformDocumentIntoMutationRequestPayload = (document, instructions, defaults) => {
|
|
1184
|
-
const { _collection, __typename, _template,
|
|
1240
|
+
const _a = document, { _collection, __typename, _template } = _a, rest = __objRest(_a, ["_collection", "__typename", "_template"]);
|
|
1185
1241
|
const params = transformParams(rest);
|
|
1186
1242
|
const paramsWithTemplate = instructions.includeTemplate ? { [_template]: params } : params;
|
|
1187
|
-
return instructions.includeCollection ? { [_collection]: {
|
|
1243
|
+
return instructions.includeCollection ? { [_collection]: __spreadValues(__spreadValues({}, defaults), filterObject(paramsWithTemplate)) } : __spreadValues(__spreadValues({}, defaults), filterObject(paramsWithTemplate));
|
|
1188
1244
|
};
|
|
1189
1245
|
var transformParams = (data) => {
|
|
1190
1246
|
if (["string", "number", "boolean"].includes(typeof data)) {
|
|
@@ -1195,7 +1251,7 @@ var transformParams = (data) => {
|
|
|
1195
1251
|
}
|
|
1196
1252
|
try {
|
|
1197
1253
|
(0, import_graphql9.assertShape)(data, (yup) => yup.object({ _template: yup.string().required() }));
|
|
1198
|
-
const { _template, __typename,
|
|
1254
|
+
const _a = data, { _template, __typename } = _a, rest = __objRest(_a, ["_template", "__typename"]);
|
|
1199
1255
|
const nested = transformParams(rest);
|
|
1200
1256
|
return { [_template]: nested };
|
|
1201
1257
|
} catch (e) {
|
|
@@ -1224,11 +1280,20 @@ function filterObject(obj) {
|
|
|
1224
1280
|
return ret;
|
|
1225
1281
|
}
|
|
1226
1282
|
|
|
1227
|
-
// pnp:/
|
|
1283
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/audit/index.ts
|
|
1228
1284
|
var import_chalk4 = __toModule(require("chalk"));
|
|
1229
1285
|
var import_prompts2 = __toModule(require("prompts"));
|
|
1286
|
+
var import_metrics3 = __toModule(require("@tinacms/metrics"));
|
|
1230
1287
|
var rootPath = process.cwd();
|
|
1231
1288
|
var audit = async (ctx, next, options) => {
|
|
1289
|
+
const telemetry = new import_metrics3.Telemetry({ disabled: options.noTelemetry });
|
|
1290
|
+
await telemetry.submitRecord({
|
|
1291
|
+
event: {
|
|
1292
|
+
name: "tinacms:cli:audit:invoke",
|
|
1293
|
+
clean: Boolean(options.clean),
|
|
1294
|
+
useDefaults: Boolean(options.useDefaultValues)
|
|
1295
|
+
}
|
|
1296
|
+
});
|
|
1232
1297
|
if (options.clean) {
|
|
1233
1298
|
logger.info(`You are using the \`--clean\` option. This will modify your content as if a user is submitting a form. Before running this you should have a ${import_chalk4.default.bold("clean git tree")} so unwanted changes can be undone.
|
|
1234
1299
|
|
|
@@ -1285,7 +1350,7 @@ var printFinalMessage = async (ctx, next, _options) => {
|
|
|
1285
1350
|
next();
|
|
1286
1351
|
};
|
|
1287
1352
|
|
|
1288
|
-
// pnp:/
|
|
1353
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/baseCmds.ts
|
|
1289
1354
|
var import_chalk5 = __toModule(require("chalk"));
|
|
1290
1355
|
var CMD_GEN_TYPES = "schema:types";
|
|
1291
1356
|
var CMD_START_SERVER = "server:start";
|
|
@@ -1320,6 +1385,10 @@ var useDefaultValuesOption = {
|
|
|
1320
1385
|
name: "--useDefaultValues",
|
|
1321
1386
|
description: "Adds default values to the graphQL mutation so that default values can be filled into existing documents (useful for adding a field with `required: true`)"
|
|
1322
1387
|
};
|
|
1388
|
+
var noTelemetryOption = {
|
|
1389
|
+
name: "--noTelemetry",
|
|
1390
|
+
description: "Disable anonymous telemetry that is collected"
|
|
1391
|
+
};
|
|
1323
1392
|
var baseCmds = [
|
|
1324
1393
|
{
|
|
1325
1394
|
command: CMD_START_SERVER,
|
|
@@ -1329,25 +1398,26 @@ var baseCmds = [
|
|
|
1329
1398
|
subCommand,
|
|
1330
1399
|
experimentalDatalayer,
|
|
1331
1400
|
noWatchOption,
|
|
1332
|
-
noSDKCodegenOption
|
|
1401
|
+
noSDKCodegenOption,
|
|
1402
|
+
noTelemetryOption
|
|
1333
1403
|
],
|
|
1334
1404
|
action: (options) => chain([startServer], options)
|
|
1335
1405
|
},
|
|
1336
1406
|
{
|
|
1337
1407
|
command: CMD_COMPILE_MODELS,
|
|
1338
1408
|
description: "Compile schema into static files for the server",
|
|
1339
|
-
options: [experimentalDatalayer],
|
|
1409
|
+
options: [experimentalDatalayer, noTelemetryOption],
|
|
1340
1410
|
action: (options) => chain([compile], options)
|
|
1341
1411
|
},
|
|
1342
1412
|
{
|
|
1343
1413
|
command: CMD_GEN_TYPES,
|
|
1344
1414
|
description: "Generate a GraphQL query for your site's schema, (and optionally Typescript types)",
|
|
1345
|
-
options: [experimentalDatalayer, noSDKCodegenOption],
|
|
1415
|
+
options: [experimentalDatalayer, noSDKCodegenOption, noTelemetryOption],
|
|
1346
1416
|
action: (options) => chain([attachSchema, genTypes], options)
|
|
1347
1417
|
},
|
|
1348
1418
|
{
|
|
1349
1419
|
command: INIT,
|
|
1350
|
-
options: [experimentalDatalayer],
|
|
1420
|
+
options: [experimentalDatalayer, noTelemetryOption],
|
|
1351
1421
|
description: "Add Tina Cloud to an existing project",
|
|
1352
1422
|
action: (options) => chain([
|
|
1353
1423
|
initTina,
|
|
@@ -1363,7 +1433,7 @@ var baseCmds = [
|
|
|
1363
1433
|
], options)
|
|
1364
1434
|
},
|
|
1365
1435
|
{
|
|
1366
|
-
options: [cleanOption, useDefaultValuesOption],
|
|
1436
|
+
options: [cleanOption, useDefaultValuesOption, noTelemetryOption],
|
|
1367
1437
|
command: AUDIT,
|
|
1368
1438
|
description: "Audit your schema and the files to check for errors",
|
|
1369
1439
|
action: (options) => chain([
|
|
@@ -1388,7 +1458,7 @@ var baseCmds = [
|
|
|
1388
1458
|
}
|
|
1389
1459
|
];
|
|
1390
1460
|
|
|
1391
|
-
// pnp:/
|
|
1461
|
+
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/index.ts
|
|
1392
1462
|
var program = new commander.Command(name);
|
|
1393
1463
|
var registerCommands = (commands, noHelp = false) => {
|
|
1394
1464
|
commands.forEach((command, i) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/cli",
|
|
3
|
-
"version": "0.60.
|
|
3
|
+
"version": "0.60.4",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
]
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@tinacms/scripts": "0.50.
|
|
24
|
+
"@tinacms/scripts": "0.50.6",
|
|
25
25
|
"@types/clear": "0.1.0",
|
|
26
26
|
"@types/cors": "2.8.5",
|
|
27
27
|
"@types/express": "^4.17.7",
|
|
@@ -56,8 +56,9 @@
|
|
|
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/datalayer": "0.0.
|
|
60
|
-
"@tinacms/graphql": "0.59.
|
|
59
|
+
"@tinacms/datalayer": "0.0.2",
|
|
60
|
+
"@tinacms/graphql": "0.59.6",
|
|
61
|
+
"@tinacms/metrics": "0.0.2",
|
|
61
62
|
"ajv": "^6.12.3",
|
|
62
63
|
"altair-express-middleware": "4.0.6",
|
|
63
64
|
"auto-bind": "^4.0.0",
|
|
@@ -75,7 +76,7 @@
|
|
|
75
76
|
"js-yaml": "^4.0.0",
|
|
76
77
|
"lodash": "^4.17.19",
|
|
77
78
|
"lodash.get": "^4.4.2",
|
|
78
|
-
"log4js": "^6.
|
|
79
|
+
"log4js": "^6.4.0",
|
|
79
80
|
"normalize-path": "^3.0.0",
|
|
80
81
|
"progress": "^2.0.3",
|
|
81
82
|
"prompts": "^2.4.1",
|