@tinacms/cli 0.60.15 → 0.60.18

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,5 +1,40 @@
1
1
  # tinacms-cli
2
2
 
3
+ ## 0.60.18
4
+
5
+ ### Patch Changes
6
+
7
+ - 79d112d79: Update cli to accept tinaCloudMediaStore flag and add to metadata during schema compilation
8
+ - 91d6e6758: revert platform aware paths in schema introduced in https://github.com/tinacms/tinacms/commit/558cc4368cd2a4b6e87dfb82bbfbb6f569f8a6f8
9
+ - b1240328d: Adds local server routes for handling media
10
+ - 91d6e6758: Fix issues with experimentalData on windows related to path separator inconsistency and interference with the .tina/**generated** folder
11
+ - Updated dependencies [79d112d79]
12
+ - Updated dependencies [3f46c6706]
13
+ - Updated dependencies [db9168578]
14
+ - Updated dependencies [91d6e6758]
15
+ - @tinacms/graphql@0.60.3
16
+
17
+ ## 0.60.17
18
+
19
+ ### Patch Changes
20
+
21
+ - 08cdb672a: Adds `useRelativeMedia` support to local graphql client
22
+ - 646cad8da: Adds support for using the generated client on the frontend
23
+ - f857616f6: Rename sdk to queries
24
+ - Updated dependencies [08cdb672a]
25
+ - Updated dependencies [fdbfe9a16]
26
+ - Updated dependencies [6e2ed31a2]
27
+ - @tinacms/graphql@0.60.2
28
+ - @tinacms/schema-tools@0.0.4
29
+
30
+ ## 0.60.16
31
+
32
+ ### Patch Changes
33
+
34
+ - 7372f90ca: Adds a new client that can be used on the backend and frontend.
35
+ - Updated dependencies [3b11ff6ad]
36
+ - @tinacms/graphql@0.60.1
37
+
3
38
  ## 0.60.15
4
39
 
5
40
  ### Patch Changes
@@ -10,4 +10,4 @@ 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 defaultSchema: (sep: string) => string;
13
+ export declare const defaultSchema = "\nimport { defineSchema, defineConfig } from \"tinacms\";\n\nconst schema = defineSchema({\n collections: [\n {\n label: \"Blog Posts\",\n name: \"posts\",\n path: \"content/posts\",\n fields: [\n {\n type: \"string\",\n label: \"Title\",\n name: \"title\",\n },\n {\n type: \"rich-text\",\n label: \"Blog Post Body\",\n name: \"body\",\n isBody: true,\n templates: [\n {\n name: \"PageSection\",\n label: \"Page Section\",\n fields: [\n {\n type: \"string\",\n name: \"heading\",\n label: \"Heading\",\n },\n {\n type: \"string\",\n name: \"content\",\n label: \"Content\",\n ui: {\n component: \"textarea\"\n }\n }\n ],\n },\n ]\n },\n ],\n },\n ],\n});\n\nexport default schema\n\n// Your tina config\n// ==============\nconst branch = 'main'\n// When working locally, hit our local filesystem.\n// On a Vercel deployment, hit the Tina Cloud API\nconst apiURL =\n process.env.NODE_ENV == 'development'\n ? 'http://localhost:4001/graphql'\n : `https://content.tinajs.io/content/${process.env.NEXT_PUBLIC_TINA_CLIENT_ID}/github/${branch}`\n\nexport const tinaConfig = defineConfig({\n apiURL,\n schema,\n cmsCallback: (cms) => {\n // add your CMS callback code here (if you want)\n\n // The Route Mapper\n /**\n * 1. Import `tinacms` and `RouteMappingPlugin`\n **/\n import(\"tinacms\").then(({ RouteMappingPlugin }) => {\n /**\n * 2. Define the `RouteMappingPlugin` see https://tina.io/docs/tinacms-context/#the-routemappingplugin for more details\n **/\n const RouteMapping = new RouteMappingPlugin((collection, document) => {\n return undefined;\n });\n /**\n * 3. Add the `RouteMappingPlugin` to the `cms`.\n **/\n cms.plugins.add(RouteMapping);\n });\n\n return cms;\n },\n});\n";
@@ -15,10 +15,11 @@ interface Options {
15
15
  command?: string;
16
16
  watchFolders?: string[];
17
17
  experimentalData?: boolean;
18
+ tinaCloudMediaStore?: boolean;
18
19
  noWatch?: boolean;
19
20
  noSDK: boolean;
20
21
  noTelemetry: boolean;
21
22
  verbose?: boolean;
22
23
  }
23
- export declare function startServer(_ctx: any, _next: any, { port, command, noWatch, experimentalData, noSDK, noTelemetry, watchFolders, verbose, }: Options): Promise<void>;
24
+ export declare function startServer(_ctx: any, _next: any, { port, command, noWatch, experimentalData, tinaCloudMediaStore, noSDK, noTelemetry, watchFolders, verbose, }: Options): Promise<void>;
24
25
  export {};
@@ -10,7 +10,5 @@ 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
- /// <reference types="node" />
14
- import http from 'http';
15
- declare const gqlServer: (database: any) => Promise<http.Server>;
13
+ import { gqlServer } from '../../server';
16
14
  export default gqlServer;
package/dist/index.js CHANGED
@@ -54,22 +54,112 @@ var __toModule = (module2) => {
54
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);
55
55
  };
56
56
 
57
- // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/start-server/server.ts
58
- var server_exports = {};
59
- __export(server_exports, {
60
- default: () => server_default
57
+ // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/server/models/media.ts
58
+ var import_fs_extra5, import_path6, MediaModel;
59
+ var init_media = __esm({
60
+ "pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/server/models/media.ts"() {
61
+ import_fs_extra5 = __toModule(require("fs-extra"));
62
+ import_path6 = __toModule(require("path"));
63
+ MediaModel = class {
64
+ constructor({ basePath }) {
65
+ this.basePath = basePath;
66
+ }
67
+ async listMedia(args) {
68
+ try {
69
+ const folderPath = (0, import_path6.join)(this.basePath, args.searchPath);
70
+ const filesStr = await import_fs_extra5.default.readdir(folderPath);
71
+ const filesProm = filesStr.map(async (x) => {
72
+ const filePath = (0, import_path6.join)(folderPath, x);
73
+ const stat = await import_fs_extra5.default.stat(filePath);
74
+ const src = (0, import_path6.join)(args.searchPath, x);
75
+ return {
76
+ size: stat.size,
77
+ fileName: x,
78
+ src: "/" + src,
79
+ isFile: stat.isFile()
80
+ };
81
+ });
82
+ const files = await Promise.all(filesProm);
83
+ return {
84
+ files: files.filter((x) => x.isFile),
85
+ directories: files.filter((x) => !x.isFile).map((x) => x.src)
86
+ };
87
+ } catch (error) {
88
+ console.error(error);
89
+ return {
90
+ files: [],
91
+ directories: [],
92
+ error: error == null ? void 0 : error.toString()
93
+ };
94
+ }
95
+ }
96
+ async deleteMedia(args) {
97
+ try {
98
+ const file = (0, import_path6.join)(this.basePath, args.searchPath);
99
+ await import_fs_extra5.default.stat(file);
100
+ await import_fs_extra5.default.remove(file);
101
+ return { ok: true };
102
+ } catch (error) {
103
+ console.error(error);
104
+ return { ok: false, message: error == null ? void 0 : error.toString() };
105
+ }
106
+ }
107
+ };
108
+ }
61
109
  });
62
- var import_cors, import_http, import_express, import_altair_express_middleware, import_body_parser, gqlServer, server_default;
110
+
111
+ // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/server/routes/index.ts
112
+ var import_express, import_path7, import_multer, mediaFolder, storage, upload, mediaModel, mediaRouter;
113
+ var init_routes = __esm({
114
+ "pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/server/routes/index.ts"() {
115
+ import_express = __toModule(require("express"));
116
+ import_path7 = __toModule(require("path"));
117
+ import_multer = __toModule(require("multer"));
118
+ init_media();
119
+ mediaFolder = (0, import_path7.join)(process.cwd(), "public");
120
+ storage = import_multer.default.diskStorage({
121
+ destination: function(req, file, cb) {
122
+ cb(null, mediaFolder);
123
+ },
124
+ filename: function(req, _file, cb) {
125
+ const file = req.params[0];
126
+ cb(null, file);
127
+ }
128
+ });
129
+ upload = (0, import_multer.default)({ storage });
130
+ mediaModel = new MediaModel({ basePath: mediaFolder });
131
+ mediaRouter = (0, import_express.Router)();
132
+ mediaRouter.get("/list/*", async (req, res) => {
133
+ const folder = req.params[0];
134
+ const media = await mediaModel.listMedia({
135
+ searchPath: folder
136
+ });
137
+ res.json(media);
138
+ });
139
+ mediaRouter.delete("/delete/*", async (req, res) => {
140
+ const file = req.params[0];
141
+ const didDelete = await mediaModel.deleteMedia({ searchPath: file });
142
+ res.json(didDelete);
143
+ });
144
+ mediaRouter.post("/upload/*", upload.single("file"), function(req, res, next) {
145
+ res.json({ ok: true });
146
+ });
147
+ }
148
+ });
149
+
150
+ // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/server/server.ts
151
+ var import_cors, import_http, import_express2, import_altair_express_middleware, import_body_parser, gqlServer;
63
152
  var init_server = __esm({
64
- "pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/start-server/server.ts"() {
153
+ "pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/server/server.ts"() {
65
154
  import_cors = __toModule(require("cors"));
66
155
  import_http = __toModule(require("http"));
67
- import_express = __toModule(require("express"));
156
+ import_express2 = __toModule(require("express"));
68
157
  import_altair_express_middleware = __toModule(require("altair-express-middleware"));
69
158
  import_body_parser = __toModule(require("body-parser"));
159
+ init_routes();
70
160
  gqlServer = async (database) => {
71
161
  const gqlPackage = require("@tinacms/graphql");
72
- const app = (0, import_express.default)();
162
+ const app = (0, import_express2.default)();
73
163
  const server = import_http.default.createServer(app);
74
164
  app.use((0, import_cors.default)());
75
165
  app.use(import_body_parser.default.json());
@@ -92,15 +182,39 @@ var init_server = __esm({
92
182
  }));
93
183
  app.post("/graphql", async (req, res) => {
94
184
  const { query, variables } = req.body;
185
+ const config = {
186
+ useRelativeMedia: true
187
+ };
95
188
  const result = await gqlPackage.resolve({
189
+ config,
96
190
  database,
97
191
  query,
98
192
  variables
99
193
  });
100
194
  return res.json(result);
101
195
  });
196
+ app.use("/media", mediaRouter);
102
197
  return server;
103
198
  };
199
+ }
200
+ });
201
+
202
+ // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/server/index.ts
203
+ var init_server2 = __esm({
204
+ "pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/server/index.ts"() {
205
+ init_server();
206
+ }
207
+ });
208
+
209
+ // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/start-server/server.ts
210
+ var server_exports = {};
211
+ __export(server_exports, {
212
+ default: () => server_default
213
+ });
214
+ var server_default;
215
+ var init_server3 = __esm({
216
+ "pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/start-server/server.ts"() {
217
+ init_server2();
104
218
  server_default = gqlServer;
105
219
  }
106
220
  });
@@ -114,7 +228,7 @@ var commander = __toModule(require("commander"));
114
228
 
115
229
  // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/package.json
116
230
  var name = "@tinacms/cli";
117
- var version = "0.60.15";
231
+ var version = "0.60.18";
118
232
 
119
233
  // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/query-gen/attachSchema.ts
120
234
  var import_graphql = __toModule(require("@tinacms/graphql"));
@@ -165,31 +279,45 @@ var import_graphql5 = __toModule(require("graphql"));
165
279
  var AddGeneratedClientFunc = (_schema, _documents, _config, _info) => {
166
280
  return `
167
281
  // TinaSDK generated code
168
- import { staticRequest } from 'tinacms'
169
- const requester: (doc: any, vars?: any, options?: any) => Promise<any> = async (
170
- doc,
171
- vars,
172
- _options
173
- ) => {
174
- let data = {}
175
- try {
176
- data = await staticRequest({
177
- query: doc,
178
- variables: vars,
179
- })
180
- } catch (e) {
181
- // swallow errors related to document creation
182
- console.warn('Warning: There was an error when fetching data')
183
- console.warn(e)
184
- }
282
+ import { createClient, TinaClient } from "tinacms/dist/client";
283
+
284
+ const generateRequester = (client: TinaClient) => {
285
+ const requester: (
286
+ doc: any,
287
+ vars?: any,
288
+ options?: any,
289
+ client
290
+ ) => Promise<any> = async (doc, vars, _options) => {
291
+ let data = {};
292
+ try {
293
+ data = await client.request({
294
+ query: doc,
295
+ variables: vars,
296
+ });
297
+ } catch (e) {
298
+ // swallow errors related to document creation
299
+ console.warn("Warning: There was an error when fetching data");
300
+ console.warn(e);
301
+ }
185
302
 
186
- return { data, query: doc, variables: vars || {} }
187
- }
303
+ return { data: data?.data, query: doc, variables: vars || {} };
304
+ };
305
+
306
+ return requester;
307
+ };
188
308
 
189
309
  /**
190
310
  * @experimental this class can be used but may change in the future
191
311
  **/
192
- export const ExperimentalGetTinaClient = ()=>getSdk(requester)
312
+ export const ExperimentalGetTinaClient = () =>
313
+ getSdk(
314
+ generateRequester(createClient({ url: "http://localhost:4001/graphql" }))
315
+ );
316
+
317
+ export const queries = (client: TinaClient) => {
318
+ const requester = generateRequester(client);
319
+ return getSdk(requester);
320
+ };
193
321
  `;
194
322
  };
195
323
  var AddGeneratedClient = {
@@ -275,7 +403,6 @@ var plugin = (schema, documents, config) => {
275
403
  const visitor = new GenericSdkVisitor(schema, allFragments, config);
276
404
  const visitorResult = (0, import_graphql3.visit)(allAst, { leave: visitor });
277
405
  return {
278
- prepend: visitor.getImports(),
279
406
  content: [
280
407
  visitor.fragments,
281
408
  ...visitorResult.definitions.filter((t) => typeof t === "string"),
@@ -328,10 +455,7 @@ var generateTypes = async (schema, queryPathGlob = process.cwd(), fragDocPath =
328
455
  { typescript: {} },
329
456
  { typescriptOperations: {} },
330
457
  {
331
- typescriptSdk: {
332
- gqlImport: "tinacms#gql",
333
- documentNodeImport: "tinacms#DocumentNode"
334
- }
458
+ typescriptSdk: {}
335
459
  },
336
460
  { AddGeneratedClient: {} }
337
461
  ],
@@ -362,6 +486,13 @@ async function genTypes({ schema }, next, options) {
362
486
  const typescriptTypes = await generateTypes(schema, queryPathGlob, fragPath, options);
363
487
  await import_fs_extra.default.outputFile(typesPath, `//@ts-nocheck
364
488
  // DO NOT MODIFY THIS FILE. This file is automatically generated by Tina
489
+ export function gql(strings: TemplateStringsArray, ...args: string[]): string {
490
+ let str = ''
491
+ strings.forEach((string, i) => {
492
+ str += string + (args[i] || '')
493
+ })
494
+ return str
495
+ }
365
496
  ${typescriptTypes}
366
497
  `);
367
498
  logger.info(` Typescript types => ${logText(typesPath)}`);
@@ -1268,7 +1399,7 @@ var import_path5 = __toModule(require("path"));
1268
1399
  var import_esbuild = __toModule(require("esbuild"));
1269
1400
 
1270
1401
  // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/compile/defaultSchema.ts
1271
- var defaultSchema = (sep) => `
1402
+ var defaultSchema = `
1272
1403
  import { defineSchema, defineConfig } from "tinacms";
1273
1404
 
1274
1405
  const schema = defineSchema({
@@ -1276,7 +1407,7 @@ const schema = defineSchema({
1276
1407
  {
1277
1408
  label: "Blog Posts",
1278
1409
  name: "posts",
1279
- path: "content${sep}posts",
1410
+ path: "content/posts",
1280
1411
  fields: [
1281
1412
  {
1282
1413
  type: "string",
@@ -1398,6 +1529,9 @@ var resetGeneratedFolder = async () => {
1398
1529
  console.log(e);
1399
1530
  }
1400
1531
  await import_fs_extra4.default.mkdir(tinaGeneratedPath);
1532
+ await import_fs_extra4.default.writeFile(import_path5.default.join(tinaGeneratedPath, "types.ts"), `
1533
+ export const queries = (client)=>({})
1534
+ `);
1401
1535
  await import_fs_extra4.default.outputFile(import_path5.default.join(tinaGeneratedPath, ".gitignore"), "db");
1402
1536
  };
1403
1537
  var cleanup = async ({ tinaTempPath: tinaTempPath2 }) => {
@@ -1430,7 +1564,7 @@ var compile = async (_ctx, _next, options) => {
1430
1564
  `));
1431
1565
  const file = import_path5.default.join(tinaPath, `schema.${schemaFileType2}`);
1432
1566
  await import_fs_extra4.default.ensureFile(file);
1433
- await import_fs_extra4.default.writeFile(file, defaultSchema(import_path5.default.sep));
1567
+ await import_fs_extra4.default.writeFile(file, defaultSchema);
1434
1568
  }
1435
1569
  try {
1436
1570
  await transpile(tinaPath, tinaTempPath, options.verbose);
@@ -1531,7 +1665,7 @@ var import_metrics3 = __toModule(require("@tinacms/metrics"));
1531
1665
  var import_chalk6 = __toModule(require("chalk"));
1532
1666
  var import_child_process = __toModule(require("child_process"));
1533
1667
  var import_chokidar = __toModule(require("chokidar"));
1534
- var import_path6 = __toModule(require("path"));
1668
+ var import_path8 = __toModule(require("path"));
1535
1669
  var lock = new AsyncLock();
1536
1670
  var gqlPackageFile = require.resolve("@tinacms/graphql");
1537
1671
  async function startServer(_ctx, _next, {
@@ -1539,6 +1673,7 @@ async function startServer(_ctx, _next, {
1539
1673
  command,
1540
1674
  noWatch,
1541
1675
  experimentalData,
1676
+ tinaCloudMediaStore: tinaCloudMediaStore2,
1542
1677
  noSDK,
1543
1678
  noTelemetry,
1544
1679
  watchFolders,
@@ -1587,11 +1722,17 @@ stack: ${code.stack || "No stack was provided"}`);
1587
1722
  lock.enable();
1588
1723
  try {
1589
1724
  if (!process.env.CI && !noWatch) {
1725
+ await store.close();
1590
1726
  await resetGeneratedFolder();
1727
+ await store.open();
1728
+ }
1729
+ const cliFlags = [];
1730
+ if (tinaCloudMediaStore2) {
1731
+ cliFlags.push("tinaCloudMediaStore");
1591
1732
  }
1592
1733
  const database2 = await (0, import_graphql10.createDatabase)({ store, bridge });
1593
1734
  await compile(null, null, { verbose });
1594
- const schema = await (0, import_graphql10.buildSchema)(rootPath2, database2);
1735
+ const schema = await (0, import_graphql10.buildSchema)(rootPath2, database2, cliFlags);
1595
1736
  await genTypes({ schema }, () => {
1596
1737
  }, { noSDK: noSDK2, verbose });
1597
1738
  } catch (error) {
@@ -1600,7 +1741,7 @@ stack: ${code.stack || "No stack was provided"}`);
1600
1741
  lock.disable();
1601
1742
  }
1602
1743
  };
1603
- const foldersToWatch = (watchFolders || []).map((x) => import_path6.default.join(rootPath2, x));
1744
+ const foldersToWatch = (watchFolders || []).map((x) => import_path8.default.join(rootPath2, x));
1604
1745
  if (!noWatch && !process.env.CI) {
1605
1746
  import_chokidar.default.watch([
1606
1747
  ...foldersToWatch,
@@ -1609,7 +1750,7 @@ stack: ${code.stack || "No stack was provided"}`);
1609
1750
  ignored: [
1610
1751
  "**/node_modules/**/*",
1611
1752
  "**/.next/**/*",
1612
- `${import_path6.default.resolve(rootPath2)}/.tina/__generated__/**/*`
1753
+ `${import_path8.default.resolve(rootPath2)}/.tina/__generated__/**/*`
1613
1754
  ]
1614
1755
  }).on("ready", async () => {
1615
1756
  if (verbose)
@@ -1654,7 +1795,7 @@ stack: ${code.stack || "No stack was provided"}`);
1654
1795
  };
1655
1796
  let isReady = false;
1656
1797
  const start = async () => {
1657
- const s = (init_server(), server_exports);
1798
+ const s = (init_server3(), server_exports);
1658
1799
  state.server = await s.default(database);
1659
1800
  state.server.listen(port, () => {
1660
1801
  const altairUrl = `http://localhost:${port}/altair/`;
@@ -1759,6 +1900,10 @@ var verboseOption = {
1759
1900
  name: "-v, --verbose",
1760
1901
  description: "increase verbosity of logged output"
1761
1902
  };
1903
+ var tinaCloudMediaStore = {
1904
+ name: "--tinaCloudMediaStore",
1905
+ description: "Automatically pushes updates from GitHub to the Tina Cloud Media Store"
1906
+ };
1762
1907
  var baseCmds = [
1763
1908
  {
1764
1909
  command: CMD_START_SERVER,
@@ -1767,6 +1912,7 @@ var baseCmds = [
1767
1912
  startServerPortOption,
1768
1913
  subCommand,
1769
1914
  experimentalDatalayer,
1915
+ tinaCloudMediaStore,
1770
1916
  noWatchOption,
1771
1917
  noSDKCodegenOption,
1772
1918
  noTelemetryOption,
@@ -1778,18 +1924,28 @@ var baseCmds = [
1778
1924
  {
1779
1925
  command: CMD_COMPILE_MODELS,
1780
1926
  description: "Compile schema into static files for the server",
1781
- options: [experimentalDatalayer, noTelemetryOption],
1927
+ options: [experimentalDatalayer, tinaCloudMediaStore, noTelemetryOption],
1782
1928
  action: (options) => chain([compile], options)
1783
1929
  },
1784
1930
  {
1785
1931
  command: CMD_GEN_TYPES,
1786
1932
  description: "Generate a GraphQL query for your site's schema, (and optionally Typescript types)",
1787
- options: [experimentalDatalayer, noSDKCodegenOption, noTelemetryOption],
1933
+ options: [
1934
+ experimentalDatalayer,
1935
+ tinaCloudMediaStore,
1936
+ noSDKCodegenOption,
1937
+ noTelemetryOption
1938
+ ],
1788
1939
  action: (options) => chain([attachSchema, genTypes], options)
1789
1940
  },
1790
1941
  {
1791
1942
  command: INIT,
1792
- options: [experimentalDatalayer, noTelemetryOption, schemaFileType],
1943
+ options: [
1944
+ experimentalDatalayer,
1945
+ tinaCloudMediaStore,
1946
+ noTelemetryOption,
1947
+ schemaFileType
1948
+ ],
1793
1949
  description: "Add Tina Cloud to an existing project",
1794
1950
  action: (options) => chain([
1795
1951
  checkDeps,
@@ -0,0 +1,13 @@
1
+ /**
2
+ Copyright 2021 Forestry.io Holdings, Inc.
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
12
+ */
13
+ export * from './server';
@@ -0,0 +1,41 @@
1
+ /**
2
+ Copyright 2021 Forestry.io Holdings, Inc.
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
12
+ */
13
+ interface MediaArgs {
14
+ searchPath: string;
15
+ }
16
+ interface File {
17
+ src: string;
18
+ fileName: string;
19
+ size: number;
20
+ }
21
+ interface ListMediaRes {
22
+ directories: string[];
23
+ files: File[];
24
+ cursor?: string;
25
+ error?: string;
26
+ }
27
+ declare type SuccessRecord = {
28
+ ok: true;
29
+ } | {
30
+ ok: false;
31
+ message: string;
32
+ };
33
+ export declare class MediaModel {
34
+ readonly basePath: string;
35
+ constructor({ basePath }: {
36
+ basePath: string;
37
+ });
38
+ listMedia(args: MediaArgs): Promise<ListMediaRes>;
39
+ deleteMedia(args: MediaArgs): Promise<SuccessRecord>;
40
+ }
41
+ export {};
@@ -0,0 +1,13 @@
1
+ /**
2
+ Copyright 2021 Forestry.io Holdings, Inc.
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
12
+ */
13
+ export declare const mediaRouter: import("express-serve-static-core").Router;
@@ -0,0 +1,15 @@
1
+ /**
2
+ Copyright 2021 Forestry.io Holdings, Inc.
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
12
+ */
13
+ /// <reference types="node" />
14
+ import http from 'http';
15
+ export declare const gqlServer: (database: any) => Promise<http.Server>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/cli",
3
- "version": "0.60.15",
3
+ "version": "0.60.18",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "files": [
@@ -35,6 +35,7 @@
35
35
  "@types/lodash": "^4.14.157",
36
36
  "@types/lodash.get": "^4.4.6",
37
37
  "@types/log4js": "^2.3.5",
38
+ "@types/multer": "^1.4.7",
38
39
  "@types/progress": "^2.0.3",
39
40
  "@types/prompts": "^2.0.13",
40
41
  "@types/yup": "^0.29.11",
@@ -58,9 +59,9 @@
58
59
  "@graphql-tools/graphql-file-loader": "^7.2.0",
59
60
  "@graphql-tools/load": "^7.3.2",
60
61
  "@tinacms/datalayer": "0.1.1",
61
- "@tinacms/graphql": "0.60.0",
62
+ "@tinacms/graphql": "0.60.3",
62
63
  "@tinacms/metrics": "0.0.3",
63
- "@tinacms/schema-tools": "0.0.3",
64
+ "@tinacms/schema-tools": "0.0.4",
64
65
  "@yarnpkg/esbuild-plugin-pnp": "^2.0.1-rc.3",
65
66
  "add": "^2.0.6",
66
67
  "ajv": "^6.12.3",
@@ -82,6 +83,7 @@
82
83
  "lodash": "^4.17.19",
83
84
  "lodash.get": "^4.4.2",
84
85
  "log4js": "^6.4.0",
86
+ "multer": "^1.4.4",
85
87
  "normalize-path": "^3.0.0",
86
88
  "progress": "^2.0.3",
87
89
  "prompts": "^2.4.1",