@tinacms/cli 0.60.14 → 0.60.17
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 +27 -0
- package/dist/cmds/init/setup-files/index.d.ts +1 -0
- package/dist/index.js +68 -28
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# tinacms-cli
|
|
2
2
|
|
|
3
|
+
## 0.60.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 08cdb672a: Adds `useRelativeMedia` support to local graphql client
|
|
8
|
+
- 646cad8da: Adds support for using the generated client on the frontend
|
|
9
|
+
- f857616f6: Rename sdk to queries
|
|
10
|
+
- Updated dependencies [08cdb672a]
|
|
11
|
+
- Updated dependencies [fdbfe9a16]
|
|
12
|
+
- Updated dependencies [6e2ed31a2]
|
|
13
|
+
- @tinacms/graphql@0.60.2
|
|
14
|
+
- @tinacms/schema-tools@0.0.4
|
|
15
|
+
|
|
16
|
+
## 0.60.16
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- 7372f90ca: Adds a new client that can be used on the backend and frontend.
|
|
21
|
+
- Updated dependencies [3b11ff6ad]
|
|
22
|
+
- @tinacms/graphql@0.60.1
|
|
23
|
+
|
|
24
|
+
## 0.60.15
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- ceb826916: Fix issue where \_app override from tina init was improperly formatted
|
|
29
|
+
|
|
3
30
|
## 0.60.14
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
|
@@ -2,3 +2,4 @@ export declare const adminPage = "import { TinaAdmin } from 'tinacms';\nexport d
|
|
|
2
2
|
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<PageSection heading=\"Oscula mihi\" content=\"Lorem 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";
|
|
3
3
|
export declare const nextPostPage: () => string;
|
|
4
4
|
export declare const AppJsContent: (usingSrc: boolean, extraImports?: string) => string;
|
|
5
|
+
export declare const AppJsContentPrintout: (usingSrc: boolean, extraImports?: string) => string;
|
package/dist/index.js
CHANGED
|
@@ -92,7 +92,11 @@ var init_server = __esm({
|
|
|
92
92
|
}));
|
|
93
93
|
app.post("/graphql", async (req, res) => {
|
|
94
94
|
const { query, variables } = req.body;
|
|
95
|
+
const config = {
|
|
96
|
+
useRelativeMedia: true
|
|
97
|
+
};
|
|
95
98
|
const result = await gqlPackage.resolve({
|
|
99
|
+
config,
|
|
96
100
|
database,
|
|
97
101
|
query,
|
|
98
102
|
variables
|
|
@@ -114,7 +118,7 @@ var commander = __toModule(require("commander"));
|
|
|
114
118
|
|
|
115
119
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/package.json
|
|
116
120
|
var name = "@tinacms/cli";
|
|
117
|
-
var version = "0.60.
|
|
121
|
+
var version = "0.60.17";
|
|
118
122
|
|
|
119
123
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/query-gen/attachSchema.ts
|
|
120
124
|
var import_graphql = __toModule(require("@tinacms/graphql"));
|
|
@@ -165,31 +169,45 @@ var import_graphql5 = __toModule(require("graphql"));
|
|
|
165
169
|
var AddGeneratedClientFunc = (_schema, _documents, _config, _info) => {
|
|
166
170
|
return `
|
|
167
171
|
// TinaSDK generated code
|
|
168
|
-
import {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
172
|
+
import { createClient, TinaClient } from "tinacms/dist/client";
|
|
173
|
+
|
|
174
|
+
const generateRequester = (client: TinaClient) => {
|
|
175
|
+
const requester: (
|
|
176
|
+
doc: any,
|
|
177
|
+
vars?: any,
|
|
178
|
+
options?: any,
|
|
179
|
+
client
|
|
180
|
+
) => Promise<any> = async (doc, vars, _options) => {
|
|
181
|
+
let data = {};
|
|
182
|
+
try {
|
|
183
|
+
data = await client.request({
|
|
184
|
+
query: doc,
|
|
185
|
+
variables: vars,
|
|
186
|
+
});
|
|
187
|
+
} catch (e) {
|
|
188
|
+
// swallow errors related to document creation
|
|
189
|
+
console.warn("Warning: There was an error when fetching data");
|
|
190
|
+
console.warn(e);
|
|
191
|
+
}
|
|
185
192
|
|
|
186
|
-
|
|
187
|
-
}
|
|
193
|
+
return { data: data?.data, query: doc, variables: vars || {} };
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
return requester;
|
|
197
|
+
};
|
|
188
198
|
|
|
189
199
|
/**
|
|
190
200
|
* @experimental this class can be used but may change in the future
|
|
191
201
|
**/
|
|
192
|
-
export const ExperimentalGetTinaClient = ()=>
|
|
202
|
+
export const ExperimentalGetTinaClient = () =>
|
|
203
|
+
getSdk(
|
|
204
|
+
generateRequester(createClient({ url: "http://localhost:4001/graphql" }))
|
|
205
|
+
);
|
|
206
|
+
|
|
207
|
+
export const queries = (client: TinaClient) => {
|
|
208
|
+
const requester = generateRequester(client);
|
|
209
|
+
return getSdk(requester);
|
|
210
|
+
};
|
|
193
211
|
`;
|
|
194
212
|
};
|
|
195
213
|
var AddGeneratedClient = {
|
|
@@ -275,7 +293,6 @@ var plugin = (schema, documents, config) => {
|
|
|
275
293
|
const visitor = new GenericSdkVisitor(schema, allFragments, config);
|
|
276
294
|
const visitorResult = (0, import_graphql3.visit)(allAst, { leave: visitor });
|
|
277
295
|
return {
|
|
278
|
-
prepend: visitor.getImports(),
|
|
279
296
|
content: [
|
|
280
297
|
visitor.fragments,
|
|
281
298
|
...visitorResult.definitions.filter((t) => typeof t === "string"),
|
|
@@ -328,10 +345,7 @@ var generateTypes = async (schema, queryPathGlob = process.cwd(), fragDocPath =
|
|
|
328
345
|
{ typescript: {} },
|
|
329
346
|
{ typescriptOperations: {} },
|
|
330
347
|
{
|
|
331
|
-
typescriptSdk: {
|
|
332
|
-
gqlImport: "tinacms#gql",
|
|
333
|
-
documentNodeImport: "tinacms#DocumentNode"
|
|
334
|
-
}
|
|
348
|
+
typescriptSdk: {}
|
|
335
349
|
},
|
|
336
350
|
{ AddGeneratedClient: {} }
|
|
337
351
|
],
|
|
@@ -362,6 +376,13 @@ async function genTypes({ schema }, next, options) {
|
|
|
362
376
|
const typescriptTypes = await generateTypes(schema, queryPathGlob, fragPath, options);
|
|
363
377
|
await import_fs_extra.default.outputFile(typesPath, `//@ts-nocheck
|
|
364
378
|
// DO NOT MODIFY THIS FILE. This file is automatically generated by Tina
|
|
379
|
+
export function gql(strings: TemplateStringsArray, ...args: string[]): string {
|
|
380
|
+
let str = ''
|
|
381
|
+
strings.forEach((string, i) => {
|
|
382
|
+
str += string + (args[i] || '')
|
|
383
|
+
})
|
|
384
|
+
return str
|
|
385
|
+
}
|
|
365
386
|
${typescriptTypes}
|
|
366
387
|
`);
|
|
367
388
|
logger.info(` Typescript types => ${logText(typesPath)}`);
|
|
@@ -941,6 +962,22 @@ var nextPostPage = () => `// THIS FILE HAS BEEN GENERATED WITH THE TINA CLI.
|
|
|
941
962
|
|
|
942
963
|
`;
|
|
943
964
|
var AppJsContent = (usingSrc, extraImports) => {
|
|
965
|
+
const importLine = `import Tina from '${usingSrc ? "../" : ""}../.tina/components/TinaDynamicProvider.js'`;
|
|
966
|
+
return `${importLine}
|
|
967
|
+
${extraImports || ""}
|
|
968
|
+
|
|
969
|
+
const App = ({ Component, pageProps }) => {
|
|
970
|
+
return (
|
|
971
|
+
<Tina>
|
|
972
|
+
<Component {...pageProps} />
|
|
973
|
+
</Tina>
|
|
974
|
+
)
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
export default App
|
|
978
|
+
`;
|
|
979
|
+
};
|
|
980
|
+
var AppJsContentPrintout = (usingSrc, extraImports) => {
|
|
944
981
|
const importLine = import_chalk4.default.green(`+ import Tina from '${usingSrc ? "../" : ""}../.tina/components/TinaDynamicProvider.js'`);
|
|
945
982
|
return `${importLine}
|
|
946
983
|
${extraImports || ""}
|
|
@@ -952,7 +989,7 @@ var AppJsContent = (usingSrc, extraImports) => {
|
|
|
952
989
|
${import_chalk4.default.green("+ </Tina>")}
|
|
953
990
|
)
|
|
954
991
|
}
|
|
955
|
-
|
|
992
|
+
|
|
956
993
|
export default App
|
|
957
994
|
`;
|
|
958
995
|
};
|
|
@@ -1177,7 +1214,7 @@ async function successMessage(ctx, next, options) {
|
|
|
1177
1214
|
logger.info(`${import_chalk5.default.bold("Add the Tina wrapper")}`);
|
|
1178
1215
|
logger.info(`\u26A0\uFE0F Before using Tina, you will NEED to add the Tina wrapper to your _app.jsx
|
|
1179
1216
|
`);
|
|
1180
|
-
logger.info(`${
|
|
1217
|
+
logger.info(`${AppJsContentPrintout(usingSrc)}`);
|
|
1181
1218
|
}
|
|
1182
1219
|
logger.info(`${import_chalk5.default.bold("Run your site with Tina")}`);
|
|
1183
1220
|
logger.info(` yarn dev
|
|
@@ -1382,6 +1419,9 @@ var resetGeneratedFolder = async () => {
|
|
|
1382
1419
|
console.log(e);
|
|
1383
1420
|
}
|
|
1384
1421
|
await import_fs_extra4.default.mkdir(tinaGeneratedPath);
|
|
1422
|
+
await import_fs_extra4.default.writeFile(import_path5.default.join(tinaGeneratedPath, "types.ts"), `
|
|
1423
|
+
export const queries = (client)=>({})
|
|
1424
|
+
`);
|
|
1385
1425
|
await import_fs_extra4.default.outputFile(import_path5.default.join(tinaGeneratedPath, ".gitignore"), "db");
|
|
1386
1426
|
};
|
|
1387
1427
|
var cleanup = async ({ tinaTempPath: tinaTempPath2 }) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/cli",
|
|
3
|
-
"version": "0.60.
|
|
3
|
+
"version": "0.60.17",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
"@graphql-tools/graphql-file-loader": "^7.2.0",
|
|
59
59
|
"@graphql-tools/load": "^7.3.2",
|
|
60
60
|
"@tinacms/datalayer": "0.1.1",
|
|
61
|
-
"@tinacms/graphql": "0.60.
|
|
61
|
+
"@tinacms/graphql": "0.60.2",
|
|
62
62
|
"@tinacms/metrics": "0.0.3",
|
|
63
|
-
"@tinacms/schema-tools": "0.0.
|
|
63
|
+
"@tinacms/schema-tools": "0.0.4",
|
|
64
64
|
"@yarnpkg/esbuild-plugin-pnp": "^2.0.1-rc.3",
|
|
65
65
|
"add": "^2.0.6",
|
|
66
66
|
"ajv": "^6.12.3",
|