@tinacms/cli 0.60.16 → 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 +13 -0
- package/dist/index.js +42 -23
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
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
|
+
|
|
3
16
|
## 0.60.16
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
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,33 +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 { createClient } from
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
const requester: (
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
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
|
+
}
|
|
187
192
|
|
|
188
|
-
|
|
189
|
-
}
|
|
193
|
+
return { data: data?.data, query: doc, variables: vars || {} };
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
return requester;
|
|
197
|
+
};
|
|
190
198
|
|
|
191
199
|
/**
|
|
192
200
|
* @experimental this class can be used but may change in the future
|
|
193
201
|
**/
|
|
194
|
-
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
|
+
};
|
|
195
211
|
`;
|
|
196
212
|
};
|
|
197
213
|
var AddGeneratedClient = {
|
|
@@ -1403,6 +1419,9 @@ var resetGeneratedFolder = async () => {
|
|
|
1403
1419
|
console.log(e);
|
|
1404
1420
|
}
|
|
1405
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
|
+
`);
|
|
1406
1425
|
await import_fs_extra4.default.outputFile(import_path5.default.join(tinaGeneratedPath, ".gitignore"), "db");
|
|
1407
1426
|
};
|
|
1408
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",
|