@tinacms/cli 0.60.11 → 0.60.12
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,25 @@
|
|
|
1
1
|
# tinacms-cli
|
|
2
2
|
|
|
3
|
+
## 0.60.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ef450a53a: - Update tinacms CLI to support schemaFileType option (default 'ts') to allow user to specify the schema file type
|
|
8
|
+
- Update telemetry module to optionally check NO_TELEMETRY environment variable for disabling telemetry
|
|
9
|
+
- 81b729c24: Update formatting of cli init outputs
|
|
10
|
+
- 558cc4368: Make schema init platform-aware and refactor database put requests
|
|
11
|
+
- Updated dependencies [4da32454b]
|
|
12
|
+
- Updated dependencies [921709a7e]
|
|
13
|
+
- Updated dependencies [ef450a53a]
|
|
14
|
+
- Updated dependencies [a2906d6fe]
|
|
15
|
+
- Updated dependencies [558cc4368]
|
|
16
|
+
- Updated dependencies [06666d39f]
|
|
17
|
+
- Updated dependencies [3e2d9e43a]
|
|
18
|
+
- @tinacms/graphql@0.59.11
|
|
19
|
+
- @tinacms/schema-tools@0.0.3
|
|
20
|
+
- @tinacms/metrics@0.0.3
|
|
21
|
+
- @tinacms/datalayer@0.1.1
|
|
22
|
+
|
|
3
23
|
## 0.60.11
|
|
4
24
|
|
|
5
25
|
### 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
|
|
13
|
+
export declare const defaultSchema: (sep: string) => string;
|
|
@@ -12,5 +12,7 @@ limitations under the License.
|
|
|
12
12
|
*/
|
|
13
13
|
import type { TinaCloudSchema } from '@tinacms/graphql';
|
|
14
14
|
export declare const resetGeneratedFolder: () => Promise<void>;
|
|
15
|
-
export declare const compile: (_ctx: any, _next: any
|
|
15
|
+
export declare const compile: (_ctx: any, _next: any, options?: {
|
|
16
|
+
schemaFileType: string;
|
|
17
|
+
}) => Promise<void>;
|
|
16
18
|
export declare const defineSchema: (config: TinaCloudSchema) => TinaCloudSchema;
|
|
@@ -1,15 +1,3 @@
|
|
|
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
1
|
export declare const adminPage = "import { TinaAdmin } from 'tinacms';\nexport default TinaAdmin;\n";
|
|
14
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";
|
|
15
3
|
export declare const nextPostPage: () => string;
|
package/dist/index.js
CHANGED
|
@@ -114,7 +114,7 @@ var commander = __toModule(require("commander"));
|
|
|
114
114
|
|
|
115
115
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/package.json
|
|
116
116
|
var name = "@tinacms/cli";
|
|
117
|
-
var version = "0.60.
|
|
117
|
+
var version = "0.60.12";
|
|
118
118
|
|
|
119
119
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/utils/theme.ts
|
|
120
120
|
var import_chalk = __toModule(require("chalk"));
|
|
@@ -401,7 +401,7 @@ var import_fs_extra3 = __toModule(require("fs-extra"));
|
|
|
401
401
|
var import_esbuild = __toModule(require("esbuild"));
|
|
402
402
|
|
|
403
403
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/compile/defaultSchema.ts
|
|
404
|
-
var defaultSchema = `
|
|
404
|
+
var defaultSchema = (sep) => `
|
|
405
405
|
import { defineSchema, defineConfig } from "tinacms";
|
|
406
406
|
|
|
407
407
|
export default defineSchema({
|
|
@@ -409,7 +409,7 @@ export default defineSchema({
|
|
|
409
409
|
{
|
|
410
410
|
label: "Blog Posts",
|
|
411
411
|
name: "posts",
|
|
412
|
-
path: "content
|
|
412
|
+
path: "content${sep}posts",
|
|
413
413
|
fields: [
|
|
414
414
|
{
|
|
415
415
|
type: "string",
|
|
@@ -530,14 +530,18 @@ var ExecuteSchemaError = class extends Error {
|
|
|
530
530
|
}
|
|
531
531
|
};
|
|
532
532
|
var handleServerErrors = (e) => {
|
|
533
|
-
if (e
|
|
533
|
+
if (e.name === "BuildSchemaError") {
|
|
534
534
|
logger.error(`${dangerText("ERROR: your schema was not successfully built: see https://tina.io/docs/errors/esbuild-error/ for more details")}
|
|
535
535
|
Error Message Below
|
|
536
536
|
${e}`);
|
|
537
|
-
} else if (e
|
|
537
|
+
} else if (e.name === "ExecuteSchemaError") {
|
|
538
538
|
logger.error(`${dangerText("ERROR: your schema was not successfully executed: see https://tina.io/docs/errors/esbuild-error/ for more details")}
|
|
539
539
|
Error Message Below
|
|
540
540
|
${e}`);
|
|
541
|
+
} else if (e.name === "TinaSchemaValidationError") {
|
|
542
|
+
logger.error(`${dangerText("ERROR: your schema was not successfully validated: see https://tina.io/docs/schema/ for instructions on how to setup a schema")}
|
|
543
|
+
Error Message Below
|
|
544
|
+
${e}`);
|
|
541
545
|
} else {
|
|
542
546
|
logger.info(dangerText("Compilation failed with errors. Server has not been restarted.") + ` see error below
|
|
543
547
|
${e.message}`);
|
|
@@ -564,8 +568,16 @@ var resetGeneratedFolder = async () => {
|
|
|
564
568
|
var cleanup = async ({ tinaTempPath: tinaTempPath2 }) => {
|
|
565
569
|
await import_fs_extra3.default.remove(tinaTempPath2);
|
|
566
570
|
};
|
|
567
|
-
var compile = async (_ctx, _next) => {
|
|
571
|
+
var compile = async (_ctx, _next, options = { schemaFileType: "ts" }) => {
|
|
568
572
|
logger.info(logText("Compiling..."));
|
|
573
|
+
const { schemaFileType: requestedSchemaFileType = "ts" } = options;
|
|
574
|
+
const schemaFileType2 = (requestedSchemaFileType === "ts" || requestedSchemaFileType === "tsx") && "ts" || (requestedSchemaFileType === "js" || requestedSchemaFileType === "jsx") && "js";
|
|
575
|
+
if (!schemaFileType2) {
|
|
576
|
+
throw new Error(`Requested schema file type '${requestedSchemaFileType}' is not valid. Supported schema file types: 'ts, js, tsx, jsx'`);
|
|
577
|
+
}
|
|
578
|
+
if (_ctx) {
|
|
579
|
+
_ctx.schemaFileType = schemaFileType2;
|
|
580
|
+
}
|
|
569
581
|
let schemaExists = true;
|
|
570
582
|
try {
|
|
571
583
|
getSchemaPath({ projectDir: tinaPath });
|
|
@@ -574,12 +586,12 @@ var compile = async (_ctx, _next) => {
|
|
|
574
586
|
}
|
|
575
587
|
if (!schemaExists) {
|
|
576
588
|
logger.info(dangerText(`
|
|
577
|
-
.tina/schema
|
|
589
|
+
.tina/schema.${schemaFileType2} not found, Creating one for you...
|
|
578
590
|
See Documentation: https://tina.io/docs/tina-cloud/cli/#getting-started"
|
|
579
591
|
`));
|
|
580
|
-
const file = import_path3.default.join(tinaPath,
|
|
592
|
+
const file = import_path3.default.join(tinaPath, `schema.${schemaFileType2}`);
|
|
581
593
|
await import_fs_extra3.default.ensureFile(file);
|
|
582
|
-
await import_fs_extra3.default.writeFile(file, defaultSchema);
|
|
594
|
+
await import_fs_extra3.default.writeFile(file, defaultSchema(import_path3.default.sep));
|
|
583
595
|
}
|
|
584
596
|
try {
|
|
585
597
|
await transpile(tinaPath, tinaTempPath);
|
|
@@ -599,6 +611,11 @@ var compile = async (_ctx, _next) => {
|
|
|
599
611
|
await cleanup({ tinaTempPath });
|
|
600
612
|
} catch (e) {
|
|
601
613
|
await cleanup({ tinaTempPath });
|
|
614
|
+
if (e instanceof Error) {
|
|
615
|
+
if (e.name === "TinaSchemaValidationError") {
|
|
616
|
+
throw e;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
602
619
|
throw new ExecuteSchemaError(e);
|
|
603
620
|
}
|
|
604
621
|
};
|
|
@@ -838,14 +855,8 @@ stack: ${code.stack || "No stack was provided"}`);
|
|
|
838
855
|
}
|
|
839
856
|
}
|
|
840
857
|
|
|
841
|
-
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/init/index.ts
|
|
842
|
-
var import_fs_extra4 = __toModule(require("fs-extra"));
|
|
843
|
-
var import_path5 = __toModule(require("path"));
|
|
844
|
-
var import_progress = __toModule(require("progress"));
|
|
845
|
-
var import_prompts = __toModule(require("prompts"));
|
|
846
|
-
var import_metrics2 = __toModule(require("@tinacms/metrics"));
|
|
847
|
-
|
|
848
858
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/init/setup-files/index.ts
|
|
859
|
+
var import_chalk2 = __toModule(require("chalk"));
|
|
849
860
|
var adminPage = `import { TinaAdmin } from 'tinacms';
|
|
850
861
|
export default TinaAdmin;
|
|
851
862
|
`;
|
|
@@ -1157,23 +1168,22 @@ var nextPostPage = () => `// THIS FILE HAS BEEN GENERATED WITH THE TINA CLI.
|
|
|
1157
1168
|
};
|
|
1158
1169
|
|
|
1159
1170
|
`;
|
|
1160
|
-
var AppJsContent = (usingSrc, extraImports) =>
|
|
1171
|
+
var AppJsContent = (usingSrc, extraImports) => {
|
|
1172
|
+
const importLine = import_chalk2.default.green(`+ import Tina from '${usingSrc ? "../" : ""}../.tina/components/TinaDynamicProvider.js'`);
|
|
1173
|
+
return `${importLine}
|
|
1174
|
+
${extraImports || ""}
|
|
1161
1175
|
|
|
1162
|
-
|
|
1163
|
-
const App = ({ Component, pageProps }) => {
|
|
1176
|
+
const App = ({ Component, pageProps }) => {
|
|
1164
1177
|
return (
|
|
1165
|
-
<Tina>
|
|
1166
|
-
|
|
1167
|
-
</Tina>
|
|
1178
|
+
${import_chalk2.default.green("+ <Tina>")}
|
|
1179
|
+
<Component {...pageProps} />
|
|
1180
|
+
${import_chalk2.default.green("+ </Tina>")}
|
|
1168
1181
|
)
|
|
1169
1182
|
}
|
|
1170
|
-
|
|
1183
|
+
|
|
1171
1184
|
export default App
|
|
1172
|
-
|
|
1173
1185
|
`;
|
|
1174
|
-
|
|
1175
|
-
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/init/index.ts
|
|
1176
|
-
var import_chalk2 = __toModule(require("chalk"));
|
|
1186
|
+
};
|
|
1177
1187
|
|
|
1178
1188
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/init/setup-files/tinaProvider.ts
|
|
1179
1189
|
var TinaProvider = `import TinaCMS from 'tinacms'
|
|
@@ -1221,6 +1231,12 @@ function extendNextScripts(scripts) {
|
|
|
1221
1231
|
}
|
|
1222
1232
|
|
|
1223
1233
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/init/index.ts
|
|
1234
|
+
var import_fs_extra4 = __toModule(require("fs-extra"));
|
|
1235
|
+
var import_progress = __toModule(require("progress"));
|
|
1236
|
+
var import_metrics2 = __toModule(require("@tinacms/metrics"));
|
|
1237
|
+
var import_chalk3 = __toModule(require("chalk"));
|
|
1238
|
+
var import_path5 = __toModule(require("path"));
|
|
1239
|
+
var import_prompts = __toModule(require("prompts"));
|
|
1224
1240
|
function execShellCommand(cmd) {
|
|
1225
1241
|
const exec = require("child_process").exec;
|
|
1226
1242
|
return new Promise((resolve2, _reject) => {
|
|
@@ -1234,7 +1250,12 @@ function execShellCommand(cmd) {
|
|
|
1234
1250
|
}
|
|
1235
1251
|
async function initTina(ctx, next, options) {
|
|
1236
1252
|
const telemetry = new import_metrics2.Telemetry({ disabled: options.noTelemetry });
|
|
1237
|
-
await telemetry.submitRecord({
|
|
1253
|
+
await telemetry.submitRecord({
|
|
1254
|
+
event: {
|
|
1255
|
+
name: "tinacms:cli:init:invoke",
|
|
1256
|
+
schemaFileType: options.schemaFileType || "ts"
|
|
1257
|
+
}
|
|
1258
|
+
});
|
|
1238
1259
|
logger.info(successText("Setting up Tina..."));
|
|
1239
1260
|
next();
|
|
1240
1261
|
}
|
|
@@ -1315,7 +1336,7 @@ var componentFolder = import_path5.default.join(TinaFolder, "components");
|
|
|
1315
1336
|
var TinaProviderPath = import_path5.default.join(componentFolder, "TinaProvider.js");
|
|
1316
1337
|
var TinaDynamicProvider = import_path5.default.join(componentFolder, "TinaDynamicProvider.js");
|
|
1317
1338
|
async function tinaSetup(_ctx, next, _options) {
|
|
1318
|
-
const
|
|
1339
|
+
const usingSrc = import_fs_extra4.default.pathExistsSync(import_path5.default.join(baseDir, "src"));
|
|
1319
1340
|
if (!import_fs_extra4.default.pathExistsSync(blogPostPath)) {
|
|
1320
1341
|
logger.info(logText("Adding a content folder..."));
|
|
1321
1342
|
import_fs_extra4.default.mkdirpSync(blogContentPath);
|
|
@@ -1323,23 +1344,24 @@ async function tinaSetup(_ctx, next, _options) {
|
|
|
1323
1344
|
}
|
|
1324
1345
|
if (!import_fs_extra4.default.existsSync(TinaProviderPath) && !import_fs_extra4.default.existsSync(TinaDynamicProvider)) {
|
|
1325
1346
|
import_fs_extra4.default.mkdirpSync(componentFolder);
|
|
1326
|
-
import_fs_extra4.default.writeFileSync(TinaProviderPath, TinaProvider);
|
|
1347
|
+
import_fs_extra4.default.writeFileSync(TinaProviderPath, TinaProvider.replace(/'\.\.\/schema\.ts'/, `'../schema.${_ctx.schemaFileType || "ts"}'`));
|
|
1327
1348
|
import_fs_extra4.default.writeFileSync(TinaDynamicProvider, TinaProviderDynamic);
|
|
1328
1349
|
}
|
|
1329
1350
|
logger.level = "info";
|
|
1330
|
-
const pagesPath = import_path5.default.join(baseDir,
|
|
1351
|
+
const pagesPath = import_path5.default.join(baseDir, usingSrc ? "src" : "", "pages");
|
|
1331
1352
|
const appPath = import_path5.default.join(pagesPath, "_app.js");
|
|
1332
1353
|
const appPathTS = import_path5.default.join(pagesPath, "_app.tsx");
|
|
1333
1354
|
const appExtension = import_fs_extra4.default.existsSync(appPath) ? ".js" : ".tsx";
|
|
1334
1355
|
if (!import_fs_extra4.default.pathExistsSync(appPath) && !import_fs_extra4.default.pathExistsSync(appPathTS)) {
|
|
1335
1356
|
logger.info(logText("Adding _app.js ... \u2705"));
|
|
1336
|
-
import_fs_extra4.default.writeFileSync(appPath, AppJsContent(
|
|
1357
|
+
import_fs_extra4.default.writeFileSync(appPath, AppJsContent(usingSrc));
|
|
1337
1358
|
} else {
|
|
1338
1359
|
const override = await (0, import_prompts.default)({
|
|
1339
1360
|
name: "res",
|
|
1340
1361
|
type: "confirm",
|
|
1341
|
-
message: `do you want us to ${
|
|
1362
|
+
message: `do you want us to ${import_chalk3.default.bold(`override`)} your _app${appExtension}?`
|
|
1342
1363
|
});
|
|
1364
|
+
_ctx.overrideApp = override.res;
|
|
1343
1365
|
if (override.res) {
|
|
1344
1366
|
logger.info(logText(`Adding _app${appExtension} ... \u2705`));
|
|
1345
1367
|
const appPathWithExtension = import_path5.default.join(pagesPath, `_app${appExtension}`);
|
|
@@ -1348,10 +1370,7 @@ async function tinaSetup(_ctx, next, _options) {
|
|
|
1348
1370
|
...fileContent.toString().matchAll(/^.*import.*\.css("|').*$/gm)
|
|
1349
1371
|
];
|
|
1350
1372
|
const primaryMatches = matches.map((x) => x[0]);
|
|
1351
|
-
import_fs_extra4.default.writeFileSync(appPathWithExtension, AppJsContent(
|
|
1352
|
-
} else {
|
|
1353
|
-
logger.info(dangerText(`Heads up, to enable live-editing you'll need to wrap your page or site in Tina:
|
|
1354
|
-
`, warnText(AppJsContent(useingSrc))));
|
|
1373
|
+
import_fs_extra4.default.writeFileSync(appPathWithExtension, AppJsContent(usingSrc, primaryMatches.join("\n")));
|
|
1355
1374
|
}
|
|
1356
1375
|
}
|
|
1357
1376
|
const tinaBlogPagePath = import_path5.default.join(pagesPath, "demo", "blog");
|
|
@@ -1378,10 +1397,26 @@ async function tinaSetup(_ctx, next, _options) {
|
|
|
1378
1397
|
next();
|
|
1379
1398
|
}
|
|
1380
1399
|
async function successMessage(ctx, next, options) {
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1400
|
+
const usingSrc = import_fs_extra4.default.pathExistsSync(import_path5.default.join(baseDir, "src"));
|
|
1401
|
+
logger.info(`Tina setup ${import_chalk3.default.underline.green("done")} \u2705
|
|
1402
|
+
`);
|
|
1403
|
+
logger.info("Next Steps: \n");
|
|
1404
|
+
if (!ctx.overrideApp) {
|
|
1405
|
+
logger.info(`${import_chalk3.default.bold("Add the Tina wrapper")}`);
|
|
1406
|
+
logger.info(`\u26A0\uFE0F Before using Tina, you will NEED to add the Tina wrapper to your _app.jsx
|
|
1407
|
+
`);
|
|
1408
|
+
logger.info(`${AppJsContent(usingSrc)}`);
|
|
1409
|
+
}
|
|
1410
|
+
logger.info(`${import_chalk3.default.bold("Run your site with Tina")}`);
|
|
1411
|
+
logger.info(` yarn dev
|
|
1412
|
+
`);
|
|
1413
|
+
logger.info(`${import_chalk3.default.bold("Start Editing")}`);
|
|
1414
|
+
logger.info(` Go to 'http://localhost:3000/admin'
|
|
1415
|
+
`);
|
|
1416
|
+
logger.info(`${import_chalk3.default.bold("Read the docs")}`);
|
|
1417
|
+
logger.info(` Check out 'https://tina.io/docs/introduction/tina-init/#adding-tina' for help getting started with Tina
|
|
1384
1418
|
`);
|
|
1419
|
+
logger.info(`Enjoy Tina! \u{1F999}`);
|
|
1385
1420
|
next();
|
|
1386
1421
|
}
|
|
1387
1422
|
|
|
@@ -1393,7 +1428,7 @@ var import_datalayer3 = __toModule(require("@tinacms/datalayer"));
|
|
|
1393
1428
|
var import_graphql8 = __toModule(require("@tinacms/graphql"));
|
|
1394
1429
|
var import_path6 = __toModule(require("path"));
|
|
1395
1430
|
var import_graphql9 = __toModule(require("@tinacms/graphql"));
|
|
1396
|
-
var
|
|
1431
|
+
var import_chalk4 = __toModule(require("chalk"));
|
|
1397
1432
|
var auditCollection = async (args) => {
|
|
1398
1433
|
let warning = false;
|
|
1399
1434
|
const { collection, database, rootPath: rootPath2 } = args;
|
|
@@ -1427,7 +1462,7 @@ var auditCollection = async (args) => {
|
|
|
1427
1462
|
const node = x.node;
|
|
1428
1463
|
if (node.sys.extension.replace(".", "") !== format) {
|
|
1429
1464
|
warning = true;
|
|
1430
|
-
logger.warn(
|
|
1465
|
+
logger.warn(import_chalk4.default.yellowBright(`WARNING: there is a file with extension \`${node.sys.extension}\` but in your schema it is defined to be \`.${format}\`
|
|
1431
1466
|
|
|
1432
1467
|
location: ${import_path6.default.join(rootPath2, node.sys.path)}`));
|
|
1433
1468
|
}
|
|
@@ -1513,7 +1548,7 @@ var auditDocuments = async (args) => {
|
|
|
1513
1548
|
if (mutationRes.errors) {
|
|
1514
1549
|
mutationRes.errors.forEach((err) => {
|
|
1515
1550
|
error = true;
|
|
1516
|
-
logger.error(
|
|
1551
|
+
logger.error(import_chalk4.default.red(err.message));
|
|
1517
1552
|
});
|
|
1518
1553
|
}
|
|
1519
1554
|
}
|
|
@@ -1564,7 +1599,7 @@ function filterObject(obj) {
|
|
|
1564
1599
|
}
|
|
1565
1600
|
|
|
1566
1601
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/audit/index.ts
|
|
1567
|
-
var
|
|
1602
|
+
var import_chalk5 = __toModule(require("chalk"));
|
|
1568
1603
|
var import_prompts2 = __toModule(require("prompts"));
|
|
1569
1604
|
var import_metrics3 = __toModule(require("@tinacms/metrics"));
|
|
1570
1605
|
var rootPath = process.cwd();
|
|
@@ -1578,7 +1613,7 @@ var audit = async (ctx, next, options) => {
|
|
|
1578
1613
|
}
|
|
1579
1614
|
});
|
|
1580
1615
|
if (options.clean) {
|
|
1581
|
-
logger.info(`You are using the \`--clean\` option. This will modify your content as if a user is submitting a form. Before running this you should have a ${
|
|
1616
|
+
logger.info(`You are using the \`--clean\` option. This will modify your content as if a user is submitting a form. Before running this you should have a ${import_chalk5.default.bold("clean git tree")} so unwanted changes can be undone.
|
|
1582
1617
|
|
|
1583
1618
|
`);
|
|
1584
1619
|
const res = await (0, import_prompts2.default)({
|
|
@@ -1587,12 +1622,12 @@ var audit = async (ctx, next, options) => {
|
|
|
1587
1622
|
message: `Do you want to continue?`
|
|
1588
1623
|
});
|
|
1589
1624
|
if (!res.useClean) {
|
|
1590
|
-
logger.warn(
|
|
1625
|
+
logger.warn(import_chalk5.default.yellowBright("\u26A0\uFE0F Audit not complete"));
|
|
1591
1626
|
process.exit(0);
|
|
1592
1627
|
}
|
|
1593
1628
|
}
|
|
1594
1629
|
if (options.useDefaultValues && !options.clean) {
|
|
1595
|
-
logger.warn(
|
|
1630
|
+
logger.warn(import_chalk5.default.yellowBright("WARNING: using the `--useDefaultValues` without the `--clean` flag has no effect. Please re-run audit and add the `--clean` flag"));
|
|
1596
1631
|
}
|
|
1597
1632
|
const bridge = options.clean ? new import_datalayer3.FilesystemBridge(rootPath) : new import_datalayer3.AuditFileSystemBridge(rootPath);
|
|
1598
1633
|
const store = options.clean ? new import_datalayer3.FilesystemStore({ rootPath }) : new import_datalayer3.AuditFilesystemStore({ rootPath });
|
|
@@ -1624,17 +1659,17 @@ var audit = async (ctx, next, options) => {
|
|
|
1624
1659
|
};
|
|
1625
1660
|
var printFinalMessage = async (ctx, next, _options) => {
|
|
1626
1661
|
if (ctx.error) {
|
|
1627
|
-
logger.error(
|
|
1662
|
+
logger.error(import_chalk5.default.redBright(`\u203C\uFE0F Audit ${import_chalk5.default.bold("failed")} with errors`));
|
|
1628
1663
|
} else if (ctx.warning) {
|
|
1629
|
-
logger.warn(
|
|
1664
|
+
logger.warn(import_chalk5.default.yellowBright("\u26A0\uFE0F Audit passed with warnings"));
|
|
1630
1665
|
} else {
|
|
1631
|
-
logger.info(
|
|
1666
|
+
logger.info(import_chalk5.default.greenBright("\u2705 Audit passed"));
|
|
1632
1667
|
}
|
|
1633
1668
|
next();
|
|
1634
1669
|
};
|
|
1635
1670
|
|
|
1636
1671
|
// pnp:/home/runner/work/tinacms/tinacms/packages/@tinacms/cli/src/cmds/baseCmds.ts
|
|
1637
|
-
var
|
|
1672
|
+
var import_chalk6 = __toModule(require("chalk"));
|
|
1638
1673
|
var CMD_GEN_TYPES = "schema:types";
|
|
1639
1674
|
var CMD_START_SERVER = "server:start";
|
|
1640
1675
|
var CMD_COMPILE_MODELS = "schema:compile";
|
|
@@ -1648,6 +1683,10 @@ var experimentalDatalayer = {
|
|
|
1648
1683
|
name: "--experimentalData",
|
|
1649
1684
|
description: "Build the server with additional data querying capabilities"
|
|
1650
1685
|
};
|
|
1686
|
+
var schemaFileType = {
|
|
1687
|
+
name: "--schemaFileType [fileType]",
|
|
1688
|
+
description: "The file type to use for the Tina schema"
|
|
1689
|
+
};
|
|
1651
1690
|
var subCommand = {
|
|
1652
1691
|
name: "-c, --command <command>",
|
|
1653
1692
|
description: "The sub-command to run"
|
|
@@ -1705,14 +1744,14 @@ var baseCmds = [
|
|
|
1705
1744
|
},
|
|
1706
1745
|
{
|
|
1707
1746
|
command: INIT,
|
|
1708
|
-
options: [experimentalDatalayer, noTelemetryOption],
|
|
1747
|
+
options: [experimentalDatalayer, noTelemetryOption, schemaFileType],
|
|
1709
1748
|
description: "Add Tina Cloud to an existing project",
|
|
1710
1749
|
action: (options) => chain([
|
|
1711
1750
|
checkDeps,
|
|
1712
1751
|
initTina,
|
|
1713
1752
|
installDeps,
|
|
1714
|
-
async (_ctx, next) => {
|
|
1715
|
-
await compile(_ctx, next);
|
|
1753
|
+
async (_ctx, next, options2) => {
|
|
1754
|
+
await compile(_ctx, next, options2);
|
|
1716
1755
|
next();
|
|
1717
1756
|
},
|
|
1718
1757
|
attachSchema,
|
|
@@ -1731,14 +1770,14 @@ var baseCmds = [
|
|
|
1731
1770
|
next();
|
|
1732
1771
|
},
|
|
1733
1772
|
async (_ctx, next) => {
|
|
1734
|
-
await compile(_ctx, next);
|
|
1773
|
+
await compile(_ctx, next, options);
|
|
1735
1774
|
next();
|
|
1736
1775
|
},
|
|
1737
1776
|
attachSchema,
|
|
1738
1777
|
genTypes,
|
|
1739
1778
|
async (_ctx, next) => {
|
|
1740
1779
|
logger.level = "info";
|
|
1741
|
-
logger.info(
|
|
1780
|
+
logger.info(import_chalk6.default.hex("#eb6337").bgWhite("Welcome to tina audit \u{1F999}"));
|
|
1742
1781
|
next();
|
|
1743
1782
|
},
|
|
1744
1783
|
audit,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/cli",
|
|
3
|
-
"version": "0.60.
|
|
3
|
+
"version": "0.60.12",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -57,15 +57,16 @@
|
|
|
57
57
|
"@graphql-codegen/visitor-plugin-common": "^2.4.0",
|
|
58
58
|
"@graphql-tools/graphql-file-loader": "^7.2.0",
|
|
59
59
|
"@graphql-tools/load": "^7.3.2",
|
|
60
|
-
"@tinacms/datalayer": "0.1.
|
|
61
|
-
"@tinacms/graphql": "0.59.
|
|
62
|
-
"@tinacms/metrics": "0.0.
|
|
60
|
+
"@tinacms/datalayer": "0.1.1",
|
|
61
|
+
"@tinacms/graphql": "0.59.11",
|
|
62
|
+
"@tinacms/metrics": "0.0.3",
|
|
63
|
+
"@tinacms/schema-tools": "0.0.3",
|
|
63
64
|
"@yarnpkg/esbuild-plugin-pnp": "^2.0.1-rc.3",
|
|
64
65
|
"add": "^2.0.6",
|
|
65
66
|
"ajv": "^6.12.3",
|
|
66
67
|
"altair-express-middleware": "4.0.6",
|
|
67
68
|
"auto-bind": "^4.0.0",
|
|
68
|
-
"axios": "0.
|
|
69
|
+
"axios": "0.21.2",
|
|
69
70
|
"body-parser": "^1.19.0",
|
|
70
71
|
"chalk": "^2.4.2",
|
|
71
72
|
"chokidar": "^3.5.1",
|