@tinacms/cli 0.60.21 → 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 +15 -0
- package/dist/cmds/start-server/index.d.ts +1 -2
- package/dist/command.d.ts +1 -0
- package/dist/index.js +138 -112
- package/dist/server/models/media.d.ts +7 -4
- package/dist/server/routes/index.d.ts +2 -1
- package/dist/server/server.d.ts +1 -1
- package/dist/utils/index.d.ts +13 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
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
|
+
|
|
3
18
|
## 0.60.21
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -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,
|
|
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
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({
|
|
185
|
-
this.
|
|
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.
|
|
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 (
|
|
192
|
-
const filePath = (0, import_path6.join)(folderPath,
|
|
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
|
-
|
|
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:
|
|
198
|
-
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.
|
|
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,
|
|
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
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
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
|
-
|
|
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
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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}`);
|
|
@@ -1846,7 +1886,7 @@ var loaders = {
|
|
|
1846
1886
|
|
|
1847
1887
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/start-server/index.ts
|
|
1848
1888
|
var import_datalayer3 = __toModule(require("@tinacms/datalayer"));
|
|
1849
|
-
var
|
|
1889
|
+
var import_graphql11 = __toModule(require("@tinacms/graphql"));
|
|
1850
1890
|
|
|
1851
1891
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/start-server/lock.ts
|
|
1852
1892
|
var AsyncLock = class {
|
|
@@ -1871,7 +1911,6 @@ async function startServer(_ctx, next, {
|
|
|
1871
1911
|
port = 4001,
|
|
1872
1912
|
noWatch,
|
|
1873
1913
|
experimentalData,
|
|
1874
|
-
tinaCloudMediaStore: tinaCloudMediaStore2,
|
|
1875
1914
|
noSDK,
|
|
1876
1915
|
noTelemetry,
|
|
1877
1916
|
watchFolders,
|
|
@@ -1892,7 +1931,7 @@ async function startServer(_ctx, next, {
|
|
|
1892
1931
|
const bridge = new import_datalayer3.FilesystemBridge(rootPath2);
|
|
1893
1932
|
const store = experimentalData ? new import_datalayer3.LevelStore(rootPath2) : new import_datalayer3.FilesystemStore({ rootPath: rootPath2 });
|
|
1894
1933
|
const shouldBuild = bridge.supportsBuilding();
|
|
1895
|
-
const database = await (0,
|
|
1934
|
+
const database = await (0, import_graphql11.createDatabase)({ store, bridge });
|
|
1896
1935
|
let ready = false;
|
|
1897
1936
|
const build2 = async (noSDK2) => {
|
|
1898
1937
|
database.clearCache();
|
|
@@ -1905,12 +1944,9 @@ async function startServer(_ctx, next, {
|
|
|
1905
1944
|
await store.open();
|
|
1906
1945
|
}
|
|
1907
1946
|
const cliFlags = [];
|
|
1908
|
-
|
|
1909
|
-
cliFlags.push("tinaCloudMediaStore");
|
|
1910
|
-
}
|
|
1911
|
-
const database2 = await (0, import_graphql10.createDatabase)({ store, bridge });
|
|
1947
|
+
const database2 = await (0, import_graphql11.createDatabase)({ store, bridge });
|
|
1912
1948
|
await compileSchema(null, null, { verbose, dev });
|
|
1913
|
-
const schema = await (0,
|
|
1949
|
+
const schema = await (0, import_graphql11.buildSchema)(rootPath2, database2, cliFlags);
|
|
1914
1950
|
await genTypes({ schema }, () => {
|
|
1915
1951
|
}, { noSDK: noSDK2, verbose });
|
|
1916
1952
|
} catch (error) {
|
|
@@ -1919,6 +1955,50 @@ async function startServer(_ctx, next, {
|
|
|
1919
1955
|
lock.disable();
|
|
1920
1956
|
}
|
|
1921
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
|
+
};
|
|
1922
2002
|
const foldersToWatch = (watchFolders || []).map((x) => import_path8.default.join(rootPath2, x));
|
|
1923
2003
|
if (!noWatch && !process.env.CI) {
|
|
1924
2004
|
import_chokidar.default.watch([
|
|
@@ -1950,6 +2030,9 @@ async function startServer(_ctx, next, {
|
|
|
1950
2030
|
try {
|
|
1951
2031
|
if (shouldBuild) {
|
|
1952
2032
|
await build2(noSDK);
|
|
2033
|
+
if (isReady) {
|
|
2034
|
+
restart();
|
|
2035
|
+
}
|
|
1953
2036
|
}
|
|
1954
2037
|
} catch (e) {
|
|
1955
2038
|
handleServerErrors(e);
|
|
@@ -1967,49 +2050,6 @@ async function startServer(_ctx, next, {
|
|
|
1967
2050
|
await build2(noSDK);
|
|
1968
2051
|
}
|
|
1969
2052
|
}
|
|
1970
|
-
const state = {
|
|
1971
|
-
server: null,
|
|
1972
|
-
sockets: []
|
|
1973
|
-
};
|
|
1974
|
-
let isReady = false;
|
|
1975
|
-
const start = async () => {
|
|
1976
|
-
const s = (init_server3(), server_exports);
|
|
1977
|
-
state.server = await s.default(database);
|
|
1978
|
-
state.server.listen(port, () => {
|
|
1979
|
-
const altairUrl = `http://localhost:${port}/altair/`;
|
|
1980
|
-
const cmsUrl = `[your-development-url]/admin`;
|
|
1981
|
-
if (verbose)
|
|
1982
|
-
logger.info(`Started Filesystem GraphQL server on port: ${port}`);
|
|
1983
|
-
logger.info(`Visit the GraphQL playground at ${import_chalk6.default.underline.blueBright(altairUrl)}
|
|
1984
|
-
or`);
|
|
1985
|
-
logger.info(`Enter the CMS at ${import_chalk6.default.underline.blueBright(cmsUrl)}
|
|
1986
|
-
`);
|
|
1987
|
-
});
|
|
1988
|
-
state.server.on("error", function(e) {
|
|
1989
|
-
if (e.code === "EADDRINUSE") {
|
|
1990
|
-
logger.error(dangerText(`Port 4001 already in use`));
|
|
1991
|
-
process.exit();
|
|
1992
|
-
}
|
|
1993
|
-
throw e;
|
|
1994
|
-
});
|
|
1995
|
-
state.server.on("connection", (socket) => {
|
|
1996
|
-
state.sockets.push(socket);
|
|
1997
|
-
});
|
|
1998
|
-
};
|
|
1999
|
-
const restart = async () => {
|
|
2000
|
-
logger.info("Detected change to gql package, restarting...");
|
|
2001
|
-
delete require.cache[gqlPackageFile];
|
|
2002
|
-
state.sockets.forEach((socket) => {
|
|
2003
|
-
if (socket.destroyed === false) {
|
|
2004
|
-
socket.destroy();
|
|
2005
|
-
}
|
|
2006
|
-
});
|
|
2007
|
-
state.sockets = [];
|
|
2008
|
-
state.server.close(() => {
|
|
2009
|
-
logger.info("Server closed");
|
|
2010
|
-
start();
|
|
2011
|
-
});
|
|
2012
|
-
};
|
|
2013
2053
|
if (!noWatch && !process.env.CI) {
|
|
2014
2054
|
import_chokidar.default.watch([gqlPackageFile]).on("ready", async () => {
|
|
2015
2055
|
isReady = true;
|
|
@@ -2176,11 +2216,8 @@ var watchFileOption = {
|
|
|
2176
2216
|
};
|
|
2177
2217
|
var verboseOption = {
|
|
2178
2218
|
name: "-v, --verbose",
|
|
2179
|
-
description: "increase verbosity of logged output"
|
|
2180
|
-
|
|
2181
|
-
var tinaCloudMediaStore = {
|
|
2182
|
-
name: "--tinaCloudMediaStore",
|
|
2183
|
-
description: "Automatically pushes updates from GitHub to the Tina Cloud Media Store"
|
|
2219
|
+
description: "increase verbosity of logged output",
|
|
2220
|
+
defaultValue: false
|
|
2184
2221
|
};
|
|
2185
2222
|
var developmentOption = {
|
|
2186
2223
|
name: "--dev",
|
|
@@ -2194,7 +2231,6 @@ var baseCmds = [
|
|
|
2194
2231
|
startServerPortOption,
|
|
2195
2232
|
subCommand,
|
|
2196
2233
|
experimentalDatalayer,
|
|
2197
|
-
tinaCloudMediaStore,
|
|
2198
2234
|
noWatchOption,
|
|
2199
2235
|
noSDKCodegenOption,
|
|
2200
2236
|
noTelemetryOption,
|
|
@@ -2219,28 +2255,18 @@ var baseCmds = [
|
|
|
2219
2255
|
{
|
|
2220
2256
|
command: CMD_COMPILE_MODELS,
|
|
2221
2257
|
description: "Compile schema into static files for the server",
|
|
2222
|
-
options: [experimentalDatalayer,
|
|
2258
|
+
options: [experimentalDatalayer, noTelemetryOption],
|
|
2223
2259
|
action: (options) => chain([compileSchema], options)
|
|
2224
2260
|
},
|
|
2225
2261
|
{
|
|
2226
2262
|
command: CMD_GEN_TYPES,
|
|
2227
2263
|
description: "Generate a GraphQL query for your site's schema, (and optionally Typescript types)",
|
|
2228
|
-
options: [
|
|
2229
|
-
experimentalDatalayer,
|
|
2230
|
-
tinaCloudMediaStore,
|
|
2231
|
-
noSDKCodegenOption,
|
|
2232
|
-
noTelemetryOption
|
|
2233
|
-
],
|
|
2264
|
+
options: [experimentalDatalayer, noSDKCodegenOption, noTelemetryOption],
|
|
2234
2265
|
action: (options) => chain([attachSchema, genTypes], options)
|
|
2235
2266
|
},
|
|
2236
2267
|
{
|
|
2237
2268
|
command: INIT,
|
|
2238
|
-
options: [
|
|
2239
|
-
experimentalDatalayer,
|
|
2240
|
-
tinaCloudMediaStore,
|
|
2241
|
-
noTelemetryOption,
|
|
2242
|
-
schemaFileType
|
|
2243
|
-
],
|
|
2269
|
+
options: [experimentalDatalayer, noTelemetryOption, schemaFileType],
|
|
2244
2270
|
description: "Add Tina Cloud to an existing project",
|
|
2245
2271
|
action: (options) => chain([
|
|
2246
2272
|
checkDeps,
|
|
@@ -2311,7 +2337,7 @@ Examples:
|
|
|
2311
2337
|
logger.info("");
|
|
2312
2338
|
});
|
|
2313
2339
|
(command.options || []).forEach((option) => {
|
|
2314
|
-
newCmd.option(option.name, option.description);
|
|
2340
|
+
newCmd.option(option.name, option.description, option == null ? void 0 : option.defaultValue);
|
|
2315
2341
|
});
|
|
2316
2342
|
if (command.subCommands) {
|
|
2317
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
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
13
|
+
import { PathConfig } from '../models/media';
|
|
14
|
+
export declare const createMediaRouter: (config: PathConfig) => import("express-serve-static-core").Router;
|
package/dist/server/server.d.ts
CHANGED
|
@@ -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.
|
|
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.
|
|
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.
|
|
62
|
+
"@tinacms/graphql": "0.60.7",
|
|
63
63
|
"@tinacms/metrics": "0.0.3",
|
|
64
|
-
"@tinacms/schema-tools": "0.0.
|
|
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",
|