@tinacms/cli 0.60.19 → 0.60.22

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,36 @@
1
1
  # tinacms-cli
2
2
 
3
+ ## 0.60.22
4
+
5
+ ### Patch Changes
6
+
7
+ - b1a4290e6: Use media config from the schema in the local media server
8
+ - 1955b8842: Uses new `schema.config` when resolving media/asset urls
9
+ - Updated dependencies [f6cb634c2]
10
+ - Updated dependencies [b1a4290e6]
11
+ - Updated dependencies [1955b8842]
12
+ - Updated dependencies [8b81c3cf3]
13
+ - @tinacms/graphql@0.60.7
14
+ - @tinacms/schema-tools@0.0.5
15
+ - @tinacms/datalayer@0.1.1
16
+ - @tinacms/metrics@0.0.3
17
+
18
+ ## 0.60.21
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [e2aafcd93]
23
+ - Updated dependencies [a20fed8b7]
24
+ - @tinacms/graphql@0.60.6
25
+
26
+ ## 0.60.20
27
+
28
+ ### Patch Changes
29
+
30
+ - f71f55ac3: Fixd issue where --dev caused a breaking change
31
+ - Updated dependencies [57f09bdd7]
32
+ - @tinacms/graphql@0.60.5
33
+
3
34
  ## 0.60.19
4
35
 
5
36
  ### Patch Changes
@@ -20,5 +20,6 @@ export declare const compileClient: (ctx: any, next: any, options: {
20
20
  export declare const compileSchema: (_ctx: any, _next: any, options: {
21
21
  schemaFileType?: string;
22
22
  verbose?: boolean;
23
+ dev?: boolean;
23
24
  }) => Promise<void>;
24
25
  export declare const defineSchema: (config: TinaCloudSchema) => TinaCloudSchema;
@@ -15,12 +15,11 @@ interface Options {
15
15
  command?: string;
16
16
  watchFolders?: string[];
17
17
  experimentalData?: boolean;
18
- tinaCloudMediaStore?: boolean;
19
18
  noWatch?: boolean;
20
19
  noSDK: boolean;
21
20
  noTelemetry: boolean;
22
21
  verbose?: boolean;
23
22
  dev?: boolean;
24
23
  }
25
- export declare function startServer(_ctx: any, next: any, { port, noWatch, experimentalData, tinaCloudMediaStore, noSDK, noTelemetry, watchFolders, verbose, dev, }: Options): Promise<void>;
24
+ export declare function startServer(_ctx: any, next: any, { port, noWatch, experimentalData, noSDK, noTelemetry, watchFolders, verbose, dev, }: Options): Promise<void>;
26
25
  export {};
package/dist/command.d.ts CHANGED
@@ -23,5 +23,6 @@ export interface Command {
23
23
  interface Option {
24
24
  name: string;
25
25
  description: string;
26
+ defaultValue?: any;
26
27
  }
27
28
  export {};
package/dist/index.js CHANGED
@@ -174,28 +174,52 @@ var require_cli_options = __commonJS({
174
174
  }
175
175
  });
176
176
 
177
+ // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/utils/index.ts
178
+ var parseMediaFolder;
179
+ var init_utils = __esm({
180
+ "pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/utils/index.ts"() {
181
+ parseMediaFolder = (str) => {
182
+ let returnString = str;
183
+ if (returnString.startsWith("/"))
184
+ returnString = returnString.substr(1);
185
+ if (returnString.endsWith("/"))
186
+ returnString = returnString.substr(0, returnString.length - 1);
187
+ return returnString;
188
+ };
189
+ }
190
+ });
191
+
177
192
  // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/server/models/media.ts
178
193
  var import_fs_extra5, import_path6, MediaModel;
179
194
  var init_media = __esm({
180
195
  "pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/server/models/media.ts"() {
181
196
  import_fs_extra5 = __toModule(require("fs-extra"));
182
197
  import_path6 = __toModule(require("path"));
198
+ init_utils();
183
199
  MediaModel = class {
184
- constructor({ basePath }) {
185
- this.basePath = basePath;
200
+ constructor({ publicFolder, syncFolder }) {
201
+ this.syncFolder = syncFolder;
202
+ this.publicFolder = publicFolder;
186
203
  }
187
204
  async listMedia(args) {
188
205
  try {
189
- const folderPath = (0, import_path6.join)(this.basePath, args.searchPath);
206
+ const folderPath = (0, import_path6.join)(this.publicFolder, this.syncFolder, args.searchPath);
207
+ const searchPath = parseMediaFolder(args.searchPath);
190
208
  const filesStr = await import_fs_extra5.default.readdir(folderPath);
191
- const filesProm = filesStr.map(async (x) => {
192
- const filePath = (0, import_path6.join)(folderPath, x);
209
+ const filesProm = filesStr.map(async (file) => {
210
+ const filePath = (0, import_path6.join)(folderPath, file);
193
211
  const stat = await import_fs_extra5.default.stat(filePath);
194
- const src = (0, import_path6.join)(args.searchPath, x);
212
+ let src = `/${file}`;
213
+ if (searchPath) {
214
+ src = `/${searchPath}${src}`;
215
+ }
216
+ if (this.syncFolder) {
217
+ src = `/${this.syncFolder}${src}`;
218
+ }
195
219
  return {
196
220
  size: stat.size,
197
- fileName: x,
198
- src: "/" + src,
221
+ fileName: file,
222
+ src,
199
223
  isFile: stat.isFile()
200
224
  };
201
225
  });
@@ -215,7 +239,7 @@ var init_media = __esm({
215
239
  }
216
240
  async deleteMedia(args) {
217
241
  try {
218
- const file = (0, import_path6.join)(this.basePath, args.searchPath);
242
+ const file = (0, import_path6.join)(this.publicFolder, this.syncFolder, args.searchPath);
219
243
  await import_fs_extra5.default.stat(file);
220
244
  await import_fs_extra5.default.remove(file);
221
245
  return { ok: true };
@@ -229,41 +253,44 @@ var init_media = __esm({
229
253
  });
230
254
 
231
255
  // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/server/routes/index.ts
232
- var import_express, import_path7, import_multer, mediaFolder, storage, upload, mediaModel, mediaRouter;
256
+ var import_express, import_path7, import_multer, createMediaRouter;
233
257
  var init_routes = __esm({
234
258
  "pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/server/routes/index.ts"() {
235
259
  import_express = __toModule(require("express"));
236
260
  import_path7 = __toModule(require("path"));
237
261
  import_multer = __toModule(require("multer"));
238
262
  init_media();
239
- mediaFolder = (0, import_path7.join)(process.cwd(), "public");
240
- storage = import_multer.default.diskStorage({
241
- destination: function(req, file, cb) {
242
- cb(null, mediaFolder);
243
- },
244
- filename: function(req, _file, cb) {
263
+ createMediaRouter = (config) => {
264
+ const mediaFolder = (0, import_path7.join)(process.cwd(), config.publicFolder, config.syncFolder);
265
+ const storage = import_multer.default.diskStorage({
266
+ destination: function(req, file, cb) {
267
+ cb(null, mediaFolder);
268
+ },
269
+ filename: function(req, _file, cb) {
270
+ const file = req.params[0];
271
+ cb(null, file);
272
+ }
273
+ });
274
+ const upload = (0, import_multer.default)({ storage });
275
+ const mediaModel = new MediaModel(config);
276
+ const mediaRouter = (0, import_express.Router)();
277
+ mediaRouter.get("/list/*", async (req, res) => {
278
+ const folder = req.params[0];
279
+ const media = await mediaModel.listMedia({
280
+ searchPath: folder
281
+ });
282
+ res.json(media);
283
+ });
284
+ mediaRouter.delete("/delete/*", async (req, res) => {
245
285
  const file = req.params[0];
246
- cb(null, file);
247
- }
248
- });
249
- upload = (0, import_multer.default)({ storage });
250
- mediaModel = new MediaModel({ basePath: mediaFolder });
251
- mediaRouter = (0, import_express.Router)();
252
- mediaRouter.get("/list/*", async (req, res) => {
253
- const folder = req.params[0];
254
- const media = await mediaModel.listMedia({
255
- searchPath: folder
286
+ const didDelete = await mediaModel.deleteMedia({ searchPath: file });
287
+ res.json(didDelete);
256
288
  });
257
- res.json(media);
258
- });
259
- mediaRouter.delete("/delete/*", async (req, res) => {
260
- const file = req.params[0];
261
- const didDelete = await mediaModel.deleteMedia({ searchPath: file });
262
- res.json(didDelete);
263
- });
264
- mediaRouter.post("/upload/*", upload.single("file"), function(req, res, next) {
265
- res.json({ ok: true });
266
- });
289
+ mediaRouter.post("/upload/*", upload.single("file"), function(req, res, next) {
290
+ res.json({ ok: true });
291
+ });
292
+ return mediaRouter;
293
+ };
267
294
  }
268
295
  });
269
296
 
@@ -277,7 +304,9 @@ var init_server = __esm({
277
304
  import_altair_express_middleware = __toModule(require("altair-express-middleware"));
278
305
  import_body_parser = __toModule(require("body-parser"));
279
306
  init_routes();
280
- gqlServer = async (database) => {
307
+ init_utils();
308
+ gqlServer = async (database, verbose) => {
309
+ var _a, _b, _c;
281
310
  const gqlPackage = require("@tinacms/graphql");
282
311
  const app = (0, import_express2.default)();
283
312
  const server = import_http.default.createServer(app);
@@ -309,11 +338,18 @@ var init_server = __esm({
309
338
  config,
310
339
  database,
311
340
  query,
312
- variables
341
+ variables,
342
+ verbose
313
343
  });
314
344
  return res.json(result);
315
345
  });
316
- app.use("/media", mediaRouter);
346
+ const db = database;
347
+ const schema = await db.getSchema();
348
+ const mediaPaths = ((_c = (_b = (_a = schema == null ? void 0 : schema.schema) == null ? void 0 : _a.config) == null ? void 0 : _b.media) == null ? void 0 : _c.tina) || {};
349
+ app.use("/media", createMediaRouter({
350
+ publicFolder: parseMediaFolder((mediaPaths == null ? void 0 : mediaPaths.publicFolder) || ""),
351
+ syncFolder: parseMediaFolder((mediaPaths == null ? void 0 : mediaPaths.syncFolder) || "")
352
+ }));
317
353
  return server;
318
354
  };
319
355
  }
@@ -348,7 +384,7 @@ var commander = __toModule(require("commander"));
348
384
 
349
385
  // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/package.json
350
386
  var name = "@tinacms/cli";
351
- var version = "0.60.19";
387
+ var version = "0.60.22";
352
388
 
353
389
  // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/query-gen/attachSchema.ts
354
390
  var import_graphql = __toModule(require("@tinacms/graphql"));
@@ -753,7 +789,8 @@ var auditDocuments = async (args) => {
753
789
  collection: collection.name,
754
790
  relativePath: node._sys.relativePath
755
791
  },
756
- silenceErrors: true
792
+ silenceErrors: true,
793
+ verbose: true
757
794
  });
758
795
  if (mutationRes.errors) {
759
796
  mutationRes.errors.forEach((err) => {
@@ -1487,6 +1524,7 @@ var chain = async (cmds, options) => {
1487
1524
  var import_chalk7 = __toModule(require("chalk"));
1488
1525
 
1489
1526
  // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/start-server/errors/index.ts
1527
+ var import_graphql10 = __toModule(require("@tinacms/graphql"));
1490
1528
  var BuildSchemaError = class extends Error {
1491
1529
  constructor(message) {
1492
1530
  super(message);
@@ -1512,6 +1550,8 @@ var handleServerErrors = (e) => {
1512
1550
  logger.error(`${dangerText("ERROR: your schema was not successfully validated: see https://tina.io/docs/schema/ for instructions on how to setup a schema")}
1513
1551
  Error Message Below
1514
1552
  ${e}`);
1553
+ } else if (e instanceof import_graphql10.TinaFetchError) {
1554
+ (0, import_graphql10.handleFetchErrorError)(e, true);
1515
1555
  } else {
1516
1556
  logger.info(dangerText("Compilation failed with errors. Server has not been restarted.") + ` see error below
1517
1557
  ${e.message}`);
@@ -1673,9 +1713,6 @@ var cleanup = async ({ tinaTempPath }) => {
1673
1713
  await import_fs_extra4.default.remove(tinaTempPath);
1674
1714
  };
1675
1715
  var compileClient = async (ctx, next, options) => {
1676
- if (!process.env.NODE_ENV) {
1677
- process.env.NODE_ENV = options.dev ? "development" : "production";
1678
- }
1679
1716
  const tinaTempPath = import_path5.default.join(tinaGeneratedPath, "temp_client");
1680
1717
  if (!options.clientFileType)
1681
1718
  options = __spreadProps(__spreadValues({}, options), { clientFileType: "ts" });
@@ -1703,8 +1740,12 @@ var compileClient = async (ctx, next, options) => {
1703
1740
  return next();
1704
1741
  }
1705
1742
  try {
1743
+ const define = {};
1744
+ if (!process.env.NODE_ENV) {
1745
+ define["process.env.NODE_ENV"] = options.dev ? '"development"' : '"production"';
1746
+ }
1706
1747
  const inputFile = getClientPath({ projectDir: tinaPath });
1707
- await transpile(inputFile, "client.js", tinaTempPath, options.verbose);
1748
+ await transpile(inputFile, "client.js", tinaTempPath, options.verbose, define);
1708
1749
  } catch (e) {
1709
1750
  await cleanup({ tinaTempPath });
1710
1751
  throw new BuildSchemaError(e);
@@ -1761,8 +1802,12 @@ var compileSchema = async (_ctx, _next, options) => {
1761
1802
  await import_fs_extra4.default.writeFile(file, defaultSchema);
1762
1803
  }
1763
1804
  try {
1805
+ const define = {};
1806
+ if (!process.env.NODE_ENV) {
1807
+ define["process.env.NODE_ENV"] = options.dev ? '"development"' : '"production"';
1808
+ }
1764
1809
  const inputFile = getSchemaPath({ projectDir: tinaPath });
1765
- await transpile(inputFile, "schema.js", tinaTempPath, options.verbose);
1810
+ await transpile(inputFile, "schema.js", tinaTempPath, options.verbose, define);
1766
1811
  } catch (e) {
1767
1812
  await cleanup({ tinaTempPath });
1768
1813
  throw new BuildSchemaError(e);
@@ -1787,7 +1832,7 @@ var compileSchema = async (_ctx, _next, options) => {
1787
1832
  throw new ExecuteSchemaError(e);
1788
1833
  }
1789
1834
  };
1790
- var transpile = async (inputFile, outputFile, tempDir, verbose) => {
1835
+ var transpile = async (inputFile, outputFile, tempDir, verbose, define) => {
1791
1836
  if (verbose)
1792
1837
  logger.info(logText("Building javascript..."));
1793
1838
  const packageJSON = JSON.parse(import_fs_extra4.default.readFileSync(packageJSONFilePath).toString() || "{}");
@@ -1804,7 +1849,8 @@ var transpile = async (inputFile, outputFile, tempDir, verbose) => {
1804
1849
  treeShaking: true,
1805
1850
  external: [...external, "./node_modules/*"],
1806
1851
  loader: loaders,
1807
- outfile: outputPath
1852
+ outfile: outputPath,
1853
+ define
1808
1854
  });
1809
1855
  if (verbose)
1810
1856
  logger.info(logText(`Javascript built`));
@@ -1840,7 +1886,7 @@ var loaders = {
1840
1886
 
1841
1887
  // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/start-server/index.ts
1842
1888
  var import_datalayer3 = __toModule(require("@tinacms/datalayer"));
1843
- var import_graphql10 = __toModule(require("@tinacms/graphql"));
1889
+ var import_graphql11 = __toModule(require("@tinacms/graphql"));
1844
1890
 
1845
1891
  // pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/start-server/lock.ts
1846
1892
  var AsyncLock = class {
@@ -1865,7 +1911,6 @@ async function startServer(_ctx, next, {
1865
1911
  port = 4001,
1866
1912
  noWatch,
1867
1913
  experimentalData,
1868
- tinaCloudMediaStore: tinaCloudMediaStore2,
1869
1914
  noSDK,
1870
1915
  noTelemetry,
1871
1916
  watchFolders,
@@ -1883,13 +1928,10 @@ async function startServer(_ctx, next, {
1883
1928
  if (!process.env.CI && !noWatch) {
1884
1929
  await resetGeneratedFolder();
1885
1930
  }
1886
- if (!process.env.NODE_ENV) {
1887
- process.env.NODE_ENV = dev ? "development" : "production";
1888
- }
1889
1931
  const bridge = new import_datalayer3.FilesystemBridge(rootPath2);
1890
1932
  const store = experimentalData ? new import_datalayer3.LevelStore(rootPath2) : new import_datalayer3.FilesystemStore({ rootPath: rootPath2 });
1891
1933
  const shouldBuild = bridge.supportsBuilding();
1892
- const database = await (0, import_graphql10.createDatabase)({ store, bridge });
1934
+ const database = await (0, import_graphql11.createDatabase)({ store, bridge });
1893
1935
  let ready = false;
1894
1936
  const build2 = async (noSDK2) => {
1895
1937
  database.clearCache();
@@ -1902,12 +1944,9 @@ async function startServer(_ctx, next, {
1902
1944
  await store.open();
1903
1945
  }
1904
1946
  const cliFlags = [];
1905
- if (tinaCloudMediaStore2) {
1906
- cliFlags.push("tinaCloudMediaStore");
1907
- }
1908
- const database2 = await (0, import_graphql10.createDatabase)({ store, bridge });
1909
- await compileSchema(null, null, { verbose });
1910
- const schema = await (0, import_graphql10.buildSchema)(rootPath2, database2, cliFlags);
1947
+ const database2 = await (0, import_graphql11.createDatabase)({ store, bridge });
1948
+ await compileSchema(null, null, { verbose, dev });
1949
+ const schema = await (0, import_graphql11.buildSchema)(rootPath2, database2, cliFlags);
1911
1950
  await genTypes({ schema }, () => {
1912
1951
  }, { noSDK: noSDK2, verbose });
1913
1952
  } catch (error) {
@@ -1916,6 +1955,50 @@ async function startServer(_ctx, next, {
1916
1955
  lock.disable();
1917
1956
  }
1918
1957
  };
1958
+ const state = {
1959
+ server: null,
1960
+ sockets: []
1961
+ };
1962
+ let isReady = false;
1963
+ const start = async () => {
1964
+ await lock.promise;
1965
+ const s = (init_server3(), server_exports);
1966
+ state.server = await s.default(database);
1967
+ state.server.listen(port, () => {
1968
+ const altairUrl = `http://localhost:${port}/altair/`;
1969
+ const cmsUrl = `[your-development-url]/admin`;
1970
+ if (verbose)
1971
+ logger.info(`Started Filesystem GraphQL server on port: ${port}`);
1972
+ logger.info(`Visit the GraphQL playground at ${import_chalk6.default.underline.blueBright(altairUrl)}
1973
+ or`);
1974
+ logger.info(`Enter the CMS at ${import_chalk6.default.underline.blueBright(cmsUrl)}
1975
+ `);
1976
+ });
1977
+ state.server.on("error", function(e) {
1978
+ if (e.code === "EADDRINUSE") {
1979
+ logger.error(dangerText(`Port 4001 already in use`));
1980
+ process.exit();
1981
+ }
1982
+ throw e;
1983
+ });
1984
+ state.server.on("connection", (socket) => {
1985
+ state.sockets.push(socket);
1986
+ });
1987
+ };
1988
+ const restart = async () => {
1989
+ logger.info("restarting local server...");
1990
+ delete require.cache[gqlPackageFile];
1991
+ state.sockets.forEach((socket) => {
1992
+ if (socket.destroyed === false) {
1993
+ socket.destroy();
1994
+ }
1995
+ });
1996
+ state.sockets = [];
1997
+ state.server.close(() => {
1998
+ logger.info("Server closed");
1999
+ start();
2000
+ });
2001
+ };
1919
2002
  const foldersToWatch = (watchFolders || []).map((x) => import_path8.default.join(rootPath2, x));
1920
2003
  if (!noWatch && !process.env.CI) {
1921
2004
  import_chokidar.default.watch([
@@ -1947,6 +2030,9 @@ async function startServer(_ctx, next, {
1947
2030
  try {
1948
2031
  if (shouldBuild) {
1949
2032
  await build2(noSDK);
2033
+ if (isReady) {
2034
+ restart();
2035
+ }
1950
2036
  }
1951
2037
  } catch (e) {
1952
2038
  handleServerErrors(e);
@@ -1964,49 +2050,6 @@ async function startServer(_ctx, next, {
1964
2050
  await build2(noSDK);
1965
2051
  }
1966
2052
  }
1967
- const state = {
1968
- server: null,
1969
- sockets: []
1970
- };
1971
- let isReady = false;
1972
- const start = async () => {
1973
- const s = (init_server3(), server_exports);
1974
- state.server = await s.default(database);
1975
- state.server.listen(port, () => {
1976
- const altairUrl = `http://localhost:${port}/altair/`;
1977
- const cmsUrl = `[your-development-url]/admin`;
1978
- if (verbose)
1979
- logger.info(`Started Filesystem GraphQL server on port: ${port}`);
1980
- logger.info(`Visit the GraphQL playground at ${import_chalk6.default.underline.blueBright(altairUrl)}
1981
- or`);
1982
- logger.info(`Enter the CMS at ${import_chalk6.default.underline.blueBright(cmsUrl)}
1983
- `);
1984
- });
1985
- state.server.on("error", function(e) {
1986
- if (e.code === "EADDRINUSE") {
1987
- logger.error(dangerText(`Port 4001 already in use`));
1988
- process.exit();
1989
- }
1990
- throw e;
1991
- });
1992
- state.server.on("connection", (socket) => {
1993
- state.sockets.push(socket);
1994
- });
1995
- };
1996
- const restart = async () => {
1997
- logger.info("Detected change to gql package, restarting...");
1998
- delete require.cache[gqlPackageFile];
1999
- state.sockets.forEach((socket) => {
2000
- if (socket.destroyed === false) {
2001
- socket.destroy();
2002
- }
2003
- });
2004
- state.sockets = [];
2005
- state.server.close(() => {
2006
- logger.info("Server closed");
2007
- start();
2008
- });
2009
- };
2010
2053
  if (!noWatch && !process.env.CI) {
2011
2054
  import_chokidar.default.watch([gqlPackageFile]).on("ready", async () => {
2012
2055
  isReady = true;
@@ -2173,11 +2216,8 @@ var watchFileOption = {
2173
2216
  };
2174
2217
  var verboseOption = {
2175
2218
  name: "-v, --verbose",
2176
- description: "increase verbosity of logged output"
2177
- };
2178
- var tinaCloudMediaStore = {
2179
- name: "--tinaCloudMediaStore",
2180
- description: "Automatically pushes updates from GitHub to the Tina Cloud Media Store"
2219
+ description: "increase verbosity of logged output",
2220
+ defaultValue: false
2181
2221
  };
2182
2222
  var developmentOption = {
2183
2223
  name: "--dev",
@@ -2191,7 +2231,6 @@ var baseCmds = [
2191
2231
  startServerPortOption,
2192
2232
  subCommand,
2193
2233
  experimentalDatalayer,
2194
- tinaCloudMediaStore,
2195
2234
  noWatchOption,
2196
2235
  noSDKCodegenOption,
2197
2236
  noTelemetryOption,
@@ -2199,7 +2238,7 @@ var baseCmds = [
2199
2238
  verboseOption,
2200
2239
  developmentOption
2201
2240
  ],
2202
- action: (options) => chain([compileClient, waitForDB, startServer, startSubprocess], options)
2241
+ action: (options) => chain([startServer, startSubprocess], options)
2203
2242
  },
2204
2243
  {
2205
2244
  command: CMD_WAIT_FOR_DB,
@@ -2216,28 +2255,18 @@ var baseCmds = [
2216
2255
  {
2217
2256
  command: CMD_COMPILE_MODELS,
2218
2257
  description: "Compile schema into static files for the server",
2219
- options: [experimentalDatalayer, tinaCloudMediaStore, noTelemetryOption],
2258
+ options: [experimentalDatalayer, noTelemetryOption],
2220
2259
  action: (options) => chain([compileSchema], options)
2221
2260
  },
2222
2261
  {
2223
2262
  command: CMD_GEN_TYPES,
2224
2263
  description: "Generate a GraphQL query for your site's schema, (and optionally Typescript types)",
2225
- options: [
2226
- experimentalDatalayer,
2227
- tinaCloudMediaStore,
2228
- noSDKCodegenOption,
2229
- noTelemetryOption
2230
- ],
2264
+ options: [experimentalDatalayer, noSDKCodegenOption, noTelemetryOption],
2231
2265
  action: (options) => chain([attachSchema, genTypes], options)
2232
2266
  },
2233
2267
  {
2234
2268
  command: INIT,
2235
- options: [
2236
- experimentalDatalayer,
2237
- tinaCloudMediaStore,
2238
- noTelemetryOption,
2239
- schemaFileType
2240
- ],
2269
+ options: [experimentalDatalayer, noTelemetryOption, schemaFileType],
2241
2270
  description: "Add Tina Cloud to an existing project",
2242
2271
  action: (options) => chain([
2243
2272
  checkDeps,
@@ -2308,7 +2337,7 @@ Examples:
2308
2337
  logger.info("");
2309
2338
  });
2310
2339
  (command.options || []).forEach((option) => {
2311
- newCmd.option(option.name, option.description);
2340
+ newCmd.option(option.name, option.description, option == null ? void 0 : option.defaultValue);
2312
2341
  });
2313
2342
  if (command.subCommands) {
2314
2343
  registerCommands(command.subCommands, true);
@@ -24,6 +24,10 @@ interface ListMediaRes {
24
24
  cursor?: string;
25
25
  error?: string;
26
26
  }
27
+ export interface PathConfig {
28
+ publicFolder: string;
29
+ syncFolder: string;
30
+ }
27
31
  declare type SuccessRecord = {
28
32
  ok: true;
29
33
  } | {
@@ -31,10 +35,9 @@ declare type SuccessRecord = {
31
35
  message: string;
32
36
  };
33
37
  export declare class MediaModel {
34
- readonly basePath: string;
35
- constructor({ basePath }: {
36
- basePath: string;
37
- });
38
+ readonly publicFolder: string;
39
+ readonly syncFolder: string;
40
+ constructor({ publicFolder, syncFolder }: PathConfig);
38
41
  listMedia(args: MediaArgs): Promise<ListMediaRes>;
39
42
  deleteMedia(args: MediaArgs): Promise<SuccessRecord>;
40
43
  }
@@ -10,4 +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
- export declare const mediaRouter: import("express-serve-static-core").Router;
13
+ import { PathConfig } from '../models/media';
14
+ export declare const createMediaRouter: (config: PathConfig) => import("express-serve-static-core").Router;
@@ -12,4 +12,4 @@ limitations under the License.
12
12
  */
13
13
  /// <reference types="node" />
14
14
  import http from 'http';
15
- export declare const gqlServer: (database: any) => Promise<http.Server>;
15
+ export declare const gqlServer: (database: any, verbose: boolean) => Promise<http.Server>;
@@ -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 parseMediaFolder: (str: string) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/cli",
3
- "version": "0.60.19",
3
+ "version": "0.60.22",
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.7",
24
+ "@tinacms/scripts": "0.50.8",
25
25
  "@types/clear": "0.1.0",
26
26
  "@types/cors": "2.8.5",
27
27
  "@types/express": "^4.17.7",
@@ -59,9 +59,9 @@
59
59
  "@graphql-tools/graphql-file-loader": "^7.2.0",
60
60
  "@graphql-tools/load": "^7.3.2",
61
61
  "@tinacms/datalayer": "0.1.1",
62
- "@tinacms/graphql": "0.60.4",
62
+ "@tinacms/graphql": "0.60.7",
63
63
  "@tinacms/metrics": "0.0.3",
64
- "@tinacms/schema-tools": "0.0.4",
64
+ "@tinacms/schema-tools": "0.0.5",
65
65
  "@yarnpkg/esbuild-plugin-pnp": "^2.0.1-rc.3",
66
66
  "add": "^2.0.6",
67
67
  "ajv": "^6.12.3",